Add color filter blend modes (#2013)

* Add color filter blend modes

* Only show modes supported by currently used API level.

* Fix arrays.xml for API level <=27.
This commit is contained in:
Deumiankio
2019-04-29 19:32:49 +02:00
committed by inorichi
parent 5840a3e1e2
commit 021dde66eb
12 changed files with 116 additions and 6 deletions

View File

@@ -29,7 +29,7 @@
android:layout_height="wrap_content"
android:visibility="gone" />
<View
<eu.kanade.tachiyomi.ui.reader.ReaderColorFilterView
android:id="@+id/color_overlay"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@@ -111,7 +111,7 @@
android:layout_height="match_parent"
android:visibility="gone"/>
<View
<eu.kanade.tachiyomi.ui.reader.ReaderColorFilterView
android:id="@+id/color_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@@ -6,6 +6,12 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:padding="16dp">
<android.support.v4.widget.Space
android:id="@+id/spinner_end"
android:layout_width="16dp"
android:layout_height="0dp"
app:layout_constraintLeft_toRightOf="parent" />
<!-- Color filter -->
<android.support.v7.widget.SwitchCompat
@@ -157,6 +163,27 @@
app:layout_constraintBottom_toBottomOf="@id/seekbar_color_filter_alpha"
app:layout_constraintRight_toRightOf="parent"/>
<!-- Filter mode -->
<TextView
android:id="@+id/color_filter_mode_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/pref_color_filter_mode"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/color_filter_mode"
app:layout_constraintBaseline_toBaselineOf="@id/color_filter_mode"/>
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/color_filter_mode"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:entries="@array/color_filter_modes"
app:layout_constraintTop_toBottomOf="@id/seekbar_color_filter_alpha"
app:layout_constraintLeft_toRightOf="@id/verticalcenter"
app:layout_constraintRight_toRightOf="@id/spinner_end" />
<!-- Brightness -->
<android.support.v7.widget.SwitchCompat
@@ -165,7 +192,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/pref_custom_brightness"
app:layout_constraintTop_toBottomOf="@id/seekbar_color_filter_alpha"/>
app:layout_constraintTop_toBottomOf="@id/color_filter_mode_text"/>
<!-- Brightness value -->
@@ -202,4 +229,11 @@
app:layout_constraintBottom_toBottomOf="@id/brightness_seekbar"
app:layout_constraintRight_toRightOf="parent"/>
<android.support.constraint.Guideline
android:id="@+id/verticalcenter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5" />
</android.support.constraint.ConstraintLayout>

View File

@@ -21,7 +21,7 @@
android:layout_height="match_parent"
android:visibility="gone" />
<View
<eu.kanade.tachiyomi.ui.reader.ReaderColorFilterView
android:id="@+id/color_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="color_filter_modes">
<item>@string/filter_mode_default</item>
<item>@string/filter_mode_multiply</item>
<item>@string/filter_mode_screen</item>
<!-- Attributes specific for SDK 28 and up -->
<item>@string/filter_mode_overlay</item>
<item>@string/filter_mode_lighten</item>
<item>@string/filter_mode_darken</item>
</string-array>
</resources>

View File

@@ -102,4 +102,10 @@
<item>2</item>
</string-array>
<string-array name="color_filter_modes">
<item>@string/filter_mode_default</item>
<item>@string/filter_mode_multiply</item>
<item>@string/filter_mode_screen</item>
</string-array>
</resources>

View File

@@ -178,6 +178,13 @@
<string name="pref_crop_borders">Crop borders</string>
<string name="pref_custom_brightness">Use custom brightness</string>
<string name="pref_custom_color_filter">Use custom color filter</string>
<string name="pref_color_filter_mode">Color filter blend mode</string>
<string name="filter_mode_default">Default</string>
<string name="filter_mode_overlay">Overlay</string>
<string name="filter_mode_multiply">Multiply</string>
<string name="filter_mode_screen">Screen</string>
<string name="filter_mode_lighten">Dodge / Lighten</string>
<string name="filter_mode_darken">Burn / Darken</string>
<string name="pref_keep_screen_on">Keep screen on</string>
<string name="pref_skip_read_chapters">Skip chapters marked read</string>
<string name="pref_reader_navigation">Navigation</string>