aboutsummaryrefslogtreecommitdiff
path: root/imagepicker
diff options
context:
space:
mode:
Diffstat (limited to 'imagepicker')
-rw-r--r--imagepicker/README.md6
-rw-r--r--imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImageItem.kt4
-rw-r--r--imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImagePickerActivityBase.kt (renamed from imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImagePickerActivity.kt)4
-rw-r--r--imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImagePickerBinder.kt6
-rw-r--r--imagepicker/src/main/res-public/values/colors.xml (renamed from imagepicker/src/main/res/values/colors.xml)0
-rw-r--r--imagepicker/src/main/res-public/values/dimens.xml (renamed from imagepicker/src/main/res/values/dimens.xml)0
-rw-r--r--imagepicker/src/main/res-public/values/public.xml4
-rw-r--r--imagepicker/src/main/res-public/values/styles.xml (renamed from imagepicker/src/main/res/values/styles.xml)2
8 files changed, 12 insertions, 14 deletions
diff --git a/imagepicker/README.md b/imagepicker/README.md
index 055b1c5..e37e417 100644
--- a/imagepicker/README.md
+++ b/imagepicker/README.md
@@ -3,16 +3,14 @@
ImagePicker is a beautiful gallery activity that allows you to pick images
from your storage. It is backed by FastAdapter and Glide, and offers blur and fade transitions.
-`ImagePickerActivity` is already fully functional, so you may directly add it to your manifest.
-However, you can also extend it to change the package name.
+`ImagePickerActivityBase` is already fully functional, so you may directly extend it with no further changes
+and add the activity to your manifest
You may also easily launch the activity through the simple binder:
```
Activity.kauLaunchImagePicker(YourClass::class.java, yourRequestCode)
```
-If you are using the built in activity, you may omit the class argument.
-
Note that this launches the activity through a `startActivityForResult` call
You may get the activity response by overriding your `onActivityResult` method
diff --git a/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImageItem.kt b/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImageItem.kt
index d258822..2bfc57f 100644
--- a/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImageItem.kt
+++ b/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImageItem.kt
@@ -72,13 +72,13 @@ class ImageItem(val data: ImageModel)
.sizePx(sizePx)
.paddingPx(sizePx / 3)
.color(Color.WHITE))
- imageBase.setBackgroundColor(ImagePickerActivity.accentColor)
+ imageBase.setBackgroundColor(ImagePickerActivityBase.accentColor)
imageForeground.gone()
}
private fun computeViewSize(context: Context): Int {
val screenWidthPx = context.resources.displayMetrics.widthPixels
- return screenWidthPx / ImagePickerActivity.computeColumnCount(context)
+ return screenWidthPx / ImagePickerActivityBase.computeColumnCount(context)
}
override fun unbindView(holder: ViewHolder) {
diff --git a/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImagePickerActivity.kt b/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImagePickerActivityBase.kt
index 814cde4..9d988d1 100644
--- a/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImagePickerActivity.kt
+++ b/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImagePickerActivityBase.kt
@@ -32,7 +32,7 @@ import com.mikepenz.google_material_typeface_library.GoogleMaterial
*
* Base activity for selecting images from storage
*/
-open class ImagePickerActivity : AppCompatActivity(), LoaderManager.LoaderCallbacks<Cursor> {
+abstract class ImagePickerActivityBase : AppCompatActivity(), LoaderManager.LoaderCallbacks<Cursor> {
val imageAdapter = FastItemAdapter<ImageItem>()
@@ -75,7 +75,7 @@ open class ImagePickerActivity : AppCompatActivity(), LoaderManager.LoaderCallba
supportActionBar?.apply {
setDisplayHomeAsUpEnabled(true)
setDisplayShowHomeEnabled(true)
- setHomeAsUpIndicator(GoogleMaterial.Icon.gmd_close.toDrawable(this@ImagePickerActivity, 18))
+ setHomeAsUpIndicator(GoogleMaterial.Icon.gmd_close.toDrawable(this@ImagePickerActivityBase, 18))
}
toolbar.setNavigationOnClickListener { onBackPressed() }
diff --git a/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImagePickerBinder.kt b/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImagePickerBinder.kt
index 9e63464..8e8a69c 100644
--- a/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImagePickerBinder.kt
+++ b/imagepicker/src/main/kotlin/ca/allanwang/kau/imagepicker/ImagePickerBinder.kt
@@ -13,18 +13,16 @@ import android.content.Intent
/**
* Image picker launcher
*/
-fun Activity.kauLaunchImagePicker(clazz: Class<out ImagePickerActivity>, requestCode: Int) {
+fun Activity.kauLaunchImagePicker(clazz: Class<out ImagePickerActivityBase>, requestCode: Int) {
startActivityForResult(Intent(this, clazz), requestCode)
}
-fun Activity.kauLaunchImagePicker(requestCode: Int) = kauLaunchImagePicker(ImagePickerActivity::class.java, requestCode)
-
/**
* Image picker result
* call under [Activity.onActivityResult]
* and make sure that the requestCode matches first
*/
-fun Activity.kauOnImagePickerResult(resultCode: Int, data: Intent?) = ImagePickerActivity.onImagePickerResult(resultCode, data)
+fun Activity.kauOnImagePickerResult(resultCode: Int, data: Intent?) = ImagePickerActivityBase.onImagePickerResult(resultCode, data)
internal const val LOADER_ID = 42
internal const val IMAGE_PICKER_RESULT = "image_picker_result"
diff --git a/imagepicker/src/main/res/values/colors.xml b/imagepicker/src/main/res-public/values/colors.xml
index ebaa3f7..ebaa3f7 100644
--- a/imagepicker/src/main/res/values/colors.xml
+++ b/imagepicker/src/main/res-public/values/colors.xml
diff --git a/imagepicker/src/main/res/values/dimens.xml b/imagepicker/src/main/res-public/values/dimens.xml
index 3ff2dd7..3ff2dd7 100644
--- a/imagepicker/src/main/res/values/dimens.xml
+++ b/imagepicker/src/main/res-public/values/dimens.xml
diff --git a/imagepicker/src/main/res-public/values/public.xml b/imagepicker/src/main/res-public/values/public.xml
index cf14680..3a1d9c5 100644
--- a/imagepicker/src/main/res-public/values/public.xml
+++ b/imagepicker/src/main/res-public/values/public.xml
@@ -1,4 +1,6 @@
<resources xmlns:tools='http://schemas.android.com/tools' tools:ignore='ResourceName'>
<!-- AUTO-GENERATED FILE. DO NOT MODIFY. public.xml is generated by the generatepublicxml gradle task -->
- <public name='dummy' type='id' />
+ <public name='kau_blurred_image_selection_overlay' type='color' />
+ <public name='kau_image_minimum_size' type='dimen' />
+ <public name='Kau.ImagePicker' type='style' />
</resources> \ No newline at end of file
diff --git a/imagepicker/src/main/res/values/styles.xml b/imagepicker/src/main/res-public/values/styles.xml
index 0d9ce64..4d4a135 100644
--- a/imagepicker/src/main/res/values/styles.xml
+++ b/imagepicker/src/main/res-public/values/styles.xml
@@ -1,4 +1,4 @@
-<resources>
+ <resources>
<style name="Kau.ImagePicker">
<item name="android:windowAnimationStyle">@style/KauSlideInSlideOutBottom</item>