From a17d09e0a2c3af291d901c17e12a080c8be40b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sat, 11 May 2013 23:32:18 +0200 Subject: [PATCH 1/2] First attempt at implementing the compact layout --- res/values/strings.xml | 4 ++++ res/xml/preferences.xml | 11 +++++++++-- src/org/fdroid/fdroid/AppListAdapter.java | 12 +++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index d2a22ab78..24e579438 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -138,6 +138,8 @@ Dependencies Show apps that depend on other non-free apps + Display + Expert Enable expert mode @@ -174,5 +176,7 @@ Show permissions Display a list of permissions an app needs You don\'t have any app installed that can handle %s + Compact Layout + Hide app summaries when listing apps diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index cf2cf29b4..cdacb0a92 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -26,6 +26,14 @@ android:summary="@string/update_history_desc" android:title="@string/update_history" /> + + + + - - + diff --git a/src/org/fdroid/fdroid/AppListAdapter.java b/src/org/fdroid/fdroid/AppListAdapter.java index 9e0a9404a..7d1f45168 100644 --- a/src/org/fdroid/fdroid/AppListAdapter.java +++ b/src/org/fdroid/fdroid/AppListAdapter.java @@ -6,6 +6,8 @@ import java.util.List; import android.content.Context; import android.net.Uri; +import android.preference.PreferenceManager; +import android.content.SharedPreferences; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -18,8 +20,13 @@ public class AppListAdapter extends BaseAdapter { private List items = new ArrayList(); private Context mContext; + private boolean pref_compact; + public AppListAdapter(Context context) { mContext = context; + SharedPreferences prefs = PreferenceManager + .getDefaultSharedPreferences(mContext); + pref_compact = prefs.getBoolean("compactlayout", false); } public void addItem(DB.App app) { @@ -79,7 +86,10 @@ public class AppListAdapter extends BaseAdapter { license.setText(app.license); TextView summary = (TextView) v.findViewById(R.id.summary); - summary.setText(app.summary); + if (pref_compact) + summary.setVisibility(View.GONE); + else + summary.setText(app.summary); ImageView icon = (ImageView) v.findViewById(R.id.icon); File icn = new File(DB.getIconsPath(), app.icon); From 3b84f110ac0ab391f9f0a6366c469421bcc8ab70 Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Sun, 12 May 2013 08:55:02 +1000 Subject: [PATCH 2/2] Moved initialization of app list adapter to onCreate. --- src/org/fdroid/fdroid/SearchResults.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/org/fdroid/fdroid/SearchResults.java b/src/org/fdroid/fdroid/SearchResults.java index 1204f2471..18631b1d7 100644 --- a/src/org/fdroid/fdroid/SearchResults.java +++ b/src/org/fdroid/fdroid/SearchResults.java @@ -38,13 +38,14 @@ public class SearchResults extends ListActivity { private static final int SEARCH = Menu.FIRST; - private AppListAdapter applist = new AppListAdapter(this); + private AppListAdapter applist; private String mQuery; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + applist = new AppListAdapter(this); setContentView(R.layout.searchresults); Intent intent = getIntent();