From 4f7d416b81d42e26b7c36d673f76ddf460f4500e Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Mon, 30 Nov 2015 14:22:52 +0100 Subject: [PATCH] BugFix for #1312 - setting ListPreference selection on pre kitkat --- src/com/owncloud/android/ui/dialog/OwnCloudListPreference.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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(); } -- 2.11.0