com.yanzhenjie.album.Action Java Examples

The following examples show how to use com.yanzhenjie.album.Action. 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: FormPresenter.java    From Kalle with Apache License 2.0 6 votes vote down vote up
@Override
public void addFile() {
    Album.image(this)
        .multipleChoice()
        .selectCount(3)
        .camera(true)
        .checkedList(mAlbumList)
        .onResult(new Action<ArrayList<AlbumFile>>() {
            @Override
            public void onAction(@NonNull ArrayList<AlbumFile> albumFiles) {
                mAlbumList = albumFiles;

                mFileItems = new ArrayList<>();
                for (AlbumFile albumFile : mAlbumList) {
                    FileItem fileItem = new FileItem();
                    fileItem.setAlbumFile(albumFile);
                    mFileItems.add(fileItem);
                }
                mView.setFileList(mFileItems);

                mView.setStatusText(getString(R.string.form_upload_wait));
            }
        })
        .start();
}
 
Example #2
Source File: AlbumActivity.java    From Album with Apache License 2.0 6 votes vote down vote up
/**
 * Preview image, to album.
 */
private void previewAlbum(int position) {
    if (mAlbumFiles == null || mAlbumFiles.size() == 0) {
        Toast.makeText(this, R.string.no_selected, Toast.LENGTH_LONG).show();
    } else {
        Album.galleryAlbum(this)
                .checkable(true)
                .checkedList(mAlbumFiles)
                .currentPosition(position)
                .widget(
                        Widget.newDarkBuilder(this)
                                .title(mToolbar.getTitle().toString())
                                .build()
                )
                .onResult(new Action<ArrayList<AlbumFile>>() {
                    @Override
                    public void onAction(@NonNull ArrayList<AlbumFile> result) {
                        mAlbumFiles = result;
                        mAdapter.notifyDataSetChanged(mAlbumFiles);
                        mTvMessage.setVisibility(result.size() > 0 ? View.VISIBLE : View.GONE);
                    }
                })
                .start();
    }
}
 
Example #3
Source File: ImageActivity.java    From Album with Apache License 2.0 6 votes vote down vote up
/**
 * Preview image, to album.
 */
private void previewImage(int position) {
    if (mAlbumFiles == null || mAlbumFiles.size() == 0) {
        Toast.makeText(this, R.string.no_selected, Toast.LENGTH_LONG).show();
    } else {
        Album.galleryAlbum(this)
                .checkable(true)
                .checkedList(mAlbumFiles)
                .currentPosition(position)
                .widget(
                        Widget.newDarkBuilder(this)
                                .title(mToolbar.getTitle().toString())
                                .build()
                )
                .onResult(new Action<ArrayList<AlbumFile>>() {
                    @Override
                    public void onAction(@NonNull ArrayList<AlbumFile> result) {
                        mAlbumFiles = result;
                        mAdapter.notifyDataSetChanged(mAlbumFiles);
                        mTvMessage.setVisibility(result.size() > 0 ? View.VISIBLE : View.GONE);
                    }
                })
                .start();
    }
}
 
Example #4
Source File: AlbumFilterActivity.java    From Album with Apache License 2.0 6 votes vote down vote up
/**
 * Preview image, to album.
 */
private void previewAlbum(int position) {
    if (mAlbumFiles == null || mAlbumFiles.size() == 0) {
        Toast.makeText(this, R.string.no_selected, Toast.LENGTH_LONG).show();
    } else {
        Album.galleryAlbum(this)
                .checkable(true)
                .checkedList(mAlbumFiles)
                .currentPosition(position)
                .widget(
                        Widget.newDarkBuilder(this)
                                .title(mToolbar.getTitle().toString())
                                .build()
                )
                .onResult(new Action<ArrayList<AlbumFile>>() {
                    @Override
                    public void onAction(@NonNull ArrayList<AlbumFile> result) {
                        mAlbumFiles = result;
                        mAdapter.notifyDataSetChanged(mAlbumFiles);
                        mTvMessage.setVisibility(result.size() > 0 ? View.VISIBLE : View.GONE);
                    }
                })
                .start();
    }
}
 
Example #5
Source File: VideoActivity.java    From Album with Apache License 2.0 6 votes vote down vote up
/**
 * Preview image, to album.
 */
private void previewVideo(int position) {
    if (mAlbumFiles == null || mAlbumFiles.size() == 0) {
        Toast.makeText(this, R.string.no_selected, Toast.LENGTH_LONG).show();
    } else {
        Album.galleryAlbum(this)
                .checkable(true)
                .checkedList(mAlbumFiles)
                .currentPosition(position)
                .widget(
                        Widget.newDarkBuilder(this)
                                .title(mToolbar.getTitle().toString())
                                .build()
                )
                .onResult(new Action<ArrayList<AlbumFile>>() {
                    @Override
                    public void onAction(@NonNull ArrayList<AlbumFile> result) {
                        mAlbumFiles = result;
                        mAdapter.notifyDataSetChanged(mAlbumFiles);
                        mTvMessage.setVisibility(result.size() > 0 ? View.VISIBLE : View.GONE);
                    }
                })
                .start();
    }
}
 
