Skip to content

Commit

Permalink
ImageView*: Tint error color to red everywhere required
Browse files Browse the repository at this point in the history
Material theme seems to be not respecting the tint color in the XML.
Override the colors manually to get the job done.

Signed-off-by: Aayush Gupta <[email protected]>
  • Loading branch information
theimpulson committed Jul 11, 2024
1 parent 07116b4 commit b77953b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@

package com.stevesoltys.seedvault.restore.install

import android.content.res.ColorStateList
import android.graphics.drawable.Drawable
import android.view.LayoutInflater
import android.view.View
import android.view.View.GONE
import android.view.View.INVISIBLE
import android.view.View.VISIBLE
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.AsyncListDiffer
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView.Adapter
Expand Down Expand Up @@ -102,6 +104,9 @@ internal class InstallProgressAdapter(
}
FAILED -> {
appStatus.setImageResource(R.drawable.ic_error_red)
appStatus.imageTintList = ColorStateList.valueOf(
ContextCompat.getColor(context, R.color.red)
)
appStatus.visibility = VISIBLE
appStatus.contentDescription =
context.getString(R.string.restore_app_status_install_error)
Expand All @@ -117,6 +122,9 @@ internal class InstallProgressAdapter(
}
FAILED_SYSTEM_APP -> {
appStatus.setImageResource(R.drawable.ic_error_red)
appStatus.imageTintList = ColorStateList.valueOf(
ContextCompat.getColor(context, R.color.red)
)
appStatus.contentDescription =
context.getString(R.string.restore_app_status_install_error)
appStatus.visibility = VISIBLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ package com.stevesoltys.seedvault.ui

import android.content.Context
import android.content.pm.PackageManager
import android.content.res.ColorStateList
import android.view.View
import android.view.View.GONE
import android.view.View.INVISIBLE
import android.view.View.VISIBLE
import android.widget.ImageView
import android.widget.ProgressBar
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.checkbox.MaterialCheckBox
import com.stevesoltys.seedvault.R
Expand Down Expand Up @@ -63,6 +65,9 @@ internal abstract class AppViewHolder(protected val v: View) : RecyclerView.View
}
FAILED -> {
appStatus.setImageResource(R.drawable.ic_error_red)
appStatus.imageTintList = ColorStateList.valueOf(
ContextCompat.getColor(context, R.color.red)
)
contentDescription = context.getString(
if (isRestore) R.string.restore_app_status_failed
else R.string.notification_failed_title
Expand Down

0 comments on commit b77953b

Please sign in to comment.