aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt2
-rw-r--r--about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt8
-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.kt2
-rw-r--r--adapter/build.gradle3
-rw-r--r--buildSrc/src/main/kotlin/kau/Dependencies.kt11
-rw-r--r--buildSrc/src/main/kotlin/kau/Versions.kt8
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt6
-rw-r--r--fastadapter/build.gradle2
-rw-r--r--fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/AdapterUtils.kt14
-rw-r--r--fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt8
-rw-r--r--fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/RepeatedClickListener.kt4
-rw-r--r--fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt6
-rw-r--r--fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt15
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt2
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt1
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt45
-rw-r--r--sample/build.gradle2
-rw-r--r--sample/proguard-rules.pro7
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt2
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt2
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt2
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt2
-rw-r--r--searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt10
24 files changed, 96 insertions, 74 deletions
diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt b/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt
index 79077c5..cc0eb91 100644
--- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt
+++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt
@@ -128,7 +128,7 @@ abstract class AboutActivityBase(val rClass: Class<*>?, private val configBuilde
* Open hook called just before the main page view is returned
* Feel free to add your own items to the adapter in here
*/
- open fun postInflateMainPage(adapter: FastItemThemedAdapter<IItem<*, *>>) {
+ open fun postInflateMainPage(adapter: FastItemThemedAdapter<IItem<*>>) {
}
/**
diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt b/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt
index a5d9c17..aae6cb0 100644
--- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt
+++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt
@@ -48,11 +48,11 @@ interface AboutPanelContract {
/**
* Model list to be added to [adapter]
*/
- var items: List<IItem<*, *>>?
+ var items: List<IItem<*>>?
/**
* The adapter, will be late initialized as it depends on configs
*/
- var adapter: FastItemThemedAdapter<IItem<*, *>>
+ var adapter: FastItemThemedAdapter<IItem<*>>
/**
* Reference to the recyclerview, will be used to stop scrolling upon exit
*/
@@ -90,9 +90,9 @@ interface AboutPanelContract {
abstract class AboutPanelRecycler : AboutPanelContract {
- override var items: List<IItem<*, *>>? = null
+ override var items: List<IItem<*>>? = null
- override lateinit var adapter: FastItemThemedAdapter<IItem<*, *>>
+ override lateinit var adapter: FastItemThemedAdapter<IItem<*>>
override var recycler: RecyclerView? = null
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 755ac81..8ae445d 100644
--- a/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt
+++ b/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt
@@ -41,14 +41,14 @@ class FaqIItem(val content: FaqItem) : KauIItem<LibraryIItem, FaqIItem.ViewHolde
), ThemableIItem by ThemableIItemDelegate() {
companion object {
- fun bindEvents(fastAdapter: FastAdapter<IItem<*, *>>) {
+ fun bindEvents(fastAdapter: FastAdapter<IItem<*>>) {
fastAdapter.withSelectable(false)
- .withEventHook(object : ClickEventHook<IItem<*, *>>() {
+ .withEventHook(object : ClickEventHook<IItem<*>>() {
override fun onBind(viewHolder: RecyclerView.ViewHolder): View? =
(viewHolder as? ViewHolder)?.questionContainer
- override fun onClick(v: View, position: Int, adapter: FastAdapter<IItem<*, *>>, item: IItem<*, *>) {
+ override fun onClick(v: View, position: Int, adapter: FastAdapter<IItem<*>>, item: IItem<*>) {
if (item !is FaqIItem) return
item.isExpanded = !item.isExpanded
v.parentViewGroup.findViewById<CollapsibleTextView>(R.id.faq_item_answer)
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 33aac09..dbff49a 100644
--- a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt
+++ b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt
@@ -39,7 +39,7 @@ class LibraryIItem(val lib: Library) : KauIItem<LibraryIItem, LibraryIItem.ViewH
), ThemableIItem by ThemableIItemDelegate() {
companion object {
- fun bindEvents(fastAdapter: FastAdapter<IItem<*, *>>) {
+ fun bindEvents(fastAdapter: FastAdapter<IItem<*>>) {
fastAdapter.withSelectable(false)
.withOnClickListener { v, _, item, _ ->
if (item !is LibraryIItem)
diff --git a/adapter/build.gradle b/adapter/build.gradle
index 42c6eba..4f38eae 100644
--- a/adapter/build.gradle
+++ b/adapter/build.gradle
@@ -4,6 +4,9 @@ apply from: '../android-lib.gradle'
dependencies {
implementation project(':core')
+
+ api kau.Dependencies.fastAdapter
+ api kau.Dependencies.fastAdapter('utils')
}
apply from: '../artifacts.gradle'
diff --git a/buildSrc/src/main/kotlin/kau/Dependencies.kt b/buildSrc/src/main/kotlin/kau/Dependencies.kt
index f6d07ec..d1e2b89 100644
--- a/buildSrc/src/main/kotlin/kau/Dependencies.kt
+++ b/buildSrc/src/main/kotlin/kau/Dependencies.kt
@@ -30,9 +30,9 @@ object Dependencies {
const val googleMaterial = "com.google.android.material:material:${Versions.googleMaterial}"
const val iconics = "com.mikepenz:iconics-core:${Versions.iconics}"
- const val iconicsGoogle = "com.mikepenz:google-material-typeface:${Versions.iconicsGoogle}.original@aar"
- const val iconicsMaterial = "com.mikepenz:material-design-iconic-typeface:${Versions.iconicsMaterial}@aar"
- const val iconicsCommunity = "com.mikepenz:community-material-typeface:${Versions.iconicsCommunity}@aar"
+ const val iconicsGoogle = "com.mikepenz:google-material-typeface:${Versions.iconicsGoogle}.original-kotlin@aar"
+ const val iconicsMaterial = "com.mikepenz:material-design-iconic-typeface:${Versions.iconicsMaterial}-kotlin@aar"
+ const val iconicsCommunity = "com.mikepenz:community-material-typeface:${Versions.iconicsCommunity}-kotlin@aar"
const val aboutLibraries = "com.mikepenz:aboutlibraries:${Versions.aboutLibraries}"
@@ -49,10 +49,7 @@ object Dependencies {
const val fastAdapter = "com.mikepenz:fastadapter:${Versions.fastAdapter}"
@JvmStatic
- fun fastAdapter(type: String) = "com.mikepenz:fastadapter-$type:${Versions.fastAdapter}"
-
- @JvmField
- val fastAdapterCommons = fastAdapter("commons")
+ fun fastAdapter(type: String) = "com.mikepenz:fastadapter-extensions-$type:${Versions.fastAdapter}"
const val bugsnag = "com.bugsnag:bugsnag-android:${Versions.bugsnag}"
diff --git a/buildSrc/src/main/kotlin/kau/Versions.kt b/buildSrc/src/main/kotlin/kau/Versions.kt
index 4deb3b7..f3fbd09 100644
--- a/buildSrc/src/main/kotlin/kau/Versions.kt
+++ b/buildSrc/src/main/kotlin/kau/Versions.kt
@@ -36,15 +36,15 @@ object Versions {
const val blurry = "3.0.0"
// https://github.com/mikepenz/FastAdapter#using-maven
- const val fastAdapter = "3.3.1"
+ const val fastAdapter = "4.1.0-b01"
// https://github.com/bumptech/glide/releases
const val glide = "4.9.0"
// https://github.com/mikepenz/Android-Iconics#1-provide-the-gradle-dependency
- const val iconics = "3.2.5"
- const val iconicsGoogle = "3.0.1.3"
- const val iconicsMaterial = "2.2.0.5"
+ const val iconics = "4.0.1-b01"
+ const val iconicsGoogle = "3.0.1.4"
+ const val iconicsMaterial = "2.2.0.6"
const val iconicsCommunity = "3.5.95.1"
// https://github.com/afollestad/material-dialogs/releases
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt
index 8b40352..52ea57d 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt
@@ -16,11 +16,12 @@
package ca.allanwang.kau.utils
import android.content.Context
-import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.drawable.Drawable
import androidx.annotation.ColorInt
import com.mikepenz.iconics.IconicsDrawable
+import com.mikepenz.iconics.colorInt
+import com.mikepenz.iconics.sizeDp
import com.mikepenz.iconics.typeface.IIcon
/**
@@ -33,8 +34,7 @@ fun IIcon.toDrawable(
@ColorInt color: Int = Color.WHITE,
builder: IconicsDrawable.() -> Unit = {}
): Drawable {
- val state = ColorStateList.valueOf(color)
- val icon = IconicsDrawable(c).icon(this).color(state)
+ val icon = IconicsDrawable(c).icon(this).colorInt(color)
if (sizeDp > 0) icon.sizeDp(sizeDp)
icon.builder()
return icon
diff --git a/fastadapter/build.gradle b/fastadapter/build.gradle
index 9fd848e..43e9c7c 100644
--- a/fastadapter/build.gradle
+++ b/fastadapter/build.gradle
@@ -7,7 +7,7 @@ dependencies {
api project(':adapter')
api kau.Dependencies.fastAdapter
- api kau.Dependencies.fastAdapterCommons
+// api kau.Dependencies.fastAdapterCommons
}
apply from: '../artifacts.gradle'
diff --git a/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/AdapterUtils.kt b/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/AdapterUtils.kt
index 17fd09f..42fe1a2 100644
--- a/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/AdapterUtils.kt
+++ b/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/AdapterUtils.kt
@@ -28,17 +28,17 @@ import com.mikepenz.fastadapter.select.SelectExtension
/**
* Add kotlin's generic syntax to better support out types
*/
-fun <Item : IItem<*, *>> fastAdapter(vararg adapter: IAdapter<out Item>) =
- FastAdapter.with<Item, IAdapter<out Item>>(adapter.toList())!!
+fun <Item : IItem<*>> fastAdapter(vararg adapter: IAdapter<out Item>) =
+ FastAdapter.with<Item, IAdapter<out Item>>(adapter.toList())
-inline fun <reified T : IAdapterExtension<Item>, Item : IItem<*, *>> FastAdapter<Item>.getExtension(): T? =
+inline fun <reified T : IAdapterExtension<Item>, Item : IItem<*>> FastAdapter<Item>.getExtension(): T? =
getExtension(T::class.java)
/**
* Returns selection size, or -1 if selection is disabled
*/
-inline val <Item : IItem<*, *>> IAdapter<Item>.selectionSize: Int
- get() = fastAdapter.getExtension<SelectExtension<Item>, Item>()?.selections?.size ?: -1
+inline val <Item : IItem<*>> IAdapter<Item>.selectionSize: Int
+ get() = fastAdapter?.getExtension<SelectExtension<Item>, Item>()?.selections?.size ?: -1
-inline val <Item : IItem<*, *>> IAdapter<Item>.selectedItems: Set<Item>
- get() = fastAdapter.getExtension<SelectExtension<Item>, Item>()?.selectedItems ?: emptySet()
+inline val <Item : IItem<*>> IAdapter<Item>.selectedItems: Set<Item>
+ get() = fastAdapter?.getExtension<SelectExtension<Item>, Item>()?.selectedItems ?: emptySet()
diff --git a/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt b/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt
index 152982f..01ac0e5 100644
--- a/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt
+++ b/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt
@@ -24,7 +24,7 @@ import androidx.annotation.RequiresApi
import ca.allanwang.kau.ui.createSimpleRippleDrawable
import ca.allanwang.kau.utils.adjustAlpha
import com.mikepenz.fastadapter.IItem
-import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter
+import com.mikepenz.fastadapter.adapters.FastItemAdapter
/**
* Created by Allan Wang on 2017-06-29.
@@ -35,7 +35,7 @@ import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter
* This adapter overrides every method where an item is added
* If that item extends [ThemableIItem], then the colors will be set
*/
-class FastItemThemedAdapter<Item : IItem<*, *>>(
+class FastItemThemedAdapter<Item : IItem<*>>(
textColor: Int? = null,
backgroundColor: Int? = null,
accentColor: Int? = null
@@ -113,11 +113,11 @@ class FastItemThemedAdapter<Item : IItem<*, *>>(
return super.setNewList(items)
}
- private fun injectTheme(items: Collection<IItem<*, *>?>?) {
+ private fun injectTheme(items: Collection<IItem<*>?>?) {
items?.forEach { injectTheme(it) }
}
- protected fun injectTheme(item: IItem<*, *>?) {
+ protected fun injectTheme(item: IItem<*>?) {
if (item is ThemableIItem && item.themeEnabled) {
item.textColor = textColor
item.backgroundColor = backgroundColor
diff --git a/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/RepeatedClickListener.kt b/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/RepeatedClickListener.kt
index 40b4774..3e7d707 100644
--- a/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/RepeatedClickListener.kt
+++ b/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/RepeatedClickListener.kt
@@ -25,7 +25,7 @@ import com.mikepenz.fastadapter.listeners.OnClickListener
/**
* Created by Allan Wang on 26/12/17.
*/
-fun <Item : IItem<*, *>> FastAdapter<Item>.withOnRepeatedClickListener(
+fun <Item : IItem<*>> FastAdapter<Item>.withOnRepeatedClickListener(
count: Int,
duration: Long,
event: OnClickListener<Item>
@@ -37,7 +37,7 @@ fun <Item : IItem<*, *>> FastAdapter<Item>.withOnRepeatedClickListener(
* each within [duration] from each other.
* Only then will the [event] be fired, and everything will be reset.
*/
-private class RepeatedClickListener<Item : IItem<*, *>>(
+private class RepeatedClickListener<Item : IItem<*>>(
@IntRange(from = 1) val count: Int,
@IntRange(from = 1) val duration: Long,
val event: OnClickListener<Item>
diff --git a/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt b/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
index 6e33833..47c465c 100644
--- a/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
+++ b/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
@@ -51,13 +51,13 @@ class CardIItem(
), ThemableIItem by ThemableIItemDelegate() {
companion object {
- fun bindClickEvents(fastAdapter: FastAdapter<IItem<*, *>>) {
- fastAdapter.withEventHook(object : ClickEventHook<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
}
- override fun onClick(v: View, position: Int, adapter: FastAdapter<IItem<*, *>>, item: IItem<*, *>) {
+ override fun onClick(v: View, position: Int, adapter: FastAdapter<IItem<*>>, item: IItem<*>) {
if (item !is CardIItem) return
with(item.configs) {
when (v.id) {
diff --git a/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt b/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt
index c66dc01..34a2b7d 100644
--- a/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt
+++ b/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt
@@ -15,12 +15,9 @@
*/
package ca.allanwang.kau.iitems
-import android.annotation.SuppressLint
import android.view.View
import androidx.annotation.LayoutRes
import androidx.recyclerview.widget.RecyclerView
-import com.mikepenz.fastadapter.IClickable
-import com.mikepenz.fastadapter.IItem
import com.mikepenz.fastadapter.items.AbstractItem
/**
@@ -29,14 +26,10 @@ import com.mikepenz.fastadapter.items.AbstractItem
* Kotlin implementation of the [AbstractItem] to make things shorter
* If only one iitem type extends the given [layoutRes], you may use it as the type and not worry about another id
*/
-open class KauIItem<Item, VH : RecyclerView.ViewHolder>(
- @param:LayoutRes private val layoutRes: Int,
+open class KauIItem<VH : RecyclerView.ViewHolder>(
+ @param:LayoutRes override val layoutRes: Int,
private val viewHolder: (v: View) -> VH,
- private val type: Int = layoutRes
-) : AbstractItem<Item, VH>() where Item : IItem<*, *>, Item : IClickable<*> {
- @SuppressLint("ResourceType")
- final override fun getType(): Int = type
-
+ override val type: Int = layoutRes
+) : AbstractItem<VH>() {
final override fun getViewHolder(v: View): VH = viewHolder(v)
- final override fun getLayoutRes(): Int = layoutRes
}
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 edaf347..b701a07 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
@@ -31,7 +31,7 @@ import ca.allanwang.kau.utils.KAU_RIGHT
import ca.allanwang.kau.utils.resolveColor
import ca.allanwang.kau.utils.statusBarColor
import ca.allanwang.kau.utils.withLinearAdapter
-import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter
+import com.mikepenz.fastadapter.adapters.FastItemAdapter
import kotlinx.android.synthetic.main.kau_pref_activity.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt
index 1941ec0..a365e13 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt
@@ -28,6 +28,7 @@ import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.string
import com.mikepenz.google_material_typeface_library.GoogleMaterial
import com.mikepenz.iconics.typeface.IIcon
+import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
import java.io.File
/**
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 e6556ab..c928e04 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
@@ -46,9 +46,13 @@ import com.bumptech.glide.Glide
import com.bumptech.glide.RequestManager
import com.mikepenz.fastadapter.IItem
import com.mikepenz.fastadapter.adapters.ItemAdapter
-import com.mikepenz.google_material_typeface_library.GoogleMaterial
import com.mikepenz.iconics.IconicsDrawable
+import com.mikepenz.iconics.colorInt
+import com.mikepenz.iconics.paddingPx
+import com.mikepenz.iconics.sizePx
import com.mikepenz.iconics.typeface.IIcon
+import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
+import com.mikepenz.iconics.utils.toIconicsColor
import kotlinx.coroutines.CancellationException
import java.io.File
@@ -57,7 +61,7 @@ import java.io.File
*
* Container for the main logic behind the both pickers
*/
-abstract class MediaPickerCore<T : IItem<*, *>>(
+abstract class MediaPickerCore<T : IItem<*>>(
val mediaType: MediaType,
val mediaActions: List<MediaAction>
) : KauBaseActivity(), LoaderManager.LoaderCallbacks<Cursor> {
@@ -87,15 +91,16 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
/**
* Create error tile for a given item
*/
- fun getErrorDrawable(context: Context) = getIconDrawable(context, GoogleMaterial.Icon.gmd_error, accentColor)
+ fun getErrorDrawable(context: Context) =
+ getIconDrawable(context, GoogleMaterial.Icon.gmd_error, accentColor)
fun getIconDrawable(context: Context, iicon: IIcon, color: Int): Drawable {
val sizePx = MediaPickerCore.computeViewSize(context)
return IconicsDrawable(context, iicon)
.sizePx(sizePx)
- .backgroundColor(color)
+ .backgroundColor(color.toIconicsColor())
.paddingPx(sizePx / 3)
- .color(Color.WHITE)
+ .colorInt(Color.WHITE)
}
var accentColor: Int = 0xff666666.toInt()
@@ -105,7 +110,10 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
* This is used for both single and multiple photo picks
*/
fun onMediaPickerResult(resultCode: Int, data: Intent?): List<MediaModel> {
- if (resultCode != Activity.RESULT_OK || data == null || !data.hasExtra(MEDIA_PICKER_RESULT))
+ if (resultCode != Activity.RESULT_OK || data == null || !data.hasExtra(
+ MEDIA_PICKER_RESULT
+ )
+ )
return emptyList()
return data.getParcelableArrayListExtra(MEDIA_PICKER_RESULT)
}
@@ -134,12 +142,14 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
fun initializeRecycler(recycler: RecyclerView) {
val adapterHeader = ItemAdapter<MediaActionItem>()
- val fulladapter = fastAdapter<IItem<*, *>>(adapterHeader, adapter)
+ val fulladapter = fastAdapter<IItem<*>>(adapterHeader, adapter)
adapterHeader.add(mediaActions.map { MediaActionItem(it, mediaType) })
recycler.apply {
val manager = object : GridLayoutManager(context, computeColumnCount(context)) {
override fun getExtraLayoutSpace(state: RecyclerView.State?): Int {
- return if (mediaType != MediaType.VIDEO) extraSpace else super.getExtraLayoutSpace(state)
+ return if (mediaType != MediaType.VIDEO) extraSpace else super.getExtraLayoutSpace(
+ state
+ )
}
}
setItemViewCacheSize(CACHE_SIZE)
@@ -154,7 +164,14 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
var sortQuery = MediaStore.MediaColumns.DATE_MODIFIED + " DESC"
override fun onCreateLoader(id: Int, args: Bundle?): Loader<Cursor> {
- return CursorLoader(this, mediaType.contentUri, MediaModel.projection, null, null, sortQuery)
+ return CursorLoader(
+ this,
+ mediaType.contentUri,
+ MediaModel.projection,
+ null,
+ null,
+ sortQuery
+ )
}
/**
@@ -238,7 +255,11 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
* Method used to retrieve uri data for API 19+
* 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) {
+ private fun <R> ContentResolver.query(
+ baseUri: Uri,
+ uris: List<Uri>,
+ block: (cursor: Cursor) -> R
+ ) {
val ids = uris.filter {
val valid = DocumentsContract.isDocumentUri(this@MediaPickerCore, it)
if (!valid) KL.d { "Non document uri: ${it.encodedPath}" }
@@ -248,7 +269,9 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
}.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)
+ query(baseUri, MediaModel.projection, "${BaseColumns._ID} IN $ids", null, sortQuery)?.use(
+ block
+ )
}
internal var tempPath: String? = null
diff --git a/sample/build.gradle b/sample/build.gradle
index 4e34bf9..cacd21f 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -54,8 +54,6 @@ android {
buildTypes {
debug {
- minifyEnabled false
- shrinkResources false
applicationIdSuffix ".debug"
versionNameSuffix "-debug"
signingConfig signingConfigs.debug
diff --git a/sample/proguard-rules.pro b/sample/proguard-rules.pro
index f3a65f0..3189ebb 100644
--- a/sample/proguard-rules.pro
+++ b/sample/proguard-rules.pro
@@ -1,2 +1,7 @@
-ignorewarnings
--dontwarn kotlin.** \ No newline at end of file
+-dontwarn kotlin.**
+# Iconics
+-keep class .R
+-keep class **.R$* {
+ <fields>;
+} \ No newline at end of file
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt
index 928070e..db26ef5 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt
@@ -33,7 +33,7 @@ class AboutActivity : AboutActivityBase(R.string::class.java, {
faqParseNewLine = false
}) {
- override fun postInflateMainPage(adapter: FastItemThemedAdapter<IItem<*, *>>) {
+ override fun postInflateMainPage(adapter: FastItemThemedAdapter<IItem<*>>) {
adapter.add(CardIItem {
title = "About KAU"
descRes = R.string.about_kau
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt
index a11a672..8c35c77 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt
@@ -30,7 +30,7 @@ import com.mikepenz.google_material_typeface_library.GoogleMaterial
class AdapterActivity : ElasticRecyclerActivity() {
override fun onCreate(savedInstanceState: Bundle?, configs: Configs): Boolean {
- val adapter = ItemAdapter<IItem<*, *>>()
+ val adapter = ItemAdapter<IItem<*>>()
recycler.adapter = fastAdapter(adapter)
adapter.add(
listOf(
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt
index 349e3d1..aaa6143 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt
@@ -30,7 +30,7 @@ import ca.allanwang.kau.utils.startActivity
import ca.allanwang.kau.utils.toast
import ca.allanwang.kau.utils.withAlpha
import ca.allanwang.kau.utils.withSlideOut
-import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter
+import com.mikepenz.fastadapter.adapters.FastItemAdapter
/**
* Created by Allan Wang on 2017-06-12.
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 9ce3f42..f4a09cf 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
@@ -106,7 +106,7 @@ class MainActivity : KPrefActivity() {
accentColor = KPrefSample::accentColor
}
- override fun onCreateKPrefs(savedInstanceState: android.os.Bundle?): KPrefAdapterBuilder.() -> Unit = {
+ override fun onCreateKPrefs(savedInstanceState: Bundle?): KPrefAdapterBuilder.() -> Unit = {
header(R.string.header)
diff --git a/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt
index 10f2de3..18eb675 100644
--- a/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt
+++ b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt
@@ -62,7 +62,7 @@ import ca.allanwang.kau.utils.tint
import ca.allanwang.kau.utils.toDrawable
import ca.allanwang.kau.utils.visible
import ca.allanwang.kau.utils.withLinearAdapter
-import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter
+import com.mikepenz.fastadapter.adapters.FastItemAdapter
import com.mikepenz.iconics.typeface.IIcon
import com.mikepenz.google_material_typeface_library.GoogleMaterial
import kotlinx.android.synthetic.main.kau_search_view.view.*
@@ -390,7 +390,9 @@ class SearchView @JvmOverloads constructor(
config(config)
val menuItem = menu.findItem(id)
?: throw IllegalArgumentException("Menu item with given id doesn't exist")
- if (menuItem.icon == null) menuItem.icon = GoogleMaterial.Icon.gmd_search.toDrawable(context, 18, menuIconColor)
+ if (menuItem.icon == null) {
+ menuItem.icon = GoogleMaterial.Icon.gmd_search.toDrawable(context, 18, menuIconColor)
+ }
kau_search_cardview.gone()
menuItem.setOnMenuItemClickListener { revealOpen(); true }
kau_search_shadow.setOnClickListener { revealClose() }
@@ -509,7 +511,7 @@ fun Activity.bindSearchView(
menu: Menu,
@IdRes id: Int,
@ColorInt menuIconColor: Int = Color.WHITE,
- config: SearchView.Configs.() -> Unit = {}
+ config: Configs.() -> Unit = {}
): SearchView = findViewById<ViewGroup>(android.R.id.content).bindSearchView(menu, id, menuIconColor, config)
/**
@@ -522,7 +524,7 @@ fun ViewGroup.bindSearchView(
menu: Menu,
@IdRes id: Int,
@ColorInt menuIconColor: Int = Color.WHITE,
- config: SearchView.Configs.() -> Unit = {}
+ config: Configs.() -> Unit = {}
): SearchView {
val searchView = SearchView(context)
searchView.layoutParams =