mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 20:31:51 +01:00
Tweak button styles
This commit is contained in:
parent
b434bc93a3
commit
3f4140900d
@ -1,8 +1,6 @@
|
|||||||
package eu.kanade.tachiyomi.ui.extension
|
package eu.kanade.tachiyomi.ui.extension
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
|
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.glide.GlideApp
|
import eu.kanade.tachiyomi.data.glide.GlideApp
|
||||||
import eu.kanade.tachiyomi.extension.model.Extension
|
import eu.kanade.tachiyomi.extension.model.Extension
|
||||||
@ -10,6 +8,7 @@ import eu.kanade.tachiyomi.extension.model.InstallStep
|
|||||||
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
||||||
import eu.kanade.tachiyomi.ui.base.holder.SlicedHolder
|
import eu.kanade.tachiyomi.ui.base.holder.SlicedHolder
|
||||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||||
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
import io.github.mthli.slice.Slice
|
import io.github.mthli.slice.Slice
|
||||||
import kotlinx.android.synthetic.main.extension_card_item.card
|
import kotlinx.android.synthetic.main.extension_card_item.card
|
||||||
import kotlinx.android.synthetic.main.extension_card_item.ext_button
|
import kotlinx.android.synthetic.main.extension_card_item.ext_button
|
||||||
@ -63,10 +62,8 @@ class ExtensionHolder(view: View, override val adapter: ExtensionAdapter) :
|
|||||||
fun bindButton(item: ExtensionItem) = with(ext_button) {
|
fun bindButton(item: ExtensionItem) = with(ext_button) {
|
||||||
isEnabled = true
|
isEnabled = true
|
||||||
isClickable = true
|
isClickable = true
|
||||||
isActivated = false
|
|
||||||
|
|
||||||
background = VectorDrawableCompat.create(resources!!, R.drawable.button_bg_transparent, null)
|
setTextColor(context.getResourceColor(R.attr.colorAccent))
|
||||||
setTextColor(ContextCompat.getColorStateList(context, R.drawable.button_bg_transparent))
|
|
||||||
|
|
||||||
val extension = item.extension
|
val extension = item.extension
|
||||||
|
|
||||||
@ -86,14 +83,10 @@ class ExtensionHolder(view: View, override val adapter: ExtensionAdapter) :
|
|||||||
} else if (extension is Extension.Installed) {
|
} else if (extension is Extension.Installed) {
|
||||||
when {
|
when {
|
||||||
extension.hasUpdate -> {
|
extension.hasUpdate -> {
|
||||||
isActivated = true
|
|
||||||
setText(R.string.ext_update)
|
setText(R.string.ext_update)
|
||||||
}
|
}
|
||||||
extension.isObsolete -> {
|
extension.isObsolete -> {
|
||||||
// Red outline
|
setTextColor(context.getResourceColor(R.attr.colorError))
|
||||||
background = VectorDrawableCompat.create(resources, R.drawable.button_bg_error, null)
|
|
||||||
setTextColor(ContextCompat.getColorStateList(context, R.drawable.button_bg_error))
|
|
||||||
|
|
||||||
setText(R.string.ext_obsolete)
|
setText(R.string.ext_obsolete)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:state_activated="true" android:color="@color/md_white_1000">
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
<corners android:radius="2dp" />
|
|
||||||
<solid android:color="@color/red_error" />
|
|
||||||
<padding android:left="8dp" android:right="8dp" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
<item android:state_enabled="false" android:color="@color/textColorHintLight">
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
<corners android:radius="2dp" />
|
|
||||||
<solid android:color="@android:color/transparent" />
|
|
||||||
<stroke android:width="1dp" android:color="@color/textColorHintLight" />
|
|
||||||
<padding android:left="8dp" android:right="8dp" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
<item android:color="@color/red_error">
|
|
||||||
<shape android:color="@color/red_error" android:shape="rectangle">
|
|
||||||
<corners android:radius="2dp" />
|
|
||||||
<solid android:color="@android:color/transparent" />
|
|
||||||
<stroke android:width="1dp" android:color="@color/red_error" />
|
|
||||||
<padding android:left="8dp" android:right="8dp" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</selector>
|
|
@ -1,26 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:state_activated="true" android:color="@color/md_white_1000">
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
<corners android:radius="2dp" />
|
|
||||||
<solid android:color="?attr/colorAccent" />
|
|
||||||
<padding android:left="8dp" android:right="8dp" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
<item android:state_enabled="false" android:color="@color/textColorHintLight">
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
<corners android:radius="2dp" />
|
|
||||||
<solid android:color="@android:color/transparent" />
|
|
||||||
<stroke android:color="@color/textColorHintLight" android:width="1dp"/>
|
|
||||||
<padding android:left="8dp" android:right="8dp" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
<item android:color="?attr/colorAccent">
|
|
||||||
<shape android:shape="rectangle" android:color="?attr/colorAccent">
|
|
||||||
<corners android:radius="2dp" />
|
|
||||||
<solid android:color="@android:color/transparent" />
|
|
||||||
<stroke android:color="?attr/colorAccent" android:width="1dp"/>
|
|
||||||
<padding android:left="8dp" android:right="8dp" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</selector>
|
|
@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/reset_btn"
|
android:id="@+id/reset_btn"
|
||||||
style="@style/Theme.Widget.Button.Borderless"
|
style="@style/Theme.Widget.Button"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/search_btn"
|
android:id="@+id/search_btn"
|
||||||
style="@style/Theme.Widget.Button.Colored"
|
style="@style/Theme.Widget.Button.FilledAccent"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
@ -39,9 +39,11 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/source_latest"
|
android:id="@+id/source_latest"
|
||||||
style="@style/Theme.Widget.Button.Borderless.Small"
|
style="@style/Theme.Widget.Button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:maxHeight="48dp"
|
||||||
|
android:minHeight="48dp"
|
||||||
android:text="@string/latest"
|
android:text="@string/latest"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/source_browse"
|
app:layout_constraintEnd_toStartOf="@+id/source_browse"
|
||||||
@ -49,9 +51,11 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/source_browse"
|
android:id="@+id/source_browse"
|
||||||
style="@style/Theme.Widget.Button.Borderless.Small"
|
style="@style/Theme.Widget.Button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:maxHeight="48dp"
|
||||||
|
android:minHeight="48dp"
|
||||||
android:text="@string/browse"
|
android:text="@string/browse"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
@ -60,20 +60,16 @@
|
|||||||
android:layout_marginStart="4dp"
|
android:layout_marginStart="4dp"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
app:layout_constraintBaseline_toBaselineOf="@id/lang"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/lang"
|
app:layout_constraintStart_toEndOf="@id/lang"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/ext_title"
|
||||||
tools:text="Version" />
|
tools:text="Version" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/ext_button"
|
android:id="@+id/ext_button"
|
||||||
|
style="@style/Theme.Widget.Button.Outlined.Accent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="32dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:background="@drawable/button_bg_transparent"
|
|
||||||
android:foreground="?attr/selectableItemBackground"
|
|
||||||
android:textColor="@drawable/button_bg_transparent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
@ -78,7 +78,7 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/extension_uninstall_button"
|
android:id="@+id/extension_uninstall_button"
|
||||||
style="@style/Theme.Widget.Button.Colored"
|
style="@style/Theme.Widget.Button.FilledAccent"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/remove"
|
android:id="@+id/remove"
|
||||||
style="@style/Theme.Widget.Button.Borderless.Negative"
|
style="@style/Theme.Widget.Button.Error"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/resume"
|
android:id="@+id/resume"
|
||||||
style="@style/Theme.Widget.Button.Borderless"
|
style="@style/Theme.Widget.Button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
<item name="android:textColor">?attr/colorOnSurface</item>
|
<item name="android:textColor">?attr/colorOnSurface</item>
|
||||||
|
|
||||||
<item name="buttonBarPositiveButtonStyle">@style/Theme.Widget.Button</item>
|
<item name="buttonBarPositiveButtonStyle">@style/Theme.Widget.Button</item>
|
||||||
<item name="buttonBarNegativeButtonStyle">@style/Theme.Widget.Button.Borderless</item>
|
<item name="buttonBarNegativeButtonStyle">@style/Theme.Widget.Button</item>
|
||||||
<item name="buttonBarNeutralButtonStyle">@style/Theme.Widget.Button.Borderless</item>
|
<item name="buttonBarNeutralButtonStyle">@style/Theme.Widget.Button</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.AlertDialog.Light" parent="Theme.AlertDialog">
|
<style name="Theme.AlertDialog.Light" parent="Theme.AlertDialog">
|
||||||
@ -224,24 +224,24 @@
|
|||||||
<!--Widgets.Button-->
|
<!--Widgets.Button-->
|
||||||
<!--==============-->
|
<!--==============-->
|
||||||
<style name="Theme.Widget.Button" parent="Widget.MaterialComponents.Button.TextButton">
|
<style name="Theme.Widget.Button" parent="Widget.MaterialComponents.Button.TextButton">
|
||||||
<item name="android:textColor">?attr/colorOnSurface</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="Theme.Widget.Button.Colored" parent="Widget.MaterialComponents.Button">
|
|
||||||
<item name="backgroundTint">?attr/colorAccent</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="Theme.Widget.Button.Borderless" parent="Theme.Widget.Button">
|
|
||||||
<item name="android:textColor">?attr/colorAccent</item>
|
<item name="android:textColor">?attr/colorAccent</item>
|
||||||
|
<item name="rippleColor">?attr/colorAccent</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.Widget.Button.Borderless.Negative" parent="Theme.Widget.Button.Borderless">
|
<style name="Theme.Widget.Button.Error" parent="Theme.Widget.Button">
|
||||||
<item name="android:textColor">@color/md_red_500</item>
|
<item name="android:textColor">?attr/colorError</item>
|
||||||
|
<item name="rippleColor">?attr/colorError</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.Widget.Button.Borderless.Small" parent="Theme.Widget.Button.Borderless">
|
<style name="Theme.Widget.Button.FilledAccent" parent="Widget.MaterialComponents.Button">
|
||||||
<item name="android:minHeight">48dip</item>
|
<item name="android:textColor">?attr/colorOnSecondary</item>
|
||||||
<item name="android:minWidth">48dip</item>
|
<item name="backgroundTint">?attr/colorAccent</item>
|
||||||
|
<item name="rippleColor">?attr/colorAccent</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.Widget.Button.Outlined.Accent" parent="Widget.MaterialComponents.Button.OutlinedButton">
|
||||||
|
<item name="android:textColor">?attr/colorAccent</item>
|
||||||
|
<item name="rippleColor">?attr/colorAccent</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
|
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
|
||||||
<item name="dialogTheme">@style/Theme.AlertDialog.Light</item>
|
<item name="dialogTheme">@style/Theme.AlertDialog.Light</item>
|
||||||
<item name="alertDialogTheme">@style/Theme.AlertDialog.Dark</item>
|
<item name="alertDialogTheme">@style/Theme.AlertDialog.Dark</item>
|
||||||
<item name="snackbarButtonStyle">@style/Theme.Widget.Button.Borderless</item>
|
<item name="snackbarButtonStyle">@style/Theme.Widget.Button</item>
|
||||||
<item name="textAppearanceButton">@style/TextAppearance.Widget.Button</item>
|
<item name="textAppearanceButton">@style/TextAppearance.Widget.Button</item>
|
||||||
<item name="android:itemTextAppearance">@style/TextAppearance.Widget.Menu</item>
|
<item name="android:itemTextAppearance">@style/TextAppearance.Widget.Menu</item>
|
||||||
|
|
||||||
@ -125,7 +125,7 @@
|
|||||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
|
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
|
||||||
<item name="dialogTheme">@style/Theme.AlertDialog.Dark</item>
|
<item name="dialogTheme">@style/Theme.AlertDialog.Dark</item>
|
||||||
<item name="alertDialogTheme">@style/Theme.AlertDialog.Dark</item>
|
<item name="alertDialogTheme">@style/Theme.AlertDialog.Dark</item>
|
||||||
<item name="snackbarButtonStyle">@style/Theme.Widget.Button.Borderless</item>
|
<item name="snackbarButtonStyle">@style/Theme.Widget.Button</item>
|
||||||
<item name="textAppearanceButton">@style/TextAppearance.Widget.Button</item>
|
<item name="textAppearanceButton">@style/TextAppearance.Widget.Button</item>
|
||||||
<item name="android:itemTextAppearance">@style/TextAppearance.Widget.Menu</item>
|
<item name="android:itemTextAppearance">@style/TextAppearance.Widget.Menu</item>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user