Fix categories on pre-3.0 devices

This commit is contained in:
Daniel Martí 2013-11-02 10:57:16 +01:00
parent 327de12f1a
commit 85b633750e
2 changed files with 9 additions and 4 deletions

View File

@ -6,6 +6,7 @@ import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.os.Build;
import org.fdroid.fdroid.views.AppListAdapter;
import org.fdroid.fdroid.views.AvailableAppListAdapter;
@ -98,7 +99,14 @@ public class AppListManager {
categories.add(categoryWhatsNew);
categories.add(categoryRecentlyUpdated);
categories.add(categoryAll);
categories.addAll(db.getCategories());
if (Build.VERSION.SDK_INT >= 11) {
categories.addAll(db.getCategories());
} else {
List<String> categories = db.getCategories();
for (String category : db.getCategories()) {
categories.add(category);
}
}
if (currentCategory == null)
currentCategory = categoryWhatsNew;

View File

@ -634,13 +634,10 @@ public class DB {
null, null, null, null, "categories", null);
c.moveToFirst();
while (!c.isAfterLast()) {
Log.d("FDroid", "== CATEGS "+c.getString(0));
CommaSeparatedList categories = CommaSeparatedList
.make(c.getString(0));
for (String category : categories) {
Log.d("FDroid", "== CATEG "+category);
if (!result.contains(category)) {
Log.d("FDroid", "== CATEG ADDED "+category);
result.add(category);
}
}