me.iwf.photopicker.entity.PhotoDirectory Java Examples

The following examples show how to use me.iwf.photopicker.entity.PhotoDirectory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PhotoPickerFragment.java    From PhotoPicker with Apache License 2.0 6 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();

    if (directories == null) {
        return;
    }

    for (PhotoDirectory directory : directories) {
        directory.getPhotoPaths().clear();
        directory.getPhotos().clear();
        directory.setPhotos(null);
    }
    directories.clear();
    directories = null;
}
 
Example #2
Source File: PhotoPickerFragment.java    From PhotoPicker with Apache License 2.0 6 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();

    if (directories == null) {
        return;
    }

    for (PhotoDirectory directory : directories) {
        directory.getPhotoPaths().clear();
        directory.getPhotos().clear();
        directory.setPhotos(null);
    }
    directories.clear();
    directories = null;
}
 
Example #3
Source File: PopupDirectoryListAdapter.java    From PhotoPicker with Apache License 2.0 5 votes vote down vote up
public void bindData(PhotoDirectory directory) {
  final RequestOptions options = new RequestOptions();
  options.dontAnimate()
      .dontTransform()
      .override(800, 800)
      .placeholder(R.drawable.__picker_ic_photo_black_48dp)
      .error(R.drawable.__picker_ic_broken_image_black_48dp);
  glide.setDefaultRequestOptions(options)
      .load(directory.getCoverPath())
      .thumbnail(0.1f)
      .into(ivCover);
  tvName.setText(directory.getName());
  tvCount.setText(tvCount.getContext().getString(R.string.__picker_image_count, directory.getPhotos().size()));
}
 
Example #4
Source File: PopupDirectoryListAdapter.java    From PhotoPicker with Apache License 2.0 5 votes vote down vote up
public void bindData(PhotoDirectory directory) {
  final RequestOptions options = new RequestOptions();
  options.dontAnimate()
          .dontTransform()
          .override(800, 800)
          .placeholder(R.drawable.__picker_ic_photo_black_48dp)
          .error(R.drawable.__picker_ic_broken_image_black_48dp);
  glide.setDefaultRequestOptions(options)
          .load(directory.getCoverPath())
          .thumbnail(0.1f)
          .into(ivCover);
  tvName.setText(directory.getName());
  tvCount.setText(tvCount.getContext().getString(R.string.__picker_image_count, directory.getPhotos().size()));
}
 
Example #5
Source File: PhotoPickerFragment.java    From PhotoPicker with Apache License 2.0 5 votes vote down vote up
@Override public void onDestroy() {
  super.onDestroy();

  if (directories == null) {
    return;
  }

  for (PhotoDirectory directory : directories) {
    directory.getPhotoPaths().clear();
    directory.getPhotos().clear();
    directory.setPhotos(null);
  }
  directories.clear();
  directories = null;
}
 
Example #6
Source File: PhotoPickerFragment.java    From PhotoPicker with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example #7
Source File: PopupDirectoryListAdapter.java    From PhotoPicker with Apache License 2.0 5 votes vote down vote up
public void bindData(PhotoDirectory directory) {
  glide.load(directory.getCoverPath())
      .dontAnimate()
      .thumbnail(0.1f)
      .into(ivCover);
  tvName.setText(directory.getName());
  tvCount.setText(tvCount.getContext().getString(R.string.__picker_image_count, directory.getPhotos().size()));
}
 
Example #8
Source File: PhotoGridAdapter.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
public PhotoGridAdapter(Context context, RequestManager requestManager,  List<PhotoDirectory> photoDirectories, ArrayList<String> orginalPhotos, int colNum) {
  this(context, requestManager, photoDirectories);
  setColumnNumber(context, colNum);
  selectedPhotos = new ArrayList<>();
  if (orginalPhotos != null) selectedPhotos.addAll(orginalPhotos);
}
 
Example #9
Source File: PhotoPickerFragment.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
@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);
    isCrop = getArguments().getBoolean(EXTRA_CROP, false);
    isOpenCamera = getArguments().getBoolean(EXTRA_OPEN_CAMERA, false);


    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);

    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());
}
 
Example #10
Source File: PhotoGridAdapter.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
public PhotoGridAdapter(Context context, RequestManager requestManager, List<PhotoDirectory> photoDirectories) {
  this.photoDirectories = photoDirectories;
  this.glide = requestManager;
  setColumnNumber(context, columnNumber);
}
 
Example #11
Source File: PopupDirectoryListAdapter.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
@Override public PhotoDirectory getItem(int position) {
  return directories.get(position);
}
 
