Skip to content

Instantly share code, notes, and snippets.

View cgollner's full-sized avatar

Christian Göllner cgollner

  • Google
  • Zurich, Switzerland
View GitHub Profile
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;
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;
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.SwitchCompat xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:focusable="false" />
@cgollner
cgollner / preference_switch_layout.xml
Last active October 22, 2015 21:39
Preference layout to use with the SwitchCompatPreference.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.SwitchCompat xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:focusable="false" />
@cgollner
cgollner / SwitchPreferenceCompat.java
Last active October 22, 2015 21:33
Preference that uses the new SwitchCompat class from AppCompat.
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;