Remove compact layout setting
It's quite useless because it makes app list insignificantly smaller. Besides, this contradicts the Material Design spec.
This commit is contained in:
parent
e8093a66f0
commit
71da35d3fd
@ -7,7 +7,6 @@
|
|||||||
android:baselineAligned="false"
|
android:baselineAligned="false"
|
||||||
xmlns:tools="http://schemas.android.com/tools" >
|
xmlns:tools="http://schemas.android.com/tools" >
|
||||||
|
|
||||||
<!-- Actual icon size is dependent on preferences and set in AppListAdapater.java:layoutIcon() -->
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/icon"
|
android:id="@+id/icon"
|
||||||
android:contentDescription="@string/app_icon"
|
android:contentDescription="@string/app_icon"
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<dimen name="applist_icon_normal_size">48dp</dimen>
|
|
||||||
<dimen name="applist_icon_compact_size">32dp</dimen>
|
|
||||||
|
|
||||||
<dimen name="layout_horizontal_margin">16dp</dimen>
|
<dimen name="layout_horizontal_margin">16dp</dimen>
|
||||||
<dimen name="material_listitem_height">48dp</dimen>
|
<dimen name="material_listitem_height">48dp</dimen>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -24,9 +24,6 @@
|
|||||||
android:key="language"
|
android:key="language"
|
||||||
android:defaultValue=""
|
android:defaultValue=""
|
||||||
android:entryValues="@array/languageValues" />
|
android:entryValues="@array/languageValues" />
|
||||||
<CheckBoxPreference android:title="@string/compactlayout"
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:key="compactlayout"/>
|
|
||||||
<ListPreference android:title="@string/theme"
|
<ListPreference android:title="@string/theme"
|
||||||
android:key="theme"
|
android:key="theme"
|
||||||
android:defaultValue="light"
|
android:defaultValue="light"
|
||||||
|
@ -44,7 +44,6 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
|||||||
public static final String PREF_ROOTED = "rooted";
|
public static final String PREF_ROOTED = "rooted";
|
||||||
public static final String PREF_INCOMP_VER = "incompatibleVersions";
|
public static final String PREF_INCOMP_VER = "incompatibleVersions";
|
||||||
public static final String PREF_THEME = "theme";
|
public static final String PREF_THEME = "theme";
|
||||||
public static final String PREF_COMPACT_LAYOUT = "compactlayout";
|
|
||||||
public static final String PREF_IGN_TOUCH = "ignoreTouchscreen";
|
public static final String PREF_IGN_TOUCH = "ignoreTouchscreen";
|
||||||
public static final String PREF_CACHE_APK = "cacheDownloaded";
|
public static final String PREF_CACHE_APK = "cacheDownloaded";
|
||||||
public static final String PREF_UNSTABLE_UPDATES = "unstableUpdates";
|
public static final String PREF_UNSTABLE_UPDATES = "unstableUpdates";
|
||||||
@ -62,7 +61,6 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
|||||||
public static final String PREF_FIRST_TIME = "firstTime";
|
public static final String PREF_FIRST_TIME = "firstTime";
|
||||||
public static final String PREF_POST_PRIVILEGED_INSTALL = "postPrivilegedInstall";
|
public static final String PREF_POST_PRIVILEGED_INSTALL = "postPrivilegedInstall";
|
||||||
|
|
||||||
private static final boolean DEFAULT_COMPACT_LAYOUT = false;
|
|
||||||
private static final boolean DEFAULT_ROOTED = true;
|
private static final boolean DEFAULT_ROOTED = true;
|
||||||
private static final int DEFAULT_UPD_HISTORY = 14;
|
private static final int DEFAULT_UPD_HISTORY = 14;
|
||||||
private static final boolean DEFAULT_PRIVILEGED_INSTALLER = false;
|
private static final boolean DEFAULT_PRIVILEGED_INSTALLER = false;
|
||||||
@ -80,7 +78,6 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
|||||||
private static final boolean DEFAULT_FIRST_TIME = true;
|
private static final boolean DEFAULT_FIRST_TIME = true;
|
||||||
private static final boolean DEFAULT_POST_PRIVILEGED_INSTALL = false;
|
private static final boolean DEFAULT_POST_PRIVILEGED_INSTALL = false;
|
||||||
|
|
||||||
private boolean compactLayout = DEFAULT_COMPACT_LAYOUT;
|
|
||||||
private boolean filterAppsRequiringRoot = DEFAULT_ROOTED;
|
private boolean filterAppsRequiringRoot = DEFAULT_ROOTED;
|
||||||
|
|
||||||
private final Map<String, Boolean> initialized = new HashMap<>();
|
private final Map<String, Boolean> initialized = new HashMap<>();
|
||||||
@ -187,14 +184,6 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasCompactLayout() {
|
|
||||||
if (!isInitialized(PREF_COMPACT_LAYOUT)) {
|
|
||||||
initialize(PREF_COMPACT_LAYOUT);
|
|
||||||
compactLayout = preferences.getBoolean(PREF_COMPACT_LAYOUT, DEFAULT_COMPACT_LAYOUT);
|
|
||||||
}
|
|
||||||
return compactLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerCompactLayoutChangeListener(ChangeListener listener) {
|
public void registerCompactLayoutChangeListener(ChangeListener listener) {
|
||||||
compactLayoutListeners.add(listener);
|
compactLayoutListeners.add(listener);
|
||||||
}
|
}
|
||||||
@ -256,11 +245,6 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
|||||||
uninitialize(key);
|
uninitialize(key);
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case PREF_COMPACT_LAYOUT:
|
|
||||||
for (ChangeListener listener : compactLayoutListeners) {
|
|
||||||
listener.onPreferenceChange();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PREF_ROOTED:
|
case PREF_ROOTED:
|
||||||
for (ChangeListener listener : filterAppsRequiringRootListeners) {
|
for (ChangeListener listener : filterAppsRequiringRootListeners) {
|
||||||
listener.onPreferenceChange();
|
listener.onPreferenceChange();
|
||||||
|
@ -90,12 +90,9 @@ public abstract class AppListAdapter extends CursorAdapter {
|
|||||||
private void setupView(Context context, View view, Cursor cursor, ViewHolder holder) {
|
private void setupView(Context context, View view, Cursor cursor, ViewHolder holder) {
|
||||||
final App app = new App(cursor);
|
final App app = new App(cursor);
|
||||||
|
|
||||||
boolean compact = Preferences.get().hasCompactLayout();
|
|
||||||
|
|
||||||
holder.name.setText(app.name);
|
holder.name.setText(app.name);
|
||||||
holder.summary.setText(app.summary);
|
holder.summary.setText(app.summary);
|
||||||
|
|
||||||
layoutIcon(holder.icon, compact);
|
|
||||||
ImageLoader.getInstance().displayImage(app.iconUrl, holder.icon,
|
ImageLoader.getInstance().displayImage(app.iconUrl, holder.icon,
|
||||||
displayImageOptions);
|
displayImageOptions);
|
||||||
|
|
||||||
@ -138,19 +135,4 @@ public abstract class AppListAdapter extends CursorAdapter {
|
|||||||
|
|
||||||
return installedVersionString;
|
return installedVersionString;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void layoutIcon(ImageView icon, boolean compact) {
|
|
||||||
int size = (int) mContext.getResources().getDimension(compact
|
|
||||||
? R.dimen.applist_icon_compact_size
|
|
||||||
: R.dimen.applist_icon_normal_size);
|
|
||||||
|
|
||||||
LinearLayout.LayoutParams params =
|
|
||||||
(LinearLayout.LayoutParams) icon.getLayoutParams();
|
|
||||||
|
|
||||||
params.height = size;
|
|
||||||
params.width = size;
|
|
||||||
|
|
||||||
icon.setLayoutParams(params);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@ public class PreferencesFragment extends PreferenceFragment
|
|||||||
Preferences.PREF_ROOTED,
|
Preferences.PREF_ROOTED,
|
||||||
Preferences.PREF_INCOMP_VER,
|
Preferences.PREF_INCOMP_VER,
|
||||||
Preferences.PREF_THEME,
|
Preferences.PREF_THEME,
|
||||||
Preferences.PREF_COMPACT_LAYOUT,
|
|
||||||
Preferences.PREF_IGN_TOUCH,
|
Preferences.PREF_IGN_TOUCH,
|
||||||
Preferences.PREF_LOCAL_REPO_NAME,
|
Preferences.PREF_LOCAL_REPO_NAME,
|
||||||
Preferences.PREF_LANGUAGE,
|
Preferences.PREF_LANGUAGE,
|
||||||
@ -98,10 +97,6 @@ public class PreferencesFragment extends PreferenceFragment
|
|||||||
textSummary(key, R.string.update_history_summ);
|
textSummary(key, R.string.update_history_summ);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Preferences.PREF_COMPACT_LAYOUT:
|
|
||||||
checkSummary(key, R.string.compactlayout_on);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Preferences.PREF_THEME:
|
case Preferences.PREF_THEME:
|
||||||
entrySummary(key);
|
entrySummary(key);
|
||||||
if (changing) {
|
if (changing) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user