Remove old orientation lock. Add orientation types to preferences

This commit is contained in:
inorichi
2016-02-12 21:22:54 +01:00
parent 140bf8caee
commit a90a4bf80c
4 changed files with 11 additions and 12 deletions

View File

@ -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);
}

View File

@ -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;