Wear CWF SuppressLint
This commit is contained in:
parent
c1d9cff4b5
commit
a42c6a7aea
1 changed files with 97 additions and 98 deletions
|
@ -53,7 +53,7 @@ import org.joda.time.TimeOfDay
|
|||
import org.json.JSONObject
|
||||
import java.io.ByteArrayOutputStream
|
||||
import javax.inject.Inject
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
class CustomWatchface : BaseWatchFace() {
|
||||
|
||||
@Inject lateinit var context: Context
|
||||
|
@ -88,7 +88,6 @@ class CustomWatchface : BaseWatchFace() {
|
|||
.build()
|
||||
}
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
override fun setDataFields() {
|
||||
super.setDataFields()
|
||||
binding.direction2.setImageDrawable(TrendArrowMap.drawable(singleBg.slopeArrow, resources, resDataMap))
|
||||
|
@ -141,7 +140,6 @@ class CustomWatchface : BaseWatchFace() {
|
|||
binding.secondHand.visibility = (binding.secondHand.visibility == View.VISIBLE && showSecond).toVisibility()
|
||||
}
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
private fun setWatchfaceStyle() {
|
||||
val customWatchface = persistence.readCustomWatchface() ?: persistence.readCustomWatchface(true)
|
||||
customWatchface?.let {
|
||||
|
@ -514,9 +512,8 @@ class CustomWatchface : BaseWatchFace() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum class TrendArrowMap(val symbol: String, @DrawableRes val icon: Int, val customDrawable: ResFileMap?) {
|
||||
private enum class TrendArrowMap(val symbol: String, @DrawableRes val icon: Int, val customDrawable: ResFileMap?) {
|
||||
NONE("??", R.drawable.ic_invalid, ResFileMap.ARROW_NONE),
|
||||
TRIPLE_UP("X", R.drawable.ic_doubleup, ResFileMap.ARROW_DOUBLE_UP),
|
||||
DOUBLE_UP("\u21c8", R.drawable.ic_doubleup, ResFileMap.ARROW_DOUBLE_UP),
|
||||
|
@ -536,9 +533,10 @@ private enum class TrendArrowMap(val symbol: String, @DrawableRes val icon: Int,
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum class GravityMap(val key: String, val gravity: Int) {
|
||||
@SuppressLint("RtlHardcoded")
|
||||
private enum class GravityMap(val key: String, val gravity: Int) {
|
||||
CENTER(JsonKeyValues.CENTER.key, Gravity.CENTER),
|
||||
LEFT(JsonKeyValues.LEFT.key, Gravity.LEFT),
|
||||
RIGHT(JsonKeyValues.RIGHT.key, Gravity.RIGHT);
|
||||
|
@ -548,9 +546,9 @@ private enum class GravityMap(val key: String, val gravity: Int) {
|
|||
fun gravity(key: String?) = values().firstOrNull { it.key == key }?.gravity ?: CENTER.gravity
|
||||
fun key(gravity: Int) = values().firstOrNull { it.gravity == gravity }?.key ?: CENTER.key
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum class FontMap(val key: String, var font: Typeface, @FontRes val fontRessources: Int?) {
|
||||
private enum class FontMap(val key: String, var font: Typeface, @FontRes val fontRessources: Int?) {
|
||||
SANS_SERIF(JsonKeyValues.SANS_SERIF.key, Typeface.SANS_SERIF, null),
|
||||
DEFAULT(JsonKeyValues.DEFAULT.key, Typeface.DEFAULT, null),
|
||||
DEFAULT_BOLD(JsonKeyValues.DEFAULT_BOLD.key, Typeface.DEFAULT_BOLD, null),
|
||||
|
@ -581,9 +579,9 @@ private enum class FontMap(val key: String, var font: Typeface, @FontRes val fon
|
|||
fun font(key: String) = customFonts[key.lowercase()] ?: DEFAULT.font
|
||||
fun key() = DEFAULT.key
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum class StyleMap(val key: String, val style: Int) {
|
||||
private enum class StyleMap(val key: String, val style: Int) {
|
||||
NORMAL(JsonKeyValues.NORMAL.key, Typeface.NORMAL),
|
||||
BOLD(JsonKeyValues.BOLD.key, Typeface.BOLD),
|
||||
BOLD_ITALIC(JsonKeyValues.BOLD_ITALIC.key, Typeface.BOLD_ITALIC),
|
||||
|
@ -594,10 +592,10 @@ private enum class StyleMap(val key: String, val style: Int) {
|
|||
fun style(key: String?) = values().firstOrNull { it.key == key }?.style ?: NORMAL.style
|
||||
fun key(style: Int) = values().firstOrNull { it.style == style }?.key ?: NORMAL.key
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This class containt mapping between keys used within json of Custom Watchface and preferences
|
||||
private enum class PrefMap(val key: String, @StringRes val prefKey: Int) {
|
||||
// This class containt mapping between keys used within json of Custom Watchface and preferences
|
||||
private enum class PrefMap(val key: String, @StringRes val prefKey: Int) {
|
||||
|
||||
SHOW_IOB(CwfMetadataKey.CWF_PREF_WATCH_SHOW_IOB.key, R.string.key_show_iob),
|
||||
SHOW_DETAILED_IOB(CwfMetadataKey.CWF_PREF_WATCH_SHOW_DETAILED_IOB.key, R.string.key_show_detailed_iob),
|
||||
|
@ -614,6 +612,7 @@ private enum class PrefMap(val key: String, @StringRes val prefKey: Int) {
|
|||
SHOW_BGI(CwfMetadataKey.CWF_PREF_WATCH_SHOW_BGI.key, R.string.key_show_bgi),
|
||||
SHOW_LOOP_STATUS(CwfMetadataKey.CWF_PREF_WATCH_SHOW_LOOP_STATUS.key, R.string.key_show_external_status),
|
||||
SHOW_WEEK_NUMBER(CwfMetadataKey.CWF_PREF_WATCH_SHOW_WEEK_NUMBER.key, R.string.key_show_week_number)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue