use of com.yydcdut.noteplugin.adapter.MediaPhotoAdapter in project PhotoNoter by yydcdut.
the class MediaPhotoFragment method onActivityCreated.
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mMediaFolderByNameMap = PhotoModel.getInstance().findByMedia(getContext());
mFolderNameList = new ArrayList<>(mMediaFolderByNameMap.size());
for (Map.Entry<String, MediaFolder> entry : mMediaFolderByNameMap.entrySet()) {
mFolderNameList.add(entry.getKey());
}
mFolderNameList.remove(MediaFolder.ALL);
mFolderNameList.add(0, MediaFolder.ALL);
mCurrentFolderName = MediaFolder.ALL;
mFolderAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner, mFolderNameList);
mActionBar = mMainActivity.getSupportActionBar();
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
mActionBar.setListNavigationCallbacks(mFolderAdapter, this);
int size = getResources().getDisplayMetrics().widthPixels / 3;
mMediaPhotoAdapter = new MediaPhotoAdapter(getContext(), size, mMediaFolderByNameMap.get(mCurrentFolderName), this, this);
mRecyclerView.setAdapter(mMediaPhotoAdapter);
}
Aggregations