aboutsummaryrefslogtreecommitdiff
path: root/core/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBuilder.kt17
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt4
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt15
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt6
5 files changed, 30 insertions, 14 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBuilder.kt b/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBuilder.kt
index 4dd3012..8f6d0c5 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBuilder.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBuilder.kt
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 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.kpref
interface KPrefBuilder {
@@ -72,4 +87,4 @@ object KPrefBuilderInMemory : KPrefBuilder {
KPrefDelegateInMemory(key, fallback, this, postSetter)
override fun KPref.kprefSingle(key: String) = KPrefSingleDelegateInMemory(key, this)
-} \ No newline at end of file
+}
diff --git a/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt b/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt
index ef59e78..ae1f855 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt
@@ -110,4 +110,4 @@ class KPrefSingleDelegateInMemory internal constructor(
override fun isInitialized(): Boolean = _value != null
override fun toString(): String = if (isInitialized()) value.toString() else "Lazy kPref $key not initialized yet."
-} \ No newline at end of file
+}
diff --git a/core/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt b/core/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt
index 3c90b05..ee4f5ef 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 Allan Wang
+ * Copyright 2019 Allan Wang
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -76,6 +76,8 @@ const val PERMISSION_READ_CALL_LOG = Manifest.permission.READ_CALL_LOG
const val PERMISSION_WRITE_CALL_LOG = Manifest.permission.WRITE_CALL_LOG
const val PERMISSION_ADD_VOICEMAIL = Manifest.permission.ADD_VOICEMAIL
const val PERMISSION_USE_SIP = Manifest.permission.USE_SIP
+@Deprecated(level = DeprecationLevel.WARNING, message = "Permission is deprecated")
+@Suppress("DEPRECATION")
const val PERMISSION_PROCESS_OUTGOING_CALLS = Manifest.permission.PROCESS_OUTGOING_CALLS
@RequiresApi(Build.VERSION_CODES.KITKAT_WATCH)
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 8b40352..dc7b214 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt
@@ -16,11 +16,11 @@
package ca.allanwang.kau.utils
import android.content.Context
-import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.drawable.Drawable
import androidx.annotation.ColorInt
import com.mikepenz.iconics.IconicsDrawable
+import com.mikepenz.iconics.dsl.iconicsDrawable
import com.mikepenz.iconics.typeface.IIcon
/**
@@ -32,10 +32,9 @@ fun IIcon.toDrawable(
sizeDp: Int = 24,
@ColorInt color: Int = Color.WHITE,
builder: IconicsDrawable.() -> Unit = {}
-): Drawable {
- val state = ColorStateList.valueOf(color)
- val icon = IconicsDrawable(c).icon(this).color(state)
- 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 8765c69..aaef160 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt
@@ -116,11 +116,11 @@ private inline val Dialog.viewFinder: Dialog.(Int) -> View?
private inline val DialogFragment.viewFinder: DialogFragment.(Int) -> View?
get() = { dialog.findViewById(it) }
private inline val SupportDialogFragment.viewFinder: SupportDialogFragment.(Int) -> View?
- get() = { dialog.findViewById(it) }
+ get() = { dialog?.findViewById(it) }
private inline val Fragment.viewFinder: Fragment.(Int) -> View?
- get() = { view!!.findViewById(it) }
+ get() = { view?.findViewById(it) }
private inline val SupportFragment.viewFinder: SupportFragment.(Int) -> View?
- get() = { view!!.findViewById(it) }
+ get() = { view?.findViewById(it) }
private inline val ViewHolder.viewFinder: ViewHolder.(Int) -> View?
get() = { itemView.findViewById(it) }