Preference compat

This commit is contained in:
M66B 2016-02-01 17:42:18 +01:00
parent 4b6873b278
commit 8a2ddf6cac
7 changed files with 18 additions and 6 deletions

View File

@ -91,8 +91,10 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/preference-v7/23.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.h6ah4i.android.compat/mulsellistprefcompat/1.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
@ -112,6 +114,8 @@
<orderEntry type="library" exported="" name="support-annotations-23.1.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.1.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.1.1" level="project" />
<orderEntry type="library" exported="" name="mulsellistprefcompat-1.0.0" level="project" />
<orderEntry type="library" exported="" name="picasso-2.5.2" level="project" />
<orderEntry type="library" exported="" name="preference-v7-23.1.1" level="project" />
</component>
</module>

View File

@ -56,5 +56,7 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.+'
compile 'com.android.support:recyclerview-v7:23.1.+'
compile 'com.android.support:preference-v7:23.1.+'
compile 'com.h6ah4i.android.compat:mulsellistprefcompat:1.0.0' // Google come on ...
compile 'com.squareup.picasso:picasso:2.5.+'
}

View File

@ -101,7 +101,7 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
protected void onCreate(Bundle savedInstanceState) {
Util.setTheme(this);
super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction().replace(android.R.id.content, new FragmentSettings()).commit();
getSupportFragmentManager().beginTransaction().replace(android.R.id.content, new FragmentSettings()).commit();
getSupportActionBar().setTitle(R.string.menu_settings);
}

View File

@ -20,13 +20,16 @@ package eu.faircode.netguard;
*/
import android.os.Bundle;
import android.preference.PreferenceFragment;
public class FragmentSettings extends PreferenceFragment {
import android.support.v7.preference.PreferenceFragmentCompat;
public class FragmentSettings extends PreferenceFragmentCompat {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onCreatePreferences(Bundle bundle, String s) {
addPreferencesFromResource(R.xml.preferences);
}
}

View File

@ -20,11 +20,12 @@ package eu.faircode.netguard;
*/
import android.content.Context;
import android.support.v7.preference.SwitchPreferenceCompat;
import android.util.AttributeSet;
// https://code.google.com/p/android/issues/detail?id=26194
public class SwitchPreference extends android.preference.SwitchPreference {
public class SwitchPreference extends SwitchPreferenceCompat {
public SwitchPreference(Context context) {
this(context, null);
}

View File

@ -5,10 +5,12 @@
<style name="BaseThemeDark" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowDisablePreview">true</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
</style>
<style name="BaseThemeLight" parent="Theme.AppCompat">
<item name="android:windowDisablePreview">true</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
</style>
<style name="AppThemeTeal" parent="BaseThemeDark">

View File

@ -56,7 +56,7 @@
android:defaultValue="false"
android:key="tethering"
android:title="@string/setting_tethering" />
<MultiSelectListPreference
<com.h6ah4i.android.compat.preference.MultiSelectListPreferenceCompat
android:defaultValue="@array/default_wifi_home"
android:key="wifi_homes"
android:summary="@string/summary_wifi_home" />