Do not use color state resource for background (crashes on Android 9), use drawable instead + use direct color attribute when possible

This commit is contained in:
Sylvain Berfini 2024-07-29 18:57:46 +02:00
parent e29d64a02b
commit ae59911f0a
45 changed files with 70 additions and 46 deletions

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?attr/color_grey_300"/>
</selector>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/black" />
</shape>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="?attr/color_danger_500" />
</shape>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="?attr/color_main1_500" />
</shape>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="?attr/color_main2_000" />
</shape>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="?attr/color_main2_100" />
</shape>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="?attr/color_main2_500" />
</shape>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="?attr/color_success_500" />
</shape>

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true"
android:drawable="@color/main2_100" />
android:drawable="@drawable/color_main2_100" />
<item android:state_pressed="true"
android:drawable="@color/main2_100" />
android:drawable="@drawable/color_main2_100" />
<item
android:drawable="@color/main2_000" />
android:drawable="@drawable/color_main2_000" />
</selector>

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true"
android:drawable="@color/main2_100" />
android:drawable="@drawable/color_main2_100" />
<item android:state_pressed="true"
android:drawable="@color/main2_100" />
android:drawable="@drawable/color_main2_100" />
<item
android:drawable="@color/transparent_color" />
</selector>

View file

@ -143,7 +143,7 @@
android:layout_height="0dp"
android:indeterminate="true"
android:visibility="@{viewModel.operationInProgress ? View.VISIBLE : View.GONE}"
app:indicatorColor="@color/main1_500"
app:indicatorColor="?attr/color_main1_500"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="@id/chat"
app:layout_constraintStart_toStartOf="@id/chat"

View file

@ -104,7 +104,7 @@
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="@{viewModel.fetchInProgress ? View.VISIBLE : View.GONE}"
app:indicatorColor="@color/main1_500"
app:indicatorColor="?attr/color_main1_500"
app:layout_constraintStart_toEndOf="@id/bottom_nav_bar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"

View file

@ -142,7 +142,7 @@
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="@{viewModel.fetchInProgress ? View.VISIBLE : View.GONE}"
app:indicatorColor="@color/main1_500"
app:indicatorColor="?attr/color_main1_500"
app:layout_constraintStart_toEndOf="@id/bottom_nav_bar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"

View file

@ -114,7 +114,7 @@
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="@{viewModel.fetchInProgress ? View.VISIBLE : View.GONE}"
app:indicatorColor="@color/main1_500"
app:indicatorColor="?attr/color_main1_500"
app:layout_constraintStart_toEndOf="@id/bottom_nav_bar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"

View file

@ -34,7 +34,7 @@
android:padding="15dp"
android:src="@drawable/caret_left"
android:contentDescription="@string/content_description_go_back_icon"
app:tint="@color/main1_500"
app:tint="?attr/color_main1_500"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View file

@ -111,7 +111,7 @@
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="@{viewModel.fetchInProgress ? View.VISIBLE : View.GONE}"
app:indicatorColor="@color/main1_500"
app:indicatorColor="?attr/color_main1_500"
app:layout_constraintStart_toEndOf="@id/bottom_nav_bar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"

View file

@ -21,7 +21,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="@id/title_second_line"
app:tint="@color/main1_500"/>
app:tint="?attr/color_main1_500"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_800"

View file

@ -21,7 +21,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="@id/title_second_line"
app:tint="@color/main1_500"/>
app:tint="?attr/color_main1_500"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_800"

View file

@ -21,7 +21,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="@id/title_second_line"
app:tint="@color/main1_500"/>
app:tint="?attr/color_main1_500"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_800"

View file

@ -16,7 +16,7 @@
android:onClick="@{() -> model.setAsDefault()}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@{model.isDefault ? @color/main2_100 : @color/main2_000, default=@color/main2_100}">
android:background="@{model.isDefault ? @drawable/color_main2_100 : @drawable/color_main2_000, default=@drawable/color_main2_100}">
<androidx.constraintlayout.widget.Barrier
android:id="@+id/end_barrier"

