Theme riotx_positive_accent
This commit is contained in:
parent
311244508d
commit
e1cbd8c764
|
@ -29,9 +29,12 @@ class ColorProvider @Inject constructor(private val context: Context) {
|
|||
|
||||
@ColorInt
|
||||
fun getColor(@ColorRes colorRes: Int): Int {
|
||||
if (colorRes == R.color.riotx_accent)
|
||||
return getColorFromAttribute(R.attr.colorAccent)
|
||||
return ContextCompat.getColor(context, colorRes)
|
||||
return when(colorRes) {
|
||||
R.color.riotx_accent -> getColorFromAttribute(R.attr.colorAccent)
|
||||
R.color.riotx_positive_accent -> getColorFromAttribute(R.attr.riotx_positive_accent)
|
||||
R.color.riotx_positive_accent_alpha12 -> getColorFromAttribute(R.attr.riotx_positive_accent_alpha12)
|
||||
else -> ContextCompat.getColor(context, colorRes)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,6 +40,7 @@ import im.vector.riotx.core.extensions.replaceFragment
|
|||
import im.vector.riotx.core.platform.ToolbarConfigurable
|
||||
import im.vector.riotx.core.platform.VectorBaseActivity
|
||||
import im.vector.riotx.core.pushers.PushersManager
|
||||
import im.vector.riotx.core.resources.ColorProvider
|
||||
import im.vector.riotx.features.disclaimer.showDisclaimerDialog
|
||||
import im.vector.riotx.features.notifications.NotificationDrawerManager
|
||||
import im.vector.riotx.features.popup.PopupAlertManager
|
||||
|
@ -202,7 +203,7 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable, UnknownDeviceDet
|
|||
iconId = R.drawable.ic_shield_warning
|
||||
).apply {
|
||||
matrixItem = userItem
|
||||
colorInt = ContextCompat.getColor(this@HomeActivity, R.color.riotx_positive_accent)
|
||||
colorInt = ColorProvider(this@HomeActivity).getColor(R.color.riotx_positive_accent)
|
||||
contentAction = Runnable {
|
||||
(weakCurrentActivity?.get() as? VectorBaseActivity)?.let {
|
||||
action(it)
|
||||
|
|
|
@ -28,7 +28,6 @@ import androidx.core.content.ContextCompat
|
|||
import androidx.core.graphics.drawable.DrawableCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.features.configuration.VectorConfiguration
|
||||
import timber.log.Timber
|
||||
|
||||
/**
|
||||
|
@ -232,11 +231,19 @@ object ThemeUtils {
|
|||
c.theme.resolveAttribute(colorAttribute, color, true)
|
||||
color.data
|
||||
} catch (e: Exception) {
|
||||
when (colorAttribute) {
|
||||
android.R.attr.colorAccent -> ContextCompat.getColor(c, R.color.riotx_accent)
|
||||
R.attr.colorAccent -> ContextCompat.getColor(c, R.color.riotx_accent)
|
||||
R.attr.riotx_positive_accent -> ContextCompat.getColor(c, R.color.riotx_positive_accent)
|
||||
R.attr.riotx_positive_accent_alpha12 -> ContextCompat.getColor(c, R.color.riotx_positive_accent_alpha12)
|
||||
else -> {
|
||||
Timber.e(e, "Unable to get color")
|
||||
ContextCompat.getColor(c, android.R.color.holo_red_dark)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getAttribute(c: Context, @AttrRes attribute: Int): TypedValue? {
|
||||
try {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/riotx_button_disabled_alpha12" android:state_enabled="false" />
|
||||
<item android:color="@color/riotx_positive_accent_alpha12" android:state_enabled="true" />
|
||||
<item android:color="?riotx_positive_accent_alpha12" android:state_enabled="true" />
|
||||
</selector>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/riotx_disabled_accent" android:state_enabled="false" />
|
||||
<item android:color="@color/riotx_positive_accent" />
|
||||
<item android:color="?riotx_positive_accent" />
|
||||
</selector>
|
|
@ -6,6 +6,6 @@
|
|||
android:width="40dp"
|
||||
android:height="40dp" />
|
||||
|
||||
<solid android:color="@color/riotx_positive_accent" />
|
||||
<solid android:color="?riotx_positive_accent" />
|
||||
|
||||
</shape>
|
|
@ -37,7 +37,7 @@
|
|||
android:textColor="?riotx_text_primary"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="0dp"
|
||||
tools:textColor="@color/riotx_positive_accent"
|
||||
tools:textColor="?riotx_positive_accent"
|
||||
tools:text="Value" />
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
<attr name="sc_message_bg_incoming" format="color" />
|
||||
<attr name="sc_message_bg_outgoing" format="color" />
|
||||
|
||||
<attr name="riotx_positive_accent" format="color" />
|
||||
<attr name="riotx_positive_accent_alpha12" format="color" />
|
||||
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
<color name="accent_sc">#8BC34A</color>
|
||||
<color name="accent_sc_alpha25">#3F8BC34A</color>
|
||||
<color name="accent_sc_alpha12">#1E8BC34A</color>
|
||||
<color name="direct_chat_ring_color_sc">#689F38</color>
|
||||
|
||||
<color name="avatar_fill_sc_1">@color/accent_sc</color>
|
||||
|
|
|
@ -225,6 +225,8 @@
|
|||
|
||||
<item name="sc_message_bg_incoming">#FF465561</item>
|
||||
<item name="sc_message_bg_outgoing">#ff343b47</item>
|
||||
<item name="riotx_positive_accent">@color/riotx_positive_accent</item>
|
||||
<item name="riotx_positive_accent_alpha12">@color/riotx_positive_accent_alpha12</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Dark" parent="AppTheme.Base.Dark" />
|
||||
|
|
|
@ -225,6 +225,8 @@
|
|||
|
||||
<item name="sc_message_bg_incoming">#FFEEEEEE</item>
|
||||
<item name="sc_message_bg_outgoing">#FFDDDDDD</item>
|
||||
<item name="riotx_positive_accent">@color/riotx_positive_accent</item>
|
||||
<item name="riotx_positive_accent_alpha12">@color/riotx_positive_accent_alpha12</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Light" parent="AppTheme.Base.Light" />
|
||||
|
|
|
@ -208,6 +208,8 @@
|
|||
|
||||
<item name="sc_message_bg_incoming">@color/background_floating_sc</item>
|
||||
<item name="sc_message_bg_outgoing">@color/background_sc</item>
|
||||
<item name="riotx_positive_accent">@color/accent_sc</item>
|
||||
<item name="riotx_positive_accent_alpha12">@color/accent_sc_alpha12</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Base.SC.Dark">
|
||||
|
|
|
@ -154,6 +154,8 @@
|
|||
|
||||
<item name="sc_message_bg_incoming">#FFFFFFFF</item>
|
||||
<item name="sc_message_bg_outgoing">#FFE4E8ED</item>
|
||||
<item name="riotx_positive_accent">@color/riotx_positive_accent</item>
|
||||
<item name="riotx_positive_accent_alpha12">@color/riotx_positive_accent_alpha12</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Status" parent="AppTheme.Base.Status" />
|
||||
|
|
Loading…
Reference in New Issue