mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-24 01:48:24 +01:00
Remove old orientation lock. Add orientation types to preferences
This commit is contained in:
parent
140bf8caee
commit
a90a4bf80c
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user