From a6e2844f3a117dd68bf413b44ba4cea652d06d41 Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Sun, 15 Mar 2015 21:09:19 +0100 Subject: [PATCH 1/2] Inverse background of EditTextPreference for older android versions --- .../preferences/CustomEditTextPreference.java | 28 +++++++++++++++++++ app/src/main/res/xml/preferences.xml | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/de/danoeh/antennapod/preferences/CustomEditTextPreference.java diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/CustomEditTextPreference.java b/app/src/main/java/de/danoeh/antennapod/preferences/CustomEditTextPreference.java new file mode 100644 index 000000000..f292cca16 --- /dev/null +++ b/app/src/main/java/de/danoeh/antennapod/preferences/CustomEditTextPreference.java @@ -0,0 +1,28 @@ +package de.danoeh.antennapod.preferences; + +import android.app.AlertDialog; +import android.content.Context; +import android.os.Build; +import android.preference.EditTextPreference; +import android.util.AttributeSet; + +public class CustomEditTextPreference extends EditTextPreference { + + public CustomEditTextPreference(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + public CustomEditTextPreference(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public CustomEditTextPreference(Context context) { + super(context); + } + + @Override + protected void onPrepareDialogBuilder(AlertDialog.Builder builder) { + builder.setInverseBackgroundForced(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB); + } + +} diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 9da2d75e6..d3e08b441 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -95,7 +95,7 @@ android:key="prefMobileUpdate" android:summary="@string/pref_mobileUpdate_sum" android:title="@string/pref_mobileUpdate_title"/> - Date: Tue, 17 Mar 2015 09:51:44 +0100 Subject: [PATCH 2/2] Set edittext's text color black --- .../antennapod/preferences/CustomEditTextPreference.java | 7 ++++++- app/src/main/res/xml/preferences.xml | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/CustomEditTextPreference.java b/app/src/main/java/de/danoeh/antennapod/preferences/CustomEditTextPreference.java index f292cca16..898a56004 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/CustomEditTextPreference.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/CustomEditTextPreference.java @@ -6,6 +6,8 @@ import android.os.Build; import android.preference.EditTextPreference; import android.util.AttributeSet; +import de.danoeh.antennapod.R; + public class CustomEditTextPreference extends EditTextPreference { public CustomEditTextPreference(Context context, AttributeSet attrs, int defStyle) { @@ -22,7 +24,10 @@ public class CustomEditTextPreference extends EditTextPreference { @Override protected void onPrepareDialogBuilder(AlertDialog.Builder builder) { - builder.setInverseBackgroundForced(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB); + if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { + builder.setInverseBackgroundForced(true); + getEditText().setTextColor(getContext().getResources().getColor(R.color.black)); + } } } diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index d3e08b441..6d14349d5 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -88,7 +88,6 @@ android:key="prefAutoUpdateIntervall" android:summary="@string/pref_autoUpdateIntervall_sum" android:title="@string/pref_autoUpdateIntervall_title"/> -