View file

@ -61,7 +61,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/back"
app:layout_constraintBottom_toBottomOf="@id/title"
app:tint="@color/main1_500" />
app:tint="?attr/color_main1_500" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/assistant_page_title_style"

View file

@ -63,7 +63,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/back"
app:layout_constraintBottom_toBottomOf="@id/title"
app:tint="@color/main1_500"/>
app:tint="?attr/color_main1_500"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/assistant_page_title_style"

View file

@ -46,7 +46,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/back"
app:layout_constraintBottom_toBottomOf="@id/title"
app:tint="@color/main1_500"/>
app:tint="?attr/color_main1_500"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/assistant_page_title_style"

View file

@ -62,7 +62,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/back"
app:layout_constraintBottom_toBottomOf="@id/title"
app:tint="@color/main1_500"/>
app:tint="?attr/color_main1_500"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/assistant_page_title_style"

View file

@ -48,7 +48,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/back"
app:layout_constraintBottom_toBottomOf="@id/title"
app:tint="@color/main1_500"/>
app:tint="?attr/color_main1_500"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/assistant_page_title_style"

View file

@ -143,7 +143,7 @@
android:layout_height="0dp"
android:indeterminate="true"
android:visibility="@{viewModel.operationInProgress ? View.VISIBLE : View.GONE}"
app:indicatorColor="@color/main1_500"
app:indicatorColor="?attr/color_main1_500"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="@id/chat"
app:layout_constraintStart_toStartOf="@id/chat"

View file

@ -144,7 +144,7 @@
android:src="@drawable/pause"
android:contentDescription="@string/content_description_paused_call"
android:visibility="@{!viewModel.fullScreenMode &amp;&amp; !viewModel.pipMode &amp;&amp; conferenceViewModel.isPaused ? View.VISIBLE : View.GONE, default=gone}"
app:tint="@color/main1_500"
app:tint="?attr/color_main1_500"
app:layout_constraintTop_toTopOf="@id/back"
app:layout_constraintBottom_toBottomOf="@id/back"
app:layout_constraintEnd_toStartOf="@id/stats" />

View file

@ -211,7 +211,7 @@
android:src="@drawable/pause"
android:contentDescription="@string/content_description_paused_call"
android:visibility="@{!viewModel.fullScreenMode &amp;&amp; !viewModel.pipMode &amp;&amp; (viewModel.isPaused || viewModel.isPausedByRemote) ? View.VISIBLE : View.GONE, default=gone}"
app:tint="@color/main1_500"
app:tint="?attr/color_main1_500"
app:layout_constraintTop_toTopOf="@id/back"
app:layout_constraintBottom_toBottomOf="@id/back"
app:layout_constraintEnd_toStartOf="@id/stats" />

View file

@ -14,7 +14,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="40dp"
android:background="@{viewModel.callsCount > 1 || viewModel.showTopBar ? @color/success_500 : @color/black, default=@color/black}"
android:background="@{viewModel.callsCount > 1 || viewModel.showTopBar ? @drawable/color_success_500 : @drawable/color_black, default=@drawable/color_black}"
android:onClick="@{() -> viewModel.topBarClicked()}">
<ImageView

View file

@ -42,7 +42,7 @@
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="@string/conversation_message_meeting_updated_label"
android:textColor="@color/warning_600"
android:textColor="@color/orange_warning_600"
android:textSize="12sp"
android:maxLines="1"
android:ellipsize="end"
@ -60,7 +60,7 @@
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="@string/conversation_message_meeting_cancelled_label"
android:textColor="@color/danger_500"
android:textColor="@color/red_danger_500"
android:textSize="12sp"
android:maxLines="1"
android:ellipsize="end"

View file

@ -69,7 +69,7 @@
android:text="@string/conversation_end_to_end_encrypted_bottom_sheet_link"
android:textSize="12sp"
android:textStyle="bold"
android:textColor="@color/main1_500"
android:textColor="?attr/color_main1_500"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

View file

