From: Andy Scherzinger Date: Mon, 30 Nov 2015 13:22:52 +0000 (+0100) Subject: BugFix for #1312 - setting ListPreference selection on pre kitkat X-Git-Tag: beta-20151202~2^2~4 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/4f7d416b81d42e26b7c36d673f76ddf460f4500e?ds=sidebyside BugFix for #1312 - setting ListPreference selection on pre kitkat --- diff --git a/src/com/owncloud/android/ui/dialog/OwnCloudListPreference.java b/src/com/owncloud/android/ui/dialog/OwnCloudListPreference.java index 67ccb3ea..54ec4995 100644 --- a/src/com/owncloud/android/ui/dialog/OwnCloudListPreference.java +++ b/src/com/owncloud/android/ui/dialog/OwnCloudListPreference.java @@ -49,7 +49,7 @@ public class OwnCloudListPreference extends ListPreference { } int preselect = findIndexOfValue(getValue()); - // TODO for some reason value change is persisted but not directly shown in Android-15 emulator + // same thing happens for the Standard ListPreference though android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(mContext, R.style.ownCloud_AlertDialog) @@ -82,6 +82,11 @@ public class OwnCloudListPreference extends ListPreference { String value = getEntryValues()[which].toString(); if (callChangeListener(value)) { setValue(value); + + // Workaround for pre kitkat since they don't support change listener within setValue + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { + setSummary(getEntries()[which]); + } } dialog.dismiss(); }