mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-17 11:19:01 +00:00
Dark gray flash feedback in night mode
This commit is contained in:
parent
d1b29231f8
commit
e1fcc7e64c
1 changed files with 7 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import android.graphics.drawable.ColorDrawable
|
|||
import android.view.View
|
||||
import android.view.ViewTreeObserver
|
||||
import com.habitrpg.common.habitica.extensions.dpToPx
|
||||
import com.habitrpg.common.habitica.extensions.isUsingNightModeResources
|
||||
|
||||
fun View.setScaledPadding(context: Context?, left: Int, top: Int, right: Int, bottom: Int) {
|
||||
this.setPadding(left.dpToPx(context), top.dpToPx(context), right.dpToPx(context), bottom.dpToPx(context))
|
||||
|
|
@ -43,7 +44,12 @@ fun View.fadeInAnimation(duration: Long = 500) {
|
|||
|
||||
fun View.flash() {
|
||||
val originalColor = (background as? ColorDrawable)?.color
|
||||
setBackgroundColor(Color.LTGRAY)
|
||||
if (this.context.isUsingNightModeResources()) {
|
||||
setBackgroundColor(Color.DKGRAY)
|
||||
} else {
|
||||
setBackgroundColor(Color.LTGRAY)
|
||||
}
|
||||
|
||||
postDelayed({
|
||||
originalColor?.let { setBackgroundColor(it) } ?: setBackgroundResource(0)
|
||||
}, 100)
|
||||
|
|
|
|||
Loading…
Reference in a new issue