aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/utils
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-09-28 23:53:40 -0700
committerGitHub <noreply@github.com>2019-09-28 23:53:40 -0700
commit73e16427879908e8b46b7c9fe1e87b0df838fa78 (patch)
treec3ae5a6890b0797110f397b99812362312c07ff6 /app/src/main/kotlin/com/pitchedapps/frost/utils
parent58309cfd62ed26f3cf5d2b1cb933f50078937a3a (diff)
parentf5ae18fc0d824dbdce5523128f9ded86bdfa6d08 (diff)
downloadfrost-73e16427879908e8b46b7c9fe1e87b0df838fa78.tar.gz
frost-73e16427879908e8b46b7c9fe1e87b0df838fa78.tar.bz2
frost-73e16427879908e8b46b7c9fe1e87b0df838fa78.zip
Merge branch 'dev' into desktop-url-convert
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt12
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt4
4 files changed, 10 insertions, 10 deletions
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 e4aa5d45..8c5f6db6 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -249,11 +249,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))
}
}
@@ -323,10 +323,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
}
}