Skip to content

Commit

Permalink
修复可能因为获取专辑名称为null而报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
aaatttcccc committed Aug 17, 2022
1 parent e3ea6d5 commit 9a6140d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import android.database.Cursor
import android.net.Uri
import android.os.Parcelable
import android.provider.MediaStore
import com.zhongjh.albumcamerarecorder.R
import com.zhongjh.albumcamerarecorder.album.loader.AlbumLoader
import kotlinx.android.parcel.Parcelize
Expand Down Expand Up @@ -60,11 +61,14 @@ class Album internal constructor(
@JvmStatic
fun valueOf(cursor: Cursor): Album {
val column = cursor.getString(cursor.getColumnIndex(AlbumLoader.COLUMN_URI))
val bucketDisplayName =
cursor.getString(cursor.getColumnIndex(MediaStore.Images.ImageColumns.BUCKET_DISPLAY_NAME))
val count = cursor.getLong(cursor.getColumnIndex(AlbumLoader.COLUMN_COUNT))
return Album(
cursor.getString(cursor.getColumnIndex("bucket_id")),
cursor.getString(cursor.getColumnIndex(MediaStore.Images.ImageColumns.BUCKET_ID)),
Uri.parse(column ?: ""),
cursor.getString(cursor.getColumnIndex("bucket_display_name")),
cursor.getLong(cursor.getColumnIndex(AlbumLoader.COLUMN_COUNT))
bucketDisplayName ?: "",
count
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
album = getArguments().getParcelable(EXTRA_ALBUM);
}

// // 初始化底部间距
// int marginBottom = 0;
// if (getArguments() != null) {
// marginBottom = getArguments().getInt(MatissFragment.ARGUMENTS_MARGIN_BOTTOM);
// }
// FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) mFlMain.getLayoutParams();
// layoutParams.bottomMargin = DisplayMetricsUtils.dip2px(marginBottom);

// 实例化适配器并且传递数据源
if (getContext() == null || getActivity() == null) {
return;
Expand Down

0 comments on commit 9a6140d

Please sign in to comment.