Load compactlayout setting only once. Buildfix.
This commit is contained in:
parent
09d21740c8
commit
8762efb86b
@ -19,7 +19,7 @@ abstract public class AppListAdapter extends BaseAdapter {
|
|||||||
|
|
||||||
private List<DB.App> items = new ArrayList<DB.App>();
|
private List<DB.App> items = new ArrayList<DB.App>();
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
boolean pref_compactlayout;
|
Boolean pref_compactlayout = null;
|
||||||
|
|
||||||
public AppListAdapter(Context context) {
|
public AppListAdapter(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@ -84,16 +84,19 @@ abstract public class AppListAdapter extends BaseAdapter {
|
|||||||
icon.setImageResource(android.R.drawable.sym_def_app_icon);
|
icon.setImageResource(android.R.drawable.sym_def_app_icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImageView iconInstalled = (ImageView) convertView.findViewById(R.id.icon_status_installed);
|
||||||
|
ImageView iconUpdates = (ImageView) convertView.findViewById(R.id.icon_status_has_updates);
|
||||||
|
|
||||||
if (init) {
|
if (init) {
|
||||||
SharedPreferences prefs = PreferenceManager
|
|
||||||
.getDefaultSharedPreferences(mContext);
|
if (pref_compactlayout == null) {
|
||||||
pref_compactlayout = prefs.getBoolean("compactlayout", false);
|
SharedPreferences prefs = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(mContext);
|
||||||
|
pref_compactlayout = prefs.getBoolean("compactlayout", false);
|
||||||
|
}
|
||||||
|
|
||||||
if (pref_compactlayout == true) {
|
if (pref_compactlayout == true) {
|
||||||
|
|
||||||
ImageView iconInstalled = (ImageView) convertView.findViewById(R.id.icon_status_installed);
|
|
||||||
ImageView iconUpdates = (ImageView) convertView.findViewById(R.id.icon_status_has_updates);
|
|
||||||
|
|
||||||
iconInstalled.setImageResource(R.drawable.ic_cab_done_holo_dark);
|
iconInstalled.setImageResource(R.drawable.ic_cab_done_holo_dark);
|
||||||
iconUpdates.setImageResource(R.drawable.ic_menu_refresh);
|
iconUpdates.setImageResource(R.drawable.ic_menu_refresh);
|
||||||
|
|
||||||
@ -112,6 +115,21 @@ abstract public class AppListAdapter extends BaseAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pref_compactlayout == true) {
|
||||||
|
|
||||||
|
if (app.hasUpdates && showStatusUpdate()) {
|
||||||
|
iconUpdates.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
iconUpdates.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (app.installedVerCode > 0 && showStatusInstalled()) {
|
||||||
|
iconInstalled.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
iconInstalled.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Disable it all if it isn't compatible...
|
// Disable it all if it isn't compatible...
|
||||||
View[] views = { convertView, status, summary, license, name };
|
View[] views = { convertView, status, summary, license, name };
|
||||||
for (View view : views) {
|
for (View view : views) {
|
||||||
@ -121,16 +139,6 @@ abstract public class AppListAdapter extends BaseAdapter {
|
|||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pref_compactlayout == true) {
|
|
||||||
if (app.hasUpdates && showStatusUpdate()) {
|
|
||||||
iconUpdates.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (app.installedVerCode > 0 && showStatusInstalled()) {
|
|
||||||
iconInstalled.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getVersionInfo(DB.App app) {
|
private String getVersionInfo(DB.App app) {
|
||||||
StringBuilder version = new StringBuilder();
|
StringBuilder version = new StringBuilder();
|
||||||
if (app.installedVersion != null) {
|
if (app.installedVersion != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user