minor theme cleanup (#211)

* use color selectors for alternative text colors and status bar
removed unneeded colors
removed ptsans since its not used and also thats not the way to do fonts anymore

* cahnged name to app_color_primary from bluePrimary

* fix fact total badge color text is not being used
This commit is contained in:
Carlos 2020-04-24 22:01:39 -04:00 committed by GitHub
parent 226eacdfcb
commit 53bdb9cb12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 44 additions and 98 deletions

View File

@ -50,7 +50,7 @@ class CategoryHolder(view: View, val adapter: CategoryAdapter) : BaseFlexibleVie
}
createCategory = category.order == CREATE_CATEGORY_ORDER
if (createCategory) {
title.setTextColor(ContextCompat.getColor(itemView.context, R.color.textColorHint))
title.setTextColor(ContextCompat.getColor(itemView.context, R.color.text_color_hint))
regularDrawable = ContextCompat.getDrawable(itemView.context, R.drawable
.ic_add_white_24dp)
image.gone()

View File

@ -30,6 +30,7 @@ class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeS
context.contextCompatColor(
// hide the badge text when preference is only show badge
if (unread == -1 && !showTotalChapters) R.color.unread_badge
else if (showTotalChapters) R.color.total_badge_text
else R.color.unread_badge_text
)
)

View File

@ -1,45 +0,0 @@
package eu.kanade.tachiyomi.widget
import android.content.Context
import android.graphics.Canvas
import android.graphics.Typeface
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView
import eu.kanade.tachiyomi.R
import java.util.HashMap
class PTSansTextView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
AppCompatTextView(context, attrs) {
companion object {
const val PTSANS_NARROW = 0
const val PTSANS_NARROW_BOLD = 1
// Map where typefaces are cached
private val typefaces = HashMap<Int, Typeface>(2)
}
init {
if (attrs != null) {
val values = context.obtainStyledAttributes(attrs, R.styleable.PTSansTextView)
val typeface = values.getInt(R.styleable.PTSansTextView_typeface, 0)
setTypeface(typefaces.getOrPut(typeface) {
Typeface.createFromAsset(context.assets, when (typeface) {
PTSANS_NARROW -> "fonts/PTSans-Narrow.ttf"
PTSANS_NARROW_BOLD -> "fonts/PTSans-NarrowBold.ttf"
else -> throw IllegalArgumentException("Font not found $typeface")
})
})
values.recycle()
}
}
override fun onDraw(canvas: Canvas) {
// Draw two times for a more visible shadow around the text
super.onDraw(canvas)
super.onDraw(canvas)
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,11 +7,11 @@
<padding android:left="8dp" android:right="8dp" />
</shape>
</item>
<item android:state_enabled="false" android:color="@color/textColorHint">
<item android:state_enabled="false" android:color="@color/text_color_hint">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@android:color/transparent" />
<stroke android:width="1dp" android:color="@color/textColorHint" />
<stroke android:width="1dp" android:color="@color/text_color_hint" />
<padding android:left="8dp" android:right="8dp" />
</shape>
</item>

View File

@ -7,11 +7,11 @@
<padding android:left="8dp" android:right="8dp" />
</shape>
</item>
<item android:state_enabled="false" android:color="@color/textColorHint">
<item android:state_enabled="false" android:color="@color/text_color_hint">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@android:color/transparent" />
<stroke android:color="@color/textColorHint" android:width="1dp"/>
<stroke android:color="@color/text_color_hint" android:width="1dp"/>
<padding android:left="8dp" android:right="8dp" />
</shape>
</item>

View File

@ -16,7 +16,7 @@
android:height="32dp"
android:width="32dp" />
<solid android:color="@android:color/transparent"/>
<stroke android:width="1dp" android:color="@color/bluePrimary" />
<stroke android:width="1dp" android:color="@color/app_color_primary" />
</shape>
</item>
</ripple>

View File

@ -77,8 +77,8 @@
app:atg_inputTextColor="?android:attr/textColorPrimary"
app:atg_checkedBackgroundColor="@color/red_error"
app:atg_checkedBorderColor="@color/red_error"
app:atg_borderColor="@color/md_blue_A400"
app:atg_textColor="@color/md_blue_A400" />
app:atg_borderColor="?attr/colorAccent"
app:atg_textColor="?attr/colorAccent" />
<Button
android:id="@+id/reset_tags"

View File

@ -7,18 +7,12 @@
<color name="rippleColor">@color/md_white_1000_20</color>
<color name="fullRippleColor">#707070</color>
<color name="dialogBackground">#171717</color>
<color name="colorAccent">#3399FF</color>
<color name="splashBackground">#212121</color>
<color name="mainStatus">#AF1C1C1D</color>
<color name="actionModeShadow">@color/md_white_1000_38</color>
<color name="textColorPrimary">@color/md_white_1000</color>
<color name="textColorSecondary">@color/md_white_1000_70</color>
<color name="textColorPrimaryInverse">@color/md_black_1000_87</color>
<color name="textColorSecondaryInverse">@color/md_black_1000_54</color>
<color name="textColorHint">@color/md_white_1000_50</color>
<color name="textColorHintInverse">@color/md_black_1000_38</color>
<color name="divider">@color/md_white_1000_12</color>
<color name="download">@color/material_green_700</color>

View File

@ -16,11 +16,10 @@
<item name="colorOnPrimary">@color/colorAmoledPrimary</item>
<item name="colorPrimaryDark">@color/colorAmoledPrimary</item>
<item name="android:colorBackground">@color/md_black_1000</item>
<item name="android:statusBarColor">@color/blackStatus</item>
<!-- Material Dialog colors -->
<item name="md_color_title">@color/textColorPrimary</item>
<item name="md_color_content">@color/textColorSecondary</item>
<item name="md_color_content">@color/text_color_secondary</item>
<item name="md_color_button_text">@color/colorAccent</item>
<item name="md_background_color">@color/colorAmoledPrimary</item>
<item name="md_corner_radius">16dp</item>

View File

@ -1,15 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="typeface" format="enum">
<enum name="ptsansNarrow" value="0"/>
<enum name="ptsansNarrowBold" value="1"/>
</attr>
<declare-styleable name="PTSansTextView">
<attr name="typeface"/>
</declare-styleable>
<declare-styleable name="MinMaxNumberPicker">
<attr name="min" format="integer"/>
<attr name="max" format="integer"/>

View File

@ -4,22 +4,17 @@
<color name="colorPrimary">@color/md_white_1000</color>
<color name="colorPrimaryInactive">#C2424242</color>
<color name="colorPrimaryDark">@color/md_white_1000</color>
<color name="bluePrimary">#54759E</color>
<color name="mainStatus">#AFFAFAFA</color>
<color name="blueStatus">#AF54759E</color>
<color name="blackStatus">#AF000000</color>
<color name="splashBackground">@color/bluePrimary</color>
<color name="dialogBackground">@color/md_white_1000</color>
<color name="app_color_primary">#54759E</color>
<color name="splashBackground">@color/app_color_primary</color>
<color name="fullRippleColor">#C2C2C2</color>
<color name="rippleColor">@color/md_black_1000_12</color>
<color name="colorAccent">@color/md_blue_A400</color>
<color name="actionModeShadow">@color/md_black_1000_38</color>
<color name="gray_button">#404040</color>
<color name="read_chapter">@color/textColorHint</color>
<color name="read_chapter">@color/text_color_hint</color>
<color name="unread_chapter">@color/textColorPrimary</color>
<color name="bookmarked_chapter">@color/colorAccent</color>
<color name="active_chapter">@color/colorAccent</color>
<color name="unread_badge">@color/colorAccent</color>
<color name="unread_badge_text">@color/md_white_1000</color>
@ -31,11 +26,8 @@
<color name="colorAmoledPrimary">@color/md_black_1000</color>
<color name="textColorPrimary">@color/md_black_1000_87</color>
<color name="textColorSecondary">@color/md_black_1000_54</color>
<color name="textColorPrimaryInverse">@color/md_white_1000</color>
<color name="textColorSecondaryInverse">@color/md_white_1000_70</color>
<color name="textColorHint">@color/md_black_1000_38</color>
<color name="textColorHintInverse">@color/md_white_1000_50</color>
<color name="divider">@color/md_black_1000_12</color>
<color name="badgeColor">@color/material_red_accent_700</color>
<color name="download">@color/material_green_800</color>
@ -51,7 +43,6 @@
<color name="md_white_1000">#FFFFFFFF</color>
<color name="md_white_1000_76">#C2FFFFFF</color>
<color name="md_white_1000_70">#B3FFFFFF</color>
<color name="md_white_1000_54">#8AFFFFFF</color>
<color name="md_white_1000_50">#80FFFFFF</color>
<color name="md_white_1000_20">#33FFFFFF</color>
@ -65,10 +56,7 @@
<color name="md_grey_800">#424242</color>
<color name="md_grey_800_85">#DF424242</color>
<color name="md_blue_A200_50">#80448AFF</color>
<color name="md_blue_A400">#2979FF</color>
<color name="md_blue_A400_38">#612979FF</color>
<color name="md_red_500">#F44336</color>

View File

@ -9,18 +9,18 @@
<style name="Theme.Base" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:forceDarkAllowed" tools:targetApi="29">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="colorPrimary">@color/bluePrimary</item>
<item name="colorPrimary">@color/app_color_primary</item>
<item name="colorPrimaryVariant">@color/colorPrimary</item>
<item name="colorSecondary">@color/background</item>
<item name="colorPrimaryDark">@color/bluePrimary</item>
<item name="colorPrimaryDark">@color/app_color_primary</item>
<item name="colorControlActivated">@color/colorAccent</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColorPrimary">@color/textColorPrimary</item>
<item name="android:textColorSecondary">@color/textColorSecondary</item>
<item name="android:textColorHint">@color/textColorHint</item>
<item name="android:textColorSecondary">@color/text_color_secondary</item>
<item name="android:textColorHint">@color/text_color_hint</item>
<item name="android:textColorPrimaryInverse">@color/textColorPrimaryInverse</item>
<item name="android:textColorSecondaryInverse">@color/textColorSecondaryInverse</item>
<item name="android:textColorHintInverse">@color/textColorHintInverse</item>
<item name="android:textColorSecondaryInverse">@color/text_color_inverse_secondary</item>
<item name="android:textColorHintInverse">@color/text_color_inverse_hint</item>
<item name="android:colorBackground">@color/background</item>
<item name="android:listSelector">?colorAccent</item>
<item name="android:divider">@color/divider</item>
@ -36,14 +36,13 @@
<item name="actionBarTintColor">@color/textColorPrimary</item>
<item name="tabBarIconColor">?colorAccent</item>
<item name="tabBarIconInactive">@color/colorPrimaryInactive</item>
<item name="android:statusBarColor">@color/mainStatus</item>
<item name="android:statusBarColor">@color/status_bar</item>
<item name="android:navigationBarColor">#B3000000</item>
<item name="android:colorEdgeEffect">@color/colorAccent</item>
<!-- Material Dialog colors -->
<item name="md_color_title">@color/textColorPrimary</item>
<item name="md_color_content">@color/textColorSecondary</item>
<item name="md_color_content">@color/text_color_secondary</item>
<item name="md_color_button_text">@color/colorAccent</item>
<item name="md_background_color">@color/dialog</item>
<item name="md_button_casing">literal</item>
@ -55,11 +54,10 @@
<style name="Theme.Tachiyomi" parent="Theme.Base"/>
<style name="Theme.Tachiyomi.AllBlue" parent="Theme.Tachiyomi">
<item name="colorPrimaryVariant">@color/bluePrimary</item>
<item name="colorSecondary">@color/bluePrimary</item>
<item name="colorPrimaryVariant">@color/app_color_primary</item>
<item name="colorSecondary">@color/app_color_primary</item>
<item name="tabBarIconColor">@color/md_white_1000</item>
<item name="tabBarIconInactive">@color/md_white_1000_50</item>
<item name="android:statusBarColor">@color/blueStatus</item>
<item name="actionBarTintColor">@color/md_white_1000</item>
<item name="actionBarTheme">@style/Theme.ActionBar.Dark.DayNight</item>
<item name="android:windowLightStatusBar">false</item>