com.yanzhenjie.album.Album Java Examples
The following examples show how to use
com.yanzhenjie.album.Album.
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: ImageSingleWrapper.java From Album with Apache License 2.0 | 6 votes |
@Override public void start() { AlbumActivity.sSizeFilter = mSizeFilter; AlbumActivity.sMimeFilter = mMimeTypeFilter; AlbumActivity.sResult = mResult; AlbumActivity.sCancel = mCancel; Intent intent = new Intent(mContext, AlbumActivity.class); intent.putExtra(Album.KEY_INPUT_WIDGET, mWidget); intent.putExtra(Album.KEY_INPUT_FUNCTION, Album.FUNCTION_CHOICE_IMAGE); intent.putExtra(Album.KEY_INPUT_CHOICE_MODE, Album.MODE_SINGLE); intent.putExtra(Album.KEY_INPUT_COLUMN_COUNT, mColumnCount); intent.putExtra(Album.KEY_INPUT_ALLOW_CAMERA, mHasCamera); intent.putExtra(Album.KEY_INPUT_LIMIT_COUNT, 1); intent.putExtra(Album.KEY_INPUT_FILTER_VISIBILITY, mFilterVisibility); mContext.startActivity(intent); }
Example #2
Source File: VideoSingleWrapper.java From Album with Apache License 2.0 | 6 votes |
@Override public void start() { AlbumActivity.sSizeFilter = mSizeFilter; AlbumActivity.sMimeFilter = mMimeTypeFilter; AlbumActivity.sDurationFilter = mDurationFilter; AlbumActivity.sResult = mResult; AlbumActivity.sCancel = mCancel; Intent intent = new Intent(mContext, AlbumActivity.class); intent.putExtra(Album.KEY_INPUT_WIDGET, mWidget); intent.putExtra(Album.KEY_INPUT_FUNCTION, Album.FUNCTION_CHOICE_VIDEO); intent.putExtra(Album.KEY_INPUT_CHOICE_MODE, Album.MODE_SINGLE); intent.putExtra(Album.KEY_INPUT_COLUMN_COUNT, mColumnCount); intent.putExtra(Album.KEY_INPUT_ALLOW_CAMERA, mHasCamera); intent.putExtra(Album.KEY_INPUT_LIMIT_COUNT, 1); intent.putExtra(Album.KEY_INPUT_FILTER_VISIBILITY, mFilterVisibility); intent.putExtra(Album.KEY_INPUT_CAMERA_QUALITY, mQuality); intent.putExtra(Album.KEY_INPUT_CAMERA_DURATION, mLimitDuration); intent.putExtra(Album.KEY_INPUT_CAMERA_BYTES, mLimitBytes); mContext.startActivity(intent); }
Example #3
Source File: AlbumSingleWrapper.java From Album with Apache License 2.0 | 6 votes |
@Override public void start() { AlbumActivity.sSizeFilter = mSizeFilter; AlbumActivity.sMimeFilter = mMimeTypeFilter; AlbumActivity.sDurationFilter = mDurationFilter; AlbumActivity.sResult = mResult; AlbumActivity.sCancel = mCancel; Intent intent = new Intent(mContext, AlbumActivity.class); intent.putExtra(Album.KEY_INPUT_WIDGET, mWidget); intent.putExtra(Album.KEY_INPUT_FUNCTION, Album.FUNCTION_CHOICE_ALBUM); intent.putExtra(Album.KEY_INPUT_CHOICE_MODE, Album.MODE_SINGLE); intent.putExtra(Album.KEY_INPUT_COLUMN_COUNT, mColumnCount); intent.putExtra(Album.KEY_INPUT_ALLOW_CAMERA, mHasCamera); intent.putExtra(Album.KEY_INPUT_LIMIT_COUNT, 1); intent.putExtra(Album.KEY_INPUT_FILTER_VISIBILITY, mFilterVisibility); intent.putExtra(Album.KEY_INPUT_CAMERA_QUALITY, mQuality); intent.putExtra(Album.KEY_INPUT_CAMERA_DURATION, mLimitDuration); intent.putExtra(Album.KEY_INPUT_CAMERA_BYTES, mLimitBytes); mContext.startActivity(intent); }
Example #4
Source File: VideoMultipleWrapper.java From Album with Apache License 2.0 | 6 votes |
@Override public void start() { AlbumActivity.sSizeFilter = mSizeFilter; AlbumActivity.sMimeFilter = mMimeTypeFilter; AlbumActivity.sDurationFilter = mDurationFilter; AlbumActivity.sResult = mResult; AlbumActivity.sCancel = mCancel; Intent intent = new Intent(mContext, AlbumActivity.class); intent.putExtra(Album.KEY_INPUT_WIDGET, mWidget); intent.putParcelableArrayListExtra(Album.KEY_INPUT_CHECKED_LIST, mChecked); intent.putExtra(Album.KEY_INPUT_FUNCTION, Album.FUNCTION_CHOICE_VIDEO); intent.putExtra(Album.KEY_INPUT_CHOICE_MODE, Album.MODE_MULTIPLE); intent.putExtra(Album.KEY_INPUT_COLUMN_COUNT, mColumnCount); intent.putExtra(Album.KEY_INPUT_ALLOW_CAMERA, mHasCamera); intent.putExtra(Album.KEY_INPUT_LIMIT_COUNT, mLimitCount); intent.putExtra(Album.KEY_INPUT_FILTER_VISIBILITY, mFilterVisibility); intent.putExtra(Album.KEY_INPUT_CAMERA_QUALITY, mQuality); intent.putExtra(Album.KEY_INPUT_CAMERA_DURATION, mLimitDuration); intent.putExtra(Album.KEY_INPUT_CAMERA_BYTES, mLimitBytes); mContext.startActivity(intent); }
Example #5
Source File: AlbumMultipleWrapper.java From Album with Apache License 2.0 | 6 votes |
@Override public void start() { AlbumActivity.sSizeFilter = mSizeFilter; AlbumActivity.sMimeFilter = mMimeTypeFilter; AlbumActivity.sDurationFilter = mDurationFilter; AlbumActivity.sResult = mResult; AlbumActivity.sCancel = mCancel; Intent intent = new Intent(mContext, AlbumActivity.class); intent.putExtra(Album.KEY_INPUT_WIDGET, mWidget); intent.putParcelableArrayListExtra(Album.KEY_INPUT_CHECKED_LIST, mChecked); intent.putExtra(Album.KEY_INPUT_FUNCTION, Album.FUNCTION_CHOICE_ALBUM); intent.putExtra(Album.KEY_INPUT_CHOICE_MODE, Album.MODE_MULTIPLE); intent.putExtra(Album.KEY_INPUT_COLUMN_COUNT, mColumnCount); intent.putExtra(Album.KEY_INPUT_ALLOW_CAMERA, mHasCamera); intent.putExtra(Album.KEY_INPUT_LIMIT_COUNT, mLimitCount); intent.putExtra(Album.KEY_INPUT_FILTER_VISIBILITY, mFilterVisibility); intent.putExtra(Album.KEY_INPUT_CAMERA_QUALITY, mQuality); intent.putExtra(Album.KEY_INPUT_CAMERA_DURATION, mLimitDuration); intent.putExtra(Album.KEY_INPUT_CAMERA_BYTES, mLimitBytes); mContext.startActivity(intent); }
Example #6
Source File: AlbumFilterActivity.java From Album with Apache License 2.0 | 6 votes |
/** * 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 #7
Source File: ImageMultipleWrapper.java From Album with Apache License 2.0 | 6 votes |
@Override public void start() { AlbumActivity.sSizeFilter = mSizeFilter; AlbumActivity.sMimeFilter = mMimeTypeFilter; AlbumActivity.sResult = mResult; AlbumActivity.sCancel = mCancel; Intent intent = new Intent(mContext, AlbumActivity.class); intent.putExtra(Album.KEY_INPUT_WIDGET, mWidget); intent.putParcelableArrayListExtra(Album.KEY_INPUT_CHECKED_LIST, mChecked); intent.putExtra(Album.KEY_INPUT_FUNCTION, Album.FUNCTION_CHOICE_IMAGE); intent.putExtra(Album.KEY_INPUT_CHOICE_MODE, Album.MODE_MULTIPLE); intent.putExtra(Album.KEY_INPUT_COLUMN_COUNT, mColumnCount); intent.putExtra(Album.KEY_INPUT_ALLOW_CAMERA, mHasCamera); intent.putExtra(Album.KEY_INPUT_LIMIT_COUNT, mLimitCount); intent.putExtra(Album.KEY_INPUT_FILTER_VISIBILITY, mFilterVisibility); mContext.startActivity(intent); }
Example #8
Source File: VideoActivity.java From Album with Apache License 2.0 | 6 votes |
/** * 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 #9
Source File: GalleryActivity.java From Album with Apache License 2.0 | 6 votes |
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 #10
Source File: AlbumActivity.java From Album with Apache License 2.0 | 6 votes |
private void takeVideo() { String filePath; if (mCurrentFolder == 0) { filePath = AlbumUtils.randomMP4Path(); } else { File file = new File(mAlbumFolders.get(mCurrentFolder).getAlbumFiles().get(0).getPath()); filePath = AlbumUtils.randomMP4Path(file.getParentFile()); } Album.camera(this) .video() .filePath(filePath) .quality(mQuality) .limitDuration(mLimitDuration) .limitBytes(mLimitBytes) .onResult(mCameraAction) .start(); }
Example #11
Source File: FormPresenter.java From NoHttp with Apache License 2.0 | 6 votes |
@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 #12
Source File: ImageActivity.java From Album with Apache License 2.0 | 6 votes |
/** * 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 #13
Source File: FormPresenter.java From Kalle with Apache License 2.0 | 6 votes |
@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 #14
Source File: AlbumActivity.java From Album with Apache License 2.0 | 6 votes |
@Override public void complete() { if (mCheckedList.isEmpty()) { int messageRes; switch (mFunction) { case Album.FUNCTION_CHOICE_IMAGE: { messageRes = R.string.album_check_image_little; break; } case Album.FUNCTION_CHOICE_VIDEO: { messageRes = R.string.album_check_video_little; break; } case Album.FUNCTION_CHOICE_ALBUM: { messageRes = R.string.album_check_album_little; break; } default: { throw new AssertionError("This should not be the case."); } } mView.toast(messageRes); } else { callbackResult(); } }
Example #15
Source File: AlbumActivity.java From Album with Apache License 2.0 | 6 votes |
/** * 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 #16
Source File: NullActivity.java From Album with Apache License 2.0 | 5 votes |
@Override public void takePicture() { Album.camera(this) .image() .onResult(mCameraAction) .start(); }
Example #17
Source File: AlbumAdapter.java From Album with Apache License 2.0 | 5 votes |
@Override public void setData(AlbumFile albumFile) { mCheckBox.setChecked(albumFile.isChecked()); Album.getAlbumConfig() .getAlbumLoader() .load(mIvImage, albumFile); mLayoutLayer.setVisibility(albumFile.isDisable() ? View.VISIBLE : View.GONE); }
Example #18
Source File: GalleryActivity.java From Album with Apache License 2.0 | 5 votes |
@Override public void complete() { if (sCheckedCount == 0) { int messageRes; switch (mFunction) { case Album.FUNCTION_CHOICE_IMAGE: { messageRes = R.string.album_check_image_little; break; } case Album.FUNCTION_CHOICE_VIDEO: { messageRes = R.string.album_check_video_little; break; } case Album.FUNCTION_CHOICE_ALBUM: { messageRes = R.string.album_check_album_little; break; } default: { throw new AssertionError("This should not be the case."); } } mView.toast(messageRes); } else { sCallback.onPreviewComplete(); finish(); } }
Example #19
Source File: GalleryActivity.java From Album with Apache License 2.0 | 5 votes |
@Override public void onCheckedChanged() { AlbumFile albumFile = sAlbumFiles.get(sCurrentPosition); if (albumFile.isChecked()) { albumFile.setChecked(false); sCallback.onPreviewChanged(albumFile); sCheckedCount--; } else { if (sCheckedCount >= mAllowSelectCount) { int messageRes; switch (mFunction) { case Album.FUNCTION_CHOICE_IMAGE: { messageRes = R.plurals.album_check_image_limit; break; } case Album.FUNCTION_CHOICE_VIDEO: { messageRes = R.plurals.album_check_video_limit; break; } case Album.FUNCTION_CHOICE_ALBUM: { messageRes = R.plurals.album_check_album_limit; break; } default: { throw new AssertionError("This should not be the case."); } } mView.toast(getResources().getQuantityString(messageRes, mAllowSelectCount, mAllowSelectCount)); mView.setChecked(false); } else { albumFile.setChecked(true); sCallback.onPreviewChanged(albumFile); sCheckedCount++; } } setCheckedCount(); }
Example #20
Source File: AlbumAdapter.java From Album with Apache License 2.0 | 5 votes |
@Override public void setData(AlbumFile albumFile) { Album.getAlbumConfig().getAlbumLoader().load(mIvImage, albumFile); mCheckBox.setChecked(albumFile.isChecked()); mTvDuration.setText(AlbumUtils.convertDuration(albumFile.getDuration())); mLayoutLayer.setVisibility(albumFile.isDisable() ? View.VISIBLE : View.GONE); }
Example #21
Source File: AlbumActivity.java From Album with Apache License 2.0 | 5 votes |
@Override public void tryPreviewItem(int position) { switch (mChoiceMode) { case Album.MODE_SINGLE: { AlbumFile albumFile = mAlbumFolders.get(mCurrentFolder).getAlbumFiles().get(position); // albumFile.setChecked(true); // mView.notifyItem(position); mCheckedList.add(albumFile); setCheckedCount(); callbackResult(); break; } case Album.MODE_MULTIPLE: { GalleryActivity.sAlbumFiles = mAlbumFolders.get(mCurrentFolder).getAlbumFiles(); GalleryActivity.sCheckedCount = mCheckedList.size(); GalleryActivity.sCurrentPosition = position; GalleryActivity.sCallback = this; Intent intent = new Intent(this, GalleryActivity.class); intent.putExtras(getIntent()); startActivity(intent); break; } default: { throw new AssertionError("This should not be the case."); } } }
Example #22
Source File: NullActivity.java From Album with Apache License 2.0 | 5 votes |
@Override public void takeVideo() { Album.camera(this) .video() .quality(mQuality) .limitDuration(mLimitDuration) .limitBytes(mLimitBytes) .onResult(mCameraAction) .start(); }
Example #23
Source File: DefineStyleActivity.java From Album with Apache License 2.0 | 5 votes |
/** * 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 #24
Source File: Application.java From Album with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); if (instance == null) { instance = this; Album.initialize(AlbumConfig.newBuilder(this) .setAlbumLoader(new MediaLoader()) .setLocale(Locale.getDefault()) .build() ); } }
Example #25
Source File: ImageAdapter.java From NoHttp with Apache License 2.0 | 5 votes |
void bindData(FileItem fileItem) { Album.getAlbumConfig().getAlbumLoader().load(mIvImage, fileItem.getAlbumFile().getPath()); int progress = fileItem.getProgress(); if (progress > 0) { if (progress >= 100) { mTvStatus.setText(R.string.form_upload_result); } else { mTvStatus.setText(mTvStatus.getResources().getString(R.string.form_progress, progress)); } } else { mTvStatus.setText(R.string.form_upload_wait); } }
Example #26
Source File: BodyPresenter.java From NoHttp with Apache License 2.0 | 5 votes |
@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 #27
Source File: BodyView.java From NoHttp with Apache License 2.0 | 5 votes |
@Override public void setLocalFile(String filepath) { Album.getAlbumConfig().getAlbumLoader().load(mIvImage, filepath); mTvStatus.setText(R.string.body_status_un_upload); mBtnCopy.setVisibility(View.GONE); }
Example #28
Source File: BodyView.java From NoHttp with Apache License 2.0 | 5 votes |
@Override public void setRemoteFile(String filepath) { Album.getAlbumConfig().getAlbumLoader().load(mIvImage, filepath); mTvStatus.setText(R.string.body_status_upload_succeed); mBtnCopy.setVisibility(View.VISIBLE); }
Example #29
Source File: App.java From NoHttp with Apache License 2.0 | 5 votes |
public void initialize() { AppConfig.get().initFileDir(); NoHttp.initialize(InitializationConfig.newBuilder(this) .networkExecutor(new OkHttpNetworkExecutor()) .cacheStore(new DiskCacheStore(this)) .cookieStore(new DBCookieStore(this)) .interceptor(new LoginInterceptor()) .build()); Album.initialize(AlbumConfig.newBuilder(this).setAlbumLoader(new MediaLoader()).build()); }
Example #30
Source File: VideoCameraWrapper.java From Album with Apache License 2.0 | 5 votes |
public void start() { CameraActivity.sResult = mResult; CameraActivity.sCancel = mCancel; Intent intent = new Intent(mContext, CameraActivity.class); intent.putExtra(Album.KEY_INPUT_FUNCTION, Album.FUNCTION_CAMERA_VIDEO); intent.putExtra(Album.KEY_INPUT_FILE_PATH, mFilePath); intent.putExtra(Album.KEY_INPUT_CAMERA_QUALITY, mQuality); intent.putExtra(Album.KEY_INPUT_CAMERA_DURATION, mLimitDuration); intent.putExtra(Album.KEY_INPUT_CAMERA_BYTES, mLimitBytes); mContext.startActivity(intent); }