From d0f719faf972b6396bde79d7e8d1f3d613bb71b9 Mon Sep 17 00:00:00 2001 From: SherlockKudou Date: Wed, 20 Dec 2023 14:49:01 +0800 Subject: [PATCH] =?UTF-8?q?release:=207.3.0.=E5=A2=9E=E5=8A=A0=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=8B=96=E6=8B=BD=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit release: 7.3.0.增加页面拖拽回调 --- README.md | 2 +- gradlew | 0 .../main/java/cc/shinichi/library/ImagePreview.kt | 7 +++++++ .../java/cc/shinichi/library/bean/ImageInfo.kt | 0 .../shinichi/library/view/ImagePreviewActivity.kt | 0 .../shinichi/library/view/ImagePreviewAdapter.kt | 3 ++- .../library/view/listener/OnPageDragListener.kt | 14 ++++++++++++++ .../view/photoview/CustomGestureDetector.java | 0 .../library/view/subsampling/ImageSource.java | 0 .../library/view/subsampling/ImageViewState.java | 0 .../subsampling/SubsamplingScaleImageView.java | 0 .../subsampling/decoder/CompatDecoderFactory.java | 0 .../view/subsampling/decoder/DecoderFactory.java | 0 .../view/subsampling/decoder/ImageDecoder.java | 0 .../subsampling/decoder/ImageRegionDecoder.java | 0 .../view/subsampling/decoder/SkiaImageDecoder.java | 0 .../decoder/SkiaImageRegionDecoder.java | 0 .../decoder/SkiaPooledImageRegionDecoder.java | 0 library/src/main/res/layout/sh_item_photoview.xml | 0 library/src/main/res/layout/sh_layout_preview.xml | 0 sample/build.gradle | 6 +++--- .../shinichi/bigimageviewpager/MainActivity.java | 9 +++++++++ .../src/main/res/layout/custom_layout_preview.xml | 0 23 files changed, 36 insertions(+), 5 deletions(-) mode change 100755 => 100644 gradlew mode change 100755 => 100644 library/src/main/java/cc/shinichi/library/bean/ImageInfo.kt mode change 100755 => 100644 library/src/main/java/cc/shinichi/library/view/ImagePreviewActivity.kt mode change 100755 => 100644 library/src/main/java/cc/shinichi/library/view/ImagePreviewAdapter.kt create mode 100644 library/src/main/java/cc/shinichi/library/view/listener/OnPageDragListener.kt mode change 100755 => 100644 library/src/main/java/cc/shinichi/library/view/photoview/CustomGestureDetector.java mode change 100755 => 100644 library/src/main/java/cc/shinichi/library/view/subsampling/ImageSource.java mode change 100755 => 100644 library/src/main/java/cc/shinichi/library/view/subsampling/ImageViewState.java mode change 100755 => 100644 library/src/main/java/cc/shinichi/library/view/subsampling/SubsamplingScaleImageView.java mode change 100755 => 100644 library/src/main/java/cc/shinichi/library/view/subsampling/decoder/CompatDecoderFactory.java mode change 100755 => 100644 library/src/main/java/cc/shinichi/library/view/subsampling/decoder/DecoderFactory.java mode change 100755 => 100644 library/src/main/java/cc/shinichi/library/view/subsampling/decoder/ImageDecoder.java mode change 100755 => 100644 library/src/main/java/cc/shinichi/library/view/subsampling/decoder/ImageRegionDecoder.java mode change 100755 => 100644 library/src/main/java/cc/shinichi/library/view/subsampling/decoder/SkiaImageDecoder.java mode change 100755 => 100644 library/src/main/java/cc/shinichi/library/view/subsampling/decoder/SkiaImageRegionDecoder.java mode change 100755 => 100644 library/src/main/java/cc/shinichi/library/view/subsampling/decoder/SkiaPooledImageRegionDecoder.java mode change 100755 => 100644 library/src/main/res/layout/sh_item_photoview.xml mode change 100755 => 100644 library/src/main/res/layout/sh_layout_preview.xml mode change 100755 => 100644 sample/src/main/res/layout/custom_layout_preview.xml diff --git a/README.md b/README.md index 31be8b8..4b51cb2 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ allprojects { dependencies { // 添加本框架 BigImageViewPager https://github.com/SherlockGougou/BigImageViewPager // 此处展示的是最新版本 - implementation 'com.github.SherlockGougou:BigImageViewPager:androidx-7.2.7' + implementation 'com.github.SherlockGougou:BigImageViewPager:androidx-7.3.0' // 另外还需要依赖 glide implementation 'com.github.bumptech.glide:glide:4.11.0' diff --git a/gradlew b/gradlew old mode 100755 new mode 100644 diff --git a/library/src/main/java/cc/shinichi/library/ImagePreview.kt b/library/src/main/java/cc/shinichi/library/ImagePreview.kt index 59bb991..b604ef2 100644 --- a/library/src/main/java/cc/shinichi/library/ImagePreview.kt +++ b/library/src/main/java/cc/shinichi/library/ImagePreview.kt @@ -144,6 +144,8 @@ class ImagePreview { private set var onPageFinishListener: OnPageFinishListener? = null private set + var onPageDragListener: OnPageDragListener? = null + private set // 自定义百分比布局layout id @LayoutRes @@ -387,6 +389,11 @@ class ImagePreview { return this } + fun setOnPageDragListener(onPageDragListener: OnPageDragListener): ImagePreview { + this.onPageDragListener = onPageDragListener + return this + } + private fun setOnOriginProgressListener(onOriginProgressListener: OnOriginProgressListener): ImagePreview { this.onOriginProgressListener = onOriginProgressListener return this diff --git a/library/src/main/java/cc/shinichi/library/bean/ImageInfo.kt b/library/src/main/java/cc/shinichi/library/bean/ImageInfo.kt old mode 100755 new mode 100644 diff --git a/library/src/main/java/cc/shinichi/library/view/ImagePreviewActivity.kt b/library/src/main/java/cc/shinichi/library/view/ImagePreviewActivity.kt old mode 100755 new mode 100644 diff --git a/library/src/main/java/cc/shinichi/library/view/ImagePreviewAdapter.kt b/library/src/main/java/cc/shinichi/library/view/ImagePreviewAdapter.kt old mode 100755 new mode 100644 index aa2c36f..7bd8b69 --- a/library/src/main/java/cc/shinichi/library/view/ImagePreviewAdapter.kt +++ b/library/src/main/java/cc/shinichi/library/view/ImagePreviewAdapter.kt @@ -153,7 +153,8 @@ class ImagePreviewAdapter(private val activity: AppCompatActivity, imageList: Mu } if (ImagePreview.instance.isEnableDragClose) { - fingerDragHelper.setOnAlphaChangeListener { _, translationY -> + fingerDragHelper.setOnAlphaChangeListener { event, translationY -> + ImagePreview.instance.onPageDragListener?.onDrag(event, translationY) val yAbs = abs(translationY) val percent = yAbs / getPhoneHei(activity.applicationContext) val number = 1.0f - percent diff --git a/library/src/main/java/cc/shinichi/library/view/listener/OnPageDragListener.kt b/library/src/main/java/cc/shinichi/library/view/listener/OnPageDragListener.kt new file mode 100644 index 0000000..b3f6b1a --- /dev/null +++ b/library/src/main/java/cc/shinichi/library/view/listener/OnPageDragListener.kt @@ -0,0 +1,14 @@ +package cc.shinichi.library.view.listener + +import android.view.MotionEvent + +/** + * @author 工藤 + * @email qinglingou@gmail.com + * cc.shinichi.library.view.listener + * create at 2018/12/19 16:23 + * description: 页面拖拽回调 + */ +abstract class OnPageDragListener { + abstract fun onDrag(event: MotionEvent?, translationY: Float) +} \ No newline at end of file diff --git a/library/src/main/java/cc/shinichi/library/view/photoview/CustomGestureDetector.java b/library/src/main/java/cc/shinichi/library/view/photoview/CustomGestureDetector.java old mode 100755 new mode 100644 diff --git a/library/src/main/java/cc/shinichi/library/view/subsampling/ImageSource.java b/library/src/main/java/cc/shinichi/library/view/subsampling/ImageSource.java old mode 100755 new mode 100644 diff --git a/library/src/main/java/cc/shinichi/library/view/subsampling/ImageViewState.java b/library/src/main/java/cc/shinichi/library/view/subsampling/ImageViewState.java old mode 100755 new mode 100644 diff --git a/library/src/main/java/cc/shinichi/library/view/subsampling/SubsamplingScaleImageView.java b/library/src/main/java/cc/shinichi/library/view/subsampling/SubsamplingScaleImageView.java old mode 100755 new mode 100644 diff --git a/library/src/main/java/cc/shinichi/library/view/subsampling/decoder/CompatDecoderFactory.java b/library/src/main/java/cc/shinichi/library/view/subsampling/decoder/CompatDecoderFactory.java old mode 100755 new mode 100644 diff --git a/library/src/main/java/cc/shinichi/library/view/subsampling/decoder/DecoderFactory.java b/library/src/main/java/cc/shinichi/library/view/subsampling/decoder/DecoderFactory.java old mode 100755 new mode 100644 diff --git a/library/src/main/java/cc/shinichi/library/view/subsampling/decoder/ImageDecoder.java b/library/src/main/java/cc/shinichi/library/view/subsampling/decoder/ImageDecoder.java old mode 100755 new mode 100644 diff --git a/library/src/main/java/cc/shinichi/library/view/subsampling/decoder/ImageRegionDecoder.java b/library/src/main/java/cc/shinichi/library/view/subsampling/decoder/ImageRegionDecoder.java old mode 100755 new mode 100644 diff --git a/library/src/main/java/cc/shinichi/library/view/subsampling/decoder/SkiaImageDecoder.java b/library/src/main/java/cc/shinichi/library/view/subsampling/decoder/SkiaImageDecoder.java old mode 100755 new mode 100644 diff --git a/library/src/main/java/cc/shinichi/library/view/subsampling/decoder/SkiaImageRegionDecoder.java b/library/src/main/java/cc/shinichi/library/view/subsampling/decoder/SkiaImageRegionDecoder.java old mode 100755 new mode 100644 diff --git a/library/src/main/java/cc/shinichi/library/view/subsampling/decoder/SkiaPooledImageRegionDecoder.java b/library/src/main/java/cc/shinichi/library/view/subsampling/decoder/SkiaPooledImageRegionDecoder.java old mode 100755 new mode 100644 diff --git a/library/src/main/res/layout/sh_item_photoview.xml b/library/src/main/res/layout/sh_item_photoview.xml old mode 100755 new mode 100644 diff --git a/library/src/main/res/layout/sh_layout_preview.xml b/library/src/main/res/layout/sh_layout_preview.xml old mode 100755 new mode 100644 diff --git a/sample/build.gradle b/sample/build.gradle index 99e3a35..ac156b8 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -8,8 +8,8 @@ android { applicationId "cc.shinichi.bigimageviewpager" minSdkVersion 19 targetSdkVersion 33 - versionCode 727 - versionName "androidx-7.2.7" + versionCode 730 + versionName "androidx-7.3.0" } buildTypes { release { @@ -56,6 +56,6 @@ dependencies { implementation 'com.github.bumptech.glide:okhttp3-integration:4.11.0' // library - // implementation 'com.github.SherlockGougou:BigImageViewPager:androidx-7.2.7' + // implementation 'com.github.SherlockGougou:BigImageViewPager:androidx-7.3.0' implementation project(':library') } \ No newline at end of file diff --git a/sample/src/main/java/cc/shinichi/bigimageviewpager/MainActivity.java b/sample/src/main/java/cc/shinichi/bigimageviewpager/MainActivity.java index 442a767..e6fc65a 100644 --- a/sample/src/main/java/cc/shinichi/bigimageviewpager/MainActivity.java +++ b/sample/src/main/java/cc/shinichi/bigimageviewpager/MainActivity.java @@ -5,6 +5,7 @@ import android.os.Build; import android.os.Bundle; import android.util.Log; +import android.view.MotionEvent; import android.view.View; import android.view.Window; import android.widget.CompoundButton; @@ -40,6 +41,7 @@ import cc.shinichi.library.view.listener.OnDownloadClickListener; import cc.shinichi.library.view.listener.OnDownloadListener; import cc.shinichi.library.view.listener.OnOriginProgressListener; +import cc.shinichi.library.view.listener.OnPageDragListener; import cc.shinichi.library.view.listener.OnPageFinishListener; public class MainActivity extends AppCompatActivity { @@ -473,6 +475,13 @@ public void onLayout(@NonNull View parentView) { // 自定义控件事件处理 } }) + // 监听页面拖动(自定义布局可以根据是否拖动进行隐藏或者展示) + .setOnPageDragListener(new OnPageDragListener() { + @Override + public void onDrag(MotionEvent event, float translationY) { + Log.d(TAG, "onDrag: translationY = " + translationY); + } + }) // 开启预览 .start(); } diff --git a/sample/src/main/res/layout/custom_layout_preview.xml b/sample/src/main/res/layout/custom_layout_preview.xml old mode 100755 new mode 100644