全志行车记录仪里面FireEyepublic.apk反编译的分析(五)——图片存储

接上: FireEye.SavePicture(); 

  private void SavePicture()
  {
    if (this.mTakeImageStatus)
    {
      if (this.mConfig.getRecordModeValue() != 0)
        break label71;
      this.mCurrentVideoUri = FileStorage.AddImageToMediaStore(this.mContentResolver, 0L, this.mConfig.FrontSensorID);
    }
    for (this.mCurrentVideoUri = FileStorage.AddImageToMediaStore(this.mContentResolver, 0L, this.mConfig.BackSensorID); ; this.mCurrentVideoUri = FileStorage.AddImageToMediaStore(this.mContentResolver, 0L, this.mConfig.FrontSensorID))
    {
      this.mStartWork.setBackgroundResource(2130837584);
      this.mTakeImageStatus = false;
      label71: return;
    }
  }
整理后:

  private void SavePicture()
  {
    if (mTakeImageStatus)
    {
      if (mConfig.getRecordModeValue() == 0)//判断是录像模式还是拍照模式
      mCurrentVideoUri = FileStorage.AddImageToMediaStore(mContentResolver, 0L, mConfig.FrontSensorID);
    }
    for (mCurrentVideoUri = FileStorage.AddImageToMediaStore(mContentResolver, 0L, mConfig.BackSensorID); ; mCurrentVideoUri = FileStorage.AddImageToMediaStore(mContentResolver, 0L, mConfig.FrontSensorID))
    {
      mStartWork.setBackgroundResource(R.drawable.camera_stop_work);
      mTakeImageStatus = false;
    }
  }


转到FileStorage.java:

  public static Uri AddImageToMediaStore(ContentResolver paramContentResolver, long paramLong, int paramInt)
  {
    ContentValues localContentValues = new ContentValues(7);
    localContentValues.put("title", mImageTitle[paramInt]);
    localContentValues.put("_display_name", mImageTitle[paramInt] + ".jpg");
    localContentValues.put("datetaken", Long.valueOf(mImageDate[paramInt]));
    localContentValues.put("mime_type", "image/jpeg");
    localContentValues.put("_data", mImageFilename[paramInt]);
    if (paramLong > 0L)
      localContentValues.put("orientation", Long.valueOf(paramLong));
    while (true)
    {
      Object localObject = null;
      try
      {
        Uri localUri = paramContentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, localContentValues);
        localObject = localUri;
        if (CODE_DEBUG)
          label124: Log.d("FileStorage", "AddImageToMediaStore uri :" + localObject);
        return localObject;
        Log.w("FileStorage", "Image duration <= 0 : " + paramLong);
      }
      catch (Throwable localThrowable)
      {
        Log.d("FileStorage", "Failed to write MediaStore" + localThrowable);
        break label124:
      }
    }
  }
整理后:



  public static Uri AddImageToMediaStore(ContentResolver paramContentResolver, long paramLong, int paramInt)
  {
    ContentValues localContentValues = new ContentValues(7);
    localContentValues.put(MediaStore.Images.ImageColumns.TITLE, mImageTitle[paramInt]);
    localContentValues.put(MediaStore.Images.ImageColumns.DISPLAY_NAME, mImageTitle[paramInt] + ".jpg");
    localContentValues.put(MediaStore.Images.ImageColumns.DATE_TAKEN, Long.valueOf(mImageDate[paramInt]));
    localContentValues.put(MediaStore.Images.ImageColumns.MIME_TYPE, "image/jpeg");
    localContentValues.put(MediaStore.Images.ImageColumns.DATA, mImageFilename[paramInt]);
    if (paramLong > 0L)
      localContentValues.put("orientation", Long.valueOf(paramLong));
    else
<span style="white-space:pre">	</span>Log.w("FileStorage", "Image duration <= 0 : " + paramLong);<span style="white-space:pre">	</span>
<span style="white-space:pre">	</span>
    while (true)
    {
      Object localObject = null;
      try
      {
        Uri localUri = paramContentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, localContentValues);
        localObject = localUri;
        if (CODE_DEBUG)
           Log.d("FileStorage", "AddImageToMediaStore uri :" + localObject);
        return localObject;
      }
      catch (Throwable localThrowable)
      {
        Log.d("FileStorage", "Failed to write MediaStore" + localThrowable);
      }
    }
  }
在(一)中有介绍 AddVideoToMediaStore,基本上是一样的处理。

关键就两点:1、存储图片是的对db基本格式的填写

localContentValues.put

2、在指定的路径中插入数据:

Uri localUri = paramContentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, localContentValues);




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值