Search in sources :

Example 1 with PopupDirectoryListAdapter

use of com.daotangbill.photopicker.adapter.PopupDirectoryListAdapter in project MLib by DaoBillTang.

the class PhotoPickerFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRetainInstance(true);
    mGlideRequestManager = Glide.with(this);
    directories = new ArrayList<>();
    originalPhotos = getArguments().getStringArrayList(EXTRA_ORIGIN);
    column = getArguments().getInt(EXTRA_COLUMN, DEFAULT_COLUMN_NUMBER);
    boolean showCamera = getArguments().getBoolean(EXTRA_CAMERA, true);
    boolean previewEnable = getArguments().getBoolean(EXTRA_PREVIEW_ENABLED, true);
    photoGridAdapter = new PhotoGridAdapter(getActivity(), mGlideRequestManager, directories, originalPhotos, column);
    photoGridAdapter.setShowCamera(showCamera);
    photoGridAdapter.setPreviewEnable(previewEnable);
    listAdapter = new PopupDirectoryListAdapter(mGlideRequestManager, directories);
    Bundle mediaStoreArgs = new Bundle();
    boolean showGif = getArguments().getBoolean(EXTRA_GIF);
    mediaStoreArgs.putBoolean(EXTRA_SHOW_GIF, showGif);
    MediaStoreHelper.getPhotoDirs(getActivity(), mediaStoreArgs, new MediaStoreHelper.PhotosResultCallback() {

        @Override
        public void onResultCallback(List<PhotoDirectory> dirs) {
            directories.clear();
            directories.addAll(dirs);
            photoGridAdapter.notifyDataSetChanged();
            listAdapter.notifyDataSetChanged();
            adjustHeight();
        }
    });
    captureManager = new ImageCaptureManager(getActivity());
}
Also used : PhotoDirectory(com.daotangbill.photopicker.entity.PhotoDirectory) PhotoGridAdapter(com.daotangbill.photopicker.adapter.PhotoGridAdapter) Bundle(android.os.Bundle) PopupDirectoryListAdapter(com.daotangbill.photopicker.adapter.PopupDirectoryListAdapter) ImageCaptureManager(com.daotangbill.photopicker.utils.ImageCaptureManager) MediaStoreHelper(com.daotangbill.photopicker.utils.MediaStoreHelper)

Aggregations

Bundle (android.os.Bundle)1 PhotoGridAdapter (com.daotangbill.photopicker.adapter.PhotoGridAdapter)1 PopupDirectoryListAdapter (com.daotangbill.photopicker.adapter.PopupDirectoryListAdapter)1 PhotoDirectory (com.daotangbill.photopicker.entity.PhotoDirectory)1 ImageCaptureManager (com.daotangbill.photopicker.utils.ImageCaptureManager)1 MediaStoreHelper (com.daotangbill.photopicker.utils.MediaStoreHelper)1