Fix rotation when selecting ringtone

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-06-15 10:16:49 +02:00
parent c0d242f286
commit ed1eeac710
2 changed files with 8 additions and 5 deletions

View File

@ -98,7 +98,8 @@ public class NotificationSoundItem extends AbstractFlexibleItem<NotificationSoun
holder.magicFlipView.flipSilently(adapter.isSelected(position) || isSelected()); holder.magicFlipView.flipSilently(adapter.isSelected(position) || isSelected());
if (isSelected()) { if (isSelected() && !adapter.isSelected(position)) {
adapter.toggleSelection(position);
selected = false; selected = false;
} }

View File

@ -123,7 +123,7 @@ public class SettingsController extends BaseController {
TextView baseUrlTextView; TextView baseUrlTextView;
@BindView(R.id.settings_call_sound) @BindView(R.id.settings_call_sound)
MaterialStandardPreference settingsCallSounds; MaterialStandardPreference settingsCallSound;
@BindView(R.id.settings_message_sound) @BindView(R.id.settings_message_sound)
MaterialStandardPreference settingsMessageSound; MaterialStandardPreference settingsMessageSound;
@ -229,7 +229,7 @@ public class SettingsController extends BaseController {
versionInfo.setSummary("v" + BuildConfig.VERSION_NAME); versionInfo.setSummary("v" + BuildConfig.VERSION_NAME);
settingsCallSounds.setOnClickListener(v -> { settingsCallSound.setOnClickListener(v -> {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putBoolean(BundleKeys.KEY_ARE_CALL_SOUNDS, true); bundle.putBoolean(BundleKeys.KEY_ARE_CALL_SOUNDS, true);
getRouter().pushController(RouterTransaction.with(new RingtoneSelectionController(bundle)) getRouter().pushController(RouterTransaction.with(new RingtoneSelectionController(bundle))
@ -319,11 +319,13 @@ public class SettingsController extends BaseController {
} catch (IOException e) { } catch (IOException e) {
Log.e(TAG, "Failed to parse ringtone name"); Log.e(TAG, "Failed to parse ringtone name");
} }
settingsCallSounds.setSummary(ringtoneName); settingsCallSound.setSummary(ringtoneName);
} else { } else {
settingsCallSounds.setSummary(R.string.nc_settings_default_ringtone); settingsCallSound.setSummary(R.string.nc_settings_default_ringtone);
} }
ringtoneName = "";
if (!TextUtils.isEmpty(appPreferences.getMessageRingtoneUri())) { if (!TextUtils.isEmpty(appPreferences.getMessageRingtoneUri())) {
try { try {
ringtoneSettings = LoganSquare.parse(appPreferences.getMessageRingtoneUri(), RingtoneSettings.class); ringtoneSettings = LoganSquare.parse(appPreferences.getMessageRingtoneUri(), RingtoneSettings.class);