Эх сурвалжийг харах

Remove old orientation lock. Add orientation types to preferences

inorichi 9 жил өмнө
parent
commit
a90a4bf80c

+ 0 - 4
app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.java

@@ -56,10 +56,6 @@ public class PreferencesHelper {
         prefs.edit().clear().apply();
     }
 
-    public Preference<Boolean> lockOrientation() {
-        return rxPrefs.getBoolean(getKey(R.string.pref_lock_orientation_key), true);
-    }
-
     public Preference<Integer> rotation() {
         return rxPrefs.getInteger(getKey(R.string.pref_rotation_type_key), 1);
     }

+ 3 - 3
app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderMenu.java

@@ -182,11 +182,11 @@ public class ReaderMenu {
     @SuppressWarnings("ConstantConditions")
     private void initializeMenu() {
         // Orientation selector
-        add(preferences.lockOrientation().asObservable()
-                .subscribe(locked -> {
+        add(preferences.rotation().asObservable()
+                .subscribe(value -> {
                     boolean isPortrait = activity.getResources().getConfiguration()
                             .orientation == Configuration.ORIENTATION_PORTRAIT;
-                    int resourceId = !locked ? R.drawable.ic_screen_rotation : isPortrait ?
+                    int resourceId = value == 1 ? R.drawable.ic_screen_rotation : isPortrait ?
                                     R.drawable.ic_screen_lock_portrait :
                                     R.drawable.ic_screen_lock_landscape;
 

+ 0 - 1
app/src/main/res/values/keys.xml

@@ -19,7 +19,6 @@
     <string name="pref_image_scale_type_key">pref_image_scale_type_key</string>
     <string name="pref_zoom_start_key">pref_zoom_start_key</string>
     <string name="pref_hide_status_bar_key">pref_hide_status_bar_key</string>
-    <string name="pref_lock_orientation_key">pref_lock_orientation_key</string>
     <string name="pref_rotation_type_key">pref_rotation_type_key</string>
     <string name="pref_enable_transitions_key">pref_enable_transitions_key</string>
     <string name="pref_show_page_number_key">pref_show_page_number_key</string>

+ 8 - 4
app/src/main/res/xml/pref_reader.xml

@@ -5,10 +5,6 @@
         android:key="@string/pref_hide_status_bar_key"
         android:defaultValue="true" />
 
-    <SwitchPreference android:title="@string/pref_lock_orientation"
-        android:key="@string/pref_lock_orientation_key"
-        android:defaultValue="true" />
-
     <SwitchPreference android:title="@string/pref_enable_transitions"
         android:key="@string/pref_enable_transitions_key"
         android:defaultValue="true" />
@@ -49,6 +45,14 @@
         android:defaultValue="1"
         android:summary="%s"/>
 
+    <eu.kanade.tachiyomi.widget.preference.IntListPreference
+        android:title="@string/pref_rotation_type"
+        android:key="@string/pref_rotation_type_key"
+        android:entries="@array/rotation_type"
+        android:entryValues="@array/rotation_type_values"
+        android:defaultValue="1"
+        android:summary="%s"/>
+
     <eu.kanade.tachiyomi.widget.preference.IntListPreference
         android:title="@string/pref_reader_theme"
         android:key="@string/pref_reader_theme_key"