Merge commit 'refs/merge-requests/53' of gitorious.org:f-droid/fdroidclient
This commit is contained in:
commit
36ff25a95c
@ -1,7 +1,5 @@
|
|||||||
package org.fdroid.fdroid.views;
|
package org.fdroid.fdroid.views;
|
||||||
|
|
||||||
import org.fdroid.fdroid.Utils;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -22,7 +20,9 @@ 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 = null;
|
|
||||||
|
private boolean prefCompactLayoutInitialized = false;
|
||||||
|
private boolean prefCompactLayout = false;
|
||||||
|
|
||||||
public AppListAdapter(Context context) {
|
public AppListAdapter(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@ -55,6 +55,15 @@ abstract public class AppListAdapter extends BaseAdapter {
|
|||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean hasCompactLayout() {
|
||||||
|
if (!prefCompactLayoutInitialized) {
|
||||||
|
prefCompactLayoutInitialized = true;
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
|
||||||
|
prefCompactLayout = prefs.getBoolean("compactlayout", false);
|
||||||
|
}
|
||||||
|
return prefCompactLayout;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
boolean init = false;
|
boolean init = false;
|
||||||
@ -92,13 +101,7 @@ abstract public class AppListAdapter extends BaseAdapter {
|
|||||||
|
|
||||||
if (init) {
|
if (init) {
|
||||||
|
|
||||||
if (pref_compactlayout == null) {
|
if (hasCompactLayout()) {
|
||||||
SharedPreferences prefs = PreferenceManager
|
|
||||||
.getDefaultSharedPreferences(mContext);
|
|
||||||
pref_compactlayout = prefs.getBoolean("compactlayout", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pref_compactlayout == true) {
|
|
||||||
|
|
||||||
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);
|
||||||
@ -118,7 +121,7 @@ abstract public class AppListAdapter extends BaseAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pref_compactlayout == true) {
|
if (hasCompactLayout()) {
|
||||||
|
|
||||||
if (app.hasUpdates && showStatusUpdate()) {
|
if (app.hasUpdates && showStatusUpdate()) {
|
||||||
iconUpdates.setVisibility(View.VISIBLE);
|
iconUpdates.setVisibility(View.VISIBLE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user