Set small icon by default on phones

This commit is contained in:
Cameron Gutman
2015-02-01 00:33:43 -05:00
parent 336f85a31c
commit d3052cd97d
3 changed files with 24 additions and 4 deletions

View File

@@ -64,7 +64,7 @@ public class PreferenceConfiguration {
}
}
private static boolean getDefaultSmallMode(Context context) {
public static boolean getDefaultSmallMode(Context context) {
// Use small mode on anything smaller than a 7" tablet
return context.getResources().getConfiguration().smallestScreenWidthDp < 600;
}

View File

@@ -0,0 +1,21 @@
package com.limelight.preferences;
import android.content.Context;
import android.content.res.TypedArray;
import android.preference.CheckBoxPreference;
import android.util.AttributeSet;
public class SmallIconCheckboxPreference extends CheckBoxPreference {
public SmallIconCheckboxPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public SmallIconCheckboxPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected Object onGetDefaultValue(TypedArray a, int index) {
return PreferenceConfiguration.getDefaultSmallMode(getContext());
}
}