Fix a few bugs

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-06-16 11:52:07 +02:00
parent bce6defc89
commit 91ec476f9a
3 changed files with 15 additions and 4 deletions

View file

@ -144,7 +144,8 @@ public class RingtoneSelectionController extends BaseController implements Flexi
@SuppressLint("LongLogTag")
private void fetchNotificationSounds() {
abstractFlexibleItemList = new ArrayList<>();
abstractFlexibleItemList.add(new NotificationSoundItem("None", null));
abstractFlexibleItemList.add(new NotificationSoundItem(getResources().getString(R.string.nc_settings_no_ringtone),
null));
String ringtoneString;
@ -242,7 +243,7 @@ public class RingtoneSelectionController extends BaseController implements Flexi
mediaPlayer.start();
}
if (adapter.getSelectedPositions().get(0) != position) {
if (adapter.getSelectedPositions().size() == 0 || adapter.getSelectedPositions().get(0) != position) {
RingtoneSettings ringtoneSettings = new RingtoneSettings();
ringtoneSettings.setRingtoneName(notificationSoundItem.getNotificationSoundName());
ringtoneSettings.setRingtoneUri(ringtoneUri);

View file

@ -21,17 +21,26 @@
package com.nextcloud.talk.models.json.converters;
import android.net.Uri;
import android.text.TextUtils;
import com.bluelinelabs.logansquare.typeconverters.StringBasedTypeConverter;
public class UriTypeConverter extends StringBasedTypeConverter<Uri> {
@Override
public Uri getFromString(String string) {
return Uri.parse(string);
if (!TextUtils.isEmpty(string)) {
return Uri.parse(string);
} else {
return null;
}
}
@Override
public String convertToString(Uri object) {
return object.toString();
if (object != null) {
return object.toString();
} else {
return null;
}
}
}

View file

@ -66,6 +66,7 @@
<string name="nc_settings_message_ringtone">Messages</string>
<string name="nc_settings_message_ringtone_key">message_ringtone</string>
<string name="nc_settings_default_ringtone" translatable="false">Librem by feandesign</string>
<string name="nc_settings_no_ringtone">No sound</string>
<string name="nc_no_proxy">No proxy</string>
<string name="nc_username">Username</string>