Merge commit 'refs/merge-requests/24' of git://gitorious.org/f-droid/fdroidclient into merge-requests/24

Conflicts:
	src/org/fdroid/fdroid/DB.java
This commit is contained in:
Ciaran Gultnieks 2013-04-16 09:39:10 +01:00
commit 8401d53dc0
9 changed files with 49 additions and 47 deletions

View File

@ -22,7 +22,6 @@ import java.io.File;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import android.support.v4.view.MenuItemCompat;
import org.xml.sax.XMLReader;
@ -302,7 +301,7 @@ public class AppDetails extends ListActivity {
Log.d("FDroid", "Getting application details for " + appid);
app = null;
Vector<DB.App> apps = ((FDroidApp) getApplication()).getApps();
List<DB.App> apps = ((FDroidApp) getApplication()).getApps();
for (DB.App tapp : apps) {
if (tapp.id.equals(appid)) {
app = tapp;

View File

@ -15,7 +15,7 @@ import java.util.*;
*/
public class AppListManager {
private Vector<DB.App> allApps = null;
private List<DB.App> allApps = null;
private FDroid fdroidActivity;
@ -55,7 +55,7 @@ public class AppListManager {
// Needs to be created before createViews(), because that will use the
// getCategoriesAdapter() accessor which expects this object...
categories = new ArrayAdapter<String>(activity,
android.R.layout.simple_spinner_item, new Vector<String>());
android.R.layout.simple_spinner_item, new ArrayList<String>());
categories
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
}
@ -185,7 +185,7 @@ public class AppListManager {
Date recentDate = calcMaxHistory();
AppFilter appFilter = new AppFilter(fdroidActivity);
Vector<DB.App> availApps = new Vector<DB.App>();
List<DB.App> availApps = new ArrayList<DB.App>();
for (DB.App app : allApps) {
boolean isInCategory = isInCategory(app, currentCategory, recentDate);

View File

@ -21,6 +21,7 @@ package org.fdroid.fdroid;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
@ -28,7 +29,6 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import java.util.concurrent.Semaphore;
import android.annotation.TargetApi;
@ -116,7 +116,7 @@ public class DB {
updated = false;
added = null;
lastUpdated = null;
apks = new Vector<Apk>();
apks = new ArrayList<Apk>();
detail_Populated = false;
compatible = false;
}
@ -181,7 +181,7 @@ public class DB {
public boolean updated;
// List of apks.
public Vector<Apk> apks;
public List<Apk> apks;
// Get the current version - this will be one of the Apks from 'apks'.
// Can return null if there are no available versions.
@ -413,7 +413,7 @@ public class DB {
// Migrate repo list to new structure. (No way to change primary
// key in sqlite - table must be recreated)
if (oldVersion < 20) {
Vector<Repo> oldrepos = new Vector<Repo>();
List<Repo> oldrepos = new ArrayList<Repo>();
Cursor c = db.rawQuery("select address, inuse, pubkey from "
+ TABLE_REPO, null);
c.moveToFirst();
@ -504,7 +504,7 @@ public class DB {
// Get the number of apps that have updates available. This can be a
// time consuming operation.
public int getNumUpdates() {
Vector<App> apps = getApps(true);
List<App> apps = getApps(true);
int count = 0;
for (App app : apps) {
if (app.hasUpdates)
@ -513,8 +513,8 @@ public class DB {
return count;
}
public Vector<String> getCategories() {
Vector<String> result = new Vector<String>();
public List<String> getCategories() {
List<String> result = new ArrayList<String>();
Cursor c = null;
try {
c = db.rawQuery("select distinct category from " + TABLE_APP
@ -592,7 +592,7 @@ public class DB {
// Return a list of apps matching the given criteria. Filtering is
// also done based on compatibility and anti-features according to
// the user's current preferences.
public Vector<App> getApps(boolean getinstalledinfo) {
public List<App> getApps(boolean getinstalledinfo) {
// If we're going to need it, get info in what's currently installed
Map<String, PackageInfo> systemApks = null;
@ -698,7 +698,7 @@ public class DB {
+ (System.currentTimeMillis() - startTime) + " ms)");
}
Vector<App> result = new Vector<App>(apps.values());
List<App> result = new ArrayList<App>(apps.values());
Collections.sort(result);
// Fill in the hasUpdates fields if we have the necessary information...
@ -722,9 +722,9 @@ public class DB {
return result;
}
public Vector<String> doSearch(String query) {
public List<String> doSearch(String query) {
Vector<String> ids = new Vector<String>();
List<String> ids = new ArrayList<String>();
Cursor c = null;
try {
String filter = "%" + query + "%";
@ -772,11 +772,11 @@ public class DB {
}
}
private Vector<App> updateApps = null;
private List<App> updateApps = null;
// Called before a repo update starts. Returns the number of updates
// available beforehand.
public int beginUpdate(Vector<DB.App> apps) {
public int beginUpdate(List<DB.App> apps) {
// Get a list of all apps. All the apps and apks in this list will
// have 'updated' set to false at this point, and we will only set
// it to true when we see the app/apk in a repository. Thus, at the
@ -867,7 +867,7 @@ public class DB {
// compatible apk - if it's not, leave it out)
// Also keep a list of which were compatible, because they're the
// only ones we'll add, unless the showIncompatible preference is set.
Vector<Apk> compatibleapks = new Vector<Apk>();
List<Apk> compatibleapks = new ArrayList<Apk>();
for (Apk apk : upapp.apks) {
if (compatChecker.isCompatible(apk)) {
apk.compatible = true;
@ -1018,8 +1018,8 @@ public class DB {
}
// Get a list of the configured repositories.
public Vector<Repo> getRepos() {
Vector<Repo> repos = new Vector<Repo>();
public List<Repo> getRepos() {
List<Repo> repos = new ArrayList<Repo>();
Cursor c = null;
try {
c = db.rawQuery(
@ -1080,7 +1080,7 @@ public class DB {
db.insert(TABLE_REPO, null, values);
}
public void removeRepos(Vector<String> addresses) {
public void removeRepos(List<String> addresses) {
db.beginTransaction();
try {
for (String address : addresses) {

View File

@ -23,8 +23,9 @@ import android.app.ActionBar;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.ArrayList;
import java.util.Date;
import java.util.Vector;
import java.util.List;
import android.support.v4.view.MenuItemCompat;
import org.fdroid.fdroid.DB.App;

View File

@ -19,7 +19,8 @@
package org.fdroid.fdroid;
import java.io.File;
import java.util.Vector;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Semaphore;
import android.app.Application;
@ -47,7 +48,7 @@ public class FDroidApp extends Application {
}
// Global list of all known applications.
private Vector<DB.App> apps;
private List<DB.App> apps;
// Set when something has changed (database or installed apps) so we know
// we should invalidate the apps.
@ -70,7 +71,7 @@ public class FDroidApp extends Application {
// Get a list of all known applications. Should not be called when the
// database is locked (i.e. between DB.getDB() and db.releaseDB(). The
// contents should never be modified, it's for reading only.
public Vector<DB.App> getApps() {
public List<DB.App> getApps() {
boolean invalid = false;
try {
@ -95,7 +96,7 @@ public class FDroidApp extends Application {
}
}
if (apps == null)
return new Vector<DB.App>();
return new ArrayList<DB.App>();
return apps;
}

View File

@ -26,7 +26,6 @@ import java.util.Formatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
@ -55,7 +54,7 @@ public class ManageRepo extends ListActivity {
private boolean changed = false;
private Vector<DB.Repo> repos;
private List<DB.Repo> repos;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -201,7 +200,7 @@ public class ManageRepo extends ListActivity {
return true;
case REM_REPO:
final Vector<String> rem_lst = new Vector<String>();
final List<String> rem_lst = new ArrayList<String>();
CharSequence[] b = new CharSequence[repos.size()];
for (int i = 0; i < repos.size(); i++) {
b[i] = repos.get(i).address;
@ -215,9 +214,9 @@ public class ManageRepo extends ListActivity {
public void onClick(DialogInterface dialog,
int whichButton, boolean isChecked) {
if (isChecked) {
rem_lst.addElement(repos.get(whichButton).address);
rem_lst.add(repos.get(whichButton).address);
} else {
rem_lst.removeElement(repos.get(whichButton).address);
rem_lst.remove(repos.get(whichButton).address);
}
}
});

View File

@ -33,7 +33,7 @@ import java.net.URL;
import java.security.cert.Certificate;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Vector;
import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
@ -57,7 +57,7 @@ public class RepoXMLHandler extends DefaultHandler {
// The ID of the repo we're processing.
private int repo;
private Vector<DB.App> apps;
private List<DB.App> apps;
private DB.App curapp = null;
private DB.Apk curapk = null;
@ -69,7 +69,7 @@ public class RepoXMLHandler extends DefaultHandler {
// The date format used in the repo XML file.
private SimpleDateFormat mXMLDateFormat = new SimpleDateFormat("yyyy-MM-dd");
public RepoXMLHandler(int repo, Vector<DB.App> apps) {
public RepoXMLHandler(int repo, List<DB.App> apps) {
this.repo = repo;
this.apps = apps;
pubkey = null;
@ -293,7 +293,7 @@ public class RepoXMLHandler extends DefaultHandler {
// value for the index that was successfully processed, or it may contain
// null if none was available.
public static String doUpdate(Context ctx, DB.Repo repo,
Vector<DB.App> apps, StringBuilder newetag, Vector<Integer> keeprepos) {
List<DB.App> apps, StringBuilder newetag, List<Integer> keeprepos) {
try {
int code = 0;

View File

@ -18,7 +18,8 @@
package org.fdroid.fdroid;
import java.util.Vector;
import java.util.ArrayList;
import java.util.List;
import android.app.ListActivity;
import android.app.SearchManager;
@ -68,7 +69,7 @@ public class SearchResults extends ListActivity {
private void updateView() {
Vector<String> matchingids = new Vector<String>();
List<String> matchingids = new ArrayList<String>();
try {
DB db = DB.getDB();
matchingids = db.doSearch(mQuery);
@ -78,9 +79,9 @@ public class SearchResults extends ListActivity {
DB.releaseDB();
}
Vector<DB.App> apps = new Vector<DB.App>();
List<DB.App> apps = new ArrayList<DB.App>();
AppFilter appfilter = new AppFilter(this);
Vector<DB.App> tapps = ((FDroidApp) getApplication()).getApps();
List<DB.App> tapps = ((FDroidApp) getApplication()).getApps();
for (DB.App tapp : tapps) {
boolean include = false;
for (String tid : matchingids) {

View File

@ -24,7 +24,8 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Vector;
import java.util.ArrayList;
import java.util.List;
import android.app.AlarmManager;
import android.app.IntentService;
@ -110,7 +111,7 @@ public class UpdateService extends IntentService {
// database while we do all the downloading, etc...
int prevUpdates = 0;
int newUpdates = 0;
Vector<DB.Repo> repos;
List<DB.Repo> repos;
try {
DB db = DB.getDB();
repos = db.getRepos();
@ -119,8 +120,8 @@ public class UpdateService extends IntentService {
}
// Process each repo...
Vector<DB.App> apps = new Vector<DB.App>();
Vector<Integer> keeprepos = new Vector<Integer>();
List<DB.App> apps = new ArrayList<DB.App>();
List<Integer> keeprepos = new ArrayList<Integer>();
boolean success = true;
for (DB.Repo repo : repos) {
if (repo.inuse) {
@ -142,8 +143,8 @@ public class UpdateService extends IntentService {
}
if (success) {
Vector<DB.App> acceptedapps = new Vector<DB.App>();
Vector<DB.App> prevapps = ((FDroidApp) getApplication())
List<DB.App> acceptedapps = new ArrayList<DB.App>();
List<DB.App> prevapps = ((FDroidApp) getApplication())
.getApps();
DB db = DB.getDB();
@ -272,7 +273,7 @@ public class UpdateService extends IntentService {
}
private void getIcon(DB.App app, Vector<DB.Repo> repos) {
private void getIcon(DB.App app, List<DB.Repo> repos) {
try {
File f = new File(DB.getIconsPath(), app.icon);