├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── album ├── .gitignore ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── yanzhenjie │ │ └── album │ │ ├── Action.java │ │ ├── Album.java │ │ ├── AlbumConfig.java │ │ ├── AlbumFile.java │ │ ├── AlbumFolder.java │ │ ├── AlbumLoader.java │ │ ├── Filter.java │ │ ├── ItemAction.java │ │ ├── api │ │ ├── AlbumMultipleWrapper.java │ │ ├── AlbumSingleWrapper.java │ │ ├── BasicAlbumWrapper.java │ │ ├── BasicCameraWrapper.java │ │ ├── BasicChoiceAlbumWrapper.java │ │ ├── BasicChoiceVideoWrapper.java │ │ ├── BasicChoiceWrapper.java │ │ ├── BasicGalleryWrapper.java │ │ ├── GalleryAlbumWrapper.java │ │ ├── GalleryWrapper.java │ │ ├── ImageCameraWrapper.java │ │ ├── ImageMultipleWrapper.java │ │ ├── ImageSingleWrapper.java │ │ ├── VideoCameraWrapper.java │ │ ├── VideoMultipleWrapper.java │ │ ├── VideoSingleWrapper.java │ │ ├── camera │ │ │ ├── AlbumCamera.java │ │ │ └── Camera.java │ │ ├── choice │ │ │ ├── AlbumChoice.java │ │ │ ├── Choice.java │ │ │ ├── ImageChoice.java │ │ │ └── VideoChoice.java │ │ └── widget │ │ │ └── Widget.java │ │ ├── app │ │ ├── Contract.java │ │ ├── album │ │ │ ├── AlbumActivity.java │ │ │ ├── AlbumAdapter.java │ │ │ ├── AlbumView.java │ │ │ ├── FolderAdapter.java │ │ │ ├── FolderDialog.java │ │ │ ├── GalleryActivity.java │ │ │ ├── NullActivity.java │ │ │ ├── NullView.java │ │ │ └── data │ │ │ │ ├── MediaReadTask.java │ │ │ │ ├── MediaReader.java │ │ │ │ ├── PathConversion.java │ │ │ │ ├── PathConvertTask.java │ │ │ │ ├── ThumbnailBuildTask.java │ │ │ │ └── ThumbnailBuilder.java │ │ ├── camera │ │ │ └── CameraActivity.java │ │ └── gallery │ │ │ ├── GalleryActivity.java │ │ │ ├── GalleryAlbumActivity.java │ │ │ ├── GalleryView.java │ │ │ └── PreviewAdapter.java │ │ ├── impl │ │ ├── DoubleClickWrapper.java │ │ ├── OnCheckedClickListener.java │ │ └── OnItemClickListener.java │ │ ├── mvp │ │ ├── ActivitySource.java │ │ ├── BaseActivity.java │ │ ├── BaseFragment.java │ │ ├── BasePresenter.java │ │ ├── BaseView.java │ │ ├── Bye.java │ │ ├── Source.java │ │ └── ViewSource.java │ │ ├── provider │ │ └── CameraFileProvider.java │ │ ├── util │ │ ├── AlbumUtils.java │ │ └── SystemBar.java │ │ └── widget │ │ ├── ColorProgressBar.java │ │ ├── LoadingDialog.java │ │ ├── SquareCardView.java │ │ ├── SquareFrameLayout.java │ │ ├── SquareImageView.java │ │ ├── SquareRelativeLayout.java │ │ ├── TransferLayout.java │ │ ├── divider │ │ ├── Api20ItemDivider.java │ │ ├── Api21ItemDivider.java │ │ ├── ColorDrawer.java │ │ ├── Divider.java │ │ └── Drawer.java │ │ └── photoview │ │ ├── AttacherImageView.java │ │ ├── Compat.java │ │ ├── DefaultOnDoubleTapListener.java │ │ ├── FixViewPager.java │ │ ├── IPhotoView.java │ │ ├── PhotoViewAttacher.java │ │ ├── gestures │ │ ├── CupcakeGestureDetector.java │ │ ├── EclairGestureDetector.java │ │ ├── FroyoGestureDetector.java │ │ ├── GestureDetector.java │ │ ├── OnGestureListener.java │ │ └── VersionedGestureDetector.java │ │ └── scrollerproxy │ │ ├── GingerScroller.java │ │ ├── IcsScroller.java │ │ ├── PreGingerScroller.java │ │ └── ScrollerProxy.java │ └── res │ ├── drawable-hdpi │ ├── album_abc_spinner_white.9.png │ ├── album_ic_add_photo_white.png │ ├── album_ic_back_white.png │ ├── album_ic_done_white.png │ ├── album_ic_eye_white.png │ ├── album_ic_image_camera_white.png │ ├── album_ic_video_camera_white.png │ └── album_tag_video_white.png │ ├── drawable-xhdpi │ ├── album_abc_spinner_white.9.png │ ├── album_ic_add_photo_white.png │ ├── album_ic_back_white.png │ ├── album_ic_done_white.png │ ├── album_ic_eye_white.png │ ├── album_ic_image_camera_white.png │ ├── album_ic_video_camera_white.png │ └── album_tag_video_white.png │ ├── drawable-xxhdpi │ ├── album_abc_spinner_white.9.png │ ├── album_ic_add_photo_white.png │ ├── album_ic_back_white.png │ ├── album_ic_done_white.png │ ├── album_ic_eye_white.png │ ├── album_ic_image_camera_white.png │ ├── album_ic_video_camera_white.png │ └── album_tag_video_white.png │ ├── drawable-xxxhdpi │ ├── album_abc_spinner_white.9.png │ ├── album_ic_add_photo_white.png │ ├── album_ic_back_white.png │ ├── album_ic_done_white.png │ ├── album_ic_eye_white.png │ ├── album_ic_image_camera_white.png │ ├── album_ic_video_camera_white.png │ └── album_tag_video_white.png │ ├── layout │ ├── album_activity_album_dark.xml │ ├── album_activity_album_light.xml │ ├── album_activity_gallery.xml │ ├── album_activity_null.xml │ ├── album_content_album.xml │ ├── album_dialog_floder.xml │ ├── album_dialog_loading.xml │ ├── album_item_content_button.xml │ ├── album_item_content_image.xml │ ├── album_item_content_video.xml │ ├── album_item_dialog_folder.xml │ ├── album_toolbar_dark.xml │ └── album_toolbar_light.xml │ ├── menu │ ├── album_menu_album.xml │ ├── album_menu_gallery.xml │ └── album_menu_item_camera.xml │ ├── values-pt-rBR │ └── strings.xml │ ├── values-zh-RHK │ └── strings.xml │ ├── values-zh-RTW │ └── strings.xml │ ├── values-zh │ └── strings.xml │ ├── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── style.xml │ └── xml │ └── album_camera_provider.xml ├── build.gradle ├── config.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── image ├── 1.gif ├── 2.gif ├── 3.gif ├── 4.gif ├── 5.gif ├── 6.gif ├── 7.gif └── logo.png ├── sample ├── .gitignore ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── yanzhenjie │ │ └── album │ │ └── sample │ │ ├── Application.java │ │ ├── MainActivity.java │ │ ├── MediaLoader.java │ │ └── app │ │ ├── Adapter.java │ │ ├── AlbumActivity.java │ │ ├── AlbumFilterActivity.java │ │ ├── CameraActivity.java │ │ ├── DefineStyleActivity.java │ │ ├── GalleryActivity.java │ │ ├── ImageActivity.java │ │ └── VideoActivity.java │ └── res │ ├── drawable-hdpi │ ├── ic_back_white.png │ ├── ic_camera_white.png │ ├── ic_eye_white.png │ ├── ic_image_white.png │ ├── ic_logo_white.png │ ├── ic_video_white.png │ └── tag_video_white.png │ ├── drawable-xhdpi │ ├── ic_back_white.png │ ├── ic_camera_white.png │ ├── ic_eye_white.png │ ├── ic_image_white.png │ ├── ic_logo_white.png │ └── ic_video_white.png │ ├── drawable-xxhdpi │ ├── ic_back_white.png │ ├── ic_camera_white.png │ ├── ic_eye_white.png │ ├── ic_image_white.png │ ├── ic_logo_white.png │ ├── ic_video_white.png │ └── tag_video_white.png │ ├── drawable-xxxhdpi │ ├── ic_back_white.png │ ├── ic_camera_white.png │ ├── ic_eye_white.png │ ├── ic_image_white.png │ ├── ic_logo_white.png │ ├── ic_video_white.png │ ├── placeholder.jpg │ └── tag_video_white.png │ ├── layout │ ├── activity_album.xml │ ├── activity_album_filter.xml │ ├── activity_album_ui.xml │ ├── activity_camera.xml │ ├── activity_gallery.xml │ ├── activity_list_content.xml │ ├── activity_main.xml │ ├── item_content_image.xml │ ├── item_content_video.xml │ ├── toolbar.xml │ └── toolbar_scroll.xml │ ├── menu │ ├── menu_album.xml │ ├── menu_album_camera.xml │ ├── menu_album_image.xml │ └── menu_album_video.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | /.idea/ 3 | /build/ 4 | .gradle 5 | /local.properties 6 | .DS_Store 7 | /captures 8 | .externalNativeBuild -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Album 2 | First off, thanks for taking the time to contribute. 3 | 4 | The following is a set of guidelines for contributing to Album. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request. 5 | 6 | 1. All your actions in Album should be in English, not in other languages. 7 | 2. Please keep Album the existing code style, not according to your habits. 8 | 3. Just modify the code you are sure need to be optimized, not all the different code from your ideas. 9 | 4. Before launching a pull request, you should test your commit code adequately. 10 | 5. Please commit new code to the [dev](https://github.com/yanzhenjie/Album/tree/dev) branch instead of the master branch. -------------------------------------------------------------------------------- /album/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ -------------------------------------------------------------------------------- /album/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: rootProject.ext.plugins.library 2 | 3 | android { 4 | compileSdkVersion rootProject.ext.android.compileSdkVersion 5 | buildToolsVersion rootProject.ext.android.buildToolsVersion 6 | 7 | defaultConfig { 8 | minSdkVersion rootProject.ext.android.minSdkVersion 9 | targetSdkVersion rootProject.ext.android.targetSdkVersion 10 | } 11 | 12 | resourcePrefix 'album' 13 | } 14 | 15 | dependencies { 16 | implementation rootProject.ext.dependencies.appCompat 17 | implementation rootProject.ext.dependencies.design 18 | implementation rootProject.ext.dependencies.recyclerView 19 | implementation rootProject.ext.dependencies.cardView 20 | api rootProject.ext.dependencies.mediaScanner 21 | } 22 | 23 | apply from: 'https://raw.githubusercontent.com/yanzhenjie/bintray/master/maven.gradle' -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/Action.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album; 17 | 18 | import android.support.annotation.NonNull; 19 | 20 | /** 21 | *

Any action takes place.

22 | * Created by YanZhenjie on 2017/8/16. 23 | */ 24 | public interface Action { 25 | 26 | /** 27 | * When the action responds. 28 | * 29 | * @param result the result of the action. 30 | */ 31 | void onAction(@NonNull T result); 32 | 33 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/AlbumConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album; 17 | 18 | import android.content.Context; 19 | 20 | import java.util.Locale; 21 | 22 | /** 23 | *

Album config.

24 | * Created by Yan Zhenjie on 2017/3/31. 25 | */ 26 | public class AlbumConfig { 27 | 28 | /** 29 | * Create a new builder. 30 | */ 31 | public static Builder newBuilder(Context context) { 32 | return new Builder(context); 33 | } 34 | 35 | private AlbumLoader mLoader; 36 | private Locale mLocale; 37 | 38 | private AlbumConfig(Builder builder) { 39 | this.mLoader = builder.mLoader == null ? AlbumLoader.DEFAULT : builder.mLoader; 40 | this.mLocale = builder.mLocale == null ? Locale.getDefault() : builder.mLocale; 41 | } 42 | 43 | /** 44 | * Get {@link AlbumLoader}. 45 | * 46 | * @return {@link AlbumLoader}. 47 | */ 48 | public AlbumLoader getAlbumLoader() { 49 | return mLoader; 50 | } 51 | 52 | /** 53 | * Get {@link Locale}. 54 | * 55 | * @return {@link Locale}. 56 | */ 57 | public Locale getLocale() { 58 | return mLocale; 59 | } 60 | 61 | public static final class Builder { 62 | 63 | private AlbumLoader mLoader; 64 | private Locale mLocale; 65 | 66 | private Builder(Context context) { 67 | } 68 | 69 | /** 70 | * Set album loader. 71 | * 72 | * @param loader {@link AlbumLoader}. 73 | * @return {@link Builder}. 74 | */ 75 | public Builder setAlbumLoader(AlbumLoader loader) { 76 | this.mLoader = loader; 77 | return this; 78 | } 79 | 80 | /** 81 | * Set locale for language. 82 | * 83 | * @param locale {@link Locale}. 84 | * @return {@link Builder}. 85 | */ 86 | public Builder setLocale(Locale locale) { 87 | this.mLocale = locale; 88 | return this; 89 | } 90 | 91 | /** 92 | * Create AlbumConfig. 93 | * 94 | * @return {@link AlbumConfig}. 95 | */ 96 | public AlbumConfig build() { 97 | return new AlbumConfig(this); 98 | } 99 | } 100 | 101 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/AlbumFolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album; 17 | 18 | import android.os.Parcel; 19 | import android.os.Parcelable; 20 | 21 | import java.util.ArrayList; 22 | 23 | /** 24 | *

Album folder, contains selected status and pictures.

25 | * Created by Yan Zhenjie on 2016/10/14. 26 | */ 27 | public class AlbumFolder implements Parcelable { 28 | 29 | /** 30 | * Folder name. 31 | */ 32 | private String name; 33 | /** 34 | * Image list in folder. 35 | */ 36 | private ArrayList mAlbumFiles = new ArrayList<>(); 37 | /** 38 | * checked. 39 | */ 40 | private boolean isChecked; 41 | 42 | public AlbumFolder() { 43 | } 44 | 45 | public String getName() { 46 | return name; 47 | } 48 | 49 | public void setName(String name) { 50 | this.name = name; 51 | } 52 | 53 | public ArrayList getAlbumFiles() { 54 | return mAlbumFiles; 55 | } 56 | 57 | public void addAlbumFile(AlbumFile albumFile) { 58 | mAlbumFiles.add(albumFile); 59 | } 60 | 61 | public boolean isChecked() { 62 | return isChecked; 63 | } 64 | 65 | public void setChecked(boolean checked) { 66 | isChecked = checked; 67 | } 68 | 69 | protected AlbumFolder(Parcel in) { 70 | name = in.readString(); 71 | mAlbumFiles = in.createTypedArrayList(AlbumFile.CREATOR); 72 | isChecked = in.readByte() != 0; 73 | } 74 | 75 | @Override 76 | public void writeToParcel(Parcel dest, int flags) { 77 | dest.writeString(name); 78 | dest.writeTypedList(mAlbumFiles); 79 | dest.writeByte((byte) (isChecked ? 1 : 0)); 80 | } 81 | 82 | @Override 83 | public int describeContents() { 84 | return 0; 85 | } 86 | 87 | public static final Creator CREATOR = new Creator() { 88 | @Override 89 | public AlbumFolder createFromParcel(Parcel in) { 90 | return new AlbumFolder(in); 91 | } 92 | 93 | @Override 94 | public AlbumFolder[] newArray(int size) { 95 | return new AlbumFolder[size]; 96 | } 97 | }; 98 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/AlbumLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album; 17 | 18 | import android.widget.ImageView; 19 | 20 | /** 21 | *

Used to load the preview, it should be customized.

22 | * Created by Yan Zhenjie on 2017/3/31. 23 | */ 24 | public interface AlbumLoader { 25 | 26 | AlbumLoader DEFAULT = new AlbumLoader() { 27 | @Override 28 | public void load(ImageView imageView, AlbumFile albumFile) { 29 | } 30 | 31 | @Override 32 | public void load(ImageView imageView, String url) { 33 | } 34 | }; 35 | 36 | /** 37 | * Load a preview of the album file. 38 | * 39 | * @param imageView {@link ImageView}. 40 | * @param albumFile the media object may be a picture or video. 41 | */ 42 | void load(ImageView imageView, AlbumFile albumFile); 43 | 44 | /** 45 | * Load thumbnails of pictures or videos, either local file or remote file. 46 | * 47 | * @param imageView {@link ImageView}. 48 | * @param url The url of the file, local path or remote path. 49 | */ 50 | void load(ImageView imageView, String url); 51 | 52 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/Filter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album; 17 | 18 | /** 19 | *

Filter.

20 | * Created by YanZhenjie on 2017/10/15. 21 | */ 22 | public interface Filter { 23 | 24 | /** 25 | * Filter the file. 26 | * 27 | * @param attributes attributes of file. 28 | * @return filter returns true, otherwise false. 29 | */ 30 | boolean filter(T attributes); 31 | 32 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/ItemAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album; 17 | 18 | import android.content.Context; 19 | 20 | /** 21 | *

Any action takes place.

22 | * Created by YanZhenjie on 2018/4/17. 23 | */ 24 | public interface ItemAction { 25 | /** 26 | * When the action responds. 27 | * 28 | * @param context context. 29 | * @param item item. 30 | */ 31 | void onAction(Context context, T item); 32 | } 33 | -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/AlbumSingleWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api; 17 | 18 | import android.content.Context; 19 | import android.content.Intent; 20 | 21 | import com.yanzhenjie.album.Album; 22 | import com.yanzhenjie.album.AlbumFile; 23 | import com.yanzhenjie.album.Filter; 24 | import com.yanzhenjie.album.app.album.AlbumActivity; 25 | 26 | import java.util.ArrayList; 27 | 28 | /** 29 | *

Album wrapper.

30 | * Created by yanzhenjie on 17-3-29. 31 | */ 32 | public class AlbumSingleWrapper extends BasicChoiceAlbumWrapper, String, AlbumFile> { 33 | 34 | private Filter mDurationFilter; 35 | 36 | public AlbumSingleWrapper(Context context) { 37 | super(context); 38 | } 39 | 40 | /** 41 | * Filter video duration. 42 | * 43 | * @param filter filter. 44 | */ 45 | public AlbumSingleWrapper filterDuration(Filter filter) { 46 | this.mDurationFilter = filter; 47 | return this; 48 | } 49 | 50 | @Override 51 | public void start() { 52 | AlbumActivity.sSizeFilter = mSizeFilter; 53 | AlbumActivity.sMimeFilter = mMimeTypeFilter; 54 | AlbumActivity.sDurationFilter = mDurationFilter; 55 | AlbumActivity.sResult = mResult; 56 | AlbumActivity.sCancel = mCancel; 57 | Intent intent = new Intent(mContext, AlbumActivity.class); 58 | intent.putExtra(Album.KEY_INPUT_WIDGET, mWidget); 59 | 60 | intent.putExtra(Album.KEY_INPUT_FUNCTION, Album.FUNCTION_CHOICE_ALBUM); 61 | intent.putExtra(Album.KEY_INPUT_CHOICE_MODE, Album.MODE_SINGLE); 62 | intent.putExtra(Album.KEY_INPUT_COLUMN_COUNT, mColumnCount); 63 | intent.putExtra(Album.KEY_INPUT_ALLOW_CAMERA, mHasCamera); 64 | intent.putExtra(Album.KEY_INPUT_LIMIT_COUNT, 1); 65 | intent.putExtra(Album.KEY_INPUT_FILTER_VISIBILITY, mFilterVisibility); 66 | intent.putExtra(Album.KEY_INPUT_CAMERA_QUALITY, mQuality); 67 | intent.putExtra(Album.KEY_INPUT_CAMERA_DURATION, mLimitDuration); 68 | intent.putExtra(Album.KEY_INPUT_CAMERA_BYTES, mLimitBytes); 69 | mContext.startActivity(intent); 70 | } 71 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/BasicAlbumWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api; 17 | 18 | import android.content.Context; 19 | import android.support.annotation.Nullable; 20 | 21 | import com.yanzhenjie.album.Action; 22 | import com.yanzhenjie.album.api.widget.Widget; 23 | 24 | /** 25 | *

Album basic wrapper.

26 | * Created by yanzhenjie on 17-3-29. 27 | */ 28 | public abstract class BasicAlbumWrapper { 29 | 30 | final Context mContext; 31 | Action mResult; 32 | Action mCancel; 33 | Widget mWidget; 34 | Checked mChecked; 35 | 36 | BasicAlbumWrapper(Context context) { 37 | this.mContext = context; 38 | mWidget = Widget.getDefaultWidget(context); 39 | } 40 | 41 | /** 42 | * Set the action when result. 43 | * 44 | * @param result action when producing result. 45 | */ 46 | public final Returner onResult(Action result) { 47 | this.mResult = result; 48 | return (Returner) this; 49 | } 50 | 51 | /** 52 | * Set the action when canceling. 53 | * 54 | * @param cancel action when canceled. 55 | */ 56 | public final Returner onCancel(Action cancel) { 57 | this.mCancel = cancel; 58 | return (Returner) this; 59 | } 60 | 61 | /** 62 | * Set the widget property. 63 | * 64 | * @param widget the widget. 65 | */ 66 | public final Returner widget(@Nullable Widget widget) { 67 | this.mWidget = widget; 68 | return (Returner) this; 69 | } 70 | 71 | /** 72 | * Start up. 73 | */ 74 | public abstract void start(); 75 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/BasicCameraWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api; 17 | 18 | import android.content.Context; 19 | import android.support.annotation.Nullable; 20 | 21 | import com.yanzhenjie.album.Action; 22 | 23 | /** 24 | * Created by YanZhenjie on 2017/8/18. 25 | */ 26 | public abstract class BasicCameraWrapper { 27 | 28 | Context mContext; 29 | Action mResult; 30 | Action mCancel; 31 | String mFilePath; 32 | 33 | public BasicCameraWrapper(Context context) { 34 | this.mContext = context; 35 | } 36 | 37 | /** 38 | * Set the action when result. 39 | * 40 | * @param result action when producing result. 41 | */ 42 | public final Returner onResult(Action result) { 43 | this.mResult = result; 44 | return (Returner) this; 45 | } 46 | 47 | /** 48 | * Set the action when canceling. 49 | * 50 | * @param cancel action when canceled. 51 | */ 52 | public final Returner onCancel(Action cancel) { 53 | this.mCancel = cancel; 54 | return (Returner) this; 55 | } 56 | 57 | /** 58 | * Set the image storage path. 59 | * 60 | * @param filePath storage path. 61 | */ 62 | public Returner filePath(@Nullable String filePath) { 63 | this.mFilePath = filePath; 64 | return (Returner) this; 65 | } 66 | 67 | /** 68 | * Start up. 69 | */ 70 | public abstract void start(); 71 | 72 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/BasicChoiceAlbumWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api; 17 | 18 | import android.content.Context; 19 | import android.support.annotation.IntRange; 20 | 21 | /** 22 | * Created by YanZhenjie on 2017/11/8. 23 | */ 24 | public abstract class BasicChoiceAlbumWrapper extends BasicChoiceWrapper { 25 | 26 | BasicChoiceAlbumWrapper(Context context) { 27 | super(context); 28 | } 29 | 30 | int mQuality = 1; 31 | long mLimitDuration = Integer.MAX_VALUE; 32 | long mLimitBytes = Integer.MAX_VALUE; 33 | 34 | /** 35 | * Set the quality when taking video, should be 0 or 1. Currently value 0 means low quality, and value 1 means high quality. 36 | * 37 | * @param quality should be 0 or 1. 38 | */ 39 | public Returner cameraVideoQuality(@IntRange(from = 0, to = 1) int quality) { 40 | this.mQuality = quality; 41 | return (Returner) this; 42 | } 43 | 44 | /** 45 | * Set the maximum number of seconds to take video. 46 | * 47 | * @param duration seconds. 48 | */ 49 | public Returner cameraVideoLimitDuration(@IntRange(from = 1) long duration) { 50 | this.mLimitDuration = duration; 51 | return (Returner) this; 52 | } 53 | 54 | /** 55 | * Set the maximum file size when taking video. 56 | * 57 | * @param bytes the size of the byte. 58 | */ 59 | public Returner cameraVideoLimitBytes(@IntRange(from = 1) long bytes) { 60 | this.mLimitBytes = bytes; 61 | return (Returner) this; 62 | } 63 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/BasicChoiceVideoWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api; 17 | 18 | import android.content.Context; 19 | import android.support.annotation.IntRange; 20 | 21 | /** 22 | * Created by YanZhenjie on 2017/11/8. 23 | */ 24 | public abstract class BasicChoiceVideoWrapper extends BasicChoiceWrapper { 25 | 26 | BasicChoiceVideoWrapper(Context context) { 27 | super(context); 28 | } 29 | 30 | int mQuality = 1; 31 | long mLimitDuration = Integer.MAX_VALUE; 32 | long mLimitBytes = Integer.MAX_VALUE; 33 | 34 | /** 35 | * Set the quality when taking video, should be 0 or 1. Currently value 0 means low quality, and value 1 means high quality. 36 | * 37 | * @param quality should be 0 or 1. 38 | */ 39 | public Returner quality(@IntRange(from = 0, to = 1) int quality) { 40 | this.mQuality = quality; 41 | return (Returner) this; 42 | } 43 | 44 | /** 45 | * Specify the maximum allowed recording duration in seconds. 46 | * 47 | * @param duration the maximum number of seconds. 48 | */ 49 | public Returner limitDuration(@IntRange(from = 1) long duration) { 50 | this.mLimitDuration = duration; 51 | return (Returner) this; 52 | } 53 | 54 | /** 55 | * Specify the maximum allowed size. 56 | * 57 | * @param bytes the size of the byte. 58 | */ 59 | public Returner limitBytes(@IntRange(from = 1) long bytes) { 60 | this.mLimitBytes = bytes; 61 | return (Returner) this; 62 | } 63 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/BasicChoiceWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api; 17 | 18 | import android.content.Context; 19 | import android.support.annotation.IntRange; 20 | 21 | import com.yanzhenjie.album.Filter; 22 | 23 | /** 24 | * Created by YanZhenjie on 2017/8/16. 25 | */ 26 | public abstract class BasicChoiceWrapper extends BasicAlbumWrapper { 27 | 28 | boolean mHasCamera = true; 29 | int mColumnCount = 2; 30 | 31 | Filter mSizeFilter; 32 | Filter mMimeTypeFilter; 33 | 34 | boolean mFilterVisibility = true; 35 | 36 | BasicChoiceWrapper(Context context) { 37 | super(context); 38 | } 39 | 40 | /** 41 | * Turn on the camera function. 42 | */ 43 | public Returner camera(boolean hasCamera) { 44 | this.mHasCamera = hasCamera; 45 | return (Returner) this; 46 | } 47 | 48 | /** 49 | * Sets the number of columns for the page. 50 | * 51 | * @param count the number of columns. 52 | */ 53 | public Returner columnCount(@IntRange(from = 2, to = 4) int count) { 54 | this.mColumnCount = count; 55 | return (Returner) this; 56 | } 57 | 58 | /** 59 | * Filter the file size. 60 | * 61 | * @param filter filter. 62 | */ 63 | public Returner filterSize(Filter filter) { 64 | this.mSizeFilter = filter; 65 | return (Returner) this; 66 | } 67 | 68 | /** 69 | * Filter the file extension. 70 | * 71 | * @param filter filter. 72 | */ 73 | public Returner filterMimeType(Filter filter) { 74 | this.mMimeTypeFilter = filter; 75 | return (Returner) this; 76 | } 77 | 78 | /** 79 | * The visibility of the filtered file. 80 | * 81 | * @param visibility true is displayed, false is not displayed. 82 | */ 83 | public Returner afterFilterVisibility(boolean visibility) { 84 | this.mFilterVisibility = visibility; 85 | return (Returner) this; 86 | } 87 | 88 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/BasicGalleryWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api; 17 | 18 | import android.content.Context; 19 | import android.support.annotation.IntRange; 20 | 21 | import com.yanzhenjie.album.Action; 22 | import com.yanzhenjie.album.ItemAction; 23 | 24 | import java.util.ArrayList; 25 | 26 | /** 27 | * Created by YanZhenjie on 2017/8/19. 28 | */ 29 | public abstract class BasicGalleryWrapper extends BasicAlbumWrapper, Cancel, ArrayList> { 30 | 31 | ItemAction mItemClick; 32 | ItemAction mItemLongClick; 33 | int mCurrentPosition; 34 | boolean mCheckable; 35 | 36 | public BasicGalleryWrapper(Context context) { 37 | super(context); 38 | } 39 | 40 | /** 41 | * Set the list has been selected. 42 | * 43 | * @param checked the data list. 44 | */ 45 | public final Returner checkedList(ArrayList checked) { 46 | this.mChecked = checked; 47 | return (Returner) this; 48 | } 49 | 50 | /** 51 | * When the preview item is clicked. 52 | * 53 | * @param click action. 54 | */ 55 | public Returner itemClick(ItemAction click) { 56 | this.mItemClick = click; 57 | return (Returner) this; 58 | } 59 | 60 | /** 61 | * When the preview item is clicked long. 62 | * 63 | * @param longClick action. 64 | */ 65 | public Returner itemLongClick(ItemAction longClick) { 66 | this.mItemLongClick = longClick; 67 | return (Returner) this; 68 | } 69 | 70 | /** 71 | * Set the show position of List. 72 | * 73 | * @param currentPosition the current position. 74 | */ 75 | public Returner currentPosition(@IntRange(from = 0, to = Integer.MAX_VALUE) int currentPosition) { 76 | this.mCurrentPosition = currentPosition; 77 | return (Returner) this; 78 | } 79 | 80 | /** 81 | * The ability to select pictures. 82 | * 83 | * @param checkable checkBox is provided. 84 | */ 85 | public Returner checkable(boolean checkable) { 86 | this.mCheckable = checkable; 87 | return (Returner) this; 88 | } 89 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/GalleryAlbumWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api; 17 | 18 | import android.content.Context; 19 | import android.content.Intent; 20 | 21 | import com.yanzhenjie.album.Album; 22 | import com.yanzhenjie.album.AlbumFile; 23 | import com.yanzhenjie.album.app.gallery.GalleryActivity; 24 | import com.yanzhenjie.album.app.gallery.GalleryAlbumActivity; 25 | 26 | /** 27 | *

Gallery wrapper.

28 | * Created by yanzhenjie on 17-3-29. 29 | */ 30 | public class GalleryAlbumWrapper extends BasicGalleryWrapper { 31 | 32 | public GalleryAlbumWrapper(Context context) { 33 | super(context); 34 | } 35 | 36 | @Override 37 | public void start() { 38 | GalleryAlbumActivity.sResult = mResult; 39 | GalleryAlbumActivity.sCancel = mCancel; 40 | GalleryAlbumActivity.sClick = mItemClick; 41 | GalleryAlbumActivity.sLongClick = mItemLongClick; 42 | Intent intent = new Intent(mContext, GalleryAlbumActivity.class); 43 | intent.putExtra(Album.KEY_INPUT_WIDGET, mWidget); 44 | intent.putParcelableArrayListExtra(Album.KEY_INPUT_CHECKED_LIST, mChecked); 45 | intent.putExtra(Album.KEY_INPUT_CURRENT_POSITION, mCurrentPosition); 46 | intent.putExtra(Album.KEY_INPUT_GALLERY_CHECKABLE, mCheckable); 47 | mContext.startActivity(intent); 48 | } 49 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/GalleryWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api; 17 | 18 | import android.content.Context; 19 | import android.content.Intent; 20 | 21 | import com.yanzhenjie.album.Album; 22 | import com.yanzhenjie.album.app.gallery.GalleryActivity; 23 | import com.yanzhenjie.album.app.gallery.GalleryAlbumActivity; 24 | 25 | /** 26 | *

Gallery wrapper.

27 | * Created by yanzhenjie on 17-3-29. 28 | */ 29 | public class GalleryWrapper extends BasicGalleryWrapper { 30 | 31 | public GalleryWrapper(Context context) { 32 | super(context); 33 | } 34 | 35 | @Override 36 | public void start() { 37 | GalleryActivity.sResult = mResult; 38 | GalleryActivity.sCancel = mCancel; 39 | GalleryActivity.sClick = mItemClick; 40 | GalleryActivity.sLongClick = mItemLongClick; 41 | Intent intent = new Intent(mContext, GalleryActivity.class); 42 | intent.putExtra(Album.KEY_INPUT_WIDGET, mWidget); 43 | intent.putStringArrayListExtra(Album.KEY_INPUT_CHECKED_LIST, mChecked); 44 | intent.putExtra(Album.KEY_INPUT_CURRENT_POSITION, mCurrentPosition); 45 | intent.putExtra(Album.KEY_INPUT_GALLERY_CHECKABLE, mCheckable); 46 | mContext.startActivity(intent); 47 | } 48 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/ImageCameraWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api; 17 | 18 | import android.content.Context; 19 | import android.content.Intent; 20 | 21 | import com.yanzhenjie.album.Album; 22 | import com.yanzhenjie.album.app.camera.CameraActivity; 23 | 24 | /** 25 | *

Camera wrapper.

26 | * Created by Yan Zhenjie on 2017/4/18. 27 | */ 28 | public class ImageCameraWrapper extends BasicCameraWrapper { 29 | 30 | public ImageCameraWrapper(Context context) { 31 | super(context); 32 | } 33 | 34 | public void start() { 35 | CameraActivity.sResult = mResult; 36 | CameraActivity.sCancel = mCancel; 37 | Intent intent = new Intent(mContext, CameraActivity.class); 38 | 39 | intent.putExtra(Album.KEY_INPUT_FUNCTION, Album.FUNCTION_CAMERA_IMAGE); 40 | intent.putExtra(Album.KEY_INPUT_FILE_PATH, mFilePath); 41 | mContext.startActivity(intent); 42 | } 43 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/ImageMultipleWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api; 17 | 18 | import android.content.Context; 19 | import android.content.Intent; 20 | import android.support.annotation.IntRange; 21 | 22 | import com.yanzhenjie.album.Album; 23 | import com.yanzhenjie.album.AlbumFile; 24 | import com.yanzhenjie.album.app.album.AlbumActivity; 25 | 26 | import java.util.ArrayList; 27 | 28 | /** 29 | * Created by YanZhenjie on 2017/8/16. 30 | */ 31 | public final class ImageMultipleWrapper extends BasicChoiceWrapper, String, ArrayList> { 32 | 33 | @IntRange(from = 1, to = Integer.MAX_VALUE) 34 | private int mLimitCount = Integer.MAX_VALUE; 35 | 36 | public ImageMultipleWrapper(Context context) { 37 | super(context); 38 | } 39 | 40 | /** 41 | * Set the list has been selected. 42 | * 43 | * @param checked the data list. 44 | */ 45 | public final ImageMultipleWrapper checkedList(ArrayList checked) { 46 | this.mChecked = checked; 47 | return this; 48 | } 49 | 50 | /** 51 | * Set the maximum number to be selected. 52 | * 53 | * @param count the maximum number. 54 | */ 55 | public ImageMultipleWrapper selectCount(@IntRange(from = 1, to = Integer.MAX_VALUE) int count) { 56 | this.mLimitCount = count; 57 | return this; 58 | } 59 | 60 | @Override 61 | public void start() { 62 | AlbumActivity.sSizeFilter = mSizeFilter; 63 | AlbumActivity.sMimeFilter = mMimeTypeFilter; 64 | AlbumActivity.sResult = mResult; 65 | AlbumActivity.sCancel = mCancel; 66 | Intent intent = new Intent(mContext, AlbumActivity.class); 67 | intent.putExtra(Album.KEY_INPUT_WIDGET, mWidget); 68 | intent.putParcelableArrayListExtra(Album.KEY_INPUT_CHECKED_LIST, mChecked); 69 | 70 | intent.putExtra(Album.KEY_INPUT_FUNCTION, Album.FUNCTION_CHOICE_IMAGE); 71 | intent.putExtra(Album.KEY_INPUT_CHOICE_MODE, Album.MODE_MULTIPLE); 72 | intent.putExtra(Album.KEY_INPUT_COLUMN_COUNT, mColumnCount); 73 | intent.putExtra(Album.KEY_INPUT_ALLOW_CAMERA, mHasCamera); 74 | intent.putExtra(Album.KEY_INPUT_LIMIT_COUNT, mLimitCount); 75 | intent.putExtra(Album.KEY_INPUT_FILTER_VISIBILITY, mFilterVisibility); 76 | mContext.startActivity(intent); 77 | } 78 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/ImageSingleWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api; 17 | 18 | import android.content.Context; 19 | import android.content.Intent; 20 | 21 | import com.yanzhenjie.album.Album; 22 | import com.yanzhenjie.album.AlbumFile; 23 | import com.yanzhenjie.album.app.album.AlbumActivity; 24 | 25 | import java.util.ArrayList; 26 | 27 | /** 28 | * Created by YanZhenjie on 2017/8/16. 29 | */ 30 | public final class ImageSingleWrapper extends BasicChoiceWrapper, String, AlbumFile> { 31 | 32 | public ImageSingleWrapper(Context context) { 33 | super(context); 34 | } 35 | 36 | @Override 37 | public void start() { 38 | AlbumActivity.sSizeFilter = mSizeFilter; 39 | AlbumActivity.sMimeFilter = mMimeTypeFilter; 40 | AlbumActivity.sResult = mResult; 41 | AlbumActivity.sCancel = mCancel; 42 | Intent intent = new Intent(mContext, AlbumActivity.class); 43 | intent.putExtra(Album.KEY_INPUT_WIDGET, mWidget); 44 | 45 | intent.putExtra(Album.KEY_INPUT_FUNCTION, Album.FUNCTION_CHOICE_IMAGE); 46 | intent.putExtra(Album.KEY_INPUT_CHOICE_MODE, Album.MODE_SINGLE); 47 | intent.putExtra(Album.KEY_INPUT_COLUMN_COUNT, mColumnCount); 48 | intent.putExtra(Album.KEY_INPUT_ALLOW_CAMERA, mHasCamera); 49 | intent.putExtra(Album.KEY_INPUT_LIMIT_COUNT, 1); 50 | intent.putExtra(Album.KEY_INPUT_FILTER_VISIBILITY, mFilterVisibility); 51 | mContext.startActivity(intent); 52 | } 53 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/VideoCameraWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api; 17 | 18 | import android.content.Context; 19 | import android.content.Intent; 20 | import android.support.annotation.IntRange; 21 | 22 | import com.yanzhenjie.album.Album; 23 | import com.yanzhenjie.album.app.camera.CameraActivity; 24 | 25 | /** 26 | *

Camera wrapper.

27 | * Created by Yan Zhenjie on 2017/4/18. 28 | */ 29 | public class VideoCameraWrapper extends BasicCameraWrapper { 30 | 31 | private int mQuality = 1; 32 | private long mLimitDuration = Integer.MAX_VALUE; 33 | private long mLimitBytes = Integer.MAX_VALUE; 34 | 35 | public VideoCameraWrapper(Context context) { 36 | super(context); 37 | } 38 | 39 | /** 40 | * Currently value 0 means low quality, suitable for MMS messages, and value 1 means high quality. 41 | * 42 | * @param quality should be 0 or 1. 43 | */ 44 | public VideoCameraWrapper quality(@IntRange(from = 0, to = 1) int quality) { 45 | this.mQuality = quality; 46 | return this; 47 | } 48 | 49 | /** 50 | * Specify the maximum allowed recording duration in seconds. 51 | * 52 | * @param duration the maximum number of seconds. 53 | */ 54 | public VideoCameraWrapper limitDuration(@IntRange(from = 1) long duration) { 55 | this.mLimitDuration = duration; 56 | return this; 57 | } 58 | 59 | /** 60 | * Specify the maximum allowed size. 61 | * 62 | * @param bytes the size of the byte. 63 | */ 64 | public VideoCameraWrapper limitBytes(@IntRange(from = 1) long bytes) { 65 | this.mLimitBytes = bytes; 66 | return this; 67 | } 68 | 69 | public void start() { 70 | CameraActivity.sResult = mResult; 71 | CameraActivity.sCancel = mCancel; 72 | Intent intent = new Intent(mContext, CameraActivity.class); 73 | 74 | intent.putExtra(Album.KEY_INPUT_FUNCTION, Album.FUNCTION_CAMERA_VIDEO); 75 | intent.putExtra(Album.KEY_INPUT_FILE_PATH, mFilePath); 76 | intent.putExtra(Album.KEY_INPUT_CAMERA_QUALITY, mQuality); 77 | intent.putExtra(Album.KEY_INPUT_CAMERA_DURATION, mLimitDuration); 78 | intent.putExtra(Album.KEY_INPUT_CAMERA_BYTES, mLimitBytes); 79 | mContext.startActivity(intent); 80 | } 81 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/VideoSingleWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api; 17 | 18 | import android.content.Context; 19 | import android.content.Intent; 20 | 21 | import com.yanzhenjie.album.Album; 22 | import com.yanzhenjie.album.AlbumFile; 23 | import com.yanzhenjie.album.Filter; 24 | import com.yanzhenjie.album.app.album.AlbumActivity; 25 | 26 | import java.util.ArrayList; 27 | 28 | /** 29 | * Created by YanZhenjie on 2017/8/16. 30 | */ 31 | public final class VideoSingleWrapper extends BasicChoiceVideoWrapper, String, AlbumFile> { 32 | 33 | private Filter mDurationFilter; 34 | 35 | public VideoSingleWrapper(Context context) { 36 | super(context); 37 | } 38 | 39 | /** 40 | * Filter video duration. 41 | * 42 | * @param filter filter. 43 | */ 44 | public VideoSingleWrapper filterDuration(Filter filter) { 45 | this.mDurationFilter = filter; 46 | return this; 47 | } 48 | 49 | @Override 50 | public void start() { 51 | AlbumActivity.sSizeFilter = mSizeFilter; 52 | AlbumActivity.sMimeFilter = mMimeTypeFilter; 53 | AlbumActivity.sDurationFilter = mDurationFilter; 54 | AlbumActivity.sResult = mResult; 55 | AlbumActivity.sCancel = mCancel; 56 | Intent intent = new Intent(mContext, AlbumActivity.class); 57 | intent.putExtra(Album.KEY_INPUT_WIDGET, mWidget); 58 | 59 | intent.putExtra(Album.KEY_INPUT_FUNCTION, Album.FUNCTION_CHOICE_VIDEO); 60 | intent.putExtra(Album.KEY_INPUT_CHOICE_MODE, Album.MODE_SINGLE); 61 | intent.putExtra(Album.KEY_INPUT_COLUMN_COUNT, mColumnCount); 62 | intent.putExtra(Album.KEY_INPUT_ALLOW_CAMERA, mHasCamera); 63 | intent.putExtra(Album.KEY_INPUT_LIMIT_COUNT, 1); 64 | intent.putExtra(Album.KEY_INPUT_FILTER_VISIBILITY, mFilterVisibility); 65 | intent.putExtra(Album.KEY_INPUT_CAMERA_QUALITY, mQuality); 66 | intent.putExtra(Album.KEY_INPUT_CAMERA_DURATION, mLimitDuration); 67 | intent.putExtra(Album.KEY_INPUT_CAMERA_BYTES, mLimitBytes); 68 | mContext.startActivity(intent); 69 | } 70 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/camera/AlbumCamera.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api.camera; 17 | 18 | import android.content.Context; 19 | 20 | import com.yanzhenjie.album.api.ImageCameraWrapper; 21 | import com.yanzhenjie.album.api.VideoCameraWrapper; 22 | 23 | /** 24 | * Created by YanZhenjie on 2017/8/18. 25 | */ 26 | public class AlbumCamera implements Camera { 27 | 28 | private Context mContext; 29 | 30 | public AlbumCamera(Context context) { 31 | mContext = context; 32 | } 33 | 34 | @Override 35 | public ImageCameraWrapper image() { 36 | return new ImageCameraWrapper(mContext); 37 | } 38 | 39 | @Override 40 | public VideoCameraWrapper video() { 41 | return new VideoCameraWrapper(mContext); 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/camera/Camera.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api.camera; 17 | 18 | /** 19 | * Created by YanZhenjie on 2017/8/18. 20 | */ 21 | public interface Camera { 22 | 23 | /** 24 | * Take picture. 25 | */ 26 | Image image(); 27 | 28 | /** 29 | * Take video. 30 | */ 31 | Video video(); 32 | 33 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/choice/AlbumChoice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api.choice; 17 | 18 | import android.content.Context; 19 | 20 | import com.yanzhenjie.album.api.AlbumMultipleWrapper; 21 | import com.yanzhenjie.album.api.AlbumSingleWrapper; 22 | 23 | /** 24 | * Created by YanZhenjie on 2017/8/16. 25 | */ 26 | public final class AlbumChoice implements Choice { 27 | 28 | private Context mContext; 29 | 30 | public AlbumChoice(Context context) { 31 | mContext = context; 32 | } 33 | 34 | @Override 35 | public AlbumMultipleWrapper multipleChoice() { 36 | return new AlbumMultipleWrapper(mContext); 37 | } 38 | 39 | @Override 40 | public AlbumSingleWrapper singleChoice() { 41 | return new AlbumSingleWrapper(mContext); 42 | } 43 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/choice/Choice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api.choice; 17 | 18 | /** 19 | * Created by YanZhenjie on 2017/8/16. 20 | */ 21 | public interface Choice { 22 | 23 | /** 24 | * Multiple choice. 25 | */ 26 | Multiple multipleChoice(); 27 | 28 | /** 29 | * Single choice. 30 | */ 31 | Single singleChoice(); 32 | 33 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/choice/ImageChoice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api.choice; 17 | 18 | import android.content.Context; 19 | 20 | import com.yanzhenjie.album.api.ImageMultipleWrapper; 21 | import com.yanzhenjie.album.api.ImageSingleWrapper; 22 | 23 | /** 24 | * Created by YanZhenjie on 2017/8/16. 25 | */ 26 | public final class ImageChoice implements Choice { 27 | 28 | private Context mContext; 29 | 30 | public ImageChoice(Context context) { 31 | mContext = context; 32 | } 33 | 34 | @Override 35 | public ImageMultipleWrapper multipleChoice() { 36 | return new ImageMultipleWrapper(mContext); 37 | } 38 | 39 | @Override 40 | public ImageSingleWrapper singleChoice() { 41 | return new ImageSingleWrapper(mContext); 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/api/choice/VideoChoice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.api.choice; 17 | 18 | import android.content.Context; 19 | 20 | import com.yanzhenjie.album.api.VideoMultipleWrapper; 21 | import com.yanzhenjie.album.api.VideoSingleWrapper; 22 | 23 | /** 24 | * Created by YanZhenjie on 2017/8/16. 25 | */ 26 | public final class VideoChoice implements Choice { 27 | 28 | private Context mContext; 29 | 30 | public VideoChoice(Context context) { 31 | mContext = context; 32 | } 33 | 34 | @Override 35 | public VideoMultipleWrapper multipleChoice() { 36 | return new VideoMultipleWrapper(mContext); 37 | } 38 | 39 | @Override 40 | public VideoSingleWrapper singleChoice() { 41 | return new VideoSingleWrapper(mContext); 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/app/album/data/PathConvertTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.app.album.data; 17 | 18 | import android.os.AsyncTask; 19 | 20 | import com.yanzhenjie.album.AlbumFile; 21 | 22 | /** 23 | * Created by YanZhenjie on 2017/10/18. 24 | */ 25 | public class PathConvertTask extends AsyncTask { 26 | 27 | public interface Callback { 28 | /** 29 | * The task begins. 30 | */ 31 | void onConvertStart(); 32 | 33 | /** 34 | * Callback results. 35 | * 36 | * @param albumFile result. 37 | */ 38 | void onConvertCallback(AlbumFile albumFile); 39 | } 40 | 41 | private PathConversion mConversion; 42 | private Callback mCallback; 43 | 44 | public PathConvertTask(PathConversion conversion, Callback callback) { 45 | this.mConversion = conversion; 46 | this.mCallback = callback; 47 | } 48 | 49 | @Override 50 | protected void onPreExecute() { 51 | mCallback.onConvertStart(); 52 | } 53 | 54 | @Override 55 | protected AlbumFile doInBackground(String... params) { 56 | return mConversion.convert(params[0]); 57 | } 58 | 59 | @Override 60 | protected void onPostExecute(AlbumFile file) { 61 | mCallback.onConvertCallback(file); 62 | } 63 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/app/album/data/ThumbnailBuildTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.app.album.data; 17 | 18 | import android.content.Context; 19 | import android.os.AsyncTask; 20 | 21 | import com.yanzhenjie.album.AlbumFile; 22 | 23 | import java.util.ArrayList; 24 | 25 | /** 26 | * Created by YanZhenjie on 2017/10/15. 27 | */ 28 | public class ThumbnailBuildTask extends AsyncTask> { 29 | 30 | public interface Callback { 31 | /** 32 | * The task begins. 33 | */ 34 | void onThumbnailStart(); 35 | 36 | /** 37 | * Callback results. 38 | * 39 | * @param albumFiles result. 40 | */ 41 | void onThumbnailCallback(ArrayList albumFiles); 42 | } 43 | 44 | private ArrayList mAlbumFiles; 45 | private Callback mCallback; 46 | 47 | private ThumbnailBuilder mThumbnailBuilder; 48 | 49 | public ThumbnailBuildTask(Context context, ArrayList albumFiles, Callback callback) { 50 | this.mAlbumFiles = albumFiles; 51 | this.mCallback = callback; 52 | this.mThumbnailBuilder = new ThumbnailBuilder(context); 53 | } 54 | 55 | @Override 56 | protected void onPreExecute() { 57 | mCallback.onThumbnailStart(); 58 | } 59 | 60 | @Override 61 | protected ArrayList doInBackground(Void... params) { 62 | for (AlbumFile albumFile : mAlbumFiles) { 63 | int mediaType = albumFile.getMediaType(); 64 | if (mediaType == AlbumFile.TYPE_IMAGE) { 65 | albumFile.setThumbPath(mThumbnailBuilder.createThumbnailForImage(albumFile.getPath())); 66 | } else if (mediaType == AlbumFile.TYPE_VIDEO) { 67 | albumFile.setThumbPath(mThumbnailBuilder.createThumbnailForVideo(albumFile.getPath())); 68 | } 69 | } 70 | return mAlbumFiles; 71 | } 72 | 73 | @Override 74 | protected void onPostExecute(ArrayList albumFiles) { 75 | mCallback.onThumbnailCallback(albumFiles); 76 | } 77 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/impl/DoubleClickWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.impl; 17 | 18 | import android.view.View; 19 | 20 | /** 21 | * Created by YanZhenjie on 2018/4/20. 22 | */ 23 | public class DoubleClickWrapper implements View.OnClickListener { 24 | 25 | private final View.OnClickListener mOnClickListener; 26 | private long mFirstTime; 27 | 28 | public DoubleClickWrapper(View.OnClickListener onClickListener) { 29 | this.mOnClickListener = onClickListener; 30 | } 31 | 32 | @Override 33 | public void onClick(View v) { 34 | long now = System.currentTimeMillis(); 35 | if (now - mFirstTime <= 500) { 36 | mOnClickListener.onClick(v); 37 | } 38 | mFirstTime = now; 39 | } 40 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/impl/OnCheckedClickListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.impl; 17 | 18 | import android.widget.CompoundButton; 19 | 20 | /** 21 | * Created by YanZhenjie on 2018/4/11. 22 | */ 23 | public interface OnCheckedClickListener { 24 | 25 | /** 26 | * Compound button is clicked. 27 | * 28 | * @param button view. 29 | * @param position the position in the list. 30 | */ 31 | void onCheckedClick(CompoundButton button, int position); 32 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/impl/OnItemClickListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.impl; 17 | 18 | import android.view.View; 19 | 20 | /** 21 | *

Listens on the item's click.

22 | * Created by Yan Zhenjie on 2016/9/23. 23 | */ 24 | public interface OnItemClickListener { 25 | 26 | /** 27 | * When Item is clicked. 28 | * 29 | * @param view item view. 30 | * @param position item position. 31 | */ 32 | void onItemClick(View view, int position); 33 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/mvp/BaseFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Yan Zhenjie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.mvp; 17 | 18 | import android.app.Activity; 19 | import android.os.Bundle; 20 | import android.support.annotation.NonNull; 21 | import android.support.annotation.Nullable; 22 | import android.support.v4.app.Fragment; 23 | import android.view.LayoutInflater; 24 | import android.view.View; 25 | import android.view.ViewGroup; 26 | 27 | /** 28 | * Created by YanZhenjie on 2018/4/7. 29 | */ 30 | public class BaseFragment extends Fragment implements Bye { 31 | @Nullable 32 | @Override 33 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 34 | return null; 35 | } 36 | 37 | @Override 38 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { 39 | } 40 | 41 | @Override 42 | public void onActivityCreated(@Nullable Bundle savedInstanceState) { 43 | super.onActivityCreated(savedInstanceState); 44 | } 45 | 46 | @Override 47 | public void bye() { 48 | Activity activity = getActivity(); 49 | if (activity != null) activity.finish(); 50 | } 51 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/mvp/BasePresenter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Yan Zhenjie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.mvp; 17 | 18 | import android.arch.lifecycle.LifecycleOwner; 19 | 20 | /** 21 | *

Presenter of MVP.

22 | * Created by YanZhenjie on 2017/7/17. 23 | */ 24 | public interface BasePresenter extends LifecycleOwner, Bye { 25 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/mvp/Bye.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Yan Zhenjie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.mvp; 17 | 18 | /** 19 | * Created by YanZhenjie on 2017/12/27. 20 | */ 21 | public interface Bye { 22 | 23 | /** 24 | * Finish. 25 | */ 26 | void bye(); 27 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/mvp/Source.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Yan Zhenjie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.mvp; 17 | 18 | import android.content.Context; 19 | import android.graphics.drawable.Drawable; 20 | import android.support.annotation.DrawableRes; 21 | import android.support.annotation.StringRes; 22 | import android.support.v7.widget.Toolbar; 23 | import android.view.Menu; 24 | import android.view.MenuInflater; 25 | import android.view.MenuItem; 26 | import android.view.View; 27 | 28 | /** 29 | * Created by YanZhenjie on 2017/12/8. 30 | */ 31 | abstract class Source { 32 | 33 | private Host mHost; 34 | 35 | public Source(Host host) { 36 | mHost = host; 37 | } 38 | 39 | public Host getHost() { 40 | return mHost; 41 | } 42 | 43 | abstract void prepare(); 44 | 45 | abstract void setActionBar(Toolbar actionBar); 46 | 47 | abstract MenuInflater getMenuInflater(); 48 | 49 | abstract Menu getMenu(); 50 | 51 | abstract void setMenuClickListener(MenuClickListener selectedListener); 52 | 53 | abstract void setDisplayHomeAsUpEnabled(boolean showHome); 54 | 55 | abstract void setHomeAsUpIndicator(@DrawableRes int icon); 56 | 57 | abstract void setHomeAsUpIndicator(Drawable icon); 58 | 59 | abstract void setTitle(CharSequence title); 60 | 61 | abstract void setTitle(@StringRes int title); 62 | 63 | abstract void setSubTitle(CharSequence title); 64 | 65 | abstract void setSubTitle(@StringRes int title); 66 | 67 | abstract Context getContext(); 68 | 69 | abstract View getView(); 70 | 71 | abstract void closeInputMethod(); 72 | 73 | interface MenuClickListener { 74 | 75 | void onHomeClick(); 76 | 77 | void onMenuClick(MenuItem item); 78 | } 79 | 80 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/provider/CameraFileProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.provider; 17 | 18 | import android.content.Context; 19 | import android.support.v4.content.FileProvider; 20 | 21 | /** 22 | *

For external access to files.

23 | * Created by Yan Zhenjie on 2017/3/31. 24 | */ 25 | public class CameraFileProvider extends FileProvider { 26 | 27 | /** 28 | * Get the provider of the external file path. 29 | * 30 | * @param context context. 31 | * @return provider. 32 | */ 33 | public static String getProviderName(Context context) { 34 | return context.getPackageName() + ".app.file.provider"; 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/ColorProgressBar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget; 17 | 18 | import android.content.Context; 19 | import android.graphics.PorterDuff; 20 | import android.graphics.drawable.Drawable; 21 | import android.support.annotation.ColorInt; 22 | import android.util.AttributeSet; 23 | import android.widget.ProgressBar; 24 | 25 | /** 26 | * Created by YanZhenjie on 2018/4/11. 27 | */ 28 | public class ColorProgressBar extends ProgressBar { 29 | 30 | public ColorProgressBar(Context context) { 31 | super(context); 32 | } 33 | 34 | public ColorProgressBar(Context context, AttributeSet attrs) { 35 | super(context, attrs); 36 | } 37 | 38 | public ColorProgressBar(Context context, AttributeSet attrs, int defStyleAttr) { 39 | super(context, attrs, defStyleAttr); 40 | } 41 | 42 | /** 43 | * Set the color of the Bar. 44 | * 45 | * @param color color. 46 | */ 47 | public void setColorFilter(@ColorInt int color) { 48 | Drawable drawable = getIndeterminateDrawable(); 49 | drawable = drawable.mutate(); 50 | drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN); 51 | setIndeterminateDrawable(drawable); 52 | } 53 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/LoadingDialog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget; 17 | 18 | import android.app.Dialog; 19 | import android.content.Context; 20 | import android.support.annotation.NonNull; 21 | import android.support.annotation.StringRes; 22 | import android.support.v4.content.ContextCompat; 23 | import android.widget.TextView; 24 | 25 | import com.yanzhenjie.album.R; 26 | import com.yanzhenjie.album.api.widget.Widget; 27 | 28 | /** 29 | * Created by YanZhenjie on 2018/4/10. 30 | */ 31 | public class LoadingDialog extends Dialog { 32 | 33 | private ColorProgressBar mProgressBar; 34 | private TextView mTvMessage; 35 | 36 | public LoadingDialog(@NonNull Context context) { 37 | super(context, R.style.Album_Dialog); 38 | setCancelable(false); 39 | setCanceledOnTouchOutside(false); 40 | setContentView(R.layout.album_dialog_loading); 41 | mProgressBar = findViewById(R.id.progress_bar); 42 | mTvMessage = findViewById(R.id.tv_message); 43 | } 44 | 45 | /** 46 | * Set some properties of the view. 47 | * 48 | * @param widget widget. 49 | */ 50 | public void setupViews(Widget widget) { 51 | if (widget.getUiStyle() == Widget.STYLE_LIGHT) { 52 | int color = ContextCompat.getColor(getContext(), R.color.albumLoadingDark); 53 | mProgressBar.setColorFilter(color); 54 | } else { 55 | mProgressBar.setColorFilter(widget.getToolBarColor()); 56 | } 57 | } 58 | 59 | /** 60 | * Set the message. 61 | * 62 | * @param message message resource id. 63 | */ 64 | public void setMessage(@StringRes int message) { 65 | mTvMessage.setText(message); 66 | } 67 | 68 | /** 69 | * Set the message. 70 | * 71 | * @param message message. 72 | */ 73 | public void setMessage(String message) { 74 | mTvMessage.setText(message); 75 | } 76 | 77 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/SquareCardView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget; 17 | 18 | import android.content.Context; 19 | import android.content.res.Configuration; 20 | import android.support.annotation.NonNull; 21 | import android.support.annotation.Nullable; 22 | import android.support.v7.widget.CardView; 23 | import android.util.AttributeSet; 24 | 25 | /** 26 | * Created by YanZhenjie on 2018/4/18. 27 | */ 28 | public class SquareCardView extends CardView { 29 | 30 | private Configuration mConfig; 31 | 32 | public SquareCardView(@NonNull Context context) { 33 | this(context, null, 0); 34 | } 35 | 36 | public SquareCardView(@NonNull Context context, @Nullable AttributeSet attrs) { 37 | this(context, attrs, 0); 38 | } 39 | 40 | public SquareCardView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 41 | super(context, attrs, defStyleAttr); 42 | this.mConfig = getResources().getConfiguration(); 43 | } 44 | 45 | @Override 46 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 47 | int orientation = mConfig.orientation; 48 | switch (orientation) { 49 | case Configuration.ORIENTATION_PORTRAIT: { 50 | super.onMeasure(widthMeasureSpec, widthMeasureSpec); 51 | break; 52 | } 53 | case Configuration.ORIENTATION_LANDSCAPE: { 54 | super.onMeasure(heightMeasureSpec, heightMeasureSpec); 55 | break; 56 | } 57 | default: { 58 | throw new AssertionError("This should not be the case."); 59 | } 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/SquareFrameLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget; 17 | 18 | import android.content.Context; 19 | import android.content.res.Configuration; 20 | import android.support.annotation.NonNull; 21 | import android.support.annotation.Nullable; 22 | import android.util.AttributeSet; 23 | import android.widget.FrameLayout; 24 | 25 | /** 26 | * Created by YanZhenjie on 2018/4/18. 27 | */ 28 | public class SquareFrameLayout extends FrameLayout { 29 | 30 | private Configuration mConfig; 31 | 32 | public SquareFrameLayout(@NonNull Context context) { 33 | this(context, null, 0); 34 | } 35 | 36 | public SquareFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs) { 37 | this(context, attrs, 0); 38 | } 39 | 40 | public SquareFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 41 | super(context, attrs, defStyleAttr); 42 | this.mConfig = getResources().getConfiguration(); 43 | } 44 | 45 | @Override 46 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 47 | int orientation = mConfig.orientation; 48 | switch (orientation) { 49 | case Configuration.ORIENTATION_PORTRAIT: { 50 | super.onMeasure(widthMeasureSpec, widthMeasureSpec); 51 | break; 52 | } 53 | case Configuration.ORIENTATION_LANDSCAPE: { 54 | super.onMeasure(heightMeasureSpec, heightMeasureSpec); 55 | break; 56 | } 57 | default: { 58 | throw new AssertionError("This should not be the case."); 59 | } 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/SquareImageView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget; 17 | 18 | import android.content.Context; 19 | import android.content.res.Configuration; 20 | import android.support.annotation.Nullable; 21 | import android.util.AttributeSet; 22 | 23 | /** 24 | * Created by YanZhenjie on 2018/4/19. 25 | */ 26 | public class SquareImageView extends android.support.v7.widget.AppCompatImageView { 27 | 28 | private Configuration mConfig; 29 | 30 | public SquareImageView(Context context) { 31 | this(context, null, 0); 32 | } 33 | 34 | public SquareImageView(Context context, @Nullable AttributeSet attrs) { 35 | this(context, attrs, 0); 36 | } 37 | 38 | public SquareImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 39 | super(context, attrs, defStyleAttr); 40 | this.mConfig = getResources().getConfiguration(); 41 | } 42 | 43 | @Override 44 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 45 | int orientation = mConfig.orientation; 46 | switch (orientation) { 47 | case Configuration.ORIENTATION_PORTRAIT: { 48 | super.onMeasure(widthMeasureSpec, widthMeasureSpec); 49 | break; 50 | } 51 | case Configuration.ORIENTATION_LANDSCAPE: { 52 | super.onMeasure(heightMeasureSpec, heightMeasureSpec); 53 | break; 54 | } 55 | default: { 56 | throw new AssertionError("This should not be the case."); 57 | } 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/SquareRelativeLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget; 17 | 18 | import android.content.Context; 19 | import android.content.res.Configuration; 20 | import android.support.annotation.NonNull; 21 | import android.support.annotation.Nullable; 22 | import android.util.AttributeSet; 23 | import android.widget.FrameLayout; 24 | import android.widget.RelativeLayout; 25 | 26 | /** 27 | * Created by YanZhenjie on 2018/4/18. 28 | */ 29 | public class SquareRelativeLayout extends RelativeLayout { 30 | 31 | private Configuration mConfig; 32 | 33 | public SquareRelativeLayout(@NonNull Context context) { 34 | this(context, null, 0); 35 | } 36 | 37 | public SquareRelativeLayout(@NonNull Context context, @Nullable AttributeSet attrs) { 38 | this(context, attrs, 0); 39 | } 40 | 41 | public SquareRelativeLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 42 | super(context, attrs, defStyleAttr); 43 | this.mConfig = getResources().getConfiguration(); 44 | } 45 | 46 | @Override 47 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 48 | int orientation = mConfig.orientation; 49 | switch (orientation) { 50 | case Configuration.ORIENTATION_PORTRAIT: { 51 | super.onMeasure(widthMeasureSpec, widthMeasureSpec); 52 | break; 53 | } 54 | case Configuration.ORIENTATION_LANDSCAPE: { 55 | super.onMeasure(heightMeasureSpec, heightMeasureSpec); 56 | break; 57 | } 58 | default: { 59 | throw new AssertionError("This should not be the case."); 60 | } 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/TransferLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget; 17 | 18 | import android.content.Context; 19 | import android.support.annotation.NonNull; 20 | import android.support.annotation.Nullable; 21 | import android.util.AttributeSet; 22 | import android.widget.FrameLayout; 23 | 24 | /** 25 | * Created by YanZhenjie on 2018/4/11. 26 | */ 27 | public class TransferLayout extends FrameLayout { 28 | 29 | public TransferLayout(@NonNull Context context) { 30 | super(context); 31 | } 32 | 33 | public TransferLayout(@NonNull Context context, @Nullable AttributeSet attrs) { 34 | super(context, attrs, 0); 35 | } 36 | 37 | public TransferLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 38 | super(context, attrs, defStyleAttr); 39 | } 40 | 41 | @Override 42 | public boolean performClick() { 43 | if (getChildCount() == 1) { 44 | return getChildAt(0).performClick(); 45 | } 46 | return super.performClick(); 47 | } 48 | 49 | @Override 50 | public boolean callOnClick() { 51 | if (getChildCount() == 1) { 52 | return getChildAt(0).performClick(); 53 | } 54 | return super.performClick(); 55 | } 56 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/divider/Api21ItemDivider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget.divider; 17 | 18 | import android.graphics.Canvas; 19 | import android.graphics.Rect; 20 | import android.support.annotation.ColorInt; 21 | import android.support.v7.widget.RecyclerView; 22 | import android.view.View; 23 | 24 | /** 25 | *

The implementation of divider adds dividers around the list.

26 | * Created by YanZhenjie on 2017/8/14. 27 | */ 28 | public class Api21ItemDivider extends Divider { 29 | 30 | private final int mWidth; 31 | private final int mHeight; 32 | private final Drawer mDrawer; 33 | 34 | /** 35 | * @param color divider line color. 36 | */ 37 | public Api21ItemDivider(@ColorInt int color) { 38 | this(color, 4, 4); 39 | } 40 | 41 | /** 42 | * @param color line color. 43 | * @param width line width. 44 | * @param height line height. 45 | */ 46 | public Api21ItemDivider(@ColorInt int color, int width, int height) { 47 | this.mWidth = Math.round(width / 2F); 48 | this.mHeight = Math.round(height / 2F); 49 | this.mDrawer = new ColorDrawer(color, mWidth, mHeight); 50 | } 51 | 52 | @Override 53 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { 54 | outRect.set(mWidth, mHeight, mWidth, mHeight); 55 | } 56 | 57 | @Override 58 | public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) { 59 | canvas.save(); 60 | RecyclerView.LayoutManager layoutManager = parent.getLayoutManager(); 61 | int childCount = layoutManager.getChildCount(); 62 | for (int i = 0; i < childCount; i++) { 63 | final View view = layoutManager.getChildAt(i); 64 | mDrawer.drawLeft(view, canvas); 65 | mDrawer.drawTop(view, canvas); 66 | mDrawer.drawRight(view, canvas); 67 | mDrawer.drawBottom(view, canvas); 68 | } 69 | canvas.restore(); 70 | } 71 | 72 | @Override 73 | public int getHeight() { 74 | return mHeight; 75 | } 76 | 77 | @Override 78 | public int getWidth() { 79 | return mWidth; 80 | } 81 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/divider/ColorDrawer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget.divider; 17 | 18 | import android.graphics.Color; 19 | import android.graphics.drawable.ColorDrawable; 20 | import android.support.annotation.ColorInt; 21 | 22 | /** 23 | * Created by YanZhenjie on 2018/4/20. 24 | */ 25 | class ColorDrawer extends Drawer { 26 | 27 | public ColorDrawer(int color, int width, int height) { 28 | super(new ColorDrawable(opaqueColor(color)), width, height); 29 | } 30 | 31 | /** 32 | * The target color is packaged in an opaque color. 33 | * 34 | * @param color color. 35 | * @return color. 36 | */ 37 | @ColorInt 38 | public static int opaqueColor(@ColorInt int color) { 39 | int alpha = Color.alpha(color); 40 | if (alpha == 0) return color; 41 | int red = Color.red(color); 42 | int green = Color.green(color); 43 | int blue = Color.blue(color); 44 | return Color.argb(255, red, green, blue); 45 | } 46 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/divider/Divider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget.divider; 17 | 18 | import android.support.v7.widget.RecyclerView; 19 | 20 | /** 21 | *

Divider of {@code RecyclerView}, you can get the width and height of the line.

22 | * Created by YanZhenjie on 2017/8/16. 23 | */ 24 | public abstract class Divider extends RecyclerView.ItemDecoration { 25 | 26 | /** 27 | * Get the height of the divider. 28 | * 29 | * @return height of the divider. 30 | */ 31 | public abstract int getHeight(); 32 | 33 | /** 34 | * Get the width of the divider. 35 | * 36 | * @return width of the divider. 37 | */ 38 | public abstract int getWidth(); 39 | 40 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/divider/Drawer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget.divider; 17 | 18 | import android.graphics.Canvas; 19 | import android.graphics.drawable.Drawable; 20 | import android.view.View; 21 | 22 | /** 23 | * Created by YanZhenjie on 2018/4/20. 24 | */ 25 | class Drawer { 26 | 27 | private final Drawable mDivider; 28 | private final int mWidth; 29 | private final int mHeight; 30 | 31 | public Drawer(Drawable divider, int width, int height) { 32 | this.mDivider = divider; 33 | this.mWidth = width; 34 | this.mHeight = height; 35 | } 36 | 37 | /** 38 | * Draw the divider on the left side of the Item. 39 | */ 40 | public void drawLeft(View view, Canvas c) { 41 | int left = view.getLeft() - mWidth; 42 | int top = view.getTop() - mHeight; 43 | int right = left + mWidth; 44 | int bottom = view.getBottom() + mHeight; 45 | mDivider.setBounds(left, top, right, bottom); 46 | mDivider.draw(c); 47 | } 48 | 49 | /** 50 | * Draw the divider on the top side of the Item. 51 | */ 52 | public void drawTop(View view, Canvas c) { 53 | int left = view.getLeft() - mWidth; 54 | int top = view.getTop() - mHeight; 55 | int right = view.getRight() + mWidth; 56 | int bottom = top + mHeight; 57 | mDivider.setBounds(left, top, right, bottom); 58 | mDivider.draw(c); 59 | } 60 | 61 | /** 62 | * Draw the divider on the top side of the Item. 63 | */ 64 | public void drawRight(View view, Canvas c) { 65 | int left = view.getRight(); 66 | int top = view.getTop() - mHeight; 67 | int right = left + mWidth; 68 | int bottom = view.getBottom() + mHeight; 69 | mDivider.setBounds(left, top, right, bottom); 70 | mDivider.draw(c); 71 | } 72 | 73 | /** 74 | * Draw the divider on the top side of the Item. 75 | */ 76 | public void drawBottom(View view, Canvas c) { 77 | int left = view.getLeft() - mWidth; 78 | int top = view.getBottom(); 79 | int right = view.getRight() + mWidth; 80 | int bottom = top + mHeight; 81 | mDivider.setBounds(left, top, right, bottom); 82 | mDivider.draw(c); 83 | } 84 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/photoview/AttacherImageView.java: -------------------------------------------------------------------------------- 1 | package com.yanzhenjie.album.widget.photoview; 2 | 3 | import android.content.Context; 4 | import android.graphics.drawable.Drawable; 5 | import android.support.annotation.Nullable; 6 | import android.util.AttributeSet; 7 | 8 | /** 9 | * Created by Yan Zhenjie on 2017/3/31. 10 | */ 11 | 12 | public class AttacherImageView extends android.support.v7.widget.AppCompatImageView { 13 | 14 | private PhotoViewAttacher mAttacher; 15 | 16 | public AttacherImageView(Context context) { 17 | super(context); 18 | } 19 | 20 | public AttacherImageView(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | 24 | public AttacherImageView(Context context, AttributeSet attrs, int defStyleAttr) { 25 | super(context, attrs, defStyleAttr); 26 | } 27 | 28 | public void setAttacher(PhotoViewAttacher attacher) { 29 | this.mAttacher = attacher; 30 | } 31 | 32 | @Override 33 | public void setImageDrawable(@Nullable Drawable drawable) { 34 | super.setImageDrawable(drawable); 35 | if (mAttacher != null) { 36 | mAttacher.update(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/photoview/Compat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © Yan Zhenjie. All Rights Reserved 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget.photoview; 17 | 18 | import android.annotation.TargetApi; 19 | import android.os.Build.VERSION; 20 | import android.os.Build.VERSION_CODES; 21 | import android.view.MotionEvent; 22 | import android.view.View; 23 | 24 | public class Compat { 25 | 26 | private static final int SIXTY_FPS_INTERVAL = 1000 / 60; 27 | 28 | public static void postOnAnimation(View view, Runnable runnable) { 29 | if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) { 30 | postOnAnimationJellyBean(view, runnable); 31 | } else { 32 | view.postDelayed(runnable, SIXTY_FPS_INTERVAL); 33 | } 34 | } 35 | 36 | @TargetApi(16) 37 | private static void postOnAnimationJellyBean(View view, Runnable runnable) { 38 | view.postOnAnimation(runnable); 39 | } 40 | 41 | public static int getPointerIndex(int action) { 42 | return (action & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/photoview/FixViewPager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © Yan Zhenjie. All Rights Reserved 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget.photoview; 17 | 18 | import android.content.Context; 19 | import android.support.v4.view.ViewPager; 20 | import android.util.AttributeSet; 21 | import android.view.MotionEvent; 22 | 23 | /** 24 | * Created by Yan Zhenjie on 2016/11/1. 25 | */ 26 | public class FixViewPager extends ViewPager { 27 | 28 | public FixViewPager(Context context) { 29 | super(context); 30 | } 31 | 32 | public FixViewPager(Context context, AttributeSet attrs) { 33 | super(context, attrs); 34 | } 35 | 36 | @Override 37 | public boolean onInterceptTouchEvent(MotionEvent ev) { 38 | try { 39 | return super.onInterceptTouchEvent(ev); 40 | } catch (IllegalArgumentException e) { 41 | return false; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/FroyoGestureDetector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © Yan Zhenjie. All Rights Reserved 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget.photoview.gestures; 17 | 18 | import android.annotation.TargetApi; 19 | import android.content.Context; 20 | import android.view.MotionEvent; 21 | import android.view.ScaleGestureDetector; 22 | 23 | @TargetApi(8) 24 | public class FroyoGestureDetector extends EclairGestureDetector { 25 | 26 | protected final ScaleGestureDetector mDetector; 27 | 28 | public FroyoGestureDetector(Context context) { 29 | super(context); 30 | ScaleGestureDetector.OnScaleGestureListener mScaleListener = new ScaleGestureDetector.OnScaleGestureListener() { 31 | 32 | @Override 33 | public boolean onScale(ScaleGestureDetector detector) { 34 | float scaleFactor = detector.getScaleFactor(); 35 | 36 | if (Float.isNaN(scaleFactor) || Float.isInfinite(scaleFactor)) 37 | return false; 38 | 39 | mListener.onScale(scaleFactor, 40 | detector.getFocusX(), detector.getFocusY()); 41 | return true; 42 | } 43 | 44 | @Override 45 | public boolean onScaleBegin(ScaleGestureDetector detector) { 46 | return true; 47 | } 48 | 49 | @Override 50 | public void onScaleEnd(ScaleGestureDetector detector) { 51 | // NO-OP 52 | } 53 | }; 54 | mDetector = new ScaleGestureDetector(context, mScaleListener); 55 | } 56 | 57 | @Override 58 | public boolean isScaling() { 59 | return mDetector.isInProgress(); 60 | } 61 | 62 | @Override 63 | public boolean onTouchEvent(MotionEvent ev) { 64 | try { 65 | mDetector.onTouchEvent(ev); 66 | return super.onTouchEvent(ev); 67 | } catch (IllegalArgumentException e) { 68 | // Fix for support lib bug, happening when onDestroy is 69 | return true; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/GestureDetector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © Yan Zhenjie. All Rights Reserved 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget.photoview.gestures; 17 | 18 | import android.view.MotionEvent; 19 | 20 | public interface GestureDetector { 21 | 22 | boolean onTouchEvent(MotionEvent ev); 23 | 24 | boolean isScaling(); 25 | 26 | boolean isDragging(); 27 | 28 | void setOnGestureListener(OnGestureListener listener); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/OnGestureListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © Yan Zhenjie. All Rights Reserved 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget.photoview.gestures; 17 | 18 | public interface OnGestureListener { 19 | 20 | void onDrag(float dx, float dy); 21 | 22 | void onFling(float startX, float startY, float velocityX, float velocityY); 23 | 24 | void onScale(float scaleFactor, float focusX, float focusY); 25 | 26 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/VersionedGestureDetector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © Yan Zhenjie. All Rights Reserved 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget.photoview.gestures; 17 | 18 | import android.content.Context; 19 | import android.os.Build; 20 | 21 | public final class VersionedGestureDetector { 22 | 23 | public static GestureDetector newInstance(Context context, 24 | OnGestureListener listener) { 25 | final int sdkVersion = Build.VERSION.SDK_INT; 26 | GestureDetector detector; 27 | 28 | if (sdkVersion < Build.VERSION_CODES.ECLAIR) { 29 | detector = new CupcakeGestureDetector(context); 30 | } else if (sdkVersion < Build.VERSION_CODES.FROYO) { 31 | detector = new EclairGestureDetector(context); 32 | } else { 33 | detector = new FroyoGestureDetector(context); 34 | } 35 | 36 | detector.setOnGestureListener(listener); 37 | 38 | return detector; 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/photoview/scrollerproxy/GingerScroller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © Yan Zhenjie. All Rights Reserved 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget.photoview.scrollerproxy; 17 | 18 | import android.annotation.TargetApi; 19 | import android.content.Context; 20 | import android.widget.OverScroller; 21 | 22 | @TargetApi(9) 23 | public class GingerScroller extends ScrollerProxy { 24 | 25 | protected final OverScroller mScroller; 26 | 27 | public GingerScroller(Context context) { 28 | mScroller = new OverScroller(context); 29 | } 30 | 31 | @Override 32 | public boolean computeScrollOffset() { 33 | return mScroller.computeScrollOffset(); 34 | } 35 | 36 | @Override 37 | public void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY, 38 | int overX, int overY) { 39 | mScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, overX, overY); 40 | } 41 | 42 | @Override 43 | public void forceFinished(boolean finished) { 44 | mScroller.forceFinished(finished); 45 | } 46 | 47 | @Override 48 | public boolean isFinished() { 49 | return mScroller.isFinished(); 50 | } 51 | 52 | @Override 53 | public int getCurrX() { 54 | return mScroller.getCurrX(); 55 | } 56 | 57 | @Override 58 | public int getCurrY() { 59 | return mScroller.getCurrY(); 60 | } 61 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/photoview/scrollerproxy/IcsScroller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © Yan Zhenjie. All Rights Reserved 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget.photoview.scrollerproxy; 17 | 18 | import android.annotation.TargetApi; 19 | import android.content.Context; 20 | 21 | @TargetApi(14) 22 | public class IcsScroller extends GingerScroller { 23 | 24 | public IcsScroller(Context context) { 25 | super(context); 26 | } 27 | 28 | @Override 29 | public boolean computeScrollOffset() { 30 | return mScroller.computeScrollOffset(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/photoview/scrollerproxy/PreGingerScroller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © Yan Zhenjie. All Rights Reserved 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget.photoview.scrollerproxy; 17 | 18 | import android.content.Context; 19 | import android.widget.Scroller; 20 | 21 | public class PreGingerScroller extends ScrollerProxy { 22 | 23 | private final Scroller mScroller; 24 | 25 | public PreGingerScroller(Context context) { 26 | mScroller = new Scroller(context); 27 | } 28 | 29 | @Override 30 | public boolean computeScrollOffset() { 31 | return mScroller.computeScrollOffset(); 32 | } 33 | 34 | @Override 35 | public void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY, 36 | int overX, int overY) { 37 | mScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY); 38 | } 39 | 40 | @Override 41 | public void forceFinished(boolean finished) { 42 | mScroller.forceFinished(finished); 43 | } 44 | 45 | public boolean isFinished() { 46 | return mScroller.isFinished(); 47 | } 48 | 49 | @Override 50 | public int getCurrX() { 51 | return mScroller.getCurrX(); 52 | } 53 | 54 | @Override 55 | public int getCurrY() { 56 | return mScroller.getCurrY(); 57 | } 58 | } -------------------------------------------------------------------------------- /album/src/main/java/com/yanzhenjie/album/widget/photoview/scrollerproxy/ScrollerProxy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © Yan Zhenjie. All Rights Reserved 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.widget.photoview.scrollerproxy; 17 | 18 | import android.content.Context; 19 | import android.os.Build.VERSION; 20 | import android.os.Build.VERSION_CODES; 21 | 22 | public abstract class ScrollerProxy { 23 | 24 | public static ScrollerProxy getScroller(Context context) { 25 | if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) { 26 | return new PreGingerScroller(context); 27 | } else if (VERSION.SDK_INT < VERSION_CODES.ICE_CREAM_SANDWICH) { 28 | return new GingerScroller(context); 29 | } else { 30 | return new IcsScroller(context); 31 | } 32 | } 33 | 34 | public abstract boolean computeScrollOffset(); 35 | 36 | public abstract void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, 37 | int maxY, int overX, int overY); 38 | 39 | public abstract void forceFinished(boolean finished); 40 | 41 | public abstract boolean isFinished(); 42 | 43 | public abstract int getCurrX(); 44 | 45 | public abstract int getCurrY(); 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /album/src/main/res/drawable-hdpi/album_abc_spinner_white.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-hdpi/album_abc_spinner_white.9.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-hdpi/album_ic_add_photo_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-hdpi/album_ic_add_photo_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-hdpi/album_ic_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-hdpi/album_ic_back_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-hdpi/album_ic_done_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-hdpi/album_ic_done_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-hdpi/album_ic_eye_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-hdpi/album_ic_eye_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-hdpi/album_ic_image_camera_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-hdpi/album_ic_image_camera_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-hdpi/album_ic_video_camera_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-hdpi/album_ic_video_camera_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-hdpi/album_tag_video_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-hdpi/album_tag_video_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xhdpi/album_abc_spinner_white.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xhdpi/album_abc_spinner_white.9.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xhdpi/album_ic_add_photo_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xhdpi/album_ic_add_photo_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xhdpi/album_ic_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xhdpi/album_ic_back_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xhdpi/album_ic_done_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xhdpi/album_ic_done_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xhdpi/album_ic_eye_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xhdpi/album_ic_eye_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xhdpi/album_ic_image_camera_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xhdpi/album_ic_image_camera_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xhdpi/album_ic_video_camera_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xhdpi/album_ic_video_camera_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xhdpi/album_tag_video_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xhdpi/album_tag_video_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xxhdpi/album_abc_spinner_white.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xxhdpi/album_abc_spinner_white.9.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xxhdpi/album_ic_add_photo_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xxhdpi/album_ic_add_photo_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xxhdpi/album_ic_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xxhdpi/album_ic_back_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xxhdpi/album_ic_done_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xxhdpi/album_ic_done_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xxhdpi/album_ic_eye_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xxhdpi/album_ic_eye_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xxhdpi/album_ic_image_camera_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xxhdpi/album_ic_image_camera_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xxhdpi/album_ic_video_camera_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xxhdpi/album_ic_video_camera_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xxhdpi/album_tag_video_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xxhdpi/album_tag_video_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xxxhdpi/album_abc_spinner_white.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xxxhdpi/album_abc_spinner_white.9.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xxxhdpi/album_ic_add_photo_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xxxhdpi/album_ic_add_photo_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xxxhdpi/album_ic_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xxxhdpi/album_ic_back_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xxxhdpi/album_ic_done_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xxxhdpi/album_ic_done_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xxxhdpi/album_ic_eye_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xxxhdpi/album_ic_eye_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xxxhdpi/album_ic_image_camera_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xxxhdpi/album_ic_image_camera_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xxxhdpi/album_ic_video_camera_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xxxhdpi/album_ic_video_camera_white.png -------------------------------------------------------------------------------- /album/src/main/res/drawable-xxxhdpi/album_tag_video_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/res/drawable-xxxhdpi/album_tag_video_white.png -------------------------------------------------------------------------------- /album/src/main/res/layout/album_activity_album_dark.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /album/src/main/res/layout/album_activity_album_light.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /album/src/main/res/layout/album_activity_null.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 24 | 25 | 28 | 29 | 30 | 31 | 36 | 37 | 41 | 42 | 52 | 53 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /album/src/main/res/layout/album_content_album.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | 23 | 27 | 28 | 35 | 36 | 43 | 44 | 45 | 52 | 53 | 56 | 57 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /album/src/main/res/layout/album_dialog_floder.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | -------------------------------------------------------------------------------- /album/src/main/res/layout/album_dialog_loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 24 | 25 | 28 | 29 | 36 | 37 | -------------------------------------------------------------------------------- /album/src/main/res/layout/album_item_content_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 21 | 22 | 29 | 30 | -------------------------------------------------------------------------------- /album/src/main/res/layout/album_item_content_image.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 21 | 22 | 27 | 28 | 32 | 33 | 36 | 37 | 38 | 39 | 40 | 44 | 45 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /album/src/main/res/layout/album_item_content_video.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 21 | 22 | 27 | 28 | 32 | 33 | 36 | 37 | 38 | 52 | 53 | 54 | 55 | 59 | 60 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /album/src/main/res/layout/album_item_dialog_folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 22 | 23 | 31 | 32 | 39 | 40 | 54 | 55 | -------------------------------------------------------------------------------- /album/src/main/res/layout/album_toolbar_dark.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 24 | 25 | -------------------------------------------------------------------------------- /album/src/main/res/layout/album_toolbar_light.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 24 | 25 | -------------------------------------------------------------------------------- /album/src/main/res/menu/album_menu_album.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 26 | -------------------------------------------------------------------------------- /album/src/main/res/menu/album_menu_gallery.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 25 | -------------------------------------------------------------------------------- /album/src/main/res/menu/album_menu_item_camera.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 25 | 26 | 30 | -------------------------------------------------------------------------------- /album/src/main/res/values-zh-RHK/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 加載中… 19 | 加載中… 20 | 正在創建縮略圖… 21 | 22 | 沒有發現圖片文件 23 | 沒有發現視頻文件 24 | 沒有發現媒體文件 25 | 26 | 拍照片 27 | 錄視頻 28 | 29 | 媒體專輯 30 | 所有圖片 31 | 所有視頻 32 | 所有圖片/視頻 33 | 34 | 好的 35 | 確定 36 | 取消 37 | 38 | 請選擇一個圖片文件 39 | 請選擇一個視頻文件 40 | 請選擇一個媒體文件 41 | 完成 42 | 選擇 43 | 44 | 沒有權限 45 | 沒有存儲權限,請在使用之前授權。 46 | 沒有相機或者存儲權限,請在使用前授權。 47 | 沒有相機、存儲或者錄音權限,請在使用前授權。 48 | 49 | 50 | 您只能選擇%1$d個圖片文件 51 | 52 | 53 | 54 | 您只能選擇%1$d個圖片文件,不能使用相機 55 | 56 | 57 | 您只能選擇%1$d個視頻文件 58 | 59 | 60 | 61 | 您只能選擇%1$d個視頻文件,不能使用相機 62 | 63 | 64 | 您只能選擇%1$d個媒體文件 65 | 66 | 67 | 68 | 您只能選擇%1$d個媒體文件,不能使用相機 69 | 70 | 71 | 不可用 72 | 不可用的文件,請重試 73 | 74 | -------------------------------------------------------------------------------- /album/src/main/res/values-zh-RTW/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 加載中… 19 | 加載中… 20 | 正在創建縮略圖… 21 | 22 | 沒有發現圖片文件 23 | 沒有發現視頻文件 24 | 沒有發現媒體文件 25 | 26 | 拍照片 27 | 錄視頻 28 | 29 | 媒體專輯 30 | 所有圖片 31 | 所有視頻 32 | 所有圖片/視頻 33 | 34 | 好的 35 | 確定 36 | 取消 37 | 38 | 請選擇一個圖片文件 39 | 請選擇一個視頻文件 40 | 請選擇一個媒體文件 41 | 完成 42 | 選擇 43 | 44 | 沒有權限 45 | 沒有存儲權限,請在使用之前授權。 46 | 沒有相機或者存儲權限,請在使用前授權。 47 | 沒有相機、存儲或者錄音權限,請在使用前授權。 48 | 49 | 50 | 您只能選擇%1$d個圖片文件 51 | 52 | 53 | 54 | 您只能選擇%1$d個圖片文件,不能使用相機 55 | 56 | 57 | 您只能選擇%1$d個視頻文件 58 | 59 | 60 | 61 | 您只能選擇%1$d個視頻文件,不能使用相機 62 | 63 | 64 | 您只能選擇%1$d個媒體文件 65 | 66 | 67 | 68 | 您只能選擇%1$d個媒體文件,不能使用相機 69 | 70 | 71 | 不可用 72 | 不可用的文件,請重試 73 | 74 | -------------------------------------------------------------------------------- /album/src/main/res/values-zh/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 加载中… 19 | 加载中… 20 | 正在创建缩略图… 21 | 22 | 没有发现图片文件 23 | 没有发现视频文件 24 | 没有发现媒体文件 25 | 26 | 拍照片 27 | 录视频 28 | 29 | 媒体专辑 30 | 所有图片 31 | 所有视频 32 | 所有图片/视频 33 | 34 | 好的 35 | 确定 36 | 取消 37 | 38 | 请选择一个图片文件 39 | 请选择一个视频文件 40 | 请选择一个媒体文件 41 | 完成 42 | 选择 43 | 44 | 没有权限 45 | 没有存储权限,请在使用之前授权。 46 | 没有相机或者存储权限,请在使用前授权。 47 | 没有相机、存储或者录音权限,请在使用前授权。 48 | 49 | 50 | 您只能选择%1$d个图片文件 51 | 52 | 53 | 54 | 您只能选择%1$d个图片文件,不能使用相机 55 | 56 | 57 | 您只能选择%1$d个视频文件 58 | 59 | 60 | 61 | 您只能选择%1$d个视频文件,不能使用相机 62 | 63 | 64 | 您只能选择%1$d个媒体文件 65 | 66 | 67 | 68 | 您只能选择%1$d个媒体文件,不能使用相机 69 | 70 | 71 | 不可用 72 | 不可用的文件,请重试 73 | 74 | -------------------------------------------------------------------------------- /album/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | #2196F3 19 | #1E88E5 20 | #2B2B2B 21 | 22 | #FFF 23 | #0000 24 | 25 | #808080 26 | #FFF 27 | #333 28 | 29 | #333 30 | #333 31 | #E0E0E0 32 | 33 | #992B2B2B 34 | #EE2B2B2B 35 | -------------------------------------------------------------------------------- /album/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 14sp 19 | 16sp 20 | 18sp 21 | 20sp 22 | 23 | 0dp 24 | 1dp 25 | 2dp 26 | 4dp 27 | 6dp 28 | 10dp 29 | 15dp 30 | 20dp 31 | 30dp 32 | 35dp 33 | 35dp 34 | 45dp 35 | 50dp 36 | 80dp 37 | 100dp 38 | 200dp 39 | -------------------------------------------------------------------------------- /album/src/main/res/xml/album_camera_provider.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | 29 | 30 | 33 | 34 | 37 | 38 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | apply from: "config.gradle" 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.2.1' 10 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' 11 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | jcenter() 19 | } 20 | } 21 | 22 | task clean(type: Delete) { 23 | delete rootProject.buildDir 24 | } -------------------------------------------------------------------------------- /config.gradle: -------------------------------------------------------------------------------- 1 | ext { 2 | plugins = [ 3 | library : 'com.android.library', 4 | application: 'com.android.application', 5 | maven : 'com.github.dcendents.android-maven', 6 | bintray : 'com.jfrog.bintray' 7 | ] 8 | 9 | android = [ 10 | applicationId : "com.yanzhenjie.album.sample", 11 | compileSdkVersion: 28, 12 | buildToolsVersion: "28.0.3", 13 | 14 | minSdkVersion : 14, 15 | targetSdkVersion : 28, 16 | 17 | versionCode : 27, 18 | versionName : "2.1.3", 19 | ] 20 | 21 | bintray = [ 22 | version : "2.1.3", 23 | 24 | siteUrl : 'https://github.com/yanzhenjie/Album', 25 | gitUrl : 'git@github.com:yanzhenjie/Album.git', 26 | 27 | group : "com.yanzhenjie", 28 | 29 | packaging : 'aar', 30 | name : 'Album', 31 | description : 'Album for android', 32 | 33 | licenseName : 'The Apache Software License, Version 2.0', 34 | licenseUrl : 'http://www.apache.org/licenses/LICENSE-2.0.txt', 35 | 36 | developerId : 'yanzhenjie', 37 | developerName : 'yanzhenjie', 38 | developerEmail: 'smallajax@foxmail.com', 39 | 40 | binrayLibrary : "Album", 41 | bintrayRepo : "maven", 42 | bintrayUser : 'yolanda', 43 | bintrayLicense: "Apache-2.0" 44 | ] 45 | 46 | dependencies = [ 47 | mediaScanner: 'com.yanzhenjie:mediascanner:1.0.3', 48 | 49 | design : 'com.android.support:design:28.0.0', 50 | appCompat : 'com.android.support:appcompat-v7:28.0.0', 51 | recyclerView: 'com.android.support:recyclerview-v7:28.0.0', 52 | cardView : 'com.android.support:cardview-v7:28.0.0', 53 | 54 | album : 'com.yanzhenjie:album:2.1.3', 55 | glide : 'com.github.bumptech.glide:glide:3.8.0' 56 | ] 57 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536m 2 | #systemProp.http.proxyHost=127.0.0.1 3 | #systemProp.http.proxyPort=12333 4 | #systemProp.https.proxyHost=127.0.0.1 5 | #systemProp.https.proxyPort=12333 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /image/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/image/1.gif -------------------------------------------------------------------------------- /image/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/image/2.gif -------------------------------------------------------------------------------- /image/3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/image/3.gif -------------------------------------------------------------------------------- /image/4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/image/4.gif -------------------------------------------------------------------------------- /image/5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/image/5.gif -------------------------------------------------------------------------------- /image/6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/image/6.gif -------------------------------------------------------------------------------- /image/7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/image/7.gif -------------------------------------------------------------------------------- /image/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/image/logo.png -------------------------------------------------------------------------------- /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: rootProject.ext.plugins.application 2 | 3 | android { 4 | compileSdkVersion rootProject.ext.android.compileSdkVersion 5 | buildToolsVersion rootProject.ext.android.buildToolsVersion 6 | 7 | defaultConfig { 8 | applicationId rootProject.ext.android.applicationId 9 | minSdkVersion rootProject.ext.android.minSdkVersion 10 | targetSdkVersion rootProject.ext.android.targetSdkVersion 11 | versionCode rootProject.ext.android.versionCode 12 | versionName rootProject.ext.android.versionName 13 | } 14 | } 15 | 16 | dependencies { 17 | implementation rootProject.ext.dependencies.album 18 | 19 | implementation rootProject.ext.dependencies.appCompat 20 | implementation rootProject.ext.dependencies.design 21 | implementation rootProject.ext.dependencies.recyclerView 22 | implementation rootProject.ext.dependencies.cardView 23 | 24 | implementation rootProject.ext.dependencies.glide 25 | } -------------------------------------------------------------------------------- /sample/src/main/java/com/yanzhenjie/album/sample/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.sample; 17 | 18 | import com.yanzhenjie.album.Album; 19 | import com.yanzhenjie.album.AlbumConfig; 20 | 21 | import java.util.Locale; 22 | 23 | /** 24 | *

Application.

25 | * Created by Yan Zhenjie on 2016/10/30. 26 | */ 27 | public class Application extends android.app.Application { 28 | 29 | private static Application instance; 30 | 31 | @Override 32 | public void onCreate() { 33 | super.onCreate(); 34 | if (instance == null) { 35 | instance = this; 36 | 37 | Album.initialize(AlbumConfig.newBuilder(this) 38 | .setAlbumLoader(new MediaLoader()) 39 | .setLocale(Locale.getDefault()) 40 | .build() 41 | ); 42 | } 43 | } 44 | 45 | public static Application getInstance() { 46 | return instance; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /sample/src/main/java/com/yanzhenjie/album/sample/MediaLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.album.sample; 17 | 18 | import android.widget.ImageView; 19 | 20 | import com.bumptech.glide.Glide; 21 | import com.yanzhenjie.album.AlbumFile; 22 | import com.yanzhenjie.album.AlbumLoader; 23 | import com.yanzhenjie.album.sample.R; 24 | 25 | /** 26 | * Created by Yan Zhenjie on 2017/3/31. 27 | */ 28 | public class MediaLoader implements AlbumLoader { 29 | 30 | @Override 31 | public void load(ImageView imageView, AlbumFile albumFile) { 32 | load(imageView, albumFile.getPath()); 33 | } 34 | 35 | @Override 36 | public void load(ImageView imageView, String url) { 37 | Glide.with(imageView.getContext()) 38 | .load(url) 39 | .error(R.drawable.placeholder) 40 | .placeholder(R.drawable.placeholder) 41 | .crossFade() 42 | .into(imageView); 43 | } 44 | } -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/ic_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-hdpi/ic_back_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/ic_camera_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-hdpi/ic_camera_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/ic_eye_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-hdpi/ic_eye_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/ic_image_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-hdpi/ic_image_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/ic_logo_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-hdpi/ic_logo_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/ic_video_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-hdpi/ic_video_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/tag_video_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-hdpi/tag_video_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xhdpi/ic_back_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_camera_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xhdpi/ic_camera_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_eye_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xhdpi/ic_eye_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_image_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xhdpi/ic_image_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_logo_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xhdpi/ic_logo_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_video_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xhdpi/ic_video_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xxhdpi/ic_back_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_camera_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xxhdpi/ic_camera_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_eye_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xxhdpi/ic_eye_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_image_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xxhdpi/ic_image_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_logo_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xxhdpi/ic_logo_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_video_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xxhdpi/ic_video_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/tag_video_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xxhdpi/tag_video_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xxxhdpi/ic_back_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_camera_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xxxhdpi/ic_camera_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_eye_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xxxhdpi/ic_eye_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_image_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xxxhdpi/ic_image_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_logo_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xxxhdpi/ic_logo_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_video_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xxxhdpi/ic_video_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/placeholder.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xxxhdpi/placeholder.jpg -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/tag_video_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/drawable-xxxhdpi/tag_video_white.png -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_album.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_album_filter.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 27 | 28 | 34 | 35 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_album_ui.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_camera.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 28 | 29 | 33 | 34 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_gallery.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 21 | 22 | 23 | 24 | 28 | 29 | 33 | 34 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_list_content.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 22 | 23 | 29 | 30 | 33 | 34 | 38 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 26 | 27 | 30 | 31 | 35 | 36 | 39 | 40 | 45 | 46 | 51 | 52 | 53 | 57 | 58 | 62 | 63 | 67 | 68 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/item_content_image.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/item_content_video.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 25 | 26 | 39 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 24 | 25 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/toolbar_scroll.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 21 | 22 | 26 | 27 | -------------------------------------------------------------------------------- /sample/src/main/res/menu/menu_album.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 22 | 23 | 29 | 30 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /sample/src/main/res/menu/menu_album_camera.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 22 | 23 | 29 | 30 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /sample/src/main/res/menu/menu_album_image.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 27 | 28 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /sample/src/main/res/menu/menu_album_video.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 27 | 28 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Album/b17506440d32909d42aba41f6a388041a25c8363/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | #2196F3 19 | #1E88E5 20 | #dc572e 21 | #FF2B2B2B 22 | -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | Album 19 | 20 | Camera 21 | Pictures and Videos 22 | Only Pictures 23 | Only Videos 24 | Gallery 25 | Change Style 26 | Filter 27 | 28 | + 29 | 30 | Camera 31 | Image 32 | Video 33 | 34 | Select image 35 | Image 36 | 37 | Select video 38 | Video 39 | 40 | Media Album 41 | Album 42 | 43 | Gallery 44 | 45 | Gallery 46 | Preview Network Image 47 | 48 | Checkable Options 49 | Canceled 50 | Please select, first. 51 | 52 | Click on a item to preview them. 53 | 54 | Did you show the filtered files? 55 | Show 56 | Hide 57 | -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 26 | 27 | 30 | 31 | 34 | 35 | 45 | 46 | 50 | 51 | 59 | 60 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':sample', ':album' --------------------------------------------------------------------------------