Fix Default Layout (remove all wrapcontent)

This commit is contained in:
Philoul 2023-08-06 23:48:11 +02:00
parent 54e2a3f72c
commit 04c654c8c6
3 changed files with 61 additions and 61 deletions

View file

@ -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" />
<!--
<info.nightscout.core.ui.elements.SingleClickButton
android:id="@+id/send_custom"
style="@style/GrayButton"
@ -140,7 +140,7 @@
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="0" />
-->
<info.nightscout.core.ui.elements.SingleClickButton
android:id="@+id/export_custom"
style="@style/GrayButton"
@ -152,10 +152,10 @@
android:text="@string/wear_export_watchface"
android:textSize="11sp"
android:visibility="visible"
app:layout_column="0"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="1" />
app:layout_row="0"
app:layout_column="1" />
<info.nightscout.core.ui.elements.SingleClickButton
android:id="@+id/default_custom"
@ -168,10 +168,10 @@
android:text="@string/wear_default_watchface"
android:textSize="11sp"
android:visibility="visible"
app:layout_column="1"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="1" />
app:layout_row="1"
app:layout_column="0" />
</androidx.gridlayout.widget.GridLayout>

View file

@ -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 {

View file

@ -30,8 +30,8 @@
<ImageView
android:id="@+id/cover_chart"
android:tag="cover_chart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_width="400px"
android:layout_height="400px"
android:layout_marginTop="0px"
android:layout_marginLeft="0px"
android:visibility="gone"
@ -41,8 +41,8 @@
android:id="@+id/iob1"
android:tag="iob1"
android:layout_width="130px"
android:layout_height="wrap_content"
android:layout_marginTop="172px"
android:layout_height="33px"
android:layout_marginTop="168px"
android:layout_marginLeft="270px"
android:textSize="21px"
android:gravity="center"
@ -53,8 +53,8 @@
android:id="@+id/iob2"
android:tag="iob2"
android:layout_width="130px"
android:layout_height="wrap_content"
android:layout_marginTop="198px"
android:layout_height="33px"
android:layout_marginTop="196px"
android:layout_marginLeft="270px"
android:textSize="21px"
android:textStyle="bold"
@ -65,9 +65,9 @@
<TextView
android:id="@+id/cob1"
android:tag="cob1"
android:layout_width="130px"
android:layout_height="wrap_content"
android:layout_marginTop="172px"
android:layout_width="120px"
android:layout_height="33px"
android:layout_marginTop="168px"
android:layout_marginLeft="0px"
android:gravity="center"
android:text="@string/activity_carb"
@ -77,9 +77,9 @@
<TextView
android:id="@+id/cob2"
android:tag="cob2"
android:layout_width="130px"
android:layout_height="wrap_content"
android:layout_marginTop="198px"
android:layout_width="120px"
android:layout_height="33px"
android:layout_marginTop="196px"
android:layout_marginLeft="0px"
android:gravity="center"
android:text="@string/no_cob_g"
@ -90,10 +90,11 @@
<TextView
android:id="@+id/delta"
android:tag="delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="59px"
android:layout_height="32px"
android:layout_marginTop="133px"
android:layout_marginLeft="15px"
android:gravity="center"
android:textSize="23px"
android:textStyle="bold"
android:textColor="@color/light_grey"
@ -102,10 +103,11 @@
<TextView
android:id="@+id/avg_delta"
android:tag="avg_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="59px"
android:layout_height="32px"
android:layout_marginTop="133px"
android:layout_marginLeft="75px"
android:layout_marginLeft="74px"
android:gravity="center"
android:textSize="23px"
android:textStyle="bold"
android:textColor="@color/light_grey"
@ -116,11 +118,12 @@
android:id="@+id/uploader_battery"
android:tag="uploader_battery"
android:layout_width="60px"
android:layout_height="wrap_content"
android:layout_height="32px"
android:gravity="center"
android:layout_marginTop="133px"
android:layout_marginLeft="129px"
android:textSize="23px"
android:fontFamily="@font/roboto_condensed_bold"
android:textStyle="bold"
android:textColor="@color/light_grey"
tools:text="100%" />
@ -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 @@
<TextView
android:id="@+id/bgi"
android:tag="bgi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="60px"
android:layout_height="32px"
android:layout_marginTop="133px"
android:layout_marginLeft="340px"
android:gravity="center"
android:textSize="23px"
android:textStyle="bold"
android:textColor="@color/light_grey"
@ -169,8 +175,8 @@
<TextView
android:id="@+id/time"
android:tag="time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="0px"
android:layout_height="0px"
android:layout_marginTop="151px"
android:gravity="center"
android:fontFamily="@font/roboto_condensed_bold"
@ -184,8 +190,8 @@
<TextView
android:id="@+id/hour"
android:tag="hour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="0px"
android:layout_height="0px"
android:layout_marginTop="151px"
android:layout_marginLeft="119px"
android:fontFamily="@font/roboto_condensed_bold"
@ -199,8 +205,8 @@
<TextView
android:id="@+id/minute"
android:tag="minute"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="0px"
android:layout_height="0px"
android:layout_marginTop="158px"
android:layout_marginLeft="210px"
android:fontFamily="@font/roboto_condensed_bold"
@ -212,8 +218,8 @@
<TextView
android:id="@+id/second"
android:tag="second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="0px"
android:layout_height="0px"
android:layout_marginTop="158px"
android:layout_marginLeft="210px"
android:fontFamily="@font/roboto_condensed_bold"
@ -228,8 +234,8 @@
<TextView
android:id="@+id/timePeriod"
android:tag="timePeriod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="0px"
android:layout_height="0px"
android:layout_marginLeft="210px"
android:layout_marginTop="205px"
android:fontFamily="@font/roboto_condensed_bold"
@ -243,7 +249,7 @@
android:id="@+id/day_name"
android:tag="day_name"
android:layout_width="56px"
android:layout_height="wrap_content"
android:layout_height="36px"
android:layout_marginTop="172px"
android:layout_marginLeft="120px"
android:textAllCaps="true"
@ -258,7 +264,7 @@
android:id="@+id/day"
android:tag="day"
android:layout_width="56px"
android:layout_height="wrap_content"
android:layout_height="36px"
android:layout_marginTop="198px"
android:layout_marginLeft="120px"
android:gravity="center"
@ -271,7 +277,7 @@
android:id="@+id/month"
android:tag="month"
android:layout_width="50px"
android:layout_height="wrap_content"
android:layout_height="36px"
android:layout_marginTop="180px"
android:layout_marginLeft="220px"
android:gravity="center"
@ -283,8 +289,8 @@
<TextView
android:id="@+id/loop"
android:tag="loop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="50px"
android:layout_height="50px"
android:layout_marginTop="61px"
android:layout_marginLeft="68px"
android:background="@drawable/loop_grey_25"
@ -297,10 +303,11 @@
<TextView
android:id="@+id/direction"
android:tag="direction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="52px"
android:layout_height="52px"
android:layout_marginTop="26px"
android:layout_marginLeft="291px"
android:gravity="left"
android:textSize="39px"
android:textStyle="bold"
android:textColor="@color/light_grey"
@ -309,8 +316,9 @@
<TextView
android:id="@+id/timestamp"
android:tag="timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="52px"
android:layout_height="34px"
android:gravity="left"
android:layout_marginTop="79px"
android:layout_marginLeft="291px"
android:textSize="25px"
@ -322,7 +330,7 @@
android:id="@+id/sgv"
android:tag="sgv"
android:layout_width="400px"
android:layout_height="wrap_content"
android:layout_height="100px"
android:gravity="center"
android:lines="1"
android:layout_marginTop="26px"