Search in sources :

Example 1 with MediaPhotoAdapter

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);
}
Also used : MediaPhotoAdapter(com.yydcdut.noteplugin.adapter.MediaPhotoAdapter) MediaFolder(com.yydcdut.noteplugin.bean.MediaFolder) Map(java.util.Map)

Aggregations

MediaPhotoAdapter (com.yydcdut.noteplugin.adapter.MediaPhotoAdapter)1 MediaFolder (com.yydcdut.noteplugin.bean.MediaFolder)1 Map (java.util.Map)1