├── .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 ActionAlbum 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 ArrayListUsed 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 FilterAny action takes place.
22 | * Created by YanZhenjie on 2018/4/17. 23 | */ 24 | public interface ItemActionAlbum wrapper.
30 | * Created by yanzhenjie on 17-3-29. 31 | */ 32 | public class AlbumSingleWrapper extends BasicChoiceAlbumWrapperAlbum basic wrapper.
26 | * Created by yanzhenjie on 17-3-29. 27 | */ 28 | public abstract class BasicAlbumWrapperGallery wrapper.
28 | * Created by yanzhenjie on 17-3-29. 29 | */ 30 | public class GalleryAlbumWrapper extends BasicGalleryWrapperGallery wrapper.
27 | * Created by yanzhenjie on 17-3-29. 28 | */ 29 | public class GalleryWrapper extends BasicGalleryWrapperCamera wrapper.
26 | * Created by Yan Zhenjie on 2017/4/18. 27 | */ 28 | public class ImageCameraWrapper extends BasicCameraWrapperCamera wrapper.
27 | * Created by Yan Zhenjie on 2017/4/18. 28 | */ 29 | public class VideoCameraWrapper extends BasicCameraWrapperListens 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 SourceFor 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 |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 |