Match edit tags style to details tag

This commit is contained in:
Jays2Kings 2021-07-19 17:33:49 -04:00
parent f855c10d42
commit 0892a23f2a
3 changed files with 55 additions and 26 deletions

View File

@ -35,7 +35,6 @@ import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.system.isInNightMode
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import kotlin.math.abs
class EditMangaDialog : DialogController {
@ -195,26 +194,34 @@ class EditMangaDialog : DialogController {
val addTagEditText = binding.addTagEditText
removeAllViews()
val dark = context.isInNightMode()
val amoled = infoController.presenter.preferences.themeDarkAmoled().get()
val baseTagColor = context.getResourceColor(R.attr.background)
val bgArray = FloatArray(3)
val accentArray = FloatArray(3)
val onAccentArray = FloatArray(3)
ColorUtils.colorToHSL(baseTagColor, bgArray)
ColorUtils.colorToHSL(context.getResourceColor(R.attr.colorAccent), accentArray)
ColorUtils.colorToHSL(context.getResourceColor(R.attr.colorOnAccent), onAccentArray)
val downloadedColor = ColorUtils.setAlphaComponent(
ColorUtils.HSLToColor(
floatArrayOf(
accentArray[0],
accentArray[1],
// fun math just for good contrast
((if (dark) 0.35f else 0.87f) + (abs(onAccentArray[2] - 0.5f) * .7f)) / 2f
bgArray[0],
bgArray[1],
(
when {
amoled && dark -> 0.1f
dark -> 0.225f
else -> 0.85f
}
)
)
),
165
199
)
val textColor = ColorUtils.HSLToColor(
floatArrayOf(
accentArray[0],
0.8f,
if (dark) 0.925f else 0.15f
accentArray[1],
if (dark) 0.945f else 0.175f
)
)
genres.map { genreText ->

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/reader_nav"
android:background="@drawable/chapter_nav"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="4dp"
android:paddingEnd="4dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:layout_gravity="top"
android:paddingBottom="6dp"
android:paddingTop="6dp"
@ -19,18 +19,25 @@
<ProgressBar
android:id="@+id/left_progress"
style="?android:attr/progressBarStyleSmall"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/reader_seekbar"
android:visibility="gone"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginStart="56dp" />
android:layout_gravity="center" />
<ImageButton
android:id="@+id/left_chapter"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginStart="56dp"
android:visibility="visible"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/reader_seekbar"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/previous_chapter"
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
@ -39,13 +46,18 @@
<LinearLayout
android:id="@+id/reader_seekbar"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_width="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/left_chapter"
app:layout_constraintEnd_toStartOf="@id/right_chapter"
android:layout_height="wrap_content">
<TextView
android:id="@+id/left_page_text"
android:layout_width="32sp"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:textColor="?actionBarTintColor"
android:textSize="15sp"
@ -54,7 +66,7 @@
<eu.kanade.tachiyomi.ui.reader.ReaderSeekBar
android:id="@+id/page_seekbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="40dp"
android:layout_weight="1"
android:progressBackgroundTint="@color/tint_color_secondary"
android:maxHeight="?attr/actionBarSize"
@ -63,7 +75,8 @@
<TextView
android:id="@+id/right_page_text"
android:layout_width="32sp"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:textColor="?actionBarTintColor"
android:textSize="15sp"
@ -76,7 +89,10 @@
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginEnd="56dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/reader_seekbar"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/next_chapter"
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
@ -86,10 +102,13 @@
<ProgressBar
android:id="@+id/right_progress"
style="?android:attr/progressBarStyleSmall"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/reader_seekbar"
android:visibility="gone"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginEnd="56dp" />
android:layout_gravity="center" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<!--========-->
<!--Toolbars-->
@ -190,6 +190,9 @@
<style name="OverflowDialogTheme" parent="BottomSheetDialogTheme">
<item name="android:windowAnimationStyle">@style/Theme.Widget.Animation.DropFromAbove</item>
<item name="android:windowBlurBehindRadius" tools:targetApi="31">150dp</item>
<item name="android:windowBackgroundBlurRadius" tools:targetApi="31">150dp</item>
<item name="android:windowBlurBehindEnabled" tools:targetApi="31">true</item>
</style>
<style name="Theme.Widget.Animation.DropFromAbove" parent="android:Animation">