aboutsummaryrefslogtreecommitdiff
path: root/imagepicker/src/main
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-23 13:13:36 -0700
committerGitHub <noreply@github.com>2017-07-23 13:13:36 -0700
commit4706b8f6a8d08a6961da6ab34d15881b63356d79 (patch)
tree3d1e611e43bd589a98a5f1840c5b6f52ff254468 /imagepicker/src/main
parent61d87976e8b29ed25061ae98743a6cf4f4274542 (diff)
downloadkau-4706b8f6a8d08a6961da6ab34d15881b63356d79.tar.gz
kau-4706b8f6a8d08a6961da6ab34d15881b63356d79.tar.bz2
kau-4706b8f6a8d08a6961da6ab34d15881b63356d79.zip
Update kpref-activity's min-sdk and other minor changes (#11)3.1.0
* Move some resources to public * Lower kpref minsdk * Remove excess kauUtils annotations * Allow nullable throwable * Do not throw null throwable * Make image picker base abstract again * Migrate about strings to private * Update readme * Update readme * Update sample tagging * Update adapter readme
Diffstat (limited to 'imagepicker/src/main')
-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
7 files changed, 10 insertions, 10 deletions
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>