aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/ca/allanwang/kau/utils
diff options
context:
space:
mode:
authorAllan Wang <allanwang@google.com>2019-08-15 16:04:14 -0700
committerAllan Wang <allanwang@google.com>2019-08-15 16:04:14 -0700
commit5aefeee08f68777dd07a16bd42a7d2392db6bbc9 (patch)
treea357e6cd419123d69ca5d2977c8ce839c56f3d87 /core/src/main/kotlin/ca/allanwang/kau/utils
parent85e9e1f253bb14512ae404989c45cbc199eb1eba (diff)
downloadkau-5aefeee08f68777dd07a16bd42a7d2392db6bbc9.tar.gz
kau-5aefeee08f68777dd07a16bd42a7d2392db6bbc9.tar.bz2
kau-5aefeee08f68777dd07a16bd42a7d2392db6bbc9.zip
Apply spotless
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang/kau/utils')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt6
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt4
5 files changed, 8 insertions, 8 deletions
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 21141f1..fe210b2 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 d002fb8..62e5716 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
@@ -113,7 +113,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)
@@ -130,7 +130,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? =
@@ -161,7 +161,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/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)
}