aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.travis.yml2
-rw-r--r--README.md10
-rw-r--r--about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt6
-rw-r--r--about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt6
-rw-r--r--about/src/main/res/values/strings.xml5
-rw-r--r--about/src/main/res/values/strings_about.xml23
-rw-r--r--about/src/main/res/values/strings_about_kau.xml20
-rw-r--r--adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt2
-rw-r--r--build.gradle2
-rw-r--r--colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/CircleView.kt4
-rw-r--r--colorpicker/src/main/res/values/strings_colorpicker.xml (renamed from colorpicker/src/main/res/values/strings.xml)0
-rw-r--r--core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt12
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/logging/KauLogger.kt28
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt6
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt18
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt2
-rw-r--r--docs/Changelog.md15
-rw-r--r--gradle.properties10
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaModel.kt2
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt13
-rw-r--r--mediapicker/src/main/res/values/strings_mediapicker.xml (renamed from mediapicker/src/main/res/values/strings.xml)0
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt2
-rw-r--r--sample/src/main/res/values/strings_sample.xml (renamed from sample/src/main/res/values/strings.xml)0
-rw-r--r--sample/src/main/res/xml/kau_changelog.xml101
-rw-r--r--searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt8
26 files changed, 173 insertions, 125 deletions
diff --git a/.gitignore b/.gitignore
index 4ca0b81..6f35f6b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
*.iml
/.idea
.gradle
+/crowdin.properties
/local.properties
.DS_Store
/build
diff --git a/.travis.yml b/.travis.yml
index da9bd5c..b991811 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,7 +7,7 @@ android:
# - android-21
- platform-tools
- tools
- - build-tools-26.0.1
+ - build-tools-26.0.2
- android-26
- extra-android-support
- extra-android-m2repository
diff --git a/README.md b/README.md
index cf3215c..bc09b0f 100644
--- a/README.md
+++ b/README.md
@@ -16,8 +16,9 @@ KAU is available on JitPack
[![](https://jitpack.io/v/ca.allanwang/kau.svg)](https://jitpack.io/#ca.allanwang/kau)
[![Build Status](https://travis-ci.org/AllanWang/KAU.svg?branch=master)](https://travis-ci.org/AllanWang/KAU)
+[![Crowdin](https://d322cqt584bo4o.cloudfront.net/kotlin-android-utils/localized.svg)](https://crowdin.com/project/kotlin-android-utils)
[![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin)
-[![Stories in Ready](https://badge.waffle.io/AllanWang/KAU.png?label=ready&title=Ready)](https://waffle.io/AllanWang/KAU?utm_source=badge)
+[![ZenHub](https://img.shields.io/badge/Shipping%20faster%20with-ZenHub-45529A.svg)](https://app.zenhub.com/workspace/o/allanwang/kau/boards)
[![GitHub license](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/AllanWang/KAU/master/LICENSE)
To apply, add the following to your root build.gradle:
@@ -140,4 +141,9 @@ To resolve that, add `multiDexEnabled true` under your `app.gradle > android > d
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
+Some may have extra requirements for certain features, which will be detailed in their respective README.
+
+## Translations
+
+KAU depends on translations crowdsourced by the general public.
+If you would like to contribute, please visit [here](https://crwd.in/kotlin-android-utils)
diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt b/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt
index 629aa52..5595aed 100644
--- a/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt
+++ b/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt
@@ -1,5 +1,6 @@
package ca.allanwang.kau.about
+import android.annotation.SuppressLint
import android.support.v7.widget.RecyclerView
import android.text.method.LinkMovementMethod
import android.view.View
@@ -22,9 +23,7 @@ class FaqIItem(val content: FaqItem) : KauIItem<LibraryIItem, FaqIItem.ViewHolde
), ThemableIItem by ThemableIItemDelegate() {
companion object {
-
-
- @JvmStatic fun bindEvents(fastAdapter: FastAdapter<IItem<*, *>>) {
+ fun bindEvents(fastAdapter: FastAdapter<IItem<*, *>>) {
fastAdapter.withSelectable(false)
.withEventHook(object : ClickEventHook<IItem<*, *>>() {
@@ -43,6 +42,7 @@ class FaqIItem(val content: FaqItem) : KauIItem<LibraryIItem, FaqIItem.ViewHolde
private var isExpanded = false
+ @SuppressLint("SetTextI18n")
override fun bindView(holder: ViewHolder, payloads: MutableList<Any>?) {
super.bindView(holder, payloads)
with(holder) {
diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt
index e50460e..88e6f9b 100644
--- a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt
+++ b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt
@@ -25,7 +25,7 @@ class LibraryIItem(val lib: Library) : KauIItem<LibraryIItem, LibraryIItem.ViewH
), ThemableIItem by ThemableIItemDelegate() {
companion object {
- @JvmStatic fun bindEvents(fastAdapter: FastAdapter<IItem<*, *>>) {
+ fun bindEvents(fastAdapter: FastAdapter<IItem<*, *>>) {
fastAdapter.withSelectable(false)
.withOnClickListener { v, _, item, _ ->
if (item !is LibraryIItem) false
@@ -53,11 +53,11 @@ class LibraryIItem(val lib: Library) : KauIItem<LibraryIItem, LibraryIItem.ViewH
Html.fromHtml(lib.libraryDescription, Html.FROM_HTML_MODE_LEGACY)
else Html.fromHtml(lib.libraryDescription)
bottomDivider.gone()
- if (lib.libraryVersion?.isNotBlank() ?: false) {
+ if (lib.libraryVersion?.isNotBlank() == true) {
bottomDivider.visible()
version.visible().text = lib.libraryVersion
}
- if (lib.license?.licenseName?.isNotBlank() ?: false) {
+ if (lib.license?.licenseName?.isNotBlank() == true) {
bottomDivider.visible()
license.visible().text = lib.license?.licenseName
}
diff --git a/about/src/main/res/values/strings.xml b/about/src/main/res/values/strings.xml
deleted file mode 100644
index 164c0c8..0000000
--- a/about/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="kau_about_libraries_intro">This app would not be possible without the following great libraries.</string>
- <string name="kau_about_faq_intro">FAQ</string>
-</resources> \ No newline at end of file
diff --git a/about/src/main/res/values/strings_about.xml b/about/src/main/res/values/strings_about.xml
index 592f9f4..164c0c8 100644
--- a/about/src/main/res/values/strings_about.xml
+++ b/about/src/main/res/values/strings_about.xml
@@ -1,20 +1,5 @@
-<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="ResourceName">
- <string name="define_kau"/>
- <string name="library_kau_author">Allan Wang</string>
- <string name="library_kau_authorWebsite">https://www.allanwang.ca/dev/</string>
- <string name="library_kau_libraryVersion">@string/kau_version_code</string>
- <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 usable in any app project.
- ]]>
- </string>
- <string name="library_kau_libraryWebsite">https://allanwang.github.io/KAU/</string>
- <string name="library_kau_isOpenSource">true</string>
- <string name="library_kau_repositoryLink">https://github.com/AllanWang/KAU</string>
- <string name="library_kau_classPath">ca.allanwang.kau</string>
- <string name="library_kau_licenseId">apache_2_0</string>
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="kau_about_libraries_intro">This app would not be possible without the following great libraries.</string>
+ <string name="kau_about_faq_intro">FAQ</string>
</resources> \ No newline at end of file
diff --git a/about/src/main/res/values/strings_about_kau.xml b/about/src/main/res/values/strings_about_kau.xml
new file mode 100644
index 0000000..592f9f4
--- /dev/null
+++ b/about/src/main/res/values/strings_about_kau.xml
@@ -0,0 +1,20 @@
+<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="ResourceName">
+ <string name="define_kau"/>
+ <string name="library_kau_author">Allan Wang</string>
+ <string name="library_kau_authorWebsite">https://www.allanwang.ca/dev/</string>
+ <string name="library_kau_libraryVersion">@string/kau_version_code</string>
+ <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 usable in any app project.
+ ]]>
+ </string>
+ <string name="library_kau_libraryWebsite">https://allanwang.github.io/KAU/</string>
+ <string name="library_kau_isOpenSource">true</string>
+ <string name="library_kau_repositoryLink">https://github.com/AllanWang/KAU</string>
+ <string name="library_kau_classPath">ca.allanwang.kau</string>
+ <string name="library_kau_licenseId">apache_2_0</string>
+</resources> \ 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 eb658df..9865c70 100644
--- a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
+++ b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
@@ -31,7 +31,7 @@ class CardIItem(
), ThemableIItem by ThemableIItemDelegate() {
companion object {
- @JvmStatic fun bindClickEvents(fastAdapter: FastAdapter<IItem<*, *>>) {
+ fun bindClickEvents(fastAdapter: FastAdapter<IItem<*, *>>) {
fastAdapter.withEventHook(object : ClickEventHook<IItem<*, *>>() {
override fun onBindMany(viewHolder: RecyclerView.ViewHolder): List<View>? {
return if (viewHolder is ViewHolder) listOf(viewHolder.card, viewHolder.button) else null
diff --git a/build.gradle b/build.gradle
index 20d17ca..d40ce68 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,7 +6,7 @@ buildscript {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.0.0-beta6'
+ classpath 'com.android.tools.build:gradle:3.0.0-beta7'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${KOTLIN}"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath 'com.github.triplet.gradle:play-publisher:1.2.0'
diff --git a/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/CircleView.kt b/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/CircleView.kt
index d697c8b..ed98090 100644
--- a/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/CircleView.kt
+++ b/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/CircleView.kt
@@ -194,7 +194,6 @@ class CircleView @JvmOverloads constructor(context: Context, attrs: AttributeSet
companion object {
@ColorInt
- @JvmStatic
private fun translucentColor(color: Int): Int {
val factor = 0.7f
val alpha = Math.round(Color.alpha(color) * factor)
@@ -205,7 +204,6 @@ class CircleView @JvmOverloads constructor(context: Context, attrs: AttributeSet
}
@ColorInt
- @JvmStatic
fun shiftColor(@ColorInt color: Int,
@FloatRange(from = 0.0, to = 2.0) by: Float): Int {
if (by == 1f) return color
@@ -215,11 +213,9 @@ class CircleView @JvmOverloads constructor(context: Context, attrs: AttributeSet
}
@ColorInt
- @JvmStatic
fun shiftColorDown(@ColorInt color: Int): Int = shiftColor(color, 0.9f)
@ColorInt
- @JvmStatic
fun shiftColorUp(@ColorInt color: Int): Int = shiftColor(color, 1.1f)
}
} \ No newline at end of file
diff --git a/colorpicker/src/main/res/values/strings.xml b/colorpicker/src/main/res/values/strings_colorpicker.xml
index 5a6f89b..5a6f89b 100644
--- a/colorpicker/src/main/res/values/strings.xml
+++ b/colorpicker/src/main/res/values/strings_colorpicker.xml
diff --git a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt
index 9e8ac11..fc03563 100644
--- a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt
+++ b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt
@@ -147,14 +147,16 @@ class CutoutView @JvmOverloads constructor(
paint.textSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, mid, metrics)
val maxLineWidth = paint.measureText(text)
- return if (high - low < precision) low
- else if (maxLineWidth > targetWidth) getSingleLineTextSize(text, paint, targetWidth, low, mid, precision, metrics)
- else if (maxLineWidth < targetWidth) getSingleLineTextSize(text, paint, targetWidth, mid, high, precision, metrics)
- else mid
+ return when {
+ high - low < precision -> low
+ maxLineWidth > targetWidth -> getSingleLineTextSize(text, paint, targetWidth, low, mid, precision, metrics)
+ maxLineWidth < targetWidth -> getSingleLineTextSize(text, paint, targetWidth, mid, high, precision, metrics)
+ else -> mid
+ }
}
private fun createBitmap() {
- if (!(cutout?.isRecycled ?: true))
+ if (cutout?.isRecycled == false)
cutout?.recycle()
if (width == 0 || height == 0) return
cutout = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
diff --git a/core/src/main/kotlin/ca/allanwang/kau/logging/KauLogger.kt b/core/src/main/kotlin/ca/allanwang/kau/logging/KauLogger.kt
index 14655f0..61f0708 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/logging/KauLogger.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/logging/KauLogger.kt
@@ -11,14 +11,34 @@ import android.util.Log
*
* Base logger class with a predefined tag
* This may be extended by an object to effectively replace [Log]
+ * Almost everything is opened to make everything customizable
*/
open class KauLogger(val tag: String) {
+ /**
+ * Global toggle to enable the whole logger
+ */
open var enabled = true
+
+ /**
+ * Global toggle to show private text
+ */
open var showPrivateText = false
+
+ /**
+ * If both msg and priv msg are accepted, output the combined output
+ */
open var messageJoiner: (msg: String, privMsg: String) -> String = { msg, privMsg -> "$msg: $privMsg" }
/**
+ * Open hook to change the output of the logger (for instance, output to stdout rather than Android log files
+ * Does not use reference notation to avoid constructor leaks
+ */
+ open var logFun: (priority: Int, message: String?, privateMessage: String?, t: Throwable?) -> Unit = { p, m, pm, t ->
+ logImpl(p, m, pm, t)
+ }
+
+ /**
* Filter pass-through to decide what we wish to log
* By default, we will ignore verbose and debug logs
* @returns {@code true} to log the message, {@code false} to ignore
@@ -35,14 +55,20 @@ open class KauLogger(val tag: String) {
showPrivateText = enable
}
- open fun log(priority: Int, message: String?, privateMessage: String?, t: Throwable? = null) {
+ private fun log(priority: Int, message: String?, privateMessage: String?, t: Throwable? = null) {
if (!shouldLog(priority, message, privateMessage, t)) return
logImpl(priority, message, privateMessage, t)
}
+ /**
+ * Condition to pass to allow the input to be logged
+ */
protected open fun shouldLog(priority: Int, message: String?, privateMessage: String?, t: Throwable?): Boolean
= enabled && filter(priority)
+ /**
+ * Base implementation of the Android logger
+ */
protected open fun logImpl(priority: Int, message: String?, privateMessage: String?, t: Throwable?) {
val text = if (showPrivateText) {
if (message == null) privateMessage
diff --git a/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt b/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt
index 5fe0ddf..18f3e41 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt
@@ -18,8 +18,8 @@ import java.lang.ref.WeakReference
*/
internal object PermissionManager {
- var requestInProgress = false
- val pendingResults: MutableList<WeakReference<PermissionResult>> by lazy { mutableListOf<WeakReference<PermissionResult>>() }
+ private var requestInProgress = false
+ private val pendingResults: MutableList<WeakReference<PermissionResult>> by lazy { mutableListOf<WeakReference<PermissionResult>>() }
/**
* Retrieve permissions requested in our manifest
@@ -63,7 +63,7 @@ internal object PermissionManager {
val iter = pendingResults.iterator()
while (iter.hasNext()) {
val action = iter.next().get()
- if ((0 until count).any { action?.onResult(permissions[it], grantResults[it]) ?: true })
+ if ((0 until count).any { action?.onResult(permissions[it], grantResults[it]) != false })
iter.remove()
}
if (pendingResults.isEmpty())
diff --git a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt
index c0875d1..065f4bb 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt
@@ -349,7 +349,7 @@ internal class SwipeBackLayout @JvmOverloads constructor(context: Context, attrs
listeners.forEach { it.get()?.onScroll(scrollPercent, contentOffset, edgeFlag) }
if (scrollPercent >= 1) {
- if (!(activity?.isFinishing ?: true)) {
+ if (activity?.isFinishing == false) {
if (scrollPercent >= scrollThreshold && isScrollOverValid) {
isScrollOverValid = false
listeners.forEach { it.get()?.onScrollToClose(edgeFlag) }
@@ -390,15 +390,19 @@ internal class SwipeBackLayout @JvmOverloads constructor(context: Context, attrs
}
override fun clampViewPositionHorizontal(child: View, left: Int, dx: Int): Int {
- return if (edgeFlag == SWIPE_EDGE_RIGHT) Math.min(0, Math.max(left, -child.width))
- else if (edgeFlag == SWIPE_EDGE_LEFT) Math.min(child.width, Math.max(left, 0))
- else 0
+ return when (edgeFlag) {
+ SWIPE_EDGE_RIGHT -> Math.min(0, Math.max(left, -child.width))
+ SWIPE_EDGE_LEFT -> Math.min(child.width, Math.max(left, 0))
+ else -> 0
+ }
}
override fun clampViewPositionVertical(child: View, top: Int, dy: Int): Int {
- return if (edgeFlag == SWIPE_EDGE_BOTTOM) Math.min(0, Math.max(top, -child.height))
- else if (edgeFlag == SWIPE_EDGE_TOP) Math.min(child.height, Math.max(top, 0))
- else 0
+ return when (edgeFlag) {
+ SWIPE_EDGE_BOTTOM -> Math.min(0, Math.max(top, -child.height))
+ SWIPE_EDGE_TOP -> Math.min(child.height, Math.max(top, 0))
+ else -> 0
+ }
}
}
diff --git a/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt b/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt
index 4bf1836..58f1ccc 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt
@@ -87,7 +87,7 @@ internal enum class ChangelogType(val tag: String, val attr: String, @LayoutRes
ITEM("item", "text", R.layout.kau_changelog_content);
companion object {
- @JvmStatic val values = values()
+ val values = values()
}
/**
diff --git a/docs/Changelog.md b/docs/Changelog.md
index 6c5bb11..cad2792 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -1,9 +1,16 @@
# Changelog
-## v3.4.1
-* Validate context before showing dialogs
-* Add intent resolver checks prior to all executions.
-* Fix bundle NPE when starting activity
+## v3.4.4
+* Add translation support for crowdin
+* Update dependencies
+* :mediapicker: Validate document uri before parsing
+* :searchview: Ignore casing for highlights
+
+## v3.4.3
+* :core: Validate context before showing dialogs
+* :core: Add intent resolver checks prior to all executions.
+* :core: Fix bundle NPE when starting activity
+* :kpref-activity: Create timePicker
## v3.4.0
* Update to gradle 4.x; api and implementation rather than compile
diff --git a/gradle.properties b/gradle.properties
index 9c26759..e64203d 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -20,19 +20,19 @@ APP_GROUP=ca.allanwang
CORE_MIN_SDK=19
MIN_SDK=21
TARGET_SDK=26
-BUILD_TOOLS=26.0.1
+BUILD_TOOLS=26.0.2
ANDROID_SUPPORT_LIBS=26.1.0
-VERSION_NAME=3.4.3
+VERSION_NAME=3.4.4
-KOTLIN=1.1.4-3
+KOTLIN=1.1.51
ABOUT_LIBRARIES=5.9.7
ANKO=0.10.1
BLURRY=2.1.1
-CONSTRAINT_LAYOUT=1.1.0-beta1
+CONSTRAINT_LAYOUT=1.1.0-beta2
FAST_ADAPTER=2.6.3
FAST_ADAPTER_COMMONS=2.6.3
-GLIDE=4.1.1
+GLIDE=4.2.0
ICONICS=2.9.3
IICON_GOOGLE=3.0.1.1
MATERIAL_DIALOG=0.9.4.7
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaModel.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaModel.kt
index ae85558..26736d4 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaModel.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaModel.kt
@@ -21,7 +21,7 @@ data class MediaModel(
@Throws(SQLException::class)
constructor(@NonNull cursor: Cursor) : this(
cursor.getString(0),
- cursor.getString(1),
+ cursor.getString(1) ?: "",
cursor.getLong(2),
cursor.getLong(3),
cursor.getString(4)
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
index d518b78..ec5d2f0 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
@@ -153,8 +153,7 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
* The adapter will be cleared on each successful call
*/
open fun loadItems() {
- kauRequestPermissions(Manifest.permission.READ_EXTERNAL_STORAGE) {
- granted, _ ->
+ kauRequestPermissions(Manifest.permission.READ_EXTERNAL_STORAGE) { granted, _ ->
if (granted) {
supportLoaderManager.initLoader(LOADER_ID, null, this)
onStatusChange(true)
@@ -191,7 +190,7 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
} catch (ignored: InterruptedException) {
} catch (ignored: ExecutionException) {
} finally {
- glide.clear(target)
+ glide.clear(target)
}
}
}
@@ -238,9 +237,13 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
* See <a href="http://hmkcode.com/android-display-selected-image-and-its-real-path/"></a>
*/
private fun <R> ContentResolver.query(baseUri: Uri, uris: List<Uri>, block: (cursor: Cursor) -> R) {
- val ids = uris.map {
+ val ids = uris.filter {
+ val valid = DocumentsContract.isDocumentUri(this@MediaPickerCore, it)
+ if (!valid) KL.d("Non document uri: ${it.encodedPath}")
+ valid
+ }.mapNotNull {
DocumentsContract.getDocumentId(it).split(":").getOrNull(1)
- }.filterNotNull().joinToString(prefix = "(", separator = ",", postfix = ")")
+ }.joinToString(prefix = "(", separator = ",", postfix = ")")
//? query replacements are done for one arg at a time
//since we potentially have a list of ids, we'll just format the WHERE clause ourself
query(baseUri, MediaModel.projection, "${BaseColumns._ID} IN $ids", null, sortQuery)?.use(block)
diff --git a/mediapicker/src/main/res/values/strings.xml b/mediapicker/src/main/res/values/strings_mediapicker.xml
index 717e12b..717e12b 100644
--- a/mediapicker/src/main/res/values/strings.xml
+++ b/mediapicker/src/main/res/values/strings_mediapicker.xml
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 ca75ebb..482c911 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
@@ -277,7 +277,7 @@ class MainActivity : KPrefActivity() {
}
override fun onBackPressed() {
- if (!(searchView?.onBackPressed() ?: false)) super.onBackPressed()
+ if (searchView?.onBackPressed() != true) super.onBackPressed()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings_sample.xml
index 1e3361e..1e3361e 100644
--- a/sample/src/main/res/values/strings.xml
+++ b/sample/src/main/res/values/strings_sample.xml
diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml
index 7f421f8..a4978b3 100644
--- a/sample/src/main/res/xml/kau_changelog.xml
+++ b/sample/src/main/res/xml/kau_changelog.xml
@@ -2,20 +2,23 @@
<resources>
<!--
- <version title="v"/>
+ <version title="v" />
<item text="" />
-->
-
- <version title="v3.4.3"/>
- <item text=":core: Validate context before showing dialogs" />
- <item text=":core: Add intent resolver checks prior to all executions." />
- <item text=":core: Fix bundle NPE when starting activity" />
- <item text=":kpref-activity: Create timePicker" />
- <item text="" />
- <item text="" />
- <item text="" />
-
- <version title="v3.4.0"/>
+
+ <version title="v3.4.4" />
+ <item text="Add translation support for crowdin" />
+ <item text="Update dependencies" />
+ <item text=":mediapicker: Validate document uri before parsing" />
+ <item text=":searchview: Ignore casing for highlights" />
+
+ <version title="v3.4.3" />
+ <item text=":core: Validate context before showing dialogs" />
+ <item text=":core: Add intent resolver checks prior to all executions." />
+ <item text=":core: Fix bundle NPE when starting activity" />
+ <item text=":kpref-activity: Create timePicker" />
+
+ <version title="v3.4.0" />
<item text="Update to gradle 4.x; api and implementation rather than compile" />
<item text="Update dependencies" />
<item text=":searchview: Ensure reveals are called on the UI thread" />
@@ -23,16 +26,16 @@
<item text=":mediapicker: Reuse request manager from activity" />
<item text=":kpref-activity: Add bounds to text item" />
- <version title="v3.3.2"/>
+ <version title="v3.3.2" />
<item text=":kpref-activity: Add visibility toggle to Core contract. Items can override this to show/hide given preferences based on boolean callbacks." />
- <item text=":kpref-activity: Add width constraint for long text items" />
-
- <version title="v3.3.1"/>
+ <item text=":kpref-activity: Add width constraint for long text items" />
+
+ <version title="v3.3.1" />
<item text=":core: Open up all logger functions" />
<item text=":core: Deprecate kauSwipeOnPostCreate and move functionality to onCreate" />
<item text=":searchview: Fix background tint" />
-
- <version title="v3.3.0"/>
+
+ <version title="v3.3.0" />
<item text=":core: Create debounce methods" />
<item text=":core: Create zip methods" />
<item text=":core: [Breaking] Logging base has been renamed to KauLogger and no longer depends on timber" />
@@ -40,29 +43,29 @@
<item text=":kpref-activity: [Breaking] Removed sliding toolbar and use normal toolbar title" />
<item text=":kpref-activity: Remove :core-ui: dependency" />
<item text=":searchview: [Breaking] remove reactive dependencies and stick with basic callbacks" />
-
- <version title="v3.2.5"/>
+
+ <version title="v3.2.5" />
<item text=":core: Fix FAQ background" />
<item text=":core: Create FileUtils" />
<item text=":core: Create NotificationUtils" />
- <item text=":core: Update swipe to remove most exceptions" />
- <item text=":core: Make logging class functions inline" />
- <item text=":core: Create removeIf for mutableIteratables" />
+ <item text=":core: Update swipe to remove most exceptions" />
+ <item text=":core: Make logging class functions inline" />
+ <item text=":core: Create removeIf for mutableIteratables" />
<item text=":core-ui: Move reactive libs to :searchview:" />
-
- <version title="v3.2.3"/>
+
+ <version title="v3.2.3" />
<item text=":about: Modularize everything" />
<item text=":about: Create FAQ panel" />
<item text=":core: Create FAQ parser" />
<item text=":core: Create collapsible view delegate" />
<item text=":mediapicker: Allow for prefetching by default for videos" />
-
- <version title="v3.2.2"/>
- <item text=":core: Add simple KauBaseActivity so that activities extending AppCompatActivity can have some default kau helpers implemented" />
+
+ <version title="v3.2.2" />
+ <item text=":core: Add simple KauBaseActivity so that activities extending AppCompatActivity can have some default kau helpers implemented" />
<item text=":core: The permission manager will now notify you if you try to request a permission that isn\'t added to your manifest" />
<item text="Begin writing android tests" />
-
- <version title="v3.2.1"/>
+
+ <version title="v3.2.1" />
<item text=":core: Remove requestLayout call from setMargin and setPadding" />
<item text=":core: Fix kau direction bits" />
<item text=":core: Greatly simplify ripple canvas and truly support transparent ripples" />
@@ -75,32 +78,32 @@
<item text=":core: Add more transitions and anims" />
<item text=":kpref-activity: Reduce alpha color for desc" />
<item text=":imagepicker: [breaking] Rename to mediapicker and add support for videos (alpha)" />
-
- <version title="v3.2.0"/>
- <item text=":adapter: Make KauAnimator extensible" />
+
+ <version title="v3.2.0" />
+ <item text=":adapter: Make KauAnimator extensible" />
<item text=":imagepicker: Add uri val to ImageModel" />
<item text=":imagepicker: Create bindings and overlay activity" />
<item text=":imagepicker: Create single image picker counterpart with overlay" />
<item text=":searchview: Remove item animator so nonchanging items don\'t blink" />
<item text="Add showcase app to play store" />
<item text="Update build tools to 26.0.1" />
- <item text="Update dependencies" />
-
- <version title="v3.1.0"/>
+ <item text="Update dependencies" />
+
+ <version title="v3.1.0" />
<item text=":core: Allow for nullable throwables when logging" />
<item text=":core: Remove some extra DSL annotations" />
<item text=":kpref-activity: Bring down to minSdk 19 and fix compatibility" />
<item text=":adapter: Update readme for iitems and animators" />
- <item text=":about: Move strings to private" />
-
- <version title="v3.0"/>
+ <item text=":about: Move strings to private" />
+
+ <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="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" />
<item text=":adapter: Switched from mutablelist to list inputs for themed animator" />
@@ -115,7 +118,7 @@
<item text=":imagepicker: Create full image picker with blurrable selections" />
<item text="Update dependencies" />
- <version title="v2.0"/>
+ <version title="v2.0" />
<item text="Huge refactoring to separate functions to their own submodules" />
<item text="Huge Docs update" />
<item text="Reorder KauIItem arguments to support optional id" />
@@ -124,7 +127,7 @@
<item text="Fix scrolling issue on about dismiss" />
<item text="Make rClass optional in about activity" />
- <version title="v1.5"/>
+ <version title="v1.5" />
<item text="Change snackbar builder" />
<item text="Change addBundle to withArguments to match ANKO" />
<item text="Create KauIItem to replace AbstractItem" />
@@ -132,7 +135,7 @@
<item text="Create swipe, a very simple helper to allow for activities to be dismissed with gestures" />
<item text="Create network utils" />
- <version title="v1.4"/>
+ <version title="v1.4" />
<item text="Add about activities" />
<item text="Add themed fast item imageAdapter" />
<item text="Add chained imageAdapter" />
@@ -141,20 +144,20 @@
<item text="Add string arg option for sendEmail" />
<item text="Add many iitems" />
- <version title="v1.3"/>
+ <version title="v1.3" />
<item text="Add kpref subitems" />
<item text="Add DSL markers" />
<item text="Add transition utils and other utils" />
<item text="Add custom searchview with binders" />
<item text="Add KauBoundedCardView" />
- <version title="v1.2"/>
+ <version title="v1.2" />
<item text="Fix title attribute in changelog" />
<item text="Update support libs" />
<item text="Add is app installed utils" />
<item text="Add email builder" />
- <version title="v1.1"/>
+ <version title="v1.1" />
<item text="Create kpref items" />
<item text="Attach source files" />
<item text="Create color dialog" />
diff --git a/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt
index 75d9b27..29341af 100644
--- a/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt
+++ b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt
@@ -34,8 +34,8 @@ class SearchItem(val key: String,
) {
companion object {
- @JvmStatic var foregroundColor: Int = 0xdd000000.toInt()
- @JvmStatic var backgroundColor: Int = 0xfffafafa.toInt()
+ var foregroundColor: Int = 0xdd000000.toInt()
+ var backgroundColor: Int = 0xfffafafa.toInt()
}
var styledContent: SpannableStringBuilder? = null
@@ -44,7 +44,7 @@ class SearchItem(val key: String,
* Highlight the subText if it is present in the content
*/
fun withHighlights(subText: String) {
- val index = content.indexOf(subText)
+ val index = content.indexOf(subText, ignoreCase = true)
if (index == -1) return
styledContent = SpannableStringBuilder(content)
styledContent!!.setSpan(StyleSpan(Typeface.BOLD), index, index + subText.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
@@ -60,7 +60,7 @@ class SearchItem(val key: String,
holder.container.setRippleBackground(foregroundColor, backgroundColor)
holder.title.text = styledContent ?: content
- if (description?.isNotBlank() ?: false) holder.desc.visible().text = description
+ if (description?.isNotBlank() == true) holder.desc.visible().text = description
}
override fun unbindView(holder: ViewHolder) {