Example #12
Source File: PopupDirectoryListAdapter.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
public PopupDirectoryListAdapter(RequestManager glide, List<PhotoDirectory> directories) {
  this.directories = directories;
  this.glide = glide;
}
 
Example #13
Source File: MediaStoreHelper.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) {

      if (data == null)  return;
      List<PhotoDirectory> directories = new ArrayList<>();
      PhotoDirectory photoDirectoryAll = new PhotoDirectory();
      photoDirectoryAll.setName(context.getString(R.string.__picker_all_image));
      photoDirectoryAll.setId("ALL");

      data.moveToFirst();

      while (data.moveToNext()) {

        int imageId  = data.getInt(data.getColumnIndexOrThrow(_ID));
        String bucketId = data.getString(data.getColumnIndexOrThrow(BUCKET_ID));
        String name = data.getString(data.getColumnIndexOrThrow(BUCKET_DISPLAY_NAME));
        String path = data.getString(data.getColumnIndexOrThrow(DATA));
        long size = data.getInt(data.getColumnIndexOrThrow(SIZE));

        if (size < 1) continue;

        PhotoDirectory photoDirectory = new PhotoDirectory();
        photoDirectory.setId(bucketId);
        photoDirectory.setName(name);

        if (!directories.contains(photoDirectory)) {
          photoDirectory.setCoverPath(path);
          photoDirectory.addPhoto(imageId, path);
          photoDirectory.setDateAdded(data.getLong(data.getColumnIndexOrThrow(DATE_ADDED)));
          directories.add(photoDirectory);
        } else {
          directories.get(directories.indexOf(photoDirectory)).addPhoto(imageId, path);
        }

        photoDirectoryAll.addPhoto(imageId, path);
      }
      if (photoDirectoryAll.getPhotoPaths().size() > 0) {
        photoDirectoryAll.setCoverPath(photoDirectoryAll.getPhotoPaths().get(0));
      }
      directories.add(INDEX_ALL_PHOTOS, photoDirectoryAll);
      if (resultCallback != null) {
        resultCallback.onResultCallback(directories);
      }
    }
 
Example #14
Source File: PhotoGridAdapter.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
public PhotoGridAdapter(Context context, RequestManager requestManager, List<PhotoDirectory> photoDirectories, ArrayList<String> orginalPhotos, int colNum) {
    this(context, requestManager, photoDirectories);
    setColumnNumber(context, colNum);
    selectedPhotos = new ArrayList<>();
    if (orginalPhotos != null) selectedPhotos.addAll(orginalPhotos);
}
 
Example #15
Source File: PhotoGridAdapter.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
public PhotoGridAdapter(Context context, RequestManager requestManager, List<PhotoDirectory> photoDirectories) {
    this.photoDirectories = photoDirectories;
    this.glide = requestManager;
    inflater = LayoutInflater.from(context);
    setColumnNumber(context, columnNumber);
}
 
Example #16
Source File: PopupDirectoryListAdapter.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
@Override public PhotoDirectory getItem(int position) {
  return directories.get(position);
}
 
Example #17
Source File: PopupDirectoryListAdapter.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
public PopupDirectoryListAdapter(RequestManager glide, List<PhotoDirectory> directories) {
  this.directories = directories;
  this.glide = glide;
}
 
Example #18
Source File: MediaStoreHelper.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) {

      if (data == null)  return;
      List<PhotoDirectory> directories = new ArrayList<>();
      PhotoDirectory photoDirectoryAll = new PhotoDirectory();
      photoDirectoryAll.setName(context.getString(R.string.__picker_all_image));
      photoDirectoryAll.setId("ALL");

      while (data.moveToNext()) {

        int imageId  = data.getInt(data.getColumnIndexOrThrow(_ID));
        String bucketId = data.getString(data.getColumnIndexOrThrow(BUCKET_ID));
        String name = data.getString(data.getColumnIndexOrThrow(BUCKET_DISPLAY_NAME));
        String path = data.getString(data.getColumnIndexOrThrow(DATA));
        long size = data.getInt(data.getColumnIndexOrThrow(SIZE));

        if (size < 1) continue;

        PhotoDirectory photoDirectory = new PhotoDirectory();
        photoDirectory.setId(bucketId);
        photoDirectory.setName(name);

        if (!directories.contains(photoDirectory)) {
          photoDirectory.setCoverPath(path);
          photoDirectory.addPhoto(imageId, path);
          photoDirectory.setDateAdded(data.getLong(data.getColumnIndexOrThrow(DATE_ADDED)));
          directories.add(photoDirectory);
        } else {
          directories.get(directories.indexOf(photoDirectory)).addPhoto(imageId, path);
        }

        photoDirectoryAll.addPhoto(imageId, path);
      }
      if (photoDirectoryAll.getPhotoPaths().size() > 0) {
        photoDirectoryAll.setCoverPath(photoDirectoryAll.getPhotoPaths().get(0));
      }
      directories.add(INDEX_ALL_PHOTOS, photoDirectoryAll);
      if (resultCallback != null) {
        resultCallback.onResultCallback(directories);
      }
    }
 