@ -131,7 +131,7 @@
app:layout_constraintEnd_toStartOf="@id/ephemeral_enabled"
app:layout_constraintTop_toBottomOf="@id/title"
app:layout_constraintBottom_toBottomOf="@id/avatar"
app:tint="@color/main1_500"/>
app:tint="?attr/color_main1_500"/>
<ImageView
android:id="@+id/ephemeral_enabled"
@ -144,7 +144,7 @@
app:layout_constraintStart_toEndOf="@id/muted"
app:layout_constraintTop_toBottomOf="@id/title"
app:layout_constraintBottom_toBottomOf="@id/avatar"
app:tint="@color/main1_500"/>
app:tint="?attr/color_main1_500"/>
<ImageView
android:id="@+id/show_menu"

View file

@ -95,7 +95,7 @@
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="@{viewModel.fetchInProgress ? View.VISIBLE : View.GONE}"
app:indicatorColor="@color/main1_500"
app:indicatorColor="?attr/color_main1_500"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"

View file

@ -134,7 +134,7 @@
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="@{viewModel.fetchInProgress ? View.VISIBLE : View.GONE}"
app:indicatorColor="@color/main1_500"
app:indicatorColor="?attr/color_main1_500"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"

View file

@ -36,7 +36,7 @@
android:contentDescription="@string/app_name"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:tint="@color/main1_500" />
app:tint="?attr/color_main1_500" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/section_header_style"

View file

@ -105,7 +105,7 @@
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="@{viewModel.fetchInProgress ? View.VISIBLE : View.GONE}"
app:indicatorColor="@color/main1_500"
app:indicatorColor="?attr/color_main1_500"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"

View file

@ -14,7 +14,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="40dp"
android:background="@{viewModel.maxAlertLevel >= 20 ? @color/success_500 : viewModel.maxAlertLevel >= 10 ? @color/danger_500 : viewModel.maxAlertLevel > 0 ? @color/main2_500 : @color/main1_500, default=@color/main1_500}"
android:background="@{viewModel.maxAlertLevel >= 20 ? @drawable/color_success_500 : viewModel.maxAlertLevel >= 10 ? @drawable/color_danger_500 : viewModel.maxAlertLevel > 0 ? @drawable/color_main2_500 : @drawable/color_main1_500, default=@drawable/color_main1_500}"
android:onClick="@{() -> viewModel.onTopBarClicked()}">
<ImageView

View file

@ -63,7 +63,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{model.dayNumber, default=`19`}"
android:textColor="@color/main2_000"
android:textColor="?attr/color_main2_000"
android:textSize="20sp"
android:paddingBottom="4dp"
app:layout_constraintStart_toStartOf="@id/today_background"

View file

@ -27,7 +27,7 @@
android:padding="15dp"
android:src="@drawable/caret_left"
android:contentDescription="@string/content_description_go_back_icon"
app:tint="@color/main1_500"
app:tint="?attr/color_main1_500"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View file

@ -102,7 +102,7 @@
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="@{viewModel.fetchInProgress ? View.VISIBLE : View.GONE}"
app:indicatorColor="@color/main1_500"
app:indicatorColor="?attr/color_main1_500"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"

View file

@ -171,7 +171,7 @@
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="@{viewModel.fetchInProgress ? View.VISIBLE : View.GONE}"
app:indicatorColor="@color/main1_500"
app:indicatorColor="?attr/color_main1_500"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

View file

@ -43,7 +43,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/back"
app:layout_constraintBottom_toBottomOf="@id/title"
app:tint="@color/main1_500"/>
app:tint="?attr/color_main1_500"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/assistant_page_title_style"

View file

@ -21,7 +21,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="@id/title_second_line"
app:tint="@color/main1_500"/>
app:tint="?attr/color_main1_500"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_800"

View file

@ -21,7 +21,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="@id/title_second_line"
app:tint="@color/main1_500"/>
app:tint="?attr/color_main1_500"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_800"

View file

@ -21,7 +21,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="@id/title_second_line"
app:tint="@color/main1_500"/>
app:tint="?attr/color_main1_500"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_800"