pull/995/head
gedoor 4 years ago
parent 71fec61eac
commit 7342cee660
  1. 4
      app/src/main/java/io/legado/app/lib/theme/MaterialValueHelper.kt
  2. 31
      app/src/main/java/io/legado/app/ui/widget/text/AccentStrokeTextView.kt
  3. 2
      app/src/main/res/color/selector_image.xml
  4. 23
      app/src/main/res/layout/view_select_action_bar.xml
  5. 2
      app/src/main/res/values-night/colors.xml
  6. 5
      app/src/main/res/values/attrs.xml
  7. 3
      app/src/main/res/values/colors.xml

@ -101,9 +101,9 @@ val Fragment.secondaryDisabledTextColor: Int
val Context.buttonDisabledColor: Int
get() = if (isDarkTheme) {
ContextCompat.getColor(this, R.color.ate_button_disabled_dark)
ContextCompat.getColor(this, R.color.md_dark_disabled)
} else {
ContextCompat.getColor(this, R.color.ate_button_disabled_light)
ContextCompat.getColor(this, R.color.md_light_disabled)
}
val Context.isDarkTheme: Boolean

@ -6,25 +6,50 @@ import androidx.appcompat.widget.AppCompatTextView
import io.legado.app.R
import io.legado.app.lib.theme.Selector
import io.legado.app.lib.theme.ThemeStore
import io.legado.app.lib.theme.bottomBackground
import io.legado.app.utils.ColorUtils
import io.legado.app.utils.dp
import io.legado.app.utils.getCompatColor
class AccentStrokeTextView(context: Context, attrs: AttributeSet) :
AppCompatTextView(context, attrs) {
private var radius = 3.dp
private val isBottomBackground: Boolean
init {
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.AccentStrokeTextView)
radius = typedArray.getDimensionPixelOffset(R.styleable.StrokeTextView_radius, radius)
isBottomBackground =
typedArray.getBoolean(R.styleable.StrokeTextView_isBottomBackground, false)
typedArray.recycle()
upStyle()
}
private fun upStyle() {
val isLight = ColorUtils.isColorLight(context.bottomBackground)
val disableColor = if (isBottomBackground) {
if (isLight) {
context.getCompatColor(R.color.md_light_disabled)
} else {
context.getCompatColor(R.color.md_dark_disabled)
}
} else {
context.getCompatColor(R.color.disabled)
}
background = Selector.shapeBuild()
.setCornerRadius(3.dp)
.setCornerRadius(radius)
.setStrokeWidth(1.dp)
.setDisabledStrokeColor(context.getCompatColor(R.color.md_grey_500))
.setDisabledStrokeColor(disableColor)
.setDefaultStrokeColor(ThemeStore.accentColor(context))
.setPressedBgColor(context.getCompatColor(R.color.transparent30))
.create()
setTextColor(
Selector.colorBuild()
.setDefaultColor(ThemeStore.accentColor(context))
.setDisabledColor(context.getCompatColor(R.color.md_grey_500))
.setDisabledColor(disableColor)
.create()
)
}
}

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/ate_button_disabled_light" />
<item android:state_enabled="false" android:color="@color/disabled" />
<item android:state_pressed="true" android:color="@color/btn_bg_press" />
<item android:state_focused="true" android:color="@color/btn_bg_press_2" />
<item android:color="@color/primaryText" />

@ -1,15 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="2dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="8dp"
android:paddingTop="6dp"
android:paddingRight="8dp"
android:paddingBottom="6dp"
android:gravity="center_vertical"
android:elevation="2dp"
tools:ignore="RtlHardcoded">
<io.legado.app.lib.theme.view.ATECheckBox
@ -25,21 +26,23 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:padding="5dp"
android:gravity="center"
android:minWidth="72dp"
android:text="@string/revert_selection" />
android:padding="5dp"
android:text="@string/revert_selection"
app:isBottomBackground="true" />
<io.legado.app.ui.widget.text.AccentStrokeTextView
android:id="@+id/btn_select_action_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:padding="5dp"
android:minWidth="72dp"
android:gravity="center"
android:minWidth="72dp"
android:padding="5dp"
android:text="@string/app_name"
android:visibility="gone"
android:text="@string/app_name" />
app:isBottomBackground="true" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_menu_more"
@ -47,10 +50,10 @@
android:layout_height="36dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/more_menu"
android:tooltipText="@string/more_menu"
android:padding="6dp"
android:src="@drawable/ic_more_vert"
android:tint="@color/primaryText"
android:tooltipText="@string/more_menu"
android:visibility="gone"
tools:ignore="RtlHardcoded,UnusedAttribute" />

@ -4,6 +4,8 @@
<color name="primaryDark">@color/md_blue_grey_700</color>
<color name="accent">@color/md_deep_orange_800</color>
<color name="disabled">@color/md_dark_disabled</color>
<color name="background">@color/md_grey_900</color>
<color name="background_card">@color/md_grey_850</color>
<color name="background_menu">@color/md_grey_800</color>

@ -167,6 +167,11 @@
<attr name="radius" />
</declare-styleable>
<declare-styleable name="AccentStrokeTextView">
<attr name="radius" />
<attr name="isBottomBackground" />
</declare-styleable>
<declare-styleable name="StrokeTextView">
<attr name="radius" />
<attr name="isBottomBackground" />

@ -3,6 +3,9 @@
<color name="primary">@color/md_light_blue_600</color>
<color name="primaryDark">@color/md_light_blue_700</color>
<color name="accent">@color/md_pink_800</color>
<color name="disabled">@color/md_light_disabled</color>
<color name="divider">#66666666</color>
<color name="lightBlue_color">#FF578FCC</color>

Loading…
Cancel
Save