AttachmentDatabase.java 文件源码

java
阅读 38 收藏 0 点赞 0 评论 0

项目:PeSanKita-android 作者:
@VisibleForTesting
protected void updateAttachmentThumbnail(MasterSecret masterSecret, AttachmentId attachmentId, InputStream in, float aspectRatio)
    throws MmsException
{
  Log.w(TAG, "updating part thumbnail for #" + attachmentId);

  Pair<File, Long> thumbnailFile = setAttachmentData(masterSecret, in);

  SQLiteDatabase database = databaseHelper.getWritableDatabase();
  ContentValues  values   = new ContentValues(2);

  values.put(THUMBNAIL, thumbnailFile.first.getAbsolutePath());
  values.put(THUMBNAIL_ASPECT_RATIO, aspectRatio);

  database.update(TABLE_NAME, values, PART_ID_WHERE, attachmentId.toStrings());

  Cursor cursor = database.query(TABLE_NAME, new String[] {MMS_ID}, PART_ID_WHERE, attachmentId.toStrings(), null, null, null);

  try {
    if (cursor != null && cursor.moveToFirst()) {
      notifyConversationListeners(DatabaseFactory.getMmsDatabase(context).getThreadIdForMessage(cursor.getLong(cursor.getColumnIndexOrThrow(MMS_ID))));
    }
  } finally {
    if (cursor != null) cursor.close();
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号