diff --git a/README.md b/README.md index 4ad209d..6a38ea7 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,13 @@ Effect on landscape screen: ## Download ```groovy -implementation 'com.yanzhenjie:album:2.1.3' +repositories { + maven { url "https://jitpack.io" } +} + +dependencies { + compile 'com.github.imliujun:album:3.0.2' +} ``` ## Usage diff --git a/album/build.gradle b/album/build.gradle index de3d1fa..3aa559f 100644 --- a/album/build.gradle +++ b/album/build.gradle @@ -1,4 +1,7 @@ apply plugin: rootProject.ext.plugins.library +apply plugin: 'com.github.dcendents.android-maven' + +group = 'com.github.imliujun' android { compileSdkVersion rootProject.ext.android.compileSdkVersion @@ -20,4 +23,29 @@ dependencies { api rootProject.ext.dependencies.mediaScanner } -apply from: 'https://raw.githubusercontent.com/yanzhenjie/bintray/master/maven.gradle' \ No newline at end of file +//apply from: 'https://raw.githubusercontent.com/yanzhenjie/bintray/master/maven.gradle' + + +// build a jar with source files +task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' +} + +task javadoc(type: Javadoc) { + failOnError false + source = android.sourceSets.main.java.sourceFiles + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + classpath += configurations.compile +} + +// build a jar with javadoc +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives sourcesJar + archives javadocJar +} \ No newline at end of file diff --git a/album/src/main/AndroidManifest.xml b/album/src/main/AndroidManifest.xml index a59a969..43f7b39 100644 --- a/album/src/main/AndroidManifest.xml +++ b/album/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - - - @@ -25,7 +25,7 @@ android:layout_alignParentBottom="true" android:background="@color/albumSheetBottom"> - - - - diff --git a/album/src/main/res/layout/album_item_content_video.xml b/album/src/main/res/layout/album_item_content_video.xml index 27b4de2..c1ca22a 100644 --- a/album/src/main/res/layout/album_item_content_video.xml +++ b/album/src/main/res/layout/album_item_content_video.xml @@ -30,7 +30,7 @@ android:layout_alignParentEnd="true" android:layout_alignParentRight="true"> - diff --git a/album/src/main/res/layout/album_item_dialog_folder.xml b/album/src/main/res/layout/album_item_dialog_folder.xml index 88da0ab..2ddf7e4 100644 --- a/album/src/main/res/layout/album_item_dialog_folder.xml +++ b/album/src/main/res/layout/album_item_dialog_folder.xml @@ -29,7 +29,7 @@ android:contentDescription="@string/album_title" android:scaleType="centerCrop"/> - - - - \ No newline at end of file + \ No newline at end of file diff --git a/album/src/main/res/layout/album_toolbar_light.xml b/album/src/main/res/layout/album_toolbar_light.xml index 43b7a6c..15de099 100644 --- a/album/src/main/res/layout/album_toolbar_light.xml +++ b/album/src/main/res/layout/album_toolbar_light.xml @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. --> - - - \ No newline at end of file + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 05840ac..83eeb11 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:4.0.1' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' } @@ -16,6 +16,10 @@ allprojects { repositories { google() jcenter() + maven { url 'https://jitpack.io' } + maven { + url "http://dl.bintray.com/piasy/maven" + } } } diff --git a/config.gradle b/config.gradle index 19a4349..966e701 100644 --- a/config.gradle +++ b/config.gradle @@ -8,11 +8,11 @@ ext { android = [ applicationId : "com.yanzhenjie.album.sample", - compileSdkVersion: 28, - buildToolsVersion: "28.0.3", + compileSdkVersion: 29, + buildToolsVersion: "29.0.3", - minSdkVersion : 14, - targetSdkVersion : 28, + minSdkVersion : 17, + targetSdkVersion : 29, versionCode : 27, versionName : "2.1.3", @@ -46,12 +46,12 @@ ext { dependencies = [ mediaScanner: 'com.yanzhenjie:mediascanner:1.0.3', - design : 'com.android.support:design:28.0.0', - appCompat : 'com.android.support:appcompat-v7:28.0.0', - recyclerView: 'com.android.support:recyclerview-v7:28.0.0', - cardView : 'com.android.support:cardview-v7:28.0.0', + design : 'com.google.android.material:material:1.0.0', + appCompat : 'androidx.appcompat:appcompat:1.1.0', + recyclerView: 'androidx.recyclerview:recyclerview:1.1.0', + cardView : 'androidx.cardview:cardview:1.0.0', - album : 'com.yanzhenjie:album:2.1.3', - glide : 'com.github.bumptech.glide:glide:3.8.0' + album : 'com.github.imliujun:album:3.0.2', + glide : 'com.github.bumptech.glide:glide:4.11.0' ] } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 01e0ac2..f32badb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,3 @@ -org.gradle.jvmargs=-Xmx1536m -#systemProp.http.proxyHost=127.0.0.1 -#systemProp.http.proxyPort=12333 -#systemProp.https.proxyHost=127.0.0.1 -#systemProp.https.proxyPort=12333 \ No newline at end of file +android.enableJetifier=true +android.useAndroidX=true +org.gradle.jvmargs=-Xmx1536m \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4eafe8e..b1db12b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Dec 28 10:00:20 PST 2015 +#Thu Jul 23 17:11:57 CST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip \ No newline at end of file +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/sample/build.gradle b/sample/build.gradle index ee9a379..143f23c 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -11,10 +11,20 @@ android { versionCode rootProject.ext.android.versionCode versionName rootProject.ext.android.versionName } + + //解决 More than one file was found with OS independent path 'META-INF/DEPENDENCIES' + packagingOptions { + exclude 'META-INF/proguard/androidx-annotations.pro' + } } dependencies { + // implementation project(":album") implementation rootProject.ext.dependencies.album + implementation 'com.facebook.fresco:fresco:2.3.0' + implementation "com.github.piasy:BigImageViewer:1.6.6" + // implementation "com.github.piasy:FrescoImageLoader:1.6.6" + // implementation 'com.github.piasy:FrescoImageViewFactory:1.6.6' implementation rootProject.ext.dependencies.appCompat implementation rootProject.ext.dependencies.design diff --git a/sample/src/main/java/com/yanzhenjie/album/sample/Application.java b/sample/src/main/java/com/yanzhenjie/album/sample/Application.java index 51b383a..38eaa77 100644 --- a/sample/src/main/java/com/yanzhenjie/album/sample/Application.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/Application.java @@ -15,6 +15,8 @@ */ package com.yanzhenjie.album.sample; +import com.github.piasy.biv.BigImageViewer; +import com.github.piasy.biv.loader.fresco.FrescoImageLoader; import com.yanzhenjie.album.Album; import com.yanzhenjie.album.AlbumConfig; @@ -33,11 +35,13 @@ public void onCreate() { super.onCreate(); if (instance == null) { instance = this; + BigImageViewer.initialize(FrescoImageLoader.with(instance)); Album.initialize(AlbumConfig.newBuilder(this) - .setAlbumLoader(new MediaLoader()) - .setLocale(Locale.getDefault()) - .build() + // .setAlbumLoader(new MediaLoader()) + .setAlbumLoader(new FrescoLoader()) + .setLocale(Locale.getDefault()) + .build() ); } } diff --git a/sample/src/main/java/com/yanzhenjie/album/sample/FrescoLoader.java b/sample/src/main/java/com/yanzhenjie/album/sample/FrescoLoader.java new file mode 100644 index 0000000..9aee03d --- /dev/null +++ b/sample/src/main/java/com/yanzhenjie/album/sample/FrescoLoader.java @@ -0,0 +1,124 @@ +/* + * Copyright 2017 Yan Zhenjie. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.yanzhenjie.album.sample; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.drawable.BitmapDrawable; +import android.net.Uri; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; + +import com.facebook.common.executors.UiThreadImmediateExecutorService; +import com.facebook.common.references.CloseableReference; +import com.facebook.datasource.DataSource; +import com.facebook.drawee.backends.pipeline.Fresco; +import com.facebook.drawee.view.SimpleDraweeView; +import com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber; +import com.facebook.imagepipeline.image.CloseableImage; +import com.facebook.imagepipeline.request.ImageRequest; +import com.github.piasy.biv.view.BigImageView; +import com.github.piasy.biv.view.FrescoImageViewFactory; +import com.yanzhenjie.album.AlbumFile; +import com.yanzhenjie.album.AlbumLoader; +import com.yanzhenjie.album.sample.photoview.AttacherImageView; +import com.yanzhenjie.album.sample.photoview.PhotoViewAttacher; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +/** + * Created by Yan Zhenjie on 2017/3/31. + */ +public class FrescoLoader implements AlbumLoader { + + @Override + public void load(@NonNull ImageView imageView, @NonNull AlbumFile albumFile) { + load(imageView, albumFile.getUri()); + } + + @Override + public void load(@NonNull ImageView imageView, @NonNull Uri uri) { + if (imageView instanceof SimpleDraweeView) { + imageView.setImageURI(uri); + } + } + + @NonNull + @Override + public View getPreviewView(@NonNull Context context, @NonNull AlbumFile albumFile, final View.OnClickListener onClickListener, final View.OnClickListener longClickListener) { + if (albumFile.getMediaType() == AlbumFile.TYPE_VIDEO) { + final AttacherImageView view = new AttacherImageView(context); + view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); + DataSource> dataSource = Fresco.getImagePipeline() + .fetchDecodedImage(ImageRequest.fromUri(albumFile.getUri()), context); + dataSource.subscribe(new BaseBitmapDataSubscriber() { + @Override + protected void onNewResultImpl(Bitmap bitmap) { + view.setImageDrawable(new BitmapDrawable(bitmap.copy(bitmap.getConfig(), bitmap.isMutable()))); + } + + @Override + protected void onFailureImpl(DataSource> dataSource) { + } + }, UiThreadImmediateExecutorService.getInstance()); + final PhotoViewAttacher attacher = new PhotoViewAttacher(view); + if (onClickListener != null) { + attacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() { + @Override + public void onViewTap(View v, float x, float y) { + onClickListener.onClick(v); + } + }); + } + if (longClickListener != null) { + attacher.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + longClickListener.onClick(v); + return true; + } + }); + } + view.setAttacher(attacher); + return view; + } else { + return getPreviewView(context, albumFile.getUri(), onClickListener, longClickListener); + } + } + + @NonNull + @Override + public View getPreviewView(@NonNull Context context, @NonNull Uri uri, @Nullable View.OnClickListener onClickListener, final @Nullable View.OnClickListener longClickListener) { + final BigImageView view = new BigImageView(context); + view.setImageViewFactory(new FrescoImageViewFactory()); + view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); + view.showImage(uri); + view.setOnClickListener(onClickListener); + view.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + if (longClickListener != null) { + longClickListener.onClick(view); + } + return true; + } + }); + return view; + } + +} \ No newline at end of file diff --git a/sample/src/main/java/com/yanzhenjie/album/sample/MainActivity.java b/sample/src/main/java/com/yanzhenjie/album/sample/MainActivity.java index e99e465..3ff9f05 100644 --- a/sample/src/main/java/com/yanzhenjie/album/sample/MainActivity.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/MainActivity.java @@ -17,9 +17,9 @@ import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; import android.view.View; import com.yanzhenjie.album.sample.app.AlbumActivity; diff --git a/sample/src/main/java/com/yanzhenjie/album/sample/MediaLoader.java b/sample/src/main/java/com/yanzhenjie/album/sample/MediaLoader.java index 331e096..09663fa 100644 --- a/sample/src/main/java/com/yanzhenjie/album/sample/MediaLoader.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/MediaLoader.java @@ -15,30 +15,71 @@ */ package com.yanzhenjie.album.sample; +import android.content.Context; +import android.net.Uri; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import android.view.View; +import android.view.ViewGroup; import android.widget.ImageView; import com.bumptech.glide.Glide; import com.yanzhenjie.album.AlbumFile; import com.yanzhenjie.album.AlbumLoader; -import com.yanzhenjie.album.sample.R; +import com.yanzhenjie.album.sample.photoview.AttacherImageView; +import com.yanzhenjie.album.sample.photoview.PhotoViewAttacher; /** * Created by Yan Zhenjie on 2017/3/31. */ public class MediaLoader implements AlbumLoader { - + @Override - public void load(ImageView imageView, AlbumFile albumFile) { - load(imageView, albumFile.getPath()); + public void load(@NonNull ImageView imageView, @NonNull AlbumFile albumFile) { + load(imageView, albumFile.getUri()); } - + @Override - public void load(ImageView imageView, String url) { + public void load(@NonNull ImageView imageView, @NonNull Uri uri) { Glide.with(imageView.getContext()) - .load(url) - .error(R.drawable.placeholder) - .placeholder(R.drawable.placeholder) - .crossFade() - .into(imageView); + .load(uri) + .error(R.drawable.placeholder) + .placeholder(R.drawable.placeholder) + .into(imageView); + } + + @NonNull + @Override + public View getPreviewView(@NonNull Context context, @NonNull AlbumFile albumFile, final View.OnClickListener onClickListener, final View.OnClickListener longClickListener) { + return getPreviewView(context, albumFile.getUri(), onClickListener, longClickListener); + } + + @NonNull + @Override + public View getPreviewView(@NonNull Context context, @NonNull Uri uri, @Nullable final View.OnClickListener onClickListener, @Nullable final View.OnClickListener longClickListener) { + final AttacherImageView view = new AttacherImageView(context); + view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); + load(view, uri); + PhotoViewAttacher attacher = new PhotoViewAttacher(view); + if (onClickListener != null) { + attacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() { + @Override + public void onViewTap(View v, float x, float y) { + onClickListener.onClick(v); + } + }); + } + if (longClickListener != null) { + attacher.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + longClickListener.onClick(v); + return true; + } + }); + } + view.setAttacher(attacher); + return view; } + } \ No newline at end of file diff --git a/sample/src/main/java/com/yanzhenjie/album/sample/app/Adapter.java b/sample/src/main/java/com/yanzhenjie/album/sample/app/Adapter.java index 8ac9ae7..76c2c90 100644 --- a/sample/src/main/java/com/yanzhenjie/album/sample/app/Adapter.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/app/Adapter.java @@ -16,8 +16,8 @@ package com.yanzhenjie.album.sample.app; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/com/yanzhenjie/album/sample/app/AlbumActivity.java b/sample/src/main/java/com/yanzhenjie/album/sample/app/AlbumActivity.java index 4145100..71638ef 100644 --- a/sample/src/main/java/com/yanzhenjie/album/sample/app/AlbumActivity.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/app/AlbumActivity.java @@ -17,12 +17,12 @@ import android.graphics.Color; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.Toolbar; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.appcompat.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; diff --git a/sample/src/main/java/com/yanzhenjie/album/sample/app/AlbumFilterActivity.java b/sample/src/main/java/com/yanzhenjie/album/sample/app/AlbumFilterActivity.java index 0a02914..0adca4b 100644 --- a/sample/src/main/java/com/yanzhenjie/album/sample/app/AlbumFilterActivity.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/app/AlbumFilterActivity.java @@ -18,13 +18,13 @@ import android.content.DialogInterface; import android.graphics.Color; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.Toolbar; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.appcompat.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; diff --git a/sample/src/main/java/com/yanzhenjie/album/sample/app/CameraActivity.java b/sample/src/main/java/com/yanzhenjie/album/sample/app/CameraActivity.java index 54c0850..fcbc5a2 100644 --- a/sample/src/main/java/com/yanzhenjie/album/sample/app/CameraActivity.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/app/CameraActivity.java @@ -15,12 +15,8 @@ */ package com.yanzhenjie.album.sample.app; +import android.net.Uri; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.widget.ImageView; @@ -29,16 +25,23 @@ import com.yanzhenjie.album.Action; import com.yanzhenjie.album.Album; +import com.yanzhenjie.album.AlbumCameraFile; import com.yanzhenjie.album.sample.R; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + /** * Created by YanZhenjie on 2017/8/17. */ public class CameraActivity extends AppCompatActivity { - + TextView mTextView; private ImageView mImageView; - + @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -48,66 +51,65 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { ActionBar actionBar = getSupportActionBar(); assert actionBar != null; actionBar.setDisplayHomeAsUpEnabled(true); - + mTextView = findViewById(R.id.tv_message); mImageView = findViewById(R.id.image_view); } - + private void takePicture() { Album.camera(this) - .image() -// .filePath() - .onResult(new Action() { - @Override - public void onAction(@NonNull String result) { - mTextView.setText(result); - - Album.getAlbumConfig() - .getAlbumLoader() - .load(mImageView, result); - } - }) - .onCancel(new Action() { - @Override - public void onAction(@NonNull String result) { - Toast.makeText(CameraActivity.this, R.string.canceled, Toast.LENGTH_LONG).show(); - } - }) - .start(); + .image() + // .filePath() + .onResult(new Action() { + @Override + public void onAction(@NonNull AlbumCameraFile result) { + mTextView.setText(result.toString()); + Album.getAlbumConfig() + .getAlbumLoader() + .load(mImageView, result.getUri()); + } + }) + .onCancel(new Action() { + @Override + public void onAction(@NonNull String result) { + Toast.makeText(CameraActivity.this, R.string.canceled, Toast.LENGTH_LONG).show(); + } + }) + .start(); } - + private void recordVideo() { Album.camera(this) - .video() -// .filePath() - .quality(1) - .limitDuration(Integer.MAX_VALUE) - .limitBytes(Integer.MAX_VALUE) - .onResult(new Action() { - @Override - public void onAction(@NonNull String result) { - mTextView.setText(result); - - Album.getAlbumConfig() - .getAlbumLoader() - .load(mImageView, result); - } - }) - .onCancel(new Action() { - @Override - public void onAction(@NonNull String result) { - Toast.makeText(CameraActivity.this, R.string.canceled, Toast.LENGTH_LONG).show(); - } - }) - .start(); + .video() + // .filePath() + .quality(1) + .limitDuration(Integer.MAX_VALUE) + .limitBytes(Integer.MAX_VALUE) + .onResult(new Action() { + @Override + public void onAction(@NonNull AlbumCameraFile result) { + mTextView.setText(result.toString()); + + Album.getAlbumConfig() + .getAlbumLoader() + .load(mImageView, result.getUri()); + } + }) + .onCancel(new Action() { + @Override + public void onAction(@NonNull String result) { + Toast.makeText(CameraActivity.this, R.string.canceled, Toast.LENGTH_LONG).show(); + } + }) + .start(); } - + @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_album_camera, menu); return true; } - + @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); diff --git a/sample/src/main/java/com/yanzhenjie/album/sample/app/DefineStyleActivity.java b/sample/src/main/java/com/yanzhenjie/album/sample/app/DefineStyleActivity.java index bdd0886..40bd1d4 100644 --- a/sample/src/main/java/com/yanzhenjie/album/sample/app/DefineStyleActivity.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/app/DefineStyleActivity.java @@ -17,12 +17,12 @@ import android.graphics.Color; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.Toolbar; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.appcompat.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; diff --git a/sample/src/main/java/com/yanzhenjie/album/sample/app/GalleryActivity.java b/sample/src/main/java/com/yanzhenjie/album/sample/app/GalleryActivity.java index 63496d9..51feb37 100644 --- a/sample/src/main/java/com/yanzhenjie/album/sample/app/GalleryActivity.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/app/GalleryActivity.java @@ -16,10 +16,6 @@ package com.yanzhenjie.album.sample.app; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.view.View; import android.widget.CheckBox; @@ -32,32 +28,56 @@ import java.util.ArrayList; import java.util.Collections; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + /** * Created by YanZhenjie on 2017/8/17. */ public class GalleryActivity extends AppCompatActivity { private static final String[] IMAGE_PATH_LIST = { - "http://pic1.win4000.com/mobile/1/520d9410ebc79.jpg", "http://pic1.win4000.com/mobile/1/520d941218b04.jpg", - "http://wapfile.desktx.com/7681280/0925/160925tn4a5sz3at2.jpg", "http://wapfile.desktx.com/7681280/0925/160925ruuqfaqwuvx.jpg", - "http://wapfile.desktx.com/7681280/0925/160925a0x5knyt3ue.jpg", "http://wapfile.desktx.com/7681280/0925/160925jrfl5dnvln1.jpg", - "http://wapfile.desktx.com/7681280/0925/160925csx5pu2ysam.jpg", "http://wapfile.desktx.com/7681280/0925/160925m4lgeuakuc5.jpg", - "http://wapfile.desktx.com/7681280/0925/160925gcmbg5gycqw.jpg", "http://wapfile.desktx.com/7681280/0925/160925o0zf2pbozw1.jpg", - "http://wapfile.desktx.com/7681280/0925/160925danhsef1uzu.jpg", "http://wapfile.desktx.com/7681280/0925/160925y5lmcrqslm4.jpg", - "http://wapfile.desktx.com/7681280/0925/160925njt3dm2hlw0.jpg", "http://wapfile.desktx.com/7681280/0925/160925xgesspjxztt.jpg", - "http://wapfile.desktx.com/7681280/0925/160925a5dg2zsddtx.jpg", "http://wapfile.desktx.com/7681280/0925/1609252fupmrdasrp.jpg", - "http://wapfile.desktx.com/7681280/0925/160925lasaphesxkd.jpg", "http://wapfile.desktx.com/7681280/0925/160925ti2kged45bp.jpg", - "http://wapfile.desktx.com/7681280/0925/160925dsx3uyapoen.jpg", "http://wapfile.desktx.com/7681280/0925/160925largrb3p2l4.jpg", - "http://wapfile.desktx.com/7681280/0925/160925l0vaht45uy1.jpg", "http://wapfile.desktx.com/7681280/0925/160925054jrhaerro.jpg", - "http://wapfile.desktx.com/7681280/0925/1609255mlt2so5yp2.jpg", "http://wapfile.desktx.com/7681280/0925/160925bm3jmwdptie.jpg", - "http://wapfile.desktx.com/7681280/0925/1609251brfaryoizu.jpg", "http://wapfile.desktx.com/7681280/0925/1609254qfjkbwjlox.jpg", - "http://wapfile.desktx.com/7681280/0925/160925memb5c4pcnt.jpg", "http://wapfile.desktx.com/7681280/0925/160925c5i4dbhh2rh.jpg", - "http://wapfile.desktx.com/7681280/0925/1609254pmjqhppmah.jpg", "http://wapfile.desktx.com/7681280/0925/16092505gvkuoampz.jpg", - "http://wapfile.desktx.com/7681280/0925/1609254dxk3vpsrvj.jpg", "http://wapfile.desktx.com/7681280/0925/160925bgyxuik3j4y.jpg", - "http://wapfile.desktx.com/7681280/0925/160925jbhhtendosg.jpg", "http://wapfile.desktx.com/7681280/0925/160925knnv51uglia.jpg", - "http://wapfile.desktx.com/7681280/0925/160925vajxn2aqfkc.jpg", "http://wapfile.desktx.com/7681280/0925/160925xehnehy5frf.jpg", - "http://wapfile.desktx.com/7681280/0925/160925e2rajc4zi4k.jpg", "http://wapfile.desktx.com/7681280/0925/160925dfxg2wlarga.jpg", - "http://wapfile.desktx.com/7681280/0925/160925vuifhcqactt.jpg", "http://wapfile.desktx.com/7681280/0925/160925rcxiez3ikcg.jpg" + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511268196&di=a17c805213846a55eb067565cda0ae0f&imgtype=0&src=http%3A%2F%2F01.minipic.eastday.com%2F20170314%2F20170314093020_61f5e1c760157917576b50b62bc59c80_7.jpeg", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298118&di=263456f22d8b03397cc467c82c9cd195&imgtype=0&src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20181003%2F0f8307fe3de6468d8b51c53b276e9e1b.jpeg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298118&di=b2944fc7eef07d274d629ba9a2eff5be&imgtype=0&src=http%3A%2F%2Fpic1.win4000.com%2Fwallpaper%2Fd%2F574bd264dc04f.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298118&di=f6e60ae16352a14b848dba216af784f4&imgtype=0&src=http%3A%2F%2Fp0.qhimg.com%2Ft01dc11f29c01424c6d.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298114&di=156b200f20eb702f2ad3ba8fc5b55ba2&imgtype=0&src=http%3A%2F%2Fpic.feizl.com%2Fupload%2Fallimg%2F170614%2F1410251g5-0.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298114&di=2194e443572fcac6b86e8ca9a3eb9acc&imgtype=0&src=http%3A%2F%2F00.minipic.eastday.com%2F20170303%2F20170303140548_7cb2d40a62600c2ee10f9c826dedfb8b_9.jpeg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298112&di=69a2ac37a9b763829f3c26195a7fcbf0&imgtype=0&src=http%3A%2F%2Fn.sinaimg.cn%2Fsinacn18%2F410%2Fw1470h2140%2F20180525%2F59be-haysviy8786664.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298111&di=40e9330ad50aafb884d6699801f1d2d2&imgtype=0&src=http%3A%2F%2Fpic1.win4000.com%2Fpic%2F2%2F48%2F542c1208181.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298110&di=039ff5882950f28189cea1ad6f1a25e4&imgtype=0&src=http%3A%2F%2Fpic1.win4000.com%2Fwallpaper%2Fb%2F5680fcc0d31b2.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298110&di=ed3cf8b466ca36997ce94201f392d8c7&imgtype=0&src=http%3A%2F%2Fpic1.win4000.com%2Fpic%2Fa%2F64%2F79121317058.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298109&di=c95f19699712aa1c51b3bff4f0f6a0cc&imgtype=0&src=http%3A%2F%2F01.minipic.eastday.com%2F20170421%2F20170421142504_aa430cd7552a22e19a91054d15ae0905_14.jpeg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298109&di=8ce9291fd03a7e225cfe0f4cf4524769&imgtype=0&src=http%3A%2F%2Fimage.hnol.net%2Fc%2F2013-03%2F20%2F19%2F20130320191211951-2089977.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298256&di=51e80d7ccbda7e72856a9db4d0961afa&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201707%2F17%2F20170717230736_RWUmT.jpeg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298255&di=8ec2d086beaa20b3414eb357c4bd2286&imgtype=0&src=http%3A%2F%2Fimg.pconline.com.cn%2Fimages%2Fupload%2Fupc%2Ftx%2Fphotoblog%2F1405%2F28%2Fc3%2F34712742_34712742_1401260899709.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298256&di=d2a6ce2938738d40ae62119e68573b18&imgtype=0&src=http%3A%2F%2Fimg4.cache.netease.com%2Fphoto%2F0026%2F2013-07-08%2F938RKTEP43AJ0026.JPG", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298255&di=fa5fbffe31186ea20df334ab4063725c&imgtype=0&src=http%3A%2F%2F01.minipic.eastday.com%2F20170306%2F20170306111324_d2b7a6d928ad827f4db19f355b9550d4_5.jpeg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298255&di=da54af6be9cce91a57426f9cb684d49f&imgtype=0&src=http%3A%2F%2Fi3.17173.itc.cn%2F2008%2Fjr%2F2008%2F11%2F20%2F8.JPG", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298255&di=850c6e1979c1cac2faebe91ec910913a&imgtype=0&src=http%3A%2F%2Fimage.hnol.net%2Fc%2F2016-01%2F30%2F18%2F201601301826324531-3356886.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298254&di=5bc035ef1f5ac4ffb90fbf6fe62027ae&imgtype=0&src=http%3A%2F%2Fp0.ifengimg.com%2Fa%2F2016_33%2Fb9050beb18718b0_size524_w3885_h2745.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298254&di=8cb3d6fac8e62a0291aabde8aad08dab&imgtype=0&src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20190126%2F6727836cd8c84e3f9f02ecb97f4cc5cc.jpeg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298254&di=43f222be11c12cbf8cc77ca55ca08c11&imgtype=0&src=http%3A%2F%2F01.minipic.eastday.com%2F20170506%2F20170506134244_50112ebd2eb624744aa8b957008a8d71_4.jpeg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511954989&di=8a4a9739fab70902712c00ff9828428f&imgtype=0&src=http%3A%2F%2Fimg4.imgtn.bdimg.com%2Fit%2Fu%3D3556124484%2C830383795%26fm%3D214%26gp%3D0.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298253&di=82c1aff5dfde5886b2f10338d7733dc0&imgtype=0&src=http%3A%2F%2Fpic1.win4000.com%2Fwallpaper%2F2018-09-10%2F5b961ed1809f1.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298253&di=65206968f3d93a8e8ad4783356d7fd87&imgtype=0&src=http%3A%2F%2F00.minipic.eastday.com%2F20170122%2F20170122133549_02dc7a8d994ea57c5a7c11421a56eb2f_2.jpeg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298253&di=8aa1beeca9e2274fc8bc7055fd815d0f&imgtype=0&src=http%3A%2F%2F00.minipic.eastday.com%2F20170417%2F20170417154748_f05b8931f7bed94d8a76e9f96d784a8b_9.jpeg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298253&di=f5fa7bfe3aed8d636fa8716738415d90&imgtype=0&src=http%3A%2F%2Fpic1.win4000.com%2Fpic%2F7%2F07%2F26501170849.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298253&di=05e0dd05b7ea3e283bcc4a9f189970b5&imgtype=0&src=http%3A%2F%2Fn.sinaimg.cn%2Fsinacn10111%2F710%2Fw1600h2310%2F20181207%2F8102-hpinryc5855494.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298252&di=03c16c31e38886781a1ed04fe3a1f986&imgtype=0&src=http%3A%2F%2Fpic1.win4000.com%2Fpic%2F7%2Fe8%2Fa8781211260.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298252&di=efc9e9755ae73cfcbeeefc8088165ac1&imgtype=0&src=http%3A%2F%2F01.minipic.eastday.com%2F20170421%2F20170421142504_aa430cd7552a22e19a91054d15ae0905_9.jpeg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298252&di=d68706f875990e682a152292beb7bbb3&imgtype=0&src=http%3A%2F%2F01.minipic.eastday.com%2F20170519%2F20170519154440_0791cfd6f5d25410bcde032e77afb40d_2.jpeg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298251&di=0064201bef322ecfdc7359f7bbdabb7e&imgtype=0&src=http%3A%2F%2Fwww.deskcar.com%2Fdesktop%2Fstar%2Fchina%2F20151124212913%2F7.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298251&di=41c055afa9f969fa4096fd44e41dc094&imgtype=0&src=http%3A%2F%2Fpic1.win4000.com%2Fpic%2F5%2F39%2F58581218506.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298251&di=5ebc26be806759d833492f14887fe6bb&imgtype=0&src=http%3A%2F%2Fwww.flybridal.com%2Fhuangse%2FaHR0cDovL3BpYzEud2luNDAwMC5jb20vcGljL2YvMzMvM2I5YjMwMTQyNi5qcGc%3D.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298250&di=237cae63df3dad5ef3a8a61acf6e36b9&imgtype=0&src=http%3A%2F%2Fimg.pconline.com.cn%2Fimages%2Fupload%2Fupc%2Ftx%2Fphotoblog%2F1111%2F24%2Fc2%2F9721899_9721899_1322103707644.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298249&di=79bc09a920abfc3601420db91e3c759d&imgtype=0&src=http%3A%2F%2F00.minipic.eastday.com%2F20170407%2F20170407091825_3cbfafdd9a6fe547be7cab4ae702077e_2.jpeg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511298248&di=105a164fdb6c8192b2a8576bcc1250cb&imgtype=0&src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20181125%2F5369ec03f8274b4c889537fea5b635e9.jpeg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511994779&di=99bddb40e08488550d893ebf8f0ff892&imgtype=0&src=http%3A%2F%2Fimg.improve-yourmemory.com%2Fpic%2F913f45ee741278fc4213e5d861fe2acb-4.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511994779&di=170a327f5f388d45aeafd88a5775c727&imgtype=0&src=http%3A%2F%2Fpic1.win4000.com%2Fpic%2F0%2F29%2F163a1215183.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511994778&di=1a37f80710cd3dd09aed0e0ee3fdf772&imgtype=0&src=http%3A%2F%2Fpic1.win4000.com%2Fwallpaper%2F1%2F50655aa104436.jpg", + "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1595511994777&di=d1feb652465b5af592a82f2b6c36a1bc&imgtype=0&src=http%3A%2F%2F01.minipic.eastday.com%2F20170308%2F20170308093953_6e555cf710ad2a15a03ef91239032c85_4.jpeg" }; private Toolbar mToolbar; @@ -80,25 +100,30 @@ public void onClick(View v) { }); } + @Override + protected void onDestroy() { + super.onDestroy(); + } + private void previewImages() { ArrayList imageList = new ArrayList<>(); Collections.addAll(imageList, IMAGE_PATH_LIST); Album.gallery(this) - .checkedList(imageList) - .checkable(mCheckBox.isChecked()) - .widget( - Widget.newDarkBuilder(this) - .title(mToolbar.getTitle().toString()) - .build() - ) - .onResult(new Action>() { - @Override - public void onAction(@NonNull ArrayList result) { - // TODO If it is optional, here you can accept the results of user selection. - } - }) - .start(); + .checkedList(imageList) + .checkable(mCheckBox.isChecked()) + .widget( + Widget.newDarkBuilder(this) + .title(mToolbar.getTitle().toString()) + .build() + ) + .onResult(new Action>() { + @Override + public void onAction(@NonNull ArrayList result) { + // TODO If it is optional, here you can accept the results of user selection. + } + }) + .start(); } @Override @@ -113,8 +138,4 @@ public boolean onOptionsItemSelected(MenuItem item) { return true; } - @Override - protected void onDestroy() { - super.onDestroy(); - } } diff --git a/sample/src/main/java/com/yanzhenjie/album/sample/app/ImageActivity.java b/sample/src/main/java/com/yanzhenjie/album/sample/app/ImageActivity.java index a08c964..f985915 100644 --- a/sample/src/main/java/com/yanzhenjie/album/sample/app/ImageActivity.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/app/ImageActivity.java @@ -17,12 +17,12 @@ import android.graphics.Color; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.Toolbar; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.appcompat.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; diff --git a/sample/src/main/java/com/yanzhenjie/album/sample/app/VideoActivity.java b/sample/src/main/java/com/yanzhenjie/album/sample/app/VideoActivity.java index d1894c1..9aaac05 100644 --- a/sample/src/main/java/com/yanzhenjie/album/sample/app/VideoActivity.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/app/VideoActivity.java @@ -17,12 +17,12 @@ import android.graphics.Color; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.Toolbar; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.appcompat.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; diff --git a/album/src/main/java/com/yanzhenjie/album/widget/photoview/AttacherImageView.java b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/AttacherImageView.java similarity index 84% rename from album/src/main/java/com/yanzhenjie/album/widget/photoview/AttacherImageView.java rename to sample/src/main/java/com/yanzhenjie/album/sample/photoview/AttacherImageView.java index 71842d1..582a76e 100644 --- a/album/src/main/java/com/yanzhenjie/album/widget/photoview/AttacherImageView.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/AttacherImageView.java @@ -1,15 +1,15 @@ -package com.yanzhenjie.album.widget.photoview; +package com.yanzhenjie.album.sample.photoview; import android.content.Context; import android.graphics.drawable.Drawable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.util.AttributeSet; /** * Created by Yan Zhenjie on 2017/3/31. */ -public class AttacherImageView extends android.support.v7.widget.AppCompatImageView { +public class AttacherImageView extends androidx.appcompat.widget.AppCompatImageView { private PhotoViewAttacher mAttacher; diff --git a/album/src/main/java/com/yanzhenjie/album/widget/photoview/Compat.java b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/Compat.java similarity index 96% rename from album/src/main/java/com/yanzhenjie/album/widget/photoview/Compat.java rename to sample/src/main/java/com/yanzhenjie/album/sample/photoview/Compat.java index 7bf9dc1..70e7c92 100644 --- a/album/src/main/java/com/yanzhenjie/album/widget/photoview/Compat.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/Compat.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yanzhenjie.album.widget.photoview; +package com.yanzhenjie.album.sample.photoview; import android.annotation.TargetApi; import android.os.Build.VERSION; diff --git a/album/src/main/java/com/yanzhenjie/album/widget/photoview/DefaultOnDoubleTapListener.java b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/DefaultOnDoubleTapListener.java similarity index 98% rename from album/src/main/java/com/yanzhenjie/album/widget/photoview/DefaultOnDoubleTapListener.java rename to sample/src/main/java/com/yanzhenjie/album/sample/photoview/DefaultOnDoubleTapListener.java index d1b120c..a0cbf05 100644 --- a/album/src/main/java/com/yanzhenjie/album/widget/photoview/DefaultOnDoubleTapListener.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/DefaultOnDoubleTapListener.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yanzhenjie.album.widget.photoview; +package com.yanzhenjie.album.sample.photoview; import android.graphics.RectF; import android.view.GestureDetector; diff --git a/album/src/main/java/com/yanzhenjie/album/widget/photoview/IPhotoView.java b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/IPhotoView.java similarity index 99% rename from album/src/main/java/com/yanzhenjie/album/widget/photoview/IPhotoView.java rename to sample/src/main/java/com/yanzhenjie/album/sample/photoview/IPhotoView.java index ab27a5c..75c80dc 100644 --- a/album/src/main/java/com/yanzhenjie/album/widget/photoview/IPhotoView.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/IPhotoView.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yanzhenjie.album.widget.photoview; +package com.yanzhenjie.album.sample.photoview; import android.graphics.Bitmap; import android.graphics.Matrix; diff --git a/album/src/main/java/com/yanzhenjie/album/widget/photoview/PhotoViewAttacher.java b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/PhotoViewAttacher.java similarity index 98% rename from album/src/main/java/com/yanzhenjie/album/widget/photoview/PhotoViewAttacher.java rename to sample/src/main/java/com/yanzhenjie/album/sample/photoview/PhotoViewAttacher.java index 53ba105..72d8608 100644 --- a/album/src/main/java/com/yanzhenjie/album/widget/photoview/PhotoViewAttacher.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/PhotoViewAttacher.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yanzhenjie.album.widget.photoview; +package com.yanzhenjie.album.sample.photoview; import android.annotation.SuppressLint; import android.content.Context; @@ -22,8 +22,8 @@ import android.graphics.Matrix.ScaleToFit; import android.graphics.RectF; import android.graphics.drawable.Drawable; -import android.support.annotation.Nullable; -import android.support.v4.view.MotionEventCompat; +import androidx.annotation.Nullable; +import androidx.core.view.MotionEventCompat; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; @@ -35,9 +35,9 @@ import android.widget.ImageView; import android.widget.ImageView.ScaleType; -import com.yanzhenjie.album.widget.photoview.gestures.OnGestureListener; -import com.yanzhenjie.album.widget.photoview.gestures.VersionedGestureDetector; -import com.yanzhenjie.album.widget.photoview.scrollerproxy.ScrollerProxy; +import com.yanzhenjie.album.sample.photoview.gestures.OnGestureListener; +import com.yanzhenjie.album.sample.photoview.gestures.VersionedGestureDetector; +import com.yanzhenjie.album.sample.photoview.scrollerproxy.ScrollerProxy; import java.lang.ref.WeakReference; @@ -118,7 +118,7 @@ private static void setImageViewScaleTypeMatrix(ImageView imageView) { // Gesture Detectors private GestureDetector mGestureDetector; - private com.yanzhenjie.album.widget.photoview.gestures.GestureDetector mScaleDragDetector; + private com.yanzhenjie.album.sample.photoview.gestures.GestureDetector mScaleDragDetector; // These are set so we don't keep allocating them on the heap private final Matrix mBaseMatrix = new Matrix(); diff --git a/album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/CupcakeGestureDetector.java b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/CupcakeGestureDetector.java similarity index 98% rename from album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/CupcakeGestureDetector.java rename to sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/CupcakeGestureDetector.java index 9f31c1c..b3ce78d 100644 --- a/album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/CupcakeGestureDetector.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/CupcakeGestureDetector.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yanzhenjie.album.widget.photoview.gestures; +package com.yanzhenjie.album.sample.photoview.gestures; import android.content.Context; import android.view.MotionEvent; diff --git a/album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/EclairGestureDetector.java b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/EclairGestureDetector.java similarity index 96% rename from album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/EclairGestureDetector.java rename to sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/EclairGestureDetector.java index 32053b4..3b57f46 100644 --- a/album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/EclairGestureDetector.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/EclairGestureDetector.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yanzhenjie.album.widget.photoview.gestures; +package com.yanzhenjie.album.sample.photoview.gestures; import android.annotation.TargetApi; import android.content.Context; import android.view.MotionEvent; -import com.yanzhenjie.album.widget.photoview.Compat; +import com.yanzhenjie.album.sample.photoview.Compat; @TargetApi(5) public class EclairGestureDetector extends CupcakeGestureDetector { diff --git a/album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/FroyoGestureDetector.java b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/FroyoGestureDetector.java similarity index 97% rename from album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/FroyoGestureDetector.java rename to sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/FroyoGestureDetector.java index fd50b6e..4349ca2 100644 --- a/album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/FroyoGestureDetector.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/FroyoGestureDetector.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yanzhenjie.album.widget.photoview.gestures; +package com.yanzhenjie.album.sample.photoview.gestures; import android.annotation.TargetApi; import android.content.Context; diff --git a/album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/GestureDetector.java b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/GestureDetector.java similarity index 93% rename from album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/GestureDetector.java rename to sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/GestureDetector.java index 8cc90a5..e90c666 100644 --- a/album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/GestureDetector.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/GestureDetector.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yanzhenjie.album.widget.photoview.gestures; +package com.yanzhenjie.album.sample.photoview.gestures; import android.view.MotionEvent; diff --git a/album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/OnGestureListener.java b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/OnGestureListener.java similarity index 93% rename from album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/OnGestureListener.java rename to sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/OnGestureListener.java index a6356c3..0bda9be 100644 --- a/album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/OnGestureListener.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/OnGestureListener.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yanzhenjie.album.widget.photoview.gestures; +package com.yanzhenjie.album.sample.photoview.gestures; public interface OnGestureListener { diff --git a/album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/VersionedGestureDetector.java b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/VersionedGestureDetector.java similarity index 96% rename from album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/VersionedGestureDetector.java rename to sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/VersionedGestureDetector.java index b358c0b..05082ed 100644 --- a/album/src/main/java/com/yanzhenjie/album/widget/photoview/gestures/VersionedGestureDetector.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/gestures/VersionedGestureDetector.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yanzhenjie.album.widget.photoview.gestures; +package com.yanzhenjie.album.sample.photoview.gestures; import android.content.Context; import android.os.Build; diff --git a/album/src/main/java/com/yanzhenjie/album/widget/photoview/scrollerproxy/GingerScroller.java b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/scrollerproxy/GingerScroller.java similarity index 96% rename from album/src/main/java/com/yanzhenjie/album/widget/photoview/scrollerproxy/GingerScroller.java rename to sample/src/main/java/com/yanzhenjie/album/sample/photoview/scrollerproxy/GingerScroller.java index 592c262..f8f3290 100644 --- a/album/src/main/java/com/yanzhenjie/album/widget/photoview/scrollerproxy/GingerScroller.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/scrollerproxy/GingerScroller.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yanzhenjie.album.widget.photoview.scrollerproxy; +package com.yanzhenjie.album.sample.photoview.scrollerproxy; import android.annotation.TargetApi; import android.content.Context; diff --git a/album/src/main/java/com/yanzhenjie/album/widget/photoview/scrollerproxy/IcsScroller.java b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/scrollerproxy/IcsScroller.java similarity index 93% rename from album/src/main/java/com/yanzhenjie/album/widget/photoview/scrollerproxy/IcsScroller.java rename to sample/src/main/java/com/yanzhenjie/album/sample/photoview/scrollerproxy/IcsScroller.java index d165aa6..3a3f2e9 100644 --- a/album/src/main/java/com/yanzhenjie/album/widget/photoview/scrollerproxy/IcsScroller.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/scrollerproxy/IcsScroller.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yanzhenjie.album.widget.photoview.scrollerproxy; +package com.yanzhenjie.album.sample.photoview.scrollerproxy; import android.annotation.TargetApi; import android.content.Context; diff --git a/album/src/main/java/com/yanzhenjie/album/widget/photoview/scrollerproxy/PreGingerScroller.java b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/scrollerproxy/PreGingerScroller.java similarity index 96% rename from album/src/main/java/com/yanzhenjie/album/widget/photoview/scrollerproxy/PreGingerScroller.java rename to sample/src/main/java/com/yanzhenjie/album/sample/photoview/scrollerproxy/PreGingerScroller.java index 677c734..04b6b39 100644 --- a/album/src/main/java/com/yanzhenjie/album/widget/photoview/scrollerproxy/PreGingerScroller.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/scrollerproxy/PreGingerScroller.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yanzhenjie.album.widget.photoview.scrollerproxy; +package com.yanzhenjie.album.sample.photoview.scrollerproxy; import android.content.Context; import android.widget.Scroller; diff --git a/album/src/main/java/com/yanzhenjie/album/widget/photoview/scrollerproxy/ScrollerProxy.java b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/scrollerproxy/ScrollerProxy.java similarity index 96% rename from album/src/main/java/com/yanzhenjie/album/widget/photoview/scrollerproxy/ScrollerProxy.java rename to sample/src/main/java/com/yanzhenjie/album/sample/photoview/scrollerproxy/ScrollerProxy.java index 2f2fd1a..652eb00 100644 --- a/album/src/main/java/com/yanzhenjie/album/widget/photoview/scrollerproxy/ScrollerProxy.java +++ b/sample/src/main/java/com/yanzhenjie/album/sample/photoview/scrollerproxy/ScrollerProxy.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.yanzhenjie.album.widget.photoview.scrollerproxy; +package com.yanzhenjie.album.sample.photoview.scrollerproxy; import android.content.Context; import android.os.Build.VERSION; diff --git a/sample/src/main/res/layout/activity_album.xml b/sample/src/main/res/layout/activity_album.xml index 030c2ea..79ae7eb 100644 --- a/sample/src/main/res/layout/activity_album.xml +++ b/sample/src/main/res/layout/activity_album.xml @@ -14,11 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. --> - - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_album_filter.xml b/sample/src/main/res/layout/activity_album_filter.xml index c914c76..23a7c11 100644 --- a/sample/src/main/res/layout/activity_album_filter.xml +++ b/sample/src/main/res/layout/activity_album_filter.xml @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. --> - @@ -32,11 +32,11 @@ android:text="@string/hint_image_preview_click" android:visibility="gone" /> - - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_album_ui.xml b/sample/src/main/res/layout/activity_album_ui.xml index 061233b..aa9b0ba 100644 --- a/sample/src/main/res/layout/activity_album_ui.xml +++ b/sample/src/main/res/layout/activity_album_ui.xml @@ -13,10 +13,10 @@ See the License for the specific language governing permissions and limitations under the License. --> - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_camera.xml b/sample/src/main/res/layout/activity_camera.xml index ed5baaa..33d813d 100644 --- a/sample/src/main/res/layout/activity_camera.xml +++ b/sample/src/main/res/layout/activity_camera.xml @@ -1,5 +1,4 @@ - - - @@ -31,12 +30,12 @@ style="@style/Album.WrapContent.WidthMatchParent" android:layout_margin="@dimen/album_dp_10" /> - + app:actualImageScaleType="fitCenter" /> - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_gallery.xml b/sample/src/main/res/layout/activity_gallery.xml index dde472a..2500b6a 100644 --- a/sample/src/main/res/layout/activity_gallery.xml +++ b/sample/src/main/res/layout/activity_gallery.xml @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. --> - @@ -26,12 +26,12 @@ android:orientation="vertical" app:layout_behavior="@string/appbar_scrolling_view_behavior"> - - - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_list_content.xml b/sample/src/main/res/layout/activity_list_content.xml index eb287a6..3a4b12d 100644 --- a/sample/src/main/res/layout/activity_list_content.xml +++ b/sample/src/main/res/layout/activity_list_content.xml @@ -27,11 +27,11 @@ android:text="@string/hint_image_preview_click" android:visibility="gone" /> - - diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml index 992c0c2..db123c0 100644 --- a/sample/src/main/res/layout/activity_main.xml +++ b/sample/src/main/res/layout/activity_main.xml @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. --> - - @@ -28,7 +28,7 @@ style="@style/Album.WrapContent.WidthMatchParent" android:orientation="vertical"> - @@ -37,39 +37,39 @@ style="@style/Album.WrapContent.WidthMatchParent" android:orientation="horizontal"> - - - - - - - + - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/album_item_content_image.xml b/sample/src/main/res/layout/album_item_content_image.xml new file mode 100644 index 0000000..2e7df31 --- /dev/null +++ b/sample/src/main/res/layout/album_item_content_image.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sample/src/main/res/layout/album_item_content_video.xml b/sample/src/main/res/layout/album_item_content_video.xml new file mode 100644 index 0000000..3c0ec35 --- /dev/null +++ b/sample/src/main/res/layout/album_item_content_video.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sample/src/main/res/layout/album_item_dialog_folder.xml b/sample/src/main/res/layout/album_item_dialog_folder.xml new file mode 100644 index 0000000..24b03d4 --- /dev/null +++ b/sample/src/main/res/layout/album_item_dialog_folder.xml @@ -0,0 +1,53 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sample/src/main/res/layout/item_content_image.xml b/sample/src/main/res/layout/item_content_image.xml index 09fc0ef..41a6cae 100644 --- a/sample/src/main/res/layout/item_content_image.xml +++ b/sample/src/main/res/layout/item_content_image.xml @@ -1,5 +1,4 @@ - - - \ No newline at end of file + + + + diff --git a/sample/src/main/res/layout/item_content_video.xml b/sample/src/main/res/layout/item_content_video.xml index 7755cde..6b66897 100644 --- a/sample/src/main/res/layout/item_content_video.xml +++ b/sample/src/main/res/layout/item_content_video.xml @@ -1,5 +1,4 @@ - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/sample/src/main/res/layout/toolbar_scroll.xml b/sample/src/main/res/layout/toolbar_scroll.xml index 6b8a9f3..1b19495 100644 --- a/sample/src/main/res/layout/toolbar_scroll.xml +++ b/sample/src/main/res/layout/toolbar_scroll.xml @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. --> - - - \ No newline at end of file + \ No newline at end of file