diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATEStrokeTextView.kt b/app/src/main/java/io/legado/app/lib/theme/view/ATEStrokeTextView.kt deleted file mode 100644 index d113321d9..000000000 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATEStrokeTextView.kt +++ /dev/null @@ -1,31 +0,0 @@ -package io.legado.app.lib.theme.view - -import android.content.Context -import android.util.AttributeSet -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.utils.dp -import io.legado.app.utils.getCompatColor - -class ATEStrokeTextView(context: Context, attrs: AttributeSet) : AppCompatTextView(context, attrs) { - - init { - background = Selector.shapeBuild() - .setCornerRadius(1.dp) - .setStrokeWidth(1.dp) - .setDisabledStrokeColor(context.getCompatColor(R.color.md_grey_500)) - .setDefaultStrokeColor(ThemeStore.textColorSecondary(context)) - .setSelectedStrokeColor(ThemeStore.accentColor(context)) - .setPressedBgColor(context.getCompatColor(R.color.transparent30)) - .create() - setTextColor( - Selector.colorBuild() - .setDefaultColor(ThemeStore.textColorSecondary(context)) - .setSelectedColor(ThemeStore.accentColor(context)) - .setDisabledColor(context.getCompatColor(R.color.md_grey_500)) - .create() - ) - } -} diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATETextInputLayout.kt b/app/src/main/java/io/legado/app/lib/theme/view/ATETextInputLayout.kt deleted file mode 100644 index 5444a309c..000000000 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATETextInputLayout.kt +++ /dev/null @@ -1,15 +0,0 @@ -package io.legado.app.lib.theme.view - -import android.content.Context -import android.util.AttributeSet -import com.google.android.material.textfield.TextInputLayout -import io.legado.app.lib.theme.Selector -import io.legado.app.lib.theme.ThemeStore - -class ATETextInputLayout(context: Context, attrs: AttributeSet?) : TextInputLayout(context, attrs) { - - init { - defaultHintTextColor = Selector.colorBuild().setDefaultColor(ThemeStore.accentColor(context)).create() - } - -} diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATEPrimaryTextView.kt b/app/src/main/java/io/legado/app/ui/widget/text/PrimaryTextView.kt similarity index 75% rename from app/src/main/java/io/legado/app/lib/theme/view/ATEPrimaryTextView.kt rename to app/src/main/java/io/legado/app/ui/widget/text/PrimaryTextView.kt index b28a97305..2c2666e07 100644 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATEPrimaryTextView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/text/PrimaryTextView.kt @@ -1,4 +1,4 @@ -package io.legado.app.lib.theme.view +package io.legado.app.ui.widget.text import android.content.Context import android.util.AttributeSet @@ -8,7 +8,7 @@ import io.legado.app.lib.theme.ThemeStore /** * @author Aidan Follestad (afollestad) */ -class ATEPrimaryTextView(context: Context, attrs: AttributeSet) : +class PrimaryTextView(context: Context, attrs: AttributeSet) : AppCompatTextView(context, attrs) { init { diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATESecondaryTextView.kt b/app/src/main/java/io/legado/app/ui/widget/text/SecondaryTextView.kt similarity index 75% rename from app/src/main/java/io/legado/app/lib/theme/view/ATESecondaryTextView.kt rename to app/src/main/java/io/legado/app/ui/widget/text/SecondaryTextView.kt index 8031961d3..6d59af0e6 100644 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATESecondaryTextView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/text/SecondaryTextView.kt @@ -1,4 +1,4 @@ -package io.legado.app.lib.theme.view +package io.legado.app.ui.widget.text import android.content.Context import android.util.AttributeSet @@ -8,7 +8,7 @@ import io.legado.app.lib.theme.secondaryTextColor /** * @author Aidan Follestad (afollestad) */ -class ATESecondaryTextView(context: Context, attrs: AttributeSet) : +class SecondaryTextView(context: Context, attrs: AttributeSet) : AppCompatTextView(context, attrs) { init { diff --git a/app/src/main/java/io/legado/app/ui/widget/text/StrokeTextView.kt b/app/src/main/java/io/legado/app/ui/widget/text/StrokeTextView.kt new file mode 100644 index 000000000..c899e1c42 --- /dev/null +++ b/app/src/main/java/io/legado/app/ui/widget/text/StrokeTextView.kt @@ -0,0 +1,49 @@ +package io.legado.app.ui.widget.text + +import android.content.Context +import android.util.AttributeSet +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.utils.dp +import io.legado.app.utils.getCompatColor + +class StrokeTextView(context: Context, attrs: AttributeSet) : AppCompatTextView(context, attrs) { + + init { + if (isInEditMode) { + background = Selector.shapeBuild() + .setCornerRadius(1.dp) + .setStrokeWidth(1.dp) + .setDisabledStrokeColor(context.getCompatColor(R.color.md_grey_500)) + .setDefaultStrokeColor(context.getCompatColor(R.color.tv_text_secondary)) + .setSelectedStrokeColor(context.getCompatColor(R.color.colorAccent)) + .setPressedBgColor(context.getCompatColor(R.color.transparent30)) + .create() + setTextColor( + Selector.colorBuild() + .setDefaultColor(context.getCompatColor(R.color.tv_text_secondary)) + .setSelectedColor(context.getCompatColor(R.color.colorAccent)) + .setDisabledColor(context.getCompatColor(R.color.md_grey_500)) + .create() + ) + } else { + background = Selector.shapeBuild() + .setCornerRadius(1.dp) + .setStrokeWidth(1.dp) + .setDisabledStrokeColor(context.getCompatColor(R.color.md_grey_500)) + .setDefaultStrokeColor(ThemeStore.textColorSecondary(context)) + .setSelectedStrokeColor(ThemeStore.accentColor(context)) + .setPressedBgColor(context.getCompatColor(R.color.transparent30)) + .create() + setTextColor( + Selector.colorBuild() + .setDefaultColor(ThemeStore.textColorSecondary(context)) + .setSelectedColor(ThemeStore.accentColor(context)) + .setDisabledColor(context.getCompatColor(R.color.md_grey_500)) + .create() + ) + } + } +} diff --git a/app/src/main/java/io/legado/app/ui/widget/text/TextInputLayout.kt b/app/src/main/java/io/legado/app/ui/widget/text/TextInputLayout.kt new file mode 100644 index 000000000..015e848c3 --- /dev/null +++ b/app/src/main/java/io/legado/app/ui/widget/text/TextInputLayout.kt @@ -0,0 +1,18 @@ +package io.legado.app.ui.widget.text + +import android.content.Context +import android.util.AttributeSet +import com.google.android.material.textfield.TextInputLayout +import io.legado.app.lib.theme.Selector +import io.legado.app.lib.theme.ThemeStore + +class TextInputLayout(context: Context, attrs: AttributeSet?) : TextInputLayout(context, attrs) { + + init { + if (!isInEditMode) { + defaultHintTextColor = + Selector.colorBuild().setDefaultColor(ThemeStore.accentColor(context)).create() + } + } + +} diff --git a/app/src/main/res/layout/activity_book_info_edit.xml b/app/src/main/res/layout/activity_book_info_edit.xml index 170449767..0301bcfb6 100644 --- a/app/src/main/res/layout/activity_book_info_edit.xml +++ b/app/src/main/res/layout/activity_book_info_edit.xml @@ -42,7 +42,7 @@ android:orientation="vertical" android:padding="5dp"> - - + - - + - - + - - - - - + diff --git a/app/src/main/res/layout/activity_import_book.xml b/app/src/main/res/layout/activity_import_book.xml index e3473f202..092290eb2 100644 --- a/app/src/main/res/layout/activity_import_book.xml +++ b/app/src/main/res/layout/activity_import_book.xml @@ -34,7 +34,7 @@ android:focusable="true" tools:text="/" /> - - - + - - + - - - - - - - - - + - - + - - + - - + - - + diff --git a/app/src/main/res/layout/item_source_edit.xml b/app/src/main/res/layout/item_source_edit.xml index e68432c3e..d5db8fada 100644 --- a/app/src/main/res/layout/item_source_edit.xml +++ b/app/src/main/res/layout/item_source_edit.xml @@ -1,5 +1,5 @@ - - \ No newline at end of file + \ No newline at end of file