Last active
October 22, 2015 21:33
-
-
Save cgollner/f6ae561b2f3e765b9959 to your computer and use it in GitHub Desktop.
Preference that uses the new SwitchCompat class from AppCompat.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cgollner.unclouded.preferences; | |
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.os.Build; | |
import android.preference.CheckBoxPreference; | |
import android.util.AttributeSet; | |
import com.cgollner.unclouded.R; | |
public class SwitchPreferenceCompat extends CheckBoxPreference { | |
public SwitchPreferenceCompat(Context context, AttributeSet attrs, int defStyleAttr) { | |
super(context, attrs, defStyleAttr); | |
init(); | |
} | |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) | |
public SwitchPreferenceCompat(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { | |
super(context, attrs, defStyleAttr, defStyleRes); | |
init(); | |
} | |
public SwitchPreferenceCompat(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
init(); | |
} | |
public SwitchPreferenceCompat(Context context) { | |
super(context); | |
init(); | |
} | |
private void init() { | |
setWidgetLayoutResource(R.layout.preference_switch_layout); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment