summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/danoeh/antennapod/preferences/SwitchCompatPreference.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/preferences/SwitchCompatPreference.java')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/preferences/SwitchCompatPreference.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/SwitchCompatPreference.java b/app/src/main/java/de/danoeh/antennapod/preferences/SwitchCompatPreference.java
new file mode 100644
index 000000000..10c11b88e
--- /dev/null
+++ b/app/src/main/java/de/danoeh/antennapod/preferences/SwitchCompatPreference.java
@@ -0,0 +1,37 @@
+package de.danoeh.antennapod.preferences;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.os.Build;
+import android.preference.CheckBoxPreference;
+import android.util.AttributeSet;
+
+import de.danoeh.antennapod.R;
+
+public class SwitchCompatPreference extends CheckBoxPreference {
+
+ public SwitchCompatPreference(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ init();
+ }
+
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ public SwitchCompatPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ init();
+ }
+
+ public SwitchCompatPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init();
+ }
+
+ public SwitchCompatPreference(Context context) {
+ super(context);
+ init();
+ }
+
+ private void init() {
+ setWidgetLayoutResource(R.layout.preference_switch_layout);
+ }
+} \ No newline at end of file