aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt24
1 files changed, 19 insertions, 5 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt
index 46e29b2..48a2028 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package ca.allanwang.kau.utils
import android.content.Context
@@ -8,12 +23,11 @@ import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
import android.os.Handler
import android.os.Looper
-import android.support.annotation.IntRange
+import androidx.annotation.IntRange
import ca.allanwang.kau.R
import java.math.RoundingMode
import java.text.DecimalFormat
-
/**
* Created by Allan Wang on 2017-05-28.
*/
@@ -127,10 +141,10 @@ fun postDelayed(delay: Long, action: () -> Unit) {
}
inline val kauIsMainThread: Boolean
- get() = Looper.myLooper() == Looper.getMainLooper()
+ get() = Looper.myLooper() == ContextHelper.looper
class KauException(message: String) : RuntimeException(message)
fun String.withMaxLength(n: Int): String =
- if (length <= n) this
- else substring(0, n - 1) + KAU_ELLIPSIS \ No newline at end of file
+ if (length <= n) this
+ else substring(0, n - 1) + KAU_ELLIPSIS