diff --git a/README.md b/README.md index 6833f6a..cd66209 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ RxImagePicker的设计起源,请参考我的[这篇文章](https://www.jianshu * **[详细文档,包括进阶使用和拓展功能,请点击查看wiki!](https://github.com/qingmei2/RxImagePicker/wiki)** * **[常见问题](https://github.com/qingmei2/RxImagePicker/wiki/常见问题)** : 提issue之前查看一下,也许能节省您很多的时间! -* **[更新日志](https://github.com/qingmei2/RxImagePicker/wiki/ChangeLog)** : 升级库之前,请查看新版本关于API有可能出现的变动。 +* **[更新日志](https://github.com/qingmei2/RxImagePicker/wiki/ChangeLog)** : 升级库之前,请查看新版本关于API有可能出现的变动,**最新版本v2.1.1**。

简介

@@ -71,15 +71,16 @@ RxImagePicker是一个用于Android的响应式图片选择器,它将您的图 ```groovy // 最基础的架构,仅提供了系统默认的图片选择器和拍照功能 -compile 'com.github.qingmei2:rximagepicker:0.4.0' +compile 'com.github.qingmei2:rximagepicker:2.1.1' // 提供了自定义UI图片选择器的基本组件,自定义UI的需求需要添加该依赖 -compile 'com.github.qingmei2:rximagepicker_support:0.4.0' +compile 'com.github.qingmei2:rximagepicker_support:2.1.1' // 如果需要额外的UI支持,请选择依赖对应的UI拓展库 -compile 'com.github.qingmei2:rximagepicker_support_zhihu:0.4.0' // 知乎图片选择器 -compile 'com.github.qingmei2:rximagepicker_support_wechat:0.4.0' // 微信图片选择器 +compile 'com.github.qingmei2:rximagepicker_support_zhihu:2.1.1' // 知乎图片选择器 +compile 'com.github.qingmei2:rximagepicker_support_wechat:2.1.1' // 微信图片选择器 ``` + ### 2. 接口配置 声明一个接口,并进行基础的配置: @@ -144,7 +145,7 @@ private void onButtonClick() { * [RxCache:Reactive caching library for Android and Java](https://github.com/VictorAlbertos/RxCache) 优秀的RxJava拓展库,用于处理RxJava的数据缓存,库底层通过Dagger完成对配置的处理,我借鉴在了RxImagePicker中。 * [Dagger2:A fast dependency injector for Android and Java.](https://github.com/google/dagger) - Google优秀的依赖注入框架,它是构成RxImagePicker的 **基础组件** 。 + Google优秀的依赖注入框架,0.4.0版本之前,它是构成RxImagePicker的 **基础组件** 。 * [Matisse:A well-designed local image and video selector for Android](https://github.com/zhihu/Matisse) 知乎开源,优秀的Android图片选择库,拥有非常 **Material Design** 的设计。在RxImagePicker中,Matisse被抽出来放入了RxImagePicker_Support,成为了 **UI层的基础组件** 。 diff --git a/config.gradle b/config.gradle index 474277a..49576c4 100644 --- a/config.gradle +++ b/config.gradle @@ -12,8 +12,8 @@ project.ext { minSdkVersion : 14, targetSdkVersion : 27, - versionCode : 15, - versionName : "2.0.0" + versionCode : 17, + versionName : "2.1.1" ] dependencies = [ diff --git a/rximagepicker_support/src/main/java/com/qingmei2/rximagepicker_extension/ui/adapter/AlbumMediaAdapter.kt b/rximagepicker_support/src/main/java/com/qingmei2/rximagepicker_extension/ui/adapter/AlbumMediaAdapter.kt index da88605..5aca46e 100644 --- a/rximagepicker_support/src/main/java/com/qingmei2/rximagepicker_extension/ui/adapter/AlbumMediaAdapter.kt +++ b/rximagepicker_support/src/main/java/com/qingmei2/rximagepicker_extension/ui/adapter/AlbumMediaAdapter.kt @@ -49,9 +49,7 @@ open class AlbumMediaAdapter(context: Context, private var mOnMediaClickListener: OnMediaClickListener? = null private var mImageResize: Int = 0 - open val itemLayoutRes: Int - @LayoutRes - get() = R.layout.media_grid_item + open val itemLayoutRes: Int = R.layout.media_grid_item init { mSelectionSpec = SelectionSpec.instance diff --git a/rximagepicker_support/src/main/java/com/qingmei2/rximagepicker_extension/ui/widget/CheckView.kt b/rximagepicker_support/src/main/java/com/qingmei2/rximagepicker_extension/ui/widget/CheckView.kt index 99f177c..f1fc542 100644 --- a/rximagepicker_support/src/main/java/com/qingmei2/rximagepicker_extension/ui/widget/CheckView.kt +++ b/rximagepicker_support/src/main/java/com/qingmei2/rximagepicker_extension/ui/widget/CheckView.kt @@ -46,7 +46,6 @@ open class CheckView : View { protected var mDensity: Float = 0.toFloat() protected var mCheckRect: Rect? = null protected var mEnabled = true - // rect for drawing checked number or mark private val checkRect: Rect get() { @@ -216,12 +215,11 @@ open class CheckView : View { companion object { const val UNCHECKED = Integer.MIN_VALUE - protected const val STROKE_WIDTH = 3.0f // dp - protected const val SHADOW_WIDTH = 6.0f // dp - @JvmStatic - protected val SIZE = 48 // dp - protected val STROKE_RADIUS = 11.5f // dp - protected const val BG_RADIUS = 11.0f // dp - protected const val CONTENT_SIZE = 16 // dp + const val SIZE = 48 // dp + const val STROKE_RADIUS = 11.5f // dp + const val STROKE_WIDTH = 3.0f // dp + const val SHADOW_WIDTH = 6.0f // dp + const val BG_RADIUS = 11.0f // dp + const val CONTENT_SIZE = 16 // dp } } diff --git a/rximagepicker_support/src/main/java/com/qingmei2/rximagepicker_extension/ui/widget/MediaGrid.kt b/rximagepicker_support/src/main/java/com/qingmei2/rximagepicker_extension/ui/widget/MediaGrid.kt index 24e37e2..bd1ea5e 100644 --- a/rximagepicker_support/src/main/java/com/qingmei2/rximagepicker_extension/ui/widget/MediaGrid.kt +++ b/rximagepicker_support/src/main/java/com/qingmei2/rximagepicker_extension/ui/widget/MediaGrid.kt @@ -48,8 +48,12 @@ open class MediaGrid : SquareFrameLayout, View.OnClickListener { init(context) } - protected open fun init(context: Context) { - LayoutInflater.from(context).inflate(R.layout.media_grid_content, this, true) + open fun getLayoutRes(): Int { + return R.layout.media_grid_content + } + + fun init(context: Context) { + LayoutInflater.from(context).inflate(getLayoutRes(), this, true) mThumbnail = findViewById(R.id.media_thumbnail) mCheckView = findViewById(R.id.check_view) diff --git a/rximagepicker_support_wechat/build.gradle b/rximagepicker_support_wechat/build.gradle index 2cda9bc..65daaef 100644 --- a/rximagepicker_support_wechat/build.gradle +++ b/rximagepicker_support_wechat/build.gradle @@ -28,6 +28,7 @@ android { } } } + dependencies { implementation project(':rximagepicker') implementation project(':rximagepicker_support') diff --git a/rximagepicker_support_wechat/src/main/java/com/qingmei2/rximagepicker_extension_wechat/ui/widget/WechatCheckView.kt b/rximagepicker_support_wechat/src/main/java/com/qingmei2/rximagepicker_extension_wechat/ui/widget/WechatCheckView.kt index 1241dad..e32b37d 100644 --- a/rximagepicker_support_wechat/src/main/java/com/qingmei2/rximagepicker_extension_wechat/ui/widget/WechatCheckView.kt +++ b/rximagepicker_support_wechat/src/main/java/com/qingmei2/rximagepicker_extension_wechat/ui/widget/WechatCheckView.kt @@ -11,7 +11,7 @@ import android.util.AttributeSet import com.qingmei2.rximagepicker_extension.ui.widget.CheckView -class WechatCheckView : CheckView { +open class WechatCheckView : CheckView { private var rect: RectF? = null private var drawableRect: Rect? = null @@ -27,8 +27,8 @@ class WechatCheckView : CheckView { mStrokePaint.strokeWidth = WECHAT_STROKE_WIDTH * mDensity // draw white stroke - val dx = mDensity * CheckView.SIZE / 4 - val dy = mDensity * CheckView.SIZE / 4 + val dx = mDensity * SIZE / 4 + val dy = mDensity * SIZE / 4 rect = RectF(2 * dx - PROOFREAD_SIZE, dy - PROOFREAD_SIZE, 3 * dx + PROOFREAD_SIZE, 2 * dy + PROOFREAD_SIZE) drawableRect = Rect(rect!!.left.toInt(), rect!!.top.toInt(), rect!!.right.toInt(), rect!!.bottom.toInt()) @@ -89,6 +89,7 @@ class WechatCheckView : CheckView { private const val WECHAT_STROKE_WIDTH = 1.5f // dp private const val WECHAT_STROKE_CONNER = 5f // dp + private const val SIZE = 48 // dp private const val PROOFREAD_SIZE = 8 } diff --git a/rximagepicker_support_wechat/src/main/java/com/qingmei2/rximagepicker_extension_wechat/ui/widget/WechatMediaGrid.kt b/rximagepicker_support_wechat/src/main/java/com/qingmei2/rximagepicker_extension_wechat/ui/widget/WechatMediaGrid.kt index 5db4d7c..f2e5389 100644 --- a/rximagepicker_support_wechat/src/main/java/com/qingmei2/rximagepicker_extension_wechat/ui/widget/WechatMediaGrid.kt +++ b/rximagepicker_support_wechat/src/main/java/com/qingmei2/rximagepicker_extension_wechat/ui/widget/WechatMediaGrid.kt @@ -13,15 +13,7 @@ class WechatMediaGrid : MediaGrid { constructor(context: Context, attrs: AttributeSet) : super(context, attrs) - override fun init(context: Context) { - LayoutInflater.from(context).inflate(R.layout.wechat_media_grid_content, this, true) - - mThumbnail = findViewById(R.id.media_thumbnail) - mCheckView = findViewById(R.id.check_view) - mGifTag = findViewById(R.id.gif) - mVideoDuration = findViewById(R.id.video_duration) - - mThumbnail.setOnClickListener(this) - mCheckView.setOnClickListener(this) + override fun getLayoutRes(): Int { + return R.layout.wechat_media_grid_content } } diff --git a/sample/build.gradle b/sample/build.gradle index 0913e9f..fb12053 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -30,15 +30,15 @@ dependencies { implementation rootProject.ext.dependencies["design"] implementation rootProject.ext.dependencies["glide"] annotationProcessor rootProject.ext.dependencies["glide-compiler"] - implementation project(':rximagepicker') - implementation project(':rximagepicker_support') - implementation project(':rximagepicker_support_wechat') - implementation project(':rximagepicker_support_zhihu') +// implementation project(':rximagepicker') +// implementation project(':rximagepicker_support') +// implementation project(':rximagepicker_support_wechat') +// implementation project(':rximagepicker_support_zhihu') -// implementation 'com.github.qingmei2:rximagepicker:2.0.0' -// implementation 'com.github.qingmei2:rximagepicker_support:2.0.0' -// implementation 'com.github.qingmei2:rximagepicker_support_zhihu:2.0.0' -// implementation 'com.github.qingmei2:rximagepicker_support_wechat:2.0.0' + implementation "com.github.qingmei2:rximagepicker:2.1.1" + implementation "com.github.qingmei2:rximagepicker_support:2.1.1" + implementation "com.github.qingmei2:rximagepicker_support_zhihu:2.1.1" + implementation "com.github.qingmei2:rximagepicker_support_wechat:2.1.1" testImplementation rootProject.ext.dependencies["junit"] }