Example #6
Source File: GalleryActivity.java    From Album with Apache License 2.0 6 votes vote down vote up
private void previewImages() {
    ArrayList<String> imageList = new ArrayList<>();
    Collections.addAll(imageList, IMAGE_PATH_LIST);

    Album.gallery(this)
            .checkedList(imageList)
            .checkable(mCheckBox.isChecked())
            .widget(
                    Widget.newDarkBuilder(this)
                            .title(mToolbar.getTitle().toString())
                            .build()
            )
            .onResult(new Action<ArrayList<String>>() {
                @Override
                public void onAction(@NonNull ArrayList<String> result) {
                    // TODO If it is optional, here you can accept the results of user selection.
                }
            })
            .start();
}
 
Example #7
Source File: FormPresenter.java    From NoHttp with Apache License 2.0 6 votes vote down vote up
@Override
public void addFile() {
    Album.image(this)
      .multipleChoice()
      .selectCount(3)
      .camera(true)
      .checkedList(mAlbumList)
      .onResult(new Action<ArrayList<AlbumFile>>() {
          @Override
          public void onAction(@NonNull ArrayList<AlbumFile> albumFiles) {
              mAlbumList = albumFiles;

              mFileItems = new ArrayList<>();
              for (AlbumFile albumFile : mAlbumList) {
                  FileItem fileItem = new FileItem();
                  fileItem.setAlbumFile(albumFile);
                  mFileItems.add(fileItem);
              }
              mView.setFileList(mFileItems);

              mView.setStatusText(getString(R.string.form_upload_wait));
          }
      })
      .start();
}
 
Example #8
Source File: BodyPresenter.java    From Kalle with Apache License 2.0 5 votes vote down vote up
@Override
public void selectFile() {
    Album.album(this).singleChoice().camera(true).onResult(new Action<ArrayList<AlbumFile>>() {
        @Override
        public void onAction(@NonNull ArrayList<AlbumFile> result) {
            mAlbumFile = result.get(0);
            mView.setLocalFile(mAlbumFile.getPath());
        }
    }).start();
}
 
Example #9
Source File: DefineStyleActivity.java    From Album with Apache License 2.0 5 votes vote down vote up
/**
 * Preview image, to album.
 */
private void previewAlbum(int position) {
    if (mAlbumFiles == null || mAlbumFiles.size() == 0) {
        Toast.makeText(this, R.string.no_selected, Toast.LENGTH_LONG).show();
    } else {
        Album.galleryAlbum(this)
                .checkable(true)
                .checkedList(mAlbumFiles)
                .currentPosition(position)
                .widget(
                        Widget.newLightBuilder(this)
                                .toolBarColor(Color.WHITE)
                                .statusBarColor(Color.WHITE)
                                .mediaItemCheckSelector(Color.GREEN, Color.RED)
                                .bucketItemCheckSelector(Color.GREEN, Color.RED)
                                .buttonStyle(
                                        Widget.ButtonStyle.newLightBuilder(this)
                                                .setButtonSelector(Color.WHITE, Color.GRAY)
                                                .build()
                                )
                                .build()
                )
                .onResult(new Action<ArrayList<AlbumFile>>() {
                    @Override
                    public void onAction(@NonNull ArrayList<AlbumFile> result) {
                        mAlbumFiles = result;
                        mAdapter.notifyDataSetChanged(mAlbumFiles);
                        mTvMessage.setVisibility(result.size() > 0 ? View.VISIBLE : View.GONE);
                    }
                })
                .start();
    }
}
 
Example #10
Source File: BodyPresenter.java    From NoHttp with Apache License 2.0 5 votes vote down vote up
@Override
public void selectFile() {
    Album.album(this).singleChoice().camera(true).onResult(new Action<ArrayList<AlbumFile>>() {
        @Override
        public void onAction(@NonNull ArrayList<AlbumFile> result) {
            mAlbumFile = result.get(0);
            mView.setLocalFile(mAlbumFile.getPath());
        }
    }).start();
}
 
Example #11
Source File: BasicAlbumWrapper.java    From Album with Apache License 2.0 2 votes vote down vote up
/**
 * Set the action when result.
 *
 * @param result action when producing result.
 */
public final Returner onResult(Action<Result> result) {
    this.mResult = result;
    return (Returner) this;
}
 
Example #12
Source File: BasicAlbumWrapper.java    From Album with Apache License 2.0 2 votes vote down vote up
/**
 * Set the action when canceling.
 *
 * @param cancel action when canceled.
 */
public final Returner onCancel(Action<Cancel> cancel) {
    this.mCancel = cancel;
    return (Returner) this;
}
 
Example #13
Source File: BasicCameraWrapper.java    From Album with Apache License 2.0 2 votes vote down vote up
/**
 * Set the action when result.
 *
 * @param result action when producing result.
 */
public final Returner onResult(Action<String> result) {
    this.mResult = result;
    return (Returner) this;
}
 
Example #14
Source File: BasicCameraWrapper.java    From Album with Apache License 2.0 2 votes vote down vote up
/**
 * Set the action when canceling.
 *
 * @param cancel action when canceled.
 */
public final Returner onCancel(Action<String> cancel) {
    this.mCancel = cancel;
    return (Returner) this;
}