Example #19
Source File: PhotoPickerFragment.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
@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);
    isCrop = getArguments().getBoolean(EXTRA_CROP, false);
    isOpenCamera = getArguments().getBoolean(EXTRA_OPEN_CAMERA, false);


    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);

    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());
}
 
Example #20
Source File: PhotoGridAdapter.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
public PhotoGridAdapter(Context context, RequestManager requestManager, List<PhotoDirectory> photoDirectories, ArrayList<String> orginalPhotos, int colNum) {
    this(context, requestManager, photoDirectories);
    setColumnNumber(context, colNum);
    selectedPhotos = new ArrayList<>();
    if (orginalPhotos != null) selectedPhotos.addAll(orginalPhotos);
}
 
Example #21
Source File: PhotoGridAdapter.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
public PhotoGridAdapter(Context context, RequestManager requestManager, List<PhotoDirectory> photoDirectories) {
    this.photoDirectories = photoDirectories;
    this.glide = requestManager;
    inflater = LayoutInflater.from(context);
    setColumnNumber(context, columnNumber);
}
 
Example #22
Source File: PopupDirectoryListAdapter.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
@Override public PhotoDirectory getItem(int position) {
  return directories.get(position);
}
 
Example #23
Source File: PopupDirectoryListAdapter.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
public PopupDirectoryListAdapter(RequestManager glide, List<PhotoDirectory> directories) {
  this.directories = directories;
  this.glide = glide;
}
 
Example #24
Source File: MediaStoreHelper.java    From PhotoPicker with Apache License 2.0 4 votes vote down vote up
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) {

      if (data == null)  return;
      List<PhotoDirectory> directories = new ArrayList<>();
      PhotoDirectory photoDirectoryAll = new PhotoDirectory();
      photoDirectoryAll.setName(context.getString(R.string.__picker_all_image));
      photoDirectoryAll.setId("ALL");

      while (data.moveToNext()) {

        int imageId  = data.getInt(data.getColumnIndexOrThrow(_ID));
        String bucketId = data.getString(data.getColumnIndexOrThrow(BUCKET_ID));
        String name = data.getString(data.getColumnIndexOrThrow(BUCKET_DISPLAY_NAME));
        String path = data.getString(data.getColumnIndexOrThrow(DATA));
        long size = data.getInt(data.getColumnIndexOrThrow(SIZE));

        if (size < 1) continue;

        PhotoDirectory photoDirectory = new PhotoDirectory();
        photoDirectory.setId(bucketId);
        photoDirectory.setName(name);

        if (!directories.contains(photoDirectory)) {
          photoDirectory.setCoverPath(path);
          photoDirectory.addPhoto(imageId, path);
          photoDirectory.setDateAdded(data.getLong(data.getColumnIndexOrThrow(DATE_ADDED)));
          directories.add(photoDirectory);
        } else {
          directories.get(directories.indexOf(photoDirectory)).addPhoto(imageId, path);
        }

        photoDirectoryAll.addPhoto(imageId, path);
      }
      if (photoDirectoryAll.getPhotoPaths().size() > 0) {
        photoDirectoryAll.setCoverPath(photoDirectoryAll.getPhotoPaths().get(0));
      }
      directories.add(INDEX_ALL_PHOTOS, photoDirectoryAll);
      if (resultCallback != null) {
        resultCallback.onResultCallback(directories);
      }
    }
 
Example #25
Source File: MediaStoreHelper.java    From PhotoPicker with Apache License 2.0 votes vote down vote up
void onResultCallback(List<PhotoDirectory> directories); 
Example #26
Source File: MediaStoreHelper.java    From PhotoPicker with Apache License 2.0 votes vote down vote up
void onResultCallback(List<PhotoDirectory> directories); 
Example #27
Source File: MediaStoreHelper.java    From PhotoPicker with Apache License 2.0 votes vote down vote up
void onResultCallback(List<PhotoDirectory> directories);