diff options
36 files changed, 150 insertions, 118 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 f7eddb9..5c3a00b 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt @@ -111,14 +111,14 @@ abstract class AboutActivityBase(val rClass: Class<*>?, private val configBuilde var libPageTitle: String? = null set(value) { field = value - libPageTitleRes = INVALID_ID //reset res so we don't use our default + libPageTitleRes = INVALID_ID // reset res so we don't use our default } var faqXmlRes: Int = INVALID_ID var faqPageTitleRes: Int = R.string.kau_about_faq_intro var faqPageTitle: String? = null set(value) { field = value - faqPageTitleRes = INVALID_ID //reset res so we don't use our default + faqPageTitleRes = INVALID_ID // reset res so we don't use our default } /** * Whether new lines should be included @@ -190,7 +190,7 @@ abstract class AboutActivityBase(val rClass: Class<*>?, private val configBuilde } override fun onDestroy() { - AnimHolder.decelerateInterpolator.invalidate() //clear the reference to the interpolators we've used + AnimHolder.decelerateInterpolator.invalidate() // clear the reference to the interpolators we've used super.onDestroy() } } diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt b/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt index d51db46..d92f6a7 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt @@ -47,7 +47,7 @@ class CutoutIItem(val config: CutoutView.() -> Unit = {}) : KauIItem<CutoutIItem super.unbindView(holder) with(holder) { cutout.drawable = null - cutout.text = "Text" //back to default + cutout.text = "Text" // back to default } } diff --git a/adapter/build.gradle b/adapter/build.gradle index 4f38eae..2874275 100644 --- a/adapter/build.gradle +++ b/adapter/build.gradle @@ -1,12 +1,11 @@ -ext.kauSubModuleMinSdk = kau.Versions.coreMinSdk +import kau.Versions + +ext.kauSubModuleMinSdk = Versions.coreMinSdk 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 d1e2b89..b2cdf48 100644 --- a/buildSrc/src/main/kotlin/kau/Dependencies.kt +++ b/buildSrc/src/main/kotlin/kau/Dependencies.kt @@ -7,8 +7,34 @@ object Dependencies { @JvmStatic fun kau(version: String) = "ca.allanwang:kau:$version" + private fun kau(type: String, version: String) = "ca.allanwang.kau:$type:$version" + + @JvmStatic + fun kauAbout(version: String) = kau("about", version) + + @JvmStatic + fun kauAdapter(version: String) = kau("adapter", version) + + @JvmStatic + fun kauColorPicker(version: String) = kau("colorpicker", version) + + @JvmStatic + fun kauCore(version: String) = kau("core", version) + + @JvmStatic + fun kauCoreUi(version: String) = kau("core-ui", version) + + @JvmStatic + fun kauFastAdapter(version: String) = kau("fastadapter", version) + + @JvmStatic + fun kauKprefActivity(version: String) = kau("kpref-activity", version) + + @JvmStatic + fun kauMediaPicker(version: String) = kau("mediapicker", version) + @JvmStatic - fun kau(type: String, version: String) = "ca.allanwang.kau:$type:$version" + fun kauSearchView(version: String) = kau("searchview", version) @JvmStatic fun kotlin(type: String) = "org.jetbrains.kotlin:kotlin-$type:${Versions.kotlin}" @@ -26,13 +52,17 @@ object Dependencies { const val appcompat = "androidx.appcompat:appcompat:${Versions.appcompat}" const val recyclerView = "androidx.recyclerview:recyclerview:${Versions.recyclerView}" const val cardView = "androidx.cardview:cardview:${Versions.cardView}" - const val constraintLayout = "androidx.constraintlayout:constraintlayout:${Versions.constraintLayout}" + const val constraintLayout = + "androidx.constraintlayout:constraintlayout:${Versions.constraintLayout}" 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-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 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}" @@ -42,14 +72,16 @@ object Dependencies { const val glideKapt = "com.github.bumptech.glide:compiler:${Versions.glide}" @JvmStatic - fun materialDialog(type: String) = "com.afollestad.material-dialogs:$type:${Versions.materialDialog}" + fun materialDialog(type: String) = + "com.afollestad.material-dialogs:$type:${Versions.materialDialog}" @JvmField val materialDialog = materialDialog("core") const val fastAdapter = "com.mikepenz:fastadapter:${Versions.fastAdapter}" @JvmStatic - fun fastAdapter(type: String) = "com.mikepenz:fastadapter-extensions-$type:${Versions.fastAdapter}" + 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 f3fbd09..010aaa0 100644 --- a/buildSrc/src/main/kotlin/kau/Versions.kt +++ b/buildSrc/src/main/kotlin/kau/Versions.kt @@ -9,25 +9,25 @@ object Versions { const val buildTools = "29.0.0" // https://mvnrepository.com/artifact/androidx.appcompat/appcompat?repo=google - const val appcompat = "1.0.2" + const val appcompat = "1.1.0-rc01" // https://mvnrepository.com/artifact/com.google.android.material/material const val googleMaterial = "1.0.0" // https://mvnrepository.com/artifact/androidx.recyclerview/recyclerview - const val recyclerView = "1.0.0" + const val recyclerView = "1.1.0-beta02" // https://mvnrepository.com/artifact/androidx.cardview/cardview const val cardView = "1.0.0" // https://mvnrepository.com/artifact/androidx.constraintlayout/constraintlayout - const val constraintLayout = "1.1.3" + const val constraintLayout = "2.0.0-beta2" // https://kotlinlang.org/docs/reference/using-gradle.html const val kotlin = "1.3.41" // https://github.com/Kotlin/kotlinx.coroutines/releases - const val coroutines = "1.3.0-RC" + const val coroutines = "1.3.0-RC2" // https://github.com/mikepenz/AboutLibraries/releases const val aboutLibraries = "6.2.3" @@ -35,7 +35,7 @@ object Versions { // https://github.com/wasabeef/Blurry/releases const val blurry = "3.0.0" - // https://github.com/mikepenz/FastAdapter#using-maven + // https://github.com/mikepenz/FastAdapter/releases const val fastAdapter = "4.1.0-b01" // https://github.com/bumptech/glide/releases @@ -48,7 +48,7 @@ object Versions { const val iconicsCommunity = "3.5.95.1" // https://github.com/afollestad/material-dialogs/releases - const val materialDialog = "3.0.0-rc2" + const val materialDialog = "3.1.0" // https://mvnrepository.com/artifact/androidx.test.espresso/espresso-core?repo=google const val espresso = "3.1.1" @@ -62,16 +62,16 @@ object Versions { const val testRules = "1.1.1" // https://github.com/diffplug/spotless/blob/master/plugin-gradle/CHANGES.md - const val spotless = "3.18.0" + const val spotless = "3.24.1" // https://github.com/bugsnag/bugsnag-android/releases - const val bugsnag = "4.12.0" + const val bugsnag = "4.18.0" // https://github.com/bugsnag/bugsnag-android-gradle-plugin/releases - const val bugsnagPlugin="4.1.1" + const val bugsnagPlugin="4.5.2" // https://mvnrepository.com/artifact/com.android.tools.build/gradle?repo=google - const val gradlePlugin = "3.5.0-rc01" + const val gradlePlugin = "3.5.0-rc03" // https://github.com/dcendents/android-maven-gradle-plugin/releases const val mavenPlugin = "2.1" // https://github.com/Triple-T/gradle-play-publisher/releases diff --git a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/TextSlider.kt b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/TextSlider.kt index 51f7ab9..726f5b6 100644 --- a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/TextSlider.kt +++ b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/TextSlider.kt @@ -138,7 +138,7 @@ class TextSlider @JvmOverloads constructor( init { setFactory { TextView(context).apply { - //replica of toolbar title + // replica of toolbar title gravity = Gravity.START setSingleLine() ellipsize = TextUtils.TruncateAt.END diff --git a/core-ui/src/main/res-public/values/public.xml b/core-ui/src/main/res-public/values/public.xml index 71657d6..c8c2e56 100644 --- a/core-ui/src/main/res-public/values/public.xml +++ b/core-ui/src/main/res-public/values/public.xml @@ -1,8 +1,8 @@ <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_recycler_detached_background' type='layout' /> - <public name='kau_recycler_textslider' type='layout' /> <public name='kau_elastic_recycler_activity' type='layout' /> + <public name='kau_recycler_textslider' type='layout' /> <public name='Kau.Translucent' type='style' /> <public name='Kau.Translucent.NoAnimation' type='style' /> <public name='Kau.Translucent.SlideBottom' type='style' /> diff --git a/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt b/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt index 143b83f..64c4a37 100644 --- a/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt +++ b/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt @@ -103,7 +103,7 @@ class KPrefTest { pref { one = 2 } assertPrefEquals(2, { one }) assertPrefEquals(6, { prefMap.size }, "Prefmap does not have all elements") - pref { reset() } //only invalidates our lazy delegate; doesn't change the actual pref + pref { reset() } // only invalidates our lazy delegate; doesn't change the actual pref assertPrefEquals(2, { one }, "Kpref did not properly fetch from shared prefs") // Android pref only androidPref.sp.edit().putInt("one", -1).commit() 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 96adfa3..b549523 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt @@ -82,7 +82,7 @@ internal object PermissionManager { if (!manifestPermission(context).contains(it)) { KL.e { "Requested permission $it is not stated in the manifest" } context.toast("$it is not in the manifest") - //we'll let the request pass through so it can be denied and so the callback can be triggered + // we'll let the request pass through so it can be denied and so the callback can be triggered } } val activity = (context as? Activity) diff --git a/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt b/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt index 0b1dd88..9f23b63 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt @@ -37,7 +37,7 @@ internal class RelativeSlider(var curPage: SwipeBackPage) : SwipeListener { * Set offset of previous page based on the edge flag and percentage scrolled */ override fun onScroll(percent: Float, px: Int, edgeFlag: Int) { - if (offset == 0f) return //relative slider is not enabled + if (offset == 0f) return // relative slider is not enabled val page = SwipeBackHelper.getPrePage(curPage) ?: return if (percent == 0f) { page.swipeBackLayout.x = 0f diff --git a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackHelper.kt b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackHelper.kt index 1c6de12..0cb6935 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackHelper.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackHelper.kt @@ -57,7 +57,7 @@ internal object SwipeBackHelper { fun finish(activity: Activity) = this[activity]?.scrollToFinishActivity() internal fun getPrePage(page: SwipeBackPage): SwipeBackPage? { - //clean invalid pages + // clean invalid pages pageStack.kauRemoveIf { it.activityRef.get() == null } return pageStack.getOrNull(pageStack.indexOf(page) - 1) } 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 0fb0046..921cd1f 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt @@ -167,7 +167,7 @@ internal class SwipeBackLayout @JvmOverloads constructor( dragHelper = ViewDragHelper.create(this, ViewDragCallback()) val density = resources.displayMetrics.density val minVel = MIN_FLING_VELOCITY * density - //allow touch from anywhere on the screen + // allow touch from anywhere on the screen edgeSize = Math.max(resources.displayMetrics.widthPixels, resources.displayMetrics.heightPixels) minVelocity = minVel // maxVelocity = 2.5f * minVel @@ -371,7 +371,7 @@ internal class SwipeBackLayout @JvmOverloads constructor( super.onViewPositionChanged(changedView, left, top, dx, dy) val contentView = contentViewRef.get() ?: return KL.e { "KauSwipe cannot change view position as contentView is null; is onPostCreate called?" } - //make sure that we are using the proper axis + // make sure that we are using the proper axis scrollPercent = Math.abs( if (horizontal) left.toFloat() / contentView.width else (top.toFloat() / contentView.height) @@ -399,7 +399,7 @@ internal class SwipeBackLayout @JvmOverloads constructor( override fun onViewReleased(releasedChild: View, xvel: Float, yvel: Float) { var result = Pair(0, 0) if (scrollPercent <= scrollThreshold) { - //threshold not met; check velocities + // threshold not met; check velocities if ((edgeFlag == SWIPE_EDGE_LEFT && xvel > MIN_FLING_VELOCITY) || (edgeFlag == SWIPE_EDGE_RIGHT && xvel < -MIN_FLING_VELOCITY) || (edgeFlag == SWIPE_EDGE_TOP && yvel > MIN_FLING_VELOCITY) || @@ -407,7 +407,7 @@ internal class SwipeBackLayout @JvmOverloads constructor( ) result = exitCaptureOffsets(edgeFlag, releasedChild) } else { - //threshold met; fling to designated side + // threshold met; fling to designated side result = exitCaptureOffsets(edgeFlag, releasedChild) } dragHelper.settleCapturedViewAt(result.first, result.second) diff --git a/core/src/main/kotlin/ca/allanwang/kau/ui/views/MeasureSpecDelegate.kt b/core/src/main/kotlin/ca/allanwang/kau/ui/views/MeasureSpecDelegate.kt index 8800c2d..b1e442f 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/ui/views/MeasureSpecDelegate.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/ui/views/MeasureSpecDelegate.kt @@ -122,7 +122,7 @@ class MeasureSpecDelegate : MeasureSpecContract { if (relativeWidthToParent > 0) { width = relativeWidthToParent * parentFrame.width() } - //second cycle - relative to each other + // second cycle - relative to each other if (relativeHeight > 0) { height = relativeHeight * width } else if (relativeWidth > 0) { diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt index 3b593a6..279bcd3 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt @@ -85,7 +85,7 @@ inline fun Activity.restart(intentBuilder: Intent.() -> Unit = {}) { i.putExtras(oldExtras) i.intentBuilder() startActivity(i) - overridePendingTransition(R.anim.kau_fade_in, R.anim.kau_fade_out) //No transitions + overridePendingTransition(R.anim.kau_fade_in, R.anim.kau_fade_out) // No transitions finish() overridePendingTransition(R.anim.kau_fade_in, R.anim.kau_fade_out) } diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt index 3de0297..ab7b341 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt @@ -157,7 +157,7 @@ fun String.toColor(): Int { return Color.parseColor(toParse) } -//Get ColorStateList +// Get ColorStateList fun Context.colorStateList(@ColorInt color: Int): ColorStateList { val disabledColor = color.adjustAlpha(0.3f) return ColorStateList( 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 2f552ed..cf68066 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt @@ -119,7 +119,7 @@ fun Context.startLink(vararg url: String?) { fun Context.startLink(@StringRes url: Int) = startLink(string(url)) -//Toast helpers +// Toast helpers inline fun View.toast(@StringRes id: Int, duration: Int = Toast.LENGTH_LONG, log: Boolean = false) = context.toast(id, duration, log) @@ -136,7 +136,7 @@ inline fun Context.toast(text: String, duration: Int = Toast.LENGTH_LONG, log: B const val INVALID_ID = 0 -//Resource retrievers +// Resource retrievers inline fun Context.string(@StringRes id: Int): String = getString(id) inline fun Context.string(@StringRes id: Int, fallback: String?): String? = @@ -167,7 +167,7 @@ inline fun Context.animation(@AnimRes id: Int) = AnimationUtils.loadAnimation(th inline fun Context.plural(@PluralsRes id: Int, quantity: Number) = resources.getQuantityString(id, quantity.toInt(), quantity.toInt()) -//Attr retrievers +// Attr retrievers fun Context.resolveColor(@AttrRes attr: Int, @ColorInt fallback: Int = 0): Int { val a = theme.obtainStyledAttributes(intArrayOf(attr)) try { 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 52ea57d..dc7b214 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt @@ -20,8 +20,7 @@ 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.dsl.iconicsDrawable import com.mikepenz.iconics.typeface.IIcon /** @@ -33,9 +32,9 @@ fun IIcon.toDrawable( sizeDp: Int = 24, @ColorInt color: Int = Color.WHITE, builder: IconicsDrawable.() -> Unit = {} -): Drawable { - val icon = IconicsDrawable(c).icon(this).colorInt(color) - if (sizeDp > 0) icon.sizeDp(sizeDp) - icon.builder() - return icon -} +): Drawable = c.iconicsDrawable(this) { + this.color = colorInt(color) + if (sizeDp > 0) { + size = sizeDp(sizeDp) + } +}.apply(builder) diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt index aaef160..fac9421 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt @@ -246,7 +246,7 @@ private fun <T, V : View> requiredResettable(ids: IntArray, finder: T.(Int) -> V private fun <T, V : View> optionalResettable(ids: IntArray, finder: T.(Int) -> View?) = LazyResettable { t: T, _ -> ids.map { t.finder(it) as V? }.filterNotNull() } -//Like Kotterknife's lazy delegate but is resettable +// Like Kotterknife's lazy delegate but is resettable private class LazyResettable<in T, out V>(initializer: (T, KProperty<*>) -> V) : Lazy<T, V>(initializer) { override fun getValue(thisRef: T, property: KProperty<*>): V { KotterknifeRegistry.register(thisRef!!, this) diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt index 4055847..0bd534e 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt @@ -54,13 +54,13 @@ fun Context.isAppEnabled(packageName: String): Boolean { @KauUtils fun Context.showAppInfo(packageName: String) { try { - //Open the specific App Info page: + // Open the specific App Info page: val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS) intent.data = Uri.parse("package:$packageName") startActivity(intent) } catch (e: ActivityNotFoundException) { e.printStackTrace() - //Open the generic Apps page: + // Open the generic Apps page: val intent = Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS) startActivity(intent) } diff --git a/core/src/main/kotlin/ca/allanwang/kau/xml/FAQ.kt b/core/src/main/kotlin/ca/allanwang/kau/xml/FAQ.kt index 73d7d6c..afde735 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/xml/FAQ.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/xml/FAQ.kt @@ -43,7 +43,7 @@ fun Context.kauParseFaq( resources.getXml(xmlRes).use { parser: XmlResourceParser -> var eventType = parser.eventType var question: Spanned? = null - var flag = -1 //-1, 0, 1 -> invalid, question, answer + var flag = -1 // -1, 0, 1 -> invalid, question, answer while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { flag = when (parser.name) { diff --git a/core/src/main/res-public/values/public.xml b/core/src/main/res-public/values/public.xml index 0b050dc..211c539 100644 --- a/core/src/main/res-public/values/public.xml +++ b/core/src/main/res-public/values/public.xml @@ -1,27 +1,20 @@ <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_enter_slide_left' type='transition' /> - <public name='kau_exit_slide_right' type='transition' /> - <public name='kau_exit_slide_bottom' type='transition' /> - <public name='kau_enter_slide_bottom' type='transition' /> - <public name='kau_enter_slide_right' type='transition' /> - <public name='kau_exit_slide_top' type='transition' /> - <public name='kau_enter_slide_top' type='transition' /> - <public name='kau_exit_slide_left' type='transition' /> - <public name='kau_selectable_white' type='drawable' /> - <public name='kau_transparent' type='drawable' /> - <public name='kau_slide_out_left_top' type='anim' /> - <public name='kau_slide_in_right' type='anim' /> - <public name='kau_slide_out_right_top' type='anim' /> <public name='kau_slide_in_top' type='anim' /> - <public name='kau_slide_out_left' type='anim' /> + <public name='kau_slide_in_left' type='anim' /> <public name='kau_slide_out_right' type='anim' /> + <public name='kau_slide_out_right_top' type='anim' /> <public name='kau_fade_in' type='anim' /> - <public name='kau_slide_out_bottom' type='anim' /> - <public name='kau_slide_in_bottom' type='anim' /> <public name='kau_slide_out_top' type='anim' /> + <public name='kau_slide_out_bottom' type='anim' /> <public name='kau_fade_out' type='anim' /> - <public name='kau_slide_in_left' type='anim' /> + <public name='kau_slide_out_left' type='anim' /> + <public name='kau_slide_out_left_top' type='anim' /> + <public name='kau_slide_in_bottom' type='anim' /> + <public name='kau_slide_in_right' type='anim' /> + <public name='kau_transparent' type='drawable' /> + <public name='kau_selectable_white' type='drawable' /> + <public name='kau_shadow_overlay' type='color' /> <public name='kau_activity_horizontal_margin' type='dimen' /> <public name='kau_activity_vertical_margin' type='dimen' /> <public name='kau_dialog_margin' type='dimen' /> @@ -50,13 +43,6 @@ <public name='kau_avatar_padding' type='dimen' /> <public name='kau_avatar_margin' type='dimen' /> <public name='kau_avatar_ripple_radius' type='dimen' /> - <public name='KauFadeIn' type='style' /> - <public name='KauFadeInFadeOut' type='style' /> - <public name='KauSlideInRight' type='style' /> - <public name='KauSlideInBottom' type='style' /> - <public name='KauSlideInFadeOut' type='style' /> - <public name='KauSlideInSlideOutRight' type='style' /> - <public name='KauSlideInSlideOutBottom' type='style' /> <public name='kau_about_app' type='string' /> <public name='kau_about_x' type='string' /> <public name='kau_add_account' type='string' /> @@ -112,7 +98,21 @@ <public name='kau_permission_denied' type='string' /> <public name='kau_0' type='string' /> <public name='kau_bullet_point' type='string' /> - <public name='kau_shadow_overlay' type='color' /> <public name='Kau' type='style' /> <public name='Kau.Translucent' type='style' /> + <public name='KauFadeIn' type='style' /> + <public name='KauFadeInFadeOut' type='style' /> + <public name='KauSlideInRight' type='style' /> + <public name='KauSlideInBottom' type='style' /> + <public name='KauSlideInFadeOut' type='style' /> + <public name='KauSlideInSlideOutRight' type='style' /> + <public name='KauSlideInSlideOutBottom' type='style' /> + <public name='kau_enter_slide_bottom' type='transition' /> + <public name='kau_enter_slide_top' type='transition' /> + <public name='kau_exit_slide_bottom' type='transition' /> + <public name='kau_exit_slide_top' type='transition' /> + <public name='kau_enter_slide_right' type='transition' /> + <public name='kau_exit_slide_right' type='transition' /> + <public name='kau_exit_slide_left' type='transition' /> + <public name='kau_enter_slide_left' type='transition' /> </resources>
\ No newline at end of file diff --git a/core/src/test/kotlin/ca/allanwang/kau/kotlin/DebounceTest.kt b/core/src/test/kotlin/ca/allanwang/kau/kotlin/DebounceTest.kt index c406901..d43901f 100644 --- a/core/src/test/kotlin/ca/allanwang/kau/kotlin/DebounceTest.kt +++ b/core/src/test/kotlin/ca/allanwang/kau/kotlin/DebounceTest.kt @@ -50,16 +50,16 @@ class DebounceTest { fun multipleDebounces() { var i = 0 val debounce = debounce<Int>(20) { i += it } - debounce(1) //ignore -> i = 0 + debounce(1) // ignore -> i = 0 Thread.sleep(10) assertEquals(0, i) - debounce(2) //accept -> i = 2 + debounce(2) // accept -> i = 2 Thread.sleep(30) assertEquals(2, i) - debounce(4) //ignore -> i = 2 + debounce(4) // ignore -> i = 2 Thread.sleep(10) assertEquals(2, i) - debounce(8) //accept -> i = 10 + debounce(8) // accept -> i = 10 Thread.sleep(30) assertEquals(10, i) } diff --git a/core/src/test/kotlin/ca/allanwang/kau/kotlin/StreamsTest.kt b/core/src/test/kotlin/ca/allanwang/kau/kotlin/StreamsTest.kt index 4dc4a34..e3d4e5b 100644 --- a/core/src/test/kotlin/ca/allanwang/kau/kotlin/StreamsTest.kt +++ b/core/src/test/kotlin/ca/allanwang/kau/kotlin/StreamsTest.kt @@ -47,10 +47,10 @@ class StreamsTest { items.add(3, thePotato) assertEquals(result.size + 1, items.size, "Invalid list addition") assertEquals(2, items.filter { it.id == 9 }.size, "Invalid number of potatoes with id 9") - items.kauRemoveIf { it === thePotato } //removal by reference + items.kauRemoveIf { it === thePotato } // removal by reference assertEquals(result.size, items.size, "Invalid list size after removal") assertEquals(result, items) - items.kauRemoveIf { it == thePotato } //removal by equality + items.kauRemoveIf { it == thePotato } // removal by equality assertEquals(result.size - 1, items.size, "Invalid list removal based on equality") } } diff --git a/fastadapter/build.gradle b/fastadapter/build.gradle index 43e9c7c..ff58fe8 100644 --- a/fastadapter/build.gradle +++ b/fastadapter/build.gradle @@ -1,4 +1,7 @@ -ext.kauSubModuleMinSdk = kau.Versions.coreMinSdk +import kau.Dependencies +import kau.Versions + +ext.kauSubModuleMinSdk = Versions.coreMinSdk apply from: '../android-lib.gradle' @@ -6,8 +9,8 @@ dependencies { implementation project(':core') api project(':adapter') - api kau.Dependencies.fastAdapter -// api kau.Dependencies.fastAdapterCommons + api Dependencies.fastAdapter + api Dependencies.fastAdapter("utils") } apply from: '../artifacts.gradle' 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 c5ce61f..32806f2 100644 --- a/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt +++ b/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt @@ -161,7 +161,7 @@ class ThemableIItemDelegate : ThemableIItem, ThemableIItemColors by ThemableIIte override fun bindBackgroundRipple(vararg views: View?) { val background = backgroundColor ?: return val foreground = accentColor ?: textColor ?: backgroundColor - ?: return //default to normal background + ?: return // default to normal background val ripple = createSimpleRippleDrawable(foreground, background) views.forEach { it?.background = ripple } } 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 f11afde..800a355 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 @@ -74,7 +74,7 @@ abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract { @SuppressLint("NewApi") override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - //setup layout + // setup layout setContentView(R.layout.kau_pref_activity) setSupportActionBar(toolbar) supportActionBar?.apply { @@ -88,7 +88,7 @@ abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract { statusBarColor = 0x30000000 kau_toolbar_ripple.set(resolveColor(R.attr.colorPrimary)) kau_ripple.set(resolveColor(android.R.attr.colorBackground)) - //setup prefs + // setup prefs val core = CoreAttributeBuilder() val builder = kPrefCoreAttributes() core.builder() 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 f4f4a65..a867d06 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 @@ -39,7 +39,7 @@ open class KPrefCheckbox(builder: BaseContract<Boolean>) : KPrefItemBase<Boolean val checkbox = holder.bindInnerView<CheckBox>(R.layout.kau_pref_checkbox) withAccentColor(checkbox::tint) checkbox.isChecked = pref - checkbox.jumpDrawablesToCurrentState() //Cancel the animation + checkbox.jumpDrawablesToCurrentState() // Cancel the animation } override val type: Int diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt index 5de1f83..9abdf09 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt @@ -61,7 +61,7 @@ open class KPrefSeekbar(val builder: KPrefSeekbarContract) : KPrefItemBase<Int>( } withAccentColor(seekbar::tint) text.text = - builder.toText(seekbar.progress.fromProgress) //set initial text in case no change occurs + builder.toText(seekbar.progress.fromProgress) // set initial text in case no change occurs seekbar.progress = pref.toProgress seekbar.isEnabled = builder.enabler() } diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItemBasic.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItemBasic.kt index 873289f..e801848 100644 --- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItemBasic.kt +++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItemBasic.kt @@ -40,7 +40,7 @@ class MediaItemBasic(val data: MediaModel) : @SuppressLint("NewApi") fun bindEvents(activity: Activity, fastAdapter: FastAdapter<MediaItemBasic>) { fastAdapter.getSelectExtension().isSelectable = true - //add image data and return right away + // add image data and return right away fastAdapter.onClickListener = { _, _, item, _ -> activity.finish(arrayListOf(item.data)) true 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 cc6df81..68d1121 100644 --- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt +++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt @@ -46,7 +46,6 @@ import com.bumptech.glide.Glide import com.bumptech.glide.RequestManager import com.mikepenz.fastadapter.GenericItem import com.mikepenz.fastadapter.adapters.ItemAdapter -import com.mikepenz.iconics.dsl.ExperimentalIconicsDSL import com.mikepenz.iconics.dsl.iconicsDrawable import com.mikepenz.iconics.typeface.IIcon import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial @@ -88,11 +87,9 @@ abstract class MediaPickerCore<T : GenericItem>( /** * Create error tile for a given item */ - @ExperimentalIconicsDSL fun getErrorDrawable(context: Context) = getIconDrawable(context, GoogleMaterial.Icon.gmd_error, accentColor) - @ExperimentalIconicsDSL fun getIconDrawable(context: Context, iicon: IIcon, color: Int): Drawable { val sizePx = computeViewSize(context) return context.iconicsDrawable(iicon) { @@ -159,7 +156,7 @@ abstract class MediaPickerCore<T : GenericItem>( } } - //Sort by descending date + // Sort by descending date var sortQuery = MediaStore.MediaColumns.DATE_MODIFIED + " DESC" override fun onCreateLoader(id: Int, args: Bundle?): Loader<Cursor> { @@ -266,8 +263,8 @@ abstract class MediaPickerCore<T : GenericItem>( }.mapNotNull { DocumentsContract.getDocumentId(it).split(":").getOrNull(1) }.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 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/sample/build.gradle b/sample/build.gradle index 1441cf0..ab98695 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,3 +1,5 @@ +import kau.Dependencies + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' @@ -126,15 +128,15 @@ dependencies { implementation project(':searchview') implementation project(':mediapicker') - implementation kau.Dependencies.materialDialog("input") + implementation Dependencies.materialDialog("input") - testImplementation kau.Dependencies.kotlinTest - testImplementation kau.Dependencies.junit + testImplementation Dependencies.kotlinTest + testImplementation Dependencies.junit - androidTestImplementation kau.Dependencies.kotlinTest - androidTestImplementation kau.Dependencies.espresso - androidTestImplementation kau.Dependencies.espresso("intents") - androidTestImplementation kau.Dependencies.espresso("contrib") - androidTestImplementation kau.Dependencies.testRules - androidTestImplementation kau.Dependencies.testRunner + androidTestImplementation Dependencies.kotlinTest + androidTestImplementation Dependencies.espresso + androidTestImplementation Dependencies.espresso("intents") + androidTestImplementation Dependencies.espresso("contrib") + androidTestImplementation Dependencies.testRules + androidTestImplementation Dependencies.testRunner } 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 f6d5ccc..a5ef8c3 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt @@ -45,9 +45,7 @@ class AnimActivity : KauBaseActivity() { val adapter = FastItemAdapter<PermissionCheckbox>() setContentView(fullLinearRecycler(adapter).apply { setBackgroundColor( - KPrefSample.bgColor.withAlpha( - 255 - ) + KPrefSample.bgColor.withAlpha(255) ) }) 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 11d19e5..4fe941b 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt @@ -47,7 +47,7 @@ class MainActivity : KPrefActivity() { companion object { - //some of the most common english words for show + // some of the most common english words for show val wordBank: List<String> by lazy { listOf( "the", "name", "of", "very", "to", "through", diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt index 7cf6cc1..68dde2a 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt @@ -33,7 +33,7 @@ class PermissionCheckbox(val permission: String) : KauIItem<PermissionCheckbox.V holder.text.text = permission holder.checkbox.isChecked = holder.itemView.context.hasPermission(permission) holder.checkbox.isClickable = false - holder.checkbox.jumpDrawablesToCurrentState() //Cancel the animation + holder.checkbox.jumpDrawablesToCurrentState() // Cancel the animation } class ViewHolder(v: View) : RecyclerView.ViewHolder(v) { diff --git a/searchview/build.gradle b/searchview/build.gradle index f9e83fc..64a88b3 100644 --- a/searchview/build.gradle +++ b/searchview/build.gradle @@ -1,3 +1,5 @@ +import kau.Dependencies + ext.kauSubModuleResourcePrefix = "kau_search_" apply from: '../android-lib.gradle' 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 a552a01..c2da5fa 100644 --- a/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt +++ b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt @@ -298,9 +298,9 @@ class SearchView @JvmOverloads constructor( * These are calculated every time the search view is opened, * and can be overridden with the open listener if necessary */ - var menuX: Int = -1 //starting x for circular reveal - var menuY: Int = -1 //reference for cardview's marginTop - var menuHalfHeight: Int = -1 //starting y for circular reveal (relative to the cardview) + var menuX: Int = -1 // starting x for circular reveal + var menuY: Int = -1 // reference for cardview's marginTop + var menuHalfHeight: Int = -1 // starting y for circular reveal (relative to the cardview) init { View.inflate(context, R.layout.kau_search_view, this) @@ -383,8 +383,8 @@ class SearchView @JvmOverloads constructor( internal fun cardTransition(builder: TransitionSet.() -> Unit = {}) { TransitionManager.beginDelayedTransition(kau_search_cardview, - //we are only using change bounds, as the recyclerview items may be animated as well, - //which causes a measure IllegalStateException + // we are only using change bounds, as the recyclerview items may be animated as well, + // which causes a measure IllegalStateException TransitionSet().addTransition(ChangeBounds()).apply { duration = configs.transitionDuration builder() |