Wear CWF Cleanup unused properties

This commit is contained in:
Philoul 2023-09-09 19:56:27 +02:00
parent aa85b4f173
commit a9b6fdef27

View file

@ -202,67 +202,60 @@ enum class ViewKeys(val key: String, @StringRes val comment: Int) {
COVER_PLATE("cover_plate", R.string.cwf_comment_cover_plate), COVER_PLATE("cover_plate", R.string.cwf_comment_cover_plate),
HOUR_HAND("hour_hand", R.string.cwf_comment_hour_hand), HOUR_HAND("hour_hand", R.string.cwf_comment_hour_hand),
MINUTE_HAND("minute_hand", R.string.cwf_comment_minute_hand), MINUTE_HAND("minute_hand", R.string.cwf_comment_minute_hand),
SECOND_HAND("second_hand", R.string.cwf_comment_second_hand); SECOND_HAND("second_hand", R.string.cwf_comment_second_hand)
} }
enum class JsonKeys(val key: String, val viewType: ViewType, @StringRes val comment: Int?) { enum class JsonKeys(val key: String) {
METADATA("metadata", ViewType.NONE, null), METADATA("metadata"),
ENABLESECOND("enableSecond", ViewType.NONE, null), ENABLESECOND("enableSecond"),
HIGHCOLOR("highColor", ViewType.NONE, null), HIGHCOLOR("highColor"),
MIDCOLOR("midColor", ViewType.NONE, null), MIDCOLOR("midColor"),
LOWCOLOR("lowColor", ViewType.NONE, null), LOWCOLOR("lowColor"),
LOWBATCOLOR("lowBatColor", ViewType.NONE, null), LOWBATCOLOR("lowBatColor"),
CARBCOLOR("carbColor", ViewType.NONE, null), CARBCOLOR("carbColor"),
BASALBACKGROUNDCOLOR("basalBackgroundColor", ViewType.NONE, null), BASALBACKGROUNDCOLOR("basalBackgroundColor"),
BASALCENTERCOLOR("basalCenterColor", ViewType.NONE, null), BASALCENTERCOLOR("basalCenterColor"),
GRIDCOLOR("gridColor", ViewType.NONE, null), GRIDCOLOR("gridColor"),
POINTSIZE("pointSize", ViewType.NONE, null), POINTSIZE("pointSize"),
WIDTH("width", ViewType.ALLVIEWS, null), WIDTH("width"),
HEIGHT("height", ViewType.ALLVIEWS, null), HEIGHT("height"),
TOPMARGIN("topmargin", ViewType.ALLVIEWS, null), TOPMARGIN("topmargin"),
LEFTMARGIN("leftmargin", ViewType.ALLVIEWS, null), LEFTMARGIN("leftmargin"),
ROTATION("rotation", ViewType.TEXTVIEW, null), ROTATION("rotation"),
VISIBILITY("visibility", ViewType.ALLVIEWS, null), VISIBILITY("visibility"),
TEXTSIZE("textsize", ViewType.TEXTVIEW, null), TEXTSIZE("textsize"),
TEXTVALUE("textvalue", ViewType.TEXTVIEW, null), TEXTVALUE("textvalue"),
GRAVITY("gravity", ViewType.TEXTVIEW, null), GRAVITY("gravity"),
FONT("font", ViewType.TEXTVIEW, null), FONT("font"),
FONTSTYLE("fontStyle", ViewType.TEXTVIEW, null), FONTSTYLE("fontStyle"),
FONTCOLOR("fontColor", ViewType.TEXTVIEW, null), FONTCOLOR("fontColor"),
COLOR("color", ViewType.IMAGEVIEW, null), COLOR("color"),
ALLCAPS("allCaps", ViewType.TEXTVIEW, null), ALLCAPS("allCaps"),
DAYNAMEFORMAT("dayNameFormat", ViewType.NONE, null), DAYNAMEFORMAT("dayNameFormat"),
MONTHFORMAT("monthFormat", ViewType.NONE, null) MONTHFORMAT("monthFormat")
} }
enum class JsonKeyValues(val key: String, val jsonKey: JsonKeys) { enum class JsonKeyValues(val key: String) {
GONE("gone", JsonKeys.VISIBILITY), GONE("gone"),
VISIBLE("visible", JsonKeys.VISIBILITY), VISIBLE("visible"),
INVISIBLE("invisible", JsonKeys.VISIBILITY), INVISIBLE("invisible"),
CENTER("center", JsonKeys.GRAVITY), CENTER("center"),
LEFT("left", JsonKeys.GRAVITY), LEFT("left"),
RIGHT("right", JsonKeys.GRAVITY), RIGHT("right"),
SANS_SERIF("sans_serif", JsonKeys.FONT), SANS_SERIF("sans_serif"),
DEFAULT("default", JsonKeys.FONT), DEFAULT("default"),
DEFAULT_BOLD("default_bold", JsonKeys.FONT), DEFAULT_BOLD("default_bold"),
MONOSPACE("monospace", JsonKeys.FONT), MONOSPACE("monospace"),
SERIF("serif", JsonKeys.FONT), SERIF("serif"),
ROBOTO_CONDENSED_BOLD("roboto_condensed_bold", JsonKeys.FONT), ROBOTO_CONDENSED_BOLD("roboto_condensed_bold"),
ROBOTO_CONDENSED_LIGHT("roboto_condensed_light", JsonKeys.FONT), ROBOTO_CONDENSED_LIGHT("roboto_condensed_light"),
ROBOTO_CONDENSED_REGULAR("roboto_condensed_regular", JsonKeys.FONT), ROBOTO_CONDENSED_REGULAR("roboto_condensed_regular"),
ROBOTO_SLAB_LIGHT("roboto_slab_light", JsonKeys.FONT), ROBOTO_SLAB_LIGHT("roboto_slab_light"),
NORMAL("normal", JsonKeys.FONTSTYLE), NORMAL("normal"),
BOLD("bold", JsonKeys.FONTSTYLE), BOLD("bold"),
BOLD_ITALIC("bold_italic", JsonKeys.FONTSTYLE), BOLD_ITALIC("bold_italic"),
ITALIC("italic", JsonKeys.FONTSTYLE), ITALIC("italic"),
BGCOLOR("bgColor", JsonKeys.COLOR) BGCOLOR("bgColor")
}
enum class ViewType(@StringRes val comment: Int?) {
NONE(null),
TEXTVIEW(null),
IMAGEVIEW(null),
ALLVIEWS(null)
} }
class ZipWatchfaceFormat { class ZipWatchfaceFormat {
@ -324,7 +317,7 @@ class ZipWatchfaceFormat {
try { try {
val outputStream = FileOutputStream(file) val outputStream = FileOutputStream(file)
val zipOutputStream = ZipOutputStream(BufferedOutputStream(outputStream)) val zipOutputStream = ZipOutputStream(BufferedOutputStream(outputStream))
val jsonEntry = ZipEntry(CWF_JSON_FILE) val jsonEntry = ZipEntry(CWF_JSON_FILE)
zipOutputStream.putNextEntry(jsonEntry) zipOutputStream.putNextEntry(jsonEntry)
zipOutputStream.write(customWatchface.json.toByteArray()) zipOutputStream.write(customWatchface.json.toByteArray())
@ -355,5 +348,4 @@ class ZipWatchfaceFormat {
return metadata return metadata
} }
} }
} }