Jelajahi Sumber

Fix rotation when selecting ringtone

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 6 tahun lalu
induk
melakukan
ed1eeac710

+ 2 - 1
app/src/main/java/com/nextcloud/talk/adapters/items/NotificationSoundItem.java

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

+ 6 - 4
app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java

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