From 04c654c8c671e4446e83e93a61f30ccd2a807277 Mon Sep 17 00:00:00 2001 From: Philoul Date: Sun, 6 Aug 2023 23:48:11 +0200 Subject: [PATCH] Fix Default Layout (remove all wrapcontent) --- .../src/main/res/layout/wear_fragment.xml | 16 ++-- .../androidaps/watchfaces/CustomWatchface.kt | 12 +-- wear/src/main/res/layout/activity_custom.xml | 94 ++++++++++--------- 3 files changed, 61 insertions(+), 61 deletions(-) diff --git a/plugins/main/src/main/res/layout/wear_fragment.xml b/plugins/main/src/main/res/layout/wear_fragment.xml index 1eb374529d..a8c23efcd7 100644 --- a/plugins/main/src/main/res/layout/wear_fragment.xml +++ b/plugins/main/src/main/res/layout/wear_fragment.xml @@ -121,11 +121,11 @@ android:paddingEnd="0dp" android:text="@string/wear_load_watchface" android:textSize="11sp" - app:layout_column="0" app:layout_columnWeight="1" app:layout_gravity="fill" - app:layout_row="0" /> - + app:layout_row="0" + app:layout_column="0" /> + + app:layout_row="0" + app:layout_column="1" /> + app:layout_row="1" + app:layout_column="0" /> diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/CustomWatchface.kt b/wear/src/main/java/info/nightscout/androidaps/watchfaces/CustomWatchface.kt index d96410b81e..f556f6f114 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/CustomWatchface.kt +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/CustomWatchface.kt @@ -72,7 +72,6 @@ class CustomWatchface : BaseWatchFace() { override fun setColorDark() { setWatchfaceStyle() - //@ColorInt val batteryOkColor = ContextCompat.getColor(this, R.color.dark_midColor) binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background)) binding.sgv.setTextColor(bgColor) binding.direction.setTextColor(bgColor) @@ -135,6 +134,7 @@ class CustomWatchface : BaseWatchFace() { -1L -> lowColor else -> midColor } + binding.mainLayout.forEach { view -> view.tag?.let { tag -> if (json.has(tag.toString())) { @@ -147,7 +147,6 @@ class CustomWatchface : BaseWatchFace() { params.leftMargin = if (viewjson.has("leftmargin")) (viewjson.getInt("leftmargin") * zoomFactor).toInt() else 0 view.setLayoutParams(params) view.visibility = if (viewjson.has("visibility")) setVisibility(viewjson.getString("visibility")) else View.GONE - if (view is TextView) { view.rotation = if (viewjson.has("rotation")) viewjson.getInt("rotation").toFloat() else 0F view.setTextSize(TypedValue.COMPLEX_UNIT_PX, ((if (viewjson.has("textsize")) viewjson.getInt("textsize") else 22) * zoomFactor).toFloat()) @@ -364,9 +363,8 @@ class CustomWatchface : BaseWatchFace() { private fun changeDrawableColor(color: Int): ColorFilter { val colorMatrix = ColorMatrix() - colorMatrix.setSaturation(0f) // 0 désature l'image, 1 la laisse inchangée. + colorMatrix.setSaturation(0f) - // Modifier la teinte de couleur (couleur de fond) colorMatrix.postConcat( ColorMatrix( floatArrayOf( @@ -377,13 +375,7 @@ class CustomWatchface : BaseWatchFace() { ) ) ) - - // Appliquer la matrice de couleur au ColorFilter return ColorMatrixColorFilter(colorMatrix) - - // Appliquer le ColorFilter au Drawable - //drawable.colorFilter = colorFilter - //return drawable } private fun getColor(color: String): Int { diff --git a/wear/src/main/res/layout/activity_custom.xml b/wear/src/main/res/layout/activity_custom.xml index a1172a3c3f..aa8eca5d47 100644 --- a/wear/src/main/res/layout/activity_custom.xml +++ b/wear/src/main/res/layout/activity_custom.xml @@ -30,8 +30,8 @@ @@ -129,11 +132,12 @@ android:id="@+id/rig_battery" android:tag="rig_battery" android:layout_width="60px" - android:layout_height="wrap_content" + android:layout_height="32px" android:gravity="center" android:layout_marginTop="133px" android:layout_marginLeft="189px" android:textSize="23px" + android:fontFamily="@font/roboto_condensed_bold" android:textStyle="bold" android:textColor="@color/light_grey" android:visibility="visible" @@ -143,10 +147,11 @@ android:id="@+id/basalRate" android:tag="basalRate" android:layout_width="91px" - android:layout_height="wrap_content" - android:gravity="center" + android:layout_height="32px" android:layout_marginTop="133px" android:layout_marginLeft="249px" + android:gravity="center" + android:fontFamily="@font/roboto_condensed_bold" android:textSize="23px" android:textStyle="bold" android:textColor="@color/light_grey" @@ -155,10 +160,11 @@