aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md12
-rw-r--r--about/src/main/res-public/values/public.xml12
-rw-r--r--about/src/main/res/values/strings.xml (renamed from about/src/main/res-public/values/strings.xml)0
-rw-r--r--about/src/main/res/values/strings_about.xml (renamed from about/src/main/res-public/values/strings_about.xml)11
-rw-r--r--adapter/README.md19
-rw-r--r--adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt7
-rw-r--r--adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt14
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/logging/TimberLogger.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt24
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt7
-rw-r--r--core/src/main/res/values/strings.xml4
-rw-r--r--docs/Changelog.md11
-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
-rw-r--r--kpref-activity/build.gradle2
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt2
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefCheckbox.kt3
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt4
-rw-r--r--kpref-activity/src/main/res-public/values/ids.xml (renamed from kpref-activity/src/main/res/values/ids.xml)0
-rw-r--r--kpref-activity/src/main/res-public/values/public.xml17
-rw-r--r--kpref-activity/src/main/res/layout/kau_pref_checkbox.xml2
-rw-r--r--kpref-activity/src/main/res/layout/kau_pref_core.xml8
-rw-r--r--kpref-activity/src/main/res/layout/kau_pref_header.xml4
-rw-r--r--kpref-activity/src/main/res/layout/kau_pref_seekbar.xml2
-rw-r--r--kpref-activity/src/main/res/layout/kau_pref_seekbar_text.xml2
-rw-r--r--kpref-activity/src/main/res/layout/kau_pref_text.xml2
-rw-r--r--sample/build.gradle2
-rw-r--r--sample/src/main/AndroidManifest.xml2
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/ImagePickerActivity.kt8
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt3
-rw-r--r--sample/src/main/res/xml/kau_changelog.xml16
37 files changed, 136 insertions, 92 deletions
diff --git a/README.md b/README.md
index e4e71f4..771ce01 100644
--- a/README.md
+++ b/README.md
@@ -108,4 +108,14 @@ dependencies {
![Ink Indicator Gif](https://raw.githubusercontent.com/AllanWang/Storage-Hub/master/kau/kau_ink_indicator.gif)
![Color Picker Gif](https://raw.githubusercontent.com/AllanWang/Storage-Hub/master/kau/kau_color_picker.gif)
![KPref Items Gif](https://raw.githubusercontent.com/AllanWang/Storage-Hub/master/kau/kau_kpref_items.gif)
-![SearchView Gif](https://raw.githubusercontent.com/AllanWang/Storage-Hub/master/kau/kau_search_view.gif) \ No newline at end of file
+![SearchView Gif](https://raw.githubusercontent.com/AllanWang/Storage-Hub/master/kau/kau_search_view.gif)
+
+# Proguard/MultiDex
+
+Given that the core module contains a lot of extension functions, you may run into a dex error (over 64k methods)
+
+To resolve that, add `multiDexEnabled true` under your `app.gradle > android > defaultConfig`
+
+Likewise, it is highly recommended to use proguard to clean up your project upon release.
+All KAU components support proguard out of the box.
+Some may have extra requirements for certain features, which will be detailed in their respective README. \ No newline at end of file
diff --git a/about/src/main/res-public/values/public.xml b/about/src/main/res-public/values/public.xml
index f89ddb7..2db68c4 100644
--- a/about/src/main/res-public/values/public.xml
+++ b/about/src/main/res-public/values/public.xml
@@ -1,16 +1,4 @@
<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='kau_about_libraries_intro' type='string' />
- <public name='library_kau_libraryVersion' type='string' />
- <public name='define_kau' type='string' />
- <public name='library_kau_author' type='string' />
- <public name='library_kau_authorWebsite' type='string' />
- <public name='library_kau_libraryName' type='string' />
- <public name='library_kau_libraryDescription' type='string' />
- <public name='library_kau_libraryWebsite' type='string' />
- <public name='library_kau_isOpenSource' type='string' />
- <public name='library_kau_repositoryLink' type='string' />
- <public name='library_kau_classPath' type='string' />
- <public name='library_kau_licenseId' type='string' />
<public name='Kau.About' type='style' />
</resources> \ No newline at end of file
diff --git a/about/src/main/res-public/values/strings.xml b/about/src/main/res/values/strings.xml
index 509b56c..509b56c 100644
--- a/about/src/main/res-public/values/strings.xml
+++ b/about/src/main/res/values/strings.xml
diff --git a/about/src/main/res-public/values/strings_about.xml b/about/src/main/res/values/strings_about.xml
index f538e59..8f10d31 100644
--- a/about/src/main/res-public/values/strings_about.xml
+++ b/about/src/main/res/values/strings_about.xml
@@ -1,27 +1,20 @@
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="ResourceName">
- <string name="library_kau_libraryVersion">2.1</string>
-
+ <string name="library_kau_libraryVersion">3.0</string>
<string name="define_kau"/>
- <!-- Author section -->
<string name="library_kau_author">Allan Wang</string>
<string name="library_kau_authorWebsite">https://www.allanwang.ca/dev/</string>
- <!-- Library section -->
<string name="library_kau_libraryName">KAU</string>
<string name="library_kau_libraryDescription">
<![CDATA[
An extensive collection of Kotlin Android Utilities.
<br/><br/>
KAU aims to make many common functions executable in one line. It adds numerous extensions to match Kotlin\'s DSL,
- and supports completely customizable view groups that are used in almost any app project.
+ and supports completely customizable view groups that are usable in any app project.
]]>
</string>
<string name="library_kau_libraryWebsite">https://allanwang.github.io/KAU/</string>
- <!-- OpenSource section -->
<string name="library_kau_isOpenSource">true</string>
<string name="library_kau_repositoryLink">https://github.com/AllanWang/KAU</string>
- <!-- ClassPath for autoDetect section -->
<string name="library_kau_classPath">ca.allanwang.kau</string>
- <!-- License section -->
<string name="library_kau_licenseId">apache_2_0</string>
- <!-- Custom variables section -->
</resources> \ No newline at end of file
diff --git a/adapter/README.md b/adapter/README.md
index 6d59777..7df9713 100644
--- a/adapter/README.md
+++ b/adapter/README.md
@@ -4,8 +4,21 @@ Collection of kotlin bindings and custom IItems for [Fast Adapter](https://githu
## KauIItems
-Extends `AbstractIItems` and contains the arguments (layoutRes, ViewHolder lambda, idRes)
-In that order. Those variables are used to override the default abstract functions.
+Abstract base that extends `AbstractIItems` and contains the arguments `(layoutRes, ViewHolder lambda, idRes)` in that order.
+Those variables are used to override the default abstract functions.
If a layout is only used for one item, it may also be used as the id, which you may leave blank in this case.
The ViewHolder lambda is typically of the form `{ ViewHolder(it) }`
-Where you will have a nested class `ViewHolder(v: View) : RecyclerView.ViewHolder(v)` \ No newline at end of file
+Where you will have a nested class `ViewHolder(v: View) : RecyclerView.ViewHolder(v)`
+
+## IItem Templates
+
+* CardIItem - generic all encompassing card item with a title, description, imageview, and button.
+All items except for the title are optional.
+* HeaderIItem - simple title container with a big top margin
+
+## KauAnimator
+
+Abstract base that decouples the animations into three parts: `add`, `remove`, and `change`.
+Each component extends `KauAnimatorAdd`, `KauAnimatorRemove`, or `KauAnimatorChange` respectively.
+All the changes in the original animator are removed, so you have complete control over the transitions.
+There are a couple base animators, such as fade scale and slide, which can be mix and matched and added to `KauAnimator` \ No newline at end of file
diff --git a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
index 85f86bd..eb658df 100644
--- a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
+++ b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
@@ -24,8 +24,11 @@ import com.mikepenz.iconics.typeface.IIcon
* Simple generic card item with an icon, title, description and button
* The icon and button are hidden by default unless values are given
*/
-class CardIItem(val builder: Config.() -> Unit = {}) : KauIItem<CardIItem, CardIItem.ViewHolder>(R.layout.kau_iitem_card, { ViewHolder(it) }, R.id.kau_item_card),
- ThemableIItem by ThemableIItemDelegate() {
+class CardIItem(
+ val builder: Config.() -> Unit = {}
+) : KauIItem<CardIItem, CardIItem.ViewHolder>(
+ R.layout.kau_iitem_card, { ViewHolder(it) }, R.id.kau_item_card
+), ThemableIItem by ThemableIItemDelegate() {
companion object {
@JvmStatic fun bindClickEvents(fastAdapter: FastAdapter<IItem<*, *>>) {
diff --git a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt
index 21a49f2..d6d06f3 100644
--- a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt
+++ b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt
@@ -9,7 +9,6 @@ import ca.allanwang.kau.adapters.ThemableIItem
import ca.allanwang.kau.adapters.ThemableIItemDelegate
import ca.allanwang.kau.utils.bindView
import ca.allanwang.kau.utils.string
-import com.mikepenz.fastadapter.items.AbstractItem
/**
* Created by Allan Wang on 2017-06-28.
@@ -17,15 +16,14 @@ import com.mikepenz.fastadapter.items.AbstractItem
* Simple Header with lots of padding on the top
* Contains only one text view
*/
-class HeaderIItem(text: String? = null, var textRes: Int = -1
-) : AbstractItem<HeaderIItem, HeaderIItem.ViewHolder>(), ThemableIItem by ThemableIItemDelegate() {
+class HeaderIItem(
+ text: String? = null, var textRes: Int = -1
+) : KauIItem<HeaderIItem, HeaderIItem.ViewHolder>(
+ R.layout.kau_iitem_header, { ViewHolder(it) }, R.id.kau_item_header_big_margin_top
+), ThemableIItem by ThemableIItemDelegate() {
var text: String = text ?: "Header Placeholder"
- override fun getType(): Int = R.id.kau_item_header_big_margin_top
-
- override fun getLayoutRes(): Int = R.layout.kau_iitem_header
-
override fun bindView(holder: ViewHolder, payloads: MutableList<Any>?) {
super.bindView(holder, payloads)
holder.text.text = holder.itemView.context.string(textRes, text)
@@ -38,8 +36,6 @@ class HeaderIItem(text: String? = null, var textRes: Int = -1
holder.text.text = null
}
- override fun getViewHolder(v: View): ViewHolder = ViewHolder(v)
-
class ViewHolder(v: View) : RecyclerView.ViewHolder(v) {
val text: TextView by bindView(R.id.kau_header_text)
val container: CardView by bindView(R.id.kau_header_container)
diff --git a/core/src/main/kotlin/ca/allanwang/kau/logging/TimberLogger.kt b/core/src/main/kotlin/ca/allanwang/kau/logging/TimberLogger.kt
index 5969fd5..e0f6cae 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/logging/TimberLogger.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/logging/TimberLogger.kt
@@ -11,7 +11,7 @@ import timber.log.Timber
open class TimberLogger(tag: String) {
internal val TAG = "$tag: %s"
fun e(s: String) = Timber.e(TAG, s)
- fun e(t: Throwable, s: String = "error") = Timber.e(t, TAG, s)
+ fun e(t: Throwable?, s: String = "error") = if (t == null) e(s) else Timber.e(t, TAG, s)
fun d(s: String) = Timber.d(TAG, s)
fun i(s: String) = Timber.i(TAG, s)
fun v(s: String) = Timber.v(TAG, s)
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt
index ed4b7bd..112c8ec 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt
@@ -32,13 +32,13 @@ import android.widget.TextView
val anim = ViewAnimationUtils.createCircularReveal(this, x, y, 0f, r).setDuration(duration)
anim.startDelay = offset
anim.addListener(object : AnimatorListenerAdapter() {
- override @KauUtils fun onAnimationStart(animation: Animator?) {
+ override fun onAnimationStart(animation: Animator?) {
visible()
onStart?.invoke()
}
- override @KauUtils fun onAnimationEnd(animation: Animator?) = onFinish?.invoke() ?: Unit
- override @KauUtils fun onAnimationCancel(animation: Animator?) = onFinish?.invoke() ?: Unit
+ override fun onAnimationEnd(animation: Animator?) = onFinish?.invoke() ?: Unit
+ override fun onAnimationCancel(animation: Animator?) = onFinish?.invoke() ?: Unit
})
anim.start()
}
@@ -59,14 +59,14 @@ import android.widget.TextView
val anim = ViewAnimationUtils.createCircularReveal(this, x, y, r, 0f).setDuration(duration)
anim.startDelay = offset
anim.addListener(object : AnimatorListenerAdapter() {
- override @KauUtils fun onAnimationStart(animation: Animator?) = onStart?.invoke() ?: Unit
+ override fun onAnimationStart(animation: Animator?) = onStart?.invoke() ?: Unit
- override @KauUtils fun onAnimationEnd(animation: Animator?) {
+ override fun onAnimationEnd(animation: Animator?) {
invisible()
onFinish?.invoke() ?: Unit
}
- override @KauUtils fun onAnimationCancel(animation: Animator?) = onFinish?.invoke() ?: Unit
+ override fun onAnimationCancel(animation: Animator?) = onFinish?.invoke() ?: Unit
})
anim.start()
}
@@ -82,9 +82,9 @@ import android.widget.TextView
anim.startOffset = offset
anim.duration = duration
anim.setAnimationListener(object : Animation.AnimationListener {
- override @KauUtils fun onAnimationRepeat(animation: Animation?) {}
- override @KauUtils fun onAnimationEnd(animation: Animation?) = onFinish?.invoke() ?: Unit
- override @KauUtils fun onAnimationStart(animation: Animation?) {
+ override fun onAnimationRepeat(animation: Animation?) {}
+ override fun onAnimationEnd(animation: Animation?) = onFinish?.invoke() ?: Unit
+ override fun onAnimationStart(animation: Animation?) {
visible()
onStart?.invoke()
}
@@ -103,13 +103,13 @@ import android.widget.TextView
anim.startOffset = offset
anim.duration = duration
anim.setAnimationListener(object : Animation.AnimationListener {
- override @KauUtils fun onAnimationRepeat(animation: Animation?) {}
- override @KauUtils fun onAnimationEnd(animation: Animation?) {
+ override fun onAnimationRepeat(animation: Animation?) {}
+ override fun onAnimationEnd(animation: Animation?) {
invisible()
onFinish?.invoke()
}
- override @KauUtils fun onAnimationStart(animation: Animation?) {
+ override fun onAnimationStart(animation: Animation?) {
onStart?.invoke()
}
})
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
index bf30a91..7a92665 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
@@ -169,13 +169,14 @@ inline val Context.isNavBarOnBottom: Boolean
fun Context.hasPermission(permissions: String) = !buildIsMarshmallowAndUp || ContextCompat.checkSelfPermission(this, permissions) == PackageManager.PERMISSION_GRANTED
-fun Context.copyToClipboard(text: String, label: String = "Copied Text", showToast: Boolean = true) {
+fun Context.copyToClipboard(text: String?, label: String = "Copied Text", showToast: Boolean = true) {
val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
- clipboard.primaryClip = ClipData.newPlainText(label, text)
+ clipboard.primaryClip = ClipData.newPlainText(label, text ?: "")
if (showToast) toast(R.string.kau_text_copied)
}
-fun Context.shareText(text: String) {
+fun Context.shareText(text: String?) {
+ if (text == null) return toast(R.string.kau_text_is_null)
val intent = Intent(Intent.ACTION_SEND)
intent.type = "text/plain"
intent.putExtra(Intent.EXTRA_TEXT, text)
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
new file mode 100644
index 0000000..d8b2993
--- /dev/null
+++ b/core/src/main/res/values/strings.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="kau_text_is_null">Text is null</string>
+</resources> \ No newline at end of file
diff --git a/docs/Changelog.md b/docs/Changelog.md
index f0f4470..4a913b5 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -1,9 +1,14 @@
# Changelog
-## v2.2
-* :imagepicker: Fully implement picker
-* :core: [breaking] Replace update[x]Margin to setMargin[x]
+## v3.1
+* :core: Allow for nullable throwables when logging
+
+## v3.0
* :core: Add setPadding[x]
+* :core: [breaking] Replace update[x]Margin to setMargin[x]
+* :imagepicker: Fully implement picker
+* Make resources private where possible
+* Reduce minSdk to 19 where possible
## v2.1
* :adapter: Fix up CardIItem
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>
diff --git a/kpref-activity/build.gradle b/kpref-activity/build.gradle
index 2ced0c2..fd1c992 100644
--- a/kpref-activity/build.gradle
+++ b/kpref-activity/build.gradle
@@ -1,3 +1,5 @@
+ext.kauSubModuleMinSdk = project.CORE_MIN_SDK
+
ext.kauSubModuleResourcePrefix = "kau_pref_"
apply from: '../android-lib.gradle'
diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt
index b978a6e..91c0cf2 100644
--- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt
+++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt
@@ -1,5 +1,6 @@
package ca.allanwang.kau.kpref.activity
+import android.annotation.SuppressLint
import android.os.Bundle
import android.support.annotation.StringRes
import android.support.constraint.ConstraintLayout
@@ -51,6 +52,7 @@ abstract class KPrefActivity : AppCompatActivity(), KPrefActivityContract {
*/
abstract fun kPrefCoreAttributes(): CoreAttributeContract.() -> Unit
+ @SuppressLint("NewApi")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
//setup layout
diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefCheckbox.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefCheckbox.kt
index 19bdb56..5738022 100644
--- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefCheckbox.kt
+++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefCheckbox.kt
@@ -1,5 +1,6 @@
package ca.allanwang.kau.kpref.activity.items
+import android.support.v7.widget.AppCompatCheckBox
import android.view.View
import android.widget.CheckBox
import ca.allanwang.kau.kpref.activity.R
@@ -15,7 +16,7 @@ open class KPrefCheckbox(builder: BaseContract<Boolean>) : KPrefItemBase<Boolean
override fun defaultOnClick(itemView: View, innerContent: View?): Boolean {
pref = !pref
- (innerContent as CheckBox).isChecked = pref
+ (innerContent as AppCompatCheckBox).isChecked = pref
return true
}
diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt
index 908c139..bd245af 100644
--- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt
+++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt
@@ -1,5 +1,6 @@
package ca.allanwang.kau.kpref.activity.items
+import android.annotation.SuppressLint
import android.support.annotation.CallSuper
import android.support.annotation.IdRes
import android.support.annotation.LayoutRes
@@ -31,6 +32,7 @@ abstract class KPrefItemCore(val core: CoreContract) : AbstractItem<KPrefItemCor
override final fun getViewHolder(v: View) = ViewHolder(v)
+ @SuppressLint("NewApi")
@CallSuper
override fun bindView(viewHolder: ViewHolder, payloads: List<Any>) {
super.bindView(viewHolder, payloads)
@@ -50,7 +52,7 @@ abstract class KPrefItemCore(val core: CoreContract) : AbstractItem<KPrefItemCor
desc?.setTextColor(textColor)
}
val accentColor = core.globalOptions.accentColor?.invoke()
- if (accentColor != null) {
+ if (accentColor != null && buildIsLollipopAndUp) {
icon?.drawable?.setTint(accentColor)
}
onPostBindView(this, textColor, accentColor)
diff --git a/kpref-activity/src/main/res/values/ids.xml b/kpref-activity/src/main/res-public/values/ids.xml
index 3bd69ed..3bd69ed 100644
--- a/kpref-activity/src/main/res/values/ids.xml
+++ b/kpref-activity/src/main/res-public/values/ids.xml
diff --git a/kpref-activity/src/main/res-public/values/public.xml b/kpref-activity/src/main/res-public/values/public.xml
index cf14680..b5fb383 100644
--- a/kpref-activity/src/main/res-public/values/public.xml
+++ b/kpref-activity/src/main/res-public/values/public.xml
@@ -1,4 +1,19 @@
<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_pref_barrier' type='id' />
+ <public name='kau_pref_container' type='id' />
+ <public name='kau_pref_desc' type='id' />
+ <public name='kau_pref_icon' type='id' />
+ <public name='kau_pref_inner_content' type='id' />
+ <public name='kau_pref_inner_frame' type='id' />
+ <public name='kau_pref_item_checkbox' type='id' />
+ <public name='kau_pref_item_color_picker' type='id' />
+ <public name='kau_pref_item_header' type='id' />
+ <public name='kau_pref_item_plain_text' type='id' />
+ <public name='kau_pref_item_seekbar' type='id' />
+ <public name='kau_pref_item_sub_item' type='id' />
+ <public name='kau_pref_item_text' type='id' />
+ <public name='kau_pref_lower_content' type='id' />
+ <public name='kau_pref_lower_frame' type='id' />
+ <public name='kau_pref_title' type='id' />
</resources> \ No newline at end of file
diff --git a/kpref-activity/src/main/res/layout/kau_pref_checkbox.xml b/kpref-activity/src/main/res/layout/kau_pref_checkbox.xml
index 016394f..1fecb4d 100644
--- a/kpref-activity/src/main/res/layout/kau_pref_checkbox.xml
+++ b/kpref-activity/src/main/res/layout/kau_pref_checkbox.xml
@@ -1,4 +1,4 @@
-<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.v7.widget.AppCompatCheckBox xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@id/kau_pref_inner_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/kpref-activity/src/main/res/layout/kau_pref_core.xml b/kpref-activity/src/main/res/layout/kau_pref_core.xml
index 1a53726..4b5de56 100644
--- a/kpref-activity/src/main/res/layout/kau_pref_core.xml
+++ b/kpref-activity/src/main/res/layout/kau_pref_core.xml
@@ -22,7 +22,7 @@
<!--As per Android N, icons (24dp) are aligned to the left rather than centered-->
- <ImageView
+ <android.support.v7.widget.AppCompatImageView
android:id="@id/kau_pref_icon"
android:layout_width="56dp"
android:layout_height="56dp"
@@ -36,7 +36,7 @@
app:layout_constraintVertical_bias="0.5"
tools:layout_editor_absoluteX="0dp" />
- <TextView
+ <android.support.v7.widget.AppCompatTextView
android:id="@id/kau_pref_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
@@ -51,13 +51,13 @@
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="-175dp" />
- <TextView
+ <android.support.v7.widget.AppCompatTextView
android:id="@id/kau_pref_desc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="10"
- android:textAppearance="?android:attr/textAppearanceListItemSecondary"
+ android:textAppearance="?textAppearanceListItemSecondary"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintBottom_toTopOf="@id/kau_pref_lower_frame"
app:layout_constraintEnd_toStartOf="@id/kau_pref_inner_frame"
diff --git a/kpref-activity/src/main/res/layout/kau_pref_header.xml b/kpref-activity/src/main/res/layout/kau_pref_header.xml
index 5deece3..d802a14 100644
--- a/kpref-activity/src/main/res/layout/kau_pref_header.xml
+++ b/kpref-activity/src/main/res/layout/kau_pref_header.xml
@@ -1,4 +1,4 @@
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.v7.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/kau_pref_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -6,5 +6,5 @@
android:paddingEnd="?android:attr/listPreferredItemPaddingRight"
android:paddingStart="?android:attr/listPreferredItemPaddingLeft"
android:paddingTop="16dip"
- android:textColor="?android:attr/colorAccent"
+ android:textColor="?colorAccent"
android:textSize="14sp" /> \ No newline at end of file
diff --git a/kpref-activity/src/main/res/layout/kau_pref_seekbar.xml b/kpref-activity/src/main/res/layout/kau_pref_seekbar.xml
index 8da4d5d..0b07e1c 100644
--- a/kpref-activity/src/main/res/layout/kau_pref_seekbar.xml
+++ b/kpref-activity/src/main/res/layout/kau_pref_seekbar.xml
@@ -1,4 +1,4 @@
-<SeekBar xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.v7.widget.AppCompatSeekBar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@id/kau_pref_lower_content"
android:layout_width="match_parent"
android:paddingTop="@dimen/kau_padding_normal"
diff --git a/kpref-activity/src/main/res/layout/kau_pref_seekbar_text.xml b/kpref-activity/src/main/res/layout/kau_pref_seekbar_text.xml
index 6ba2543..dc11d2a 100644
--- a/kpref-activity/src/main/res/layout/kau_pref_seekbar_text.xml
+++ b/kpref-activity/src/main/res/layout/kau_pref_seekbar_text.xml
@@ -1,6 +1,6 @@
<!--TextView that aligns to the bottom-->
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.v7.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@id/kau_pref_inner_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/kpref-activity/src/main/res/layout/kau_pref_text.xml b/kpref-activity/src/main/res/layout/kau_pref_text.xml
index a4d901e..bae83f2 100644
--- a/kpref-activity/src/main/res/layout/kau_pref_text.xml
+++ b/kpref-activity/src/main/res/layout/kau_pref_text.xml
@@ -1,4 +1,4 @@
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.v7.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@id/kau_pref_inner_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/sample/build.gradle b/sample/build.gradle
index a31385d..b318174 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -16,7 +16,7 @@ android {
buildToolsVersion project.BUILD_TOOLS
androidGitVersion {
- codeFormat = 'MMNNBBBB'
+ codeFormat = 'MMNNPPBB'
}
defaultConfig {
diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml
index d041a3e..da26bdf 100644
--- a/sample/src/main/AndroidManifest.xml
+++ b/sample/src/main/AndroidManifest.xml
@@ -29,7 +29,7 @@
android:name=".AboutActivity"
android:theme="@style/Kau.About" />
<activity
- android:name="ca.allanwang.kau.imagepicker.ImagePickerActivity"
+ android:name=".ImagePickerActivity"
android:theme="@style/Kau.ImagePicker" />
<activity
android:name=".AdapterActivity"
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/ImagePickerActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/ImagePickerActivity.kt
new file mode 100644
index 0000000..8a23192
--- /dev/null
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/ImagePickerActivity.kt
@@ -0,0 +1,8 @@
+package ca.allanwang.kau.sample
+
+import ca.allanwang.kau.imagepicker.ImagePickerActivityBase
+
+/**
+ * Created by Allan Wang on 2017-07-23.
+ */
+class ImagePickerActivity : ImagePickerActivityBase() \ No newline at end of file
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
index 4711701..ecfef04 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
@@ -165,7 +165,7 @@ class MainActivity : KPrefActivity() {
}
plainText(R.string.gallery_showcase) {
- onClick = { _, _, _ -> kauLaunchImagePicker(REQUEST_IMAGE); false }
+ onClick = { _, _, _ -> kauLaunchImagePicker(ImagePickerActivity::class.java, REQUEST_IMAGE); false }
}
plainText(R.string.adapter_showcase) {
@@ -235,7 +235,6 @@ class MainActivity : KPrefActivity() {
when (item.itemId) {
R.id.action_settings -> startActivity(AnimActivity::class.java)
R.id.action_email -> sendEmail(R.string.your_email, R.string.your_subject)
- R.id.test -> kauLaunchImagePicker(REQUEST_IMAGE)
else -> return super.onOptionsItemSelected(item)
}
return true
diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml
index 488e01b..76aee36 100644
--- a/sample/src/main/res/xml/kau_changelog.xml
+++ b/sample/src/main/res/xml/kau_changelog.xml
@@ -6,18 +6,22 @@
<item text="" />
-->
- <version title="v2.2"/>
- <item text=":imagepicker: Fully implement picker" />
- <item text=":core: [breaking] Replace update[x]Margin to setMargin[x]" />
- <item text=":core: Add setPadding[x]" />
+ <version title="v3.1"/>
+ <item text=":core: Allow for nullable throwables when logging" />
<item text="" />
<item text="" />
<item text="" />
<item text="" />
<item text="" />
<item text="" />
- <item text="" />
-
+
+ <version title="v3.0"/>
+ <item text=":core: Add setPadding[x]" />
+ <item text=":core: [breaking] Replace update[x]Margin to setMargin[x]" />
+ <item text=":imagepicker: Fully implement picker" />
+ <item text="Make resources private where possible" />
+ <item text="Reduce minSdk to 19 where possible" />
+
<version title="v2.1"/>
<item text=":adapter: Fix up CardIItem" />
<item text=":adapter: Modularized kau animators" />