From 142b95f0ae82a849b1e9ef390a2a068b4c792be6 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 22 Sep 2019 22:47:07 -0700 Subject: Optimize imports and update changelog --- .../com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt | 2 +- app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt | 2 +- app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt | 12 ++++++------ .../kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt index c9e64eb3..0195f168 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt @@ -86,7 +86,7 @@ class AnimatedVectorDelegate( private fun animateImpl(toStart: Boolean) { if ((atStart == toStart)) return L.d { "AVD already at ${if (toStart) "start" else "end"}" } - if (avd == null) return L.d { "AVD null resource" } //no longer using animated vector; do not modify + if (avd == null) return L.d { "AVD null resource" } // no longer using animated vector; do not modify avd?.stop() view.setImageResource(if (toStart) avdEnd else avdStart) animatedVectorListener?.invoke(avd!!, !toStart) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt index f69af40b..edbe7682 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt @@ -25,7 +25,7 @@ import ca.allanwang.kau.kpref.KPref */ object Showcase : KPref() { - //check if this is the first time launching the web overlay; show snackbar if true + // check if this is the first time launching the web overlay; show snackbar if true val firstWebOverlay: Boolean by kprefSingle("first_web_overlay") val intro: Boolean by kprefSingle("intro_pages") diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt index c2f28a4b..d725acd9 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt @@ -242,11 +242,11 @@ fun View.frostSnackbar(@StringRes text: Int, builder: Snackbar.() -> Unit = {}) @SuppressLint("RestrictedApi") private inline fun frostSnackbar(crossinline builder: Snackbar.() -> Unit): Snackbar.() -> Unit = { builder() - //hacky workaround, but it has proper checks and shouldn't crash + // hacky workaround, but it has proper checks and shouldn't crash ((view as? FrameLayout)?.getChildAt(0) as? SnackbarContentLayout)?.apply { messageView.setTextColor(Prefs.textColor) actionView.setTextColor(Prefs.accentColor) - //only set if previous text colors are set + // only set if previous text colors are set view.setBackgroundColor(Prefs.bgColor.withAlpha(255).colorToForeground(0.1f)) } } @@ -316,10 +316,10 @@ inline val String.isIndirectImageUrl: Boolean */ inline val String?.isIndependent: Boolean get() { - if (this == null || length < 5) return false // ignore short queries - if (this[0] == '#' && !contains('/')) return false // ignore element values - if (startsWith("http") && !isFacebookUrl) return true // ignore non facebook urls - if (dependentSegments.any { contains(it) }) return false // ignore known dependent segments + if (this == null || length < 5) return false // ignore short queries + if (this[0] == '#' && !contains('/')) return false // ignore element values + if (startsWith("http") && !isFacebookUrl) return true // ignore non facebook urls + if (dependentSegments.any { contains(it) }) return false // ignore known dependent segments return true } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt index 7fdd485d..9089d891 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt @@ -34,7 +34,7 @@ fun Context.showWebContextMenu(wc: WebContext) { if (wc.isEmpty) return var title = wc.url ?: string(R.string.menu) title = - title.substring(title.indexOf("m/") + 1) //just so if defaults to 0 in case it's not .com/ + title.substring(title.indexOf("m/") + 1) // just so if defaults to 0 in case it's not .com/ if (title.length > 100) title = title.substring(0, 100) + '\u2026' val menuItems = WebContextType.values @@ -46,7 +46,7 @@ fun Context.showWebContextMenu(wc: WebContext) { menuItems[position].onClick(this@showWebContextMenu, wc) } onDismiss { - //showing the dialog interrupts the touch down event, so we must ensure that the viewpager's swipe is enabled + // showing the dialog interrupts the touch down event, so we must ensure that the viewpager's swipe is enabled (this@showWebContextMenu as? MainActivity)?.viewPager?.enableSwipe = true } } -- cgit v1.2.3