Fix categories on pre-3.0 devices
This commit is contained in:
parent
327de12f1a
commit
85b633750e
@ -6,6 +6,7 @@ import android.content.SharedPreferences;
|
|||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.os.Build;
|
||||||
|
|
||||||
import org.fdroid.fdroid.views.AppListAdapter;
|
import org.fdroid.fdroid.views.AppListAdapter;
|
||||||
import org.fdroid.fdroid.views.AvailableAppListAdapter;
|
import org.fdroid.fdroid.views.AvailableAppListAdapter;
|
||||||
@ -98,7 +99,14 @@ public class AppListManager {
|
|||||||
categories.add(categoryWhatsNew);
|
categories.add(categoryWhatsNew);
|
||||||
categories.add(categoryRecentlyUpdated);
|
categories.add(categoryRecentlyUpdated);
|
||||||
categories.add(categoryAll);
|
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)
|
if (currentCategory == null)
|
||||||
currentCategory = categoryWhatsNew;
|
currentCategory = categoryWhatsNew;
|
||||||
|
@ -634,13 +634,10 @@ public class DB {
|
|||||||
null, null, null, null, "categories", null);
|
null, null, null, null, "categories", null);
|
||||||
c.moveToFirst();
|
c.moveToFirst();
|
||||||
while (!c.isAfterLast()) {
|
while (!c.isAfterLast()) {
|
||||||
Log.d("FDroid", "== CATEGS "+c.getString(0));
|
|
||||||
CommaSeparatedList categories = CommaSeparatedList
|
CommaSeparatedList categories = CommaSeparatedList
|
||||||
.make(c.getString(0));
|
.make(c.getString(0));
|
||||||
for (String category : categories) {
|
for (String category : categories) {
|
||||||
Log.d("FDroid", "== CATEG "+category);
|
|
||||||
if (!result.contains(category)) {
|
if (!result.contains(category)) {
|
||||||
Log.d("FDroid", "== CATEG ADDED "+category);
|
|
||||||
result.add(category);
|
result.add(category);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user