Merge commit 'refs/merge-requests/66' of gitorious.org:f-droid/fdroidclient
Conflicts: test/src/org/fdroid/fdroid/ApkProviderTest.java
This commit is contained in:
commit
2c9d8ab7fc
@ -18,9 +18,6 @@
|
||||
|
||||
package org.fdroid.fdroid;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import org.fdroid.fdroid.data.App;
|
||||
|
||||
public class AppFilter {
|
||||
|
@ -49,7 +49,6 @@ import com.nostra13.universalimageloader.utils.StorageUtils;
|
||||
|
||||
import de.duenndns.ssl.MemorizingTrustManager;
|
||||
|
||||
import org.fdroid.fdroid.data.App;
|
||||
import org.fdroid.fdroid.data.AppProvider;
|
||||
import org.thoughtcrime.ssl.pinning.PinningTrustManager;
|
||||
import org.thoughtcrime.ssl.pinning.SystemKeyStore;
|
||||
@ -59,6 +58,7 @@ public class FDroidApp extends Application {
|
||||
private static enum Theme {
|
||||
dark, light
|
||||
}
|
||||
|
||||
private static Theme curTheme = Theme.dark;
|
||||
|
||||
public void reloadTheme() {
|
||||
@ -66,6 +66,7 @@ public class FDroidApp extends Application {
|
||||
.getDefaultSharedPreferences(getBaseContext())
|
||||
.getString(Preferences.PREF_THEME, "dark"));
|
||||
}
|
||||
|
||||
public void applyTheme(Activity activity) {
|
||||
switch (curTheme) {
|
||||
case dark:
|
||||
@ -124,7 +125,6 @@ public class FDroidApp extends Application {
|
||||
}
|
||||
}
|
||||
|
||||
apps = null;
|
||||
invalidApps = new ArrayList<String>();
|
||||
ctx = getApplicationContext();
|
||||
UpdateService.schedule(ctx);
|
||||
@ -187,12 +187,8 @@ public class FDroidApp extends Application {
|
||||
|
||||
private Context ctx;
|
||||
|
||||
// Global list of all known applications.
|
||||
private List<App> apps;
|
||||
|
||||
// Set when something has changed (database or installed apps) so we know
|
||||
// we should invalidate the apps.
|
||||
private volatile boolean appsAllInvalid = false;
|
||||
private Semaphore appsInvalidLock = new Semaphore(1, false);
|
||||
private List<String> invalidApps;
|
||||
|
||||
@ -201,7 +197,6 @@ public class FDroidApp extends Application {
|
||||
public void invalidateAllApps() {
|
||||
try {
|
||||
appsInvalidLock.acquire();
|
||||
appsAllInvalid = true;
|
||||
} catch (InterruptedException e) {
|
||||
// Don't care
|
||||
} finally {
|
||||
|
@ -2,7 +2,6 @@ package org.fdroid.fdroid;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import android.app.LoaderManager;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
@ -152,8 +152,7 @@ public class PreferencesActivity extends PreferenceActivity implements
|
||||
|
||||
super.onResume();
|
||||
getPreferenceScreen().getSharedPreferences()
|
||||
.registerOnSharedPreferenceChangeListener(
|
||||
(OnSharedPreferenceChangeListener)this);
|
||||
.registerOnSharedPreferenceChangeListener(this);
|
||||
|
||||
for (String key : summariesToUpdate) {
|
||||
updateSummary(key, false);
|
||||
|
@ -66,10 +66,12 @@ public interface ProgressListener {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<Event> CREATOR = new Parcelable.Creator<Event>() {
|
||||
@Override
|
||||
public Event createFromParcel(Parcel in) {
|
||||
return new Event(in.readInt(), in.readInt(), in.readInt(), in.readBundle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event[] newArray(int size) {
|
||||
return new Event[size];
|
||||
}
|
||||
|
@ -247,7 +247,6 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
|
||||
// Grab some preliminary information, then we can release the
|
||||
// database while we do all the downloading, etc...
|
||||
int updates = 0;
|
||||
List<Repo> repos = RepoProvider.Helper.all(this);
|
||||
|
||||
// Process each repo...
|
||||
|
@ -26,7 +26,6 @@ import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import com.nostra13.universalimageloader.utils.StorageUtils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
@ -39,8 +38,6 @@ import java.text.SimpleDateFormat;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.*;
|
||||
|
||||
import org.fdroid.fdroid.data.Repo;
|
||||
|
||||
public final class Utils {
|
||||
|
||||
public static final int BUFFER_SIZE = 4096;
|
||||
|
@ -4,10 +4,6 @@ import android.annotation.TargetApi;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.Switch;
|
||||
import android.widget.ToggleButton;
|
||||
import org.fdroid.fdroid.ManageRepo;
|
||||
|
||||
public abstract class ClipboardCompat extends Compatibility {
|
||||
|
||||
|
@ -4,7 +4,6 @@ import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.util.Log;
|
||||
import android.os.Build;
|
||||
|
||||
public class SupportedArchitectures extends Compatibility {
|
||||
|
@ -2,7 +2,6 @@ package org.fdroid.fdroid.compat;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.Switch;
|
||||
import android.widget.ToggleButton;
|
||||
|
@ -66,6 +66,7 @@ class OldTabManagerImpl extends TabManager {
|
||||
* and giving it a FrameLayout as a child. This will make the tabs have
|
||||
* dummy empty contents and then hook them up to our ViewPager.
|
||||
*/
|
||||
@Override
|
||||
public void createTabs() {
|
||||
tabHost = new TabHost(parent, null);
|
||||
tabHost.setLayoutParams(new TabHost.LayoutParams(
|
||||
@ -128,12 +129,14 @@ class OldTabManagerImpl extends TabManager {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void selectTab(int index) {
|
||||
tabHost.setCurrentTab(index);
|
||||
if (index == INDEX_CAN_UPDATE)
|
||||
removeNotification(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshTabLabel(int index) {
|
||||
CharSequence text = getLabel(index);
|
||||
|
||||
@ -166,6 +169,7 @@ class HoneycombTabManagerImpl extends TabManager {
|
||||
actionBar = parent.getActionBar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createTabs() {
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
||||
for (int i = 0; i < pager.getAdapter().getCount(); i ++) {
|
||||
@ -174,6 +178,7 @@ class HoneycombTabManagerImpl extends TabManager {
|
||||
actionBar.newTab()
|
||||
.setText(label)
|
||||
.setTabListener(new ActionBar.TabListener() {
|
||||
@Override
|
||||
public void onTabSelected(ActionBar.Tab tab,
|
||||
FragmentTransaction ft) {
|
||||
int pos = tab.getPosition();
|
||||
@ -193,6 +198,7 @@ class HoneycombTabManagerImpl extends TabManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectTab(int index) {
|
||||
actionBar.setSelectedNavigationItem(index);
|
||||
Spinner actionBarSpinner = getActionBarSpinner();
|
||||
@ -203,6 +209,7 @@ class HoneycombTabManagerImpl extends TabManager {
|
||||
removeNotification(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshTabLabel(int index) {
|
||||
CharSequence text = getLabel(index);
|
||||
actionBar.getTabAt(index).setText(text);
|
||||
|
@ -216,6 +216,7 @@ public class ApkProvider extends FDroidProvider {
|
||||
return PROVIDER_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UriMatcher getMatcher() {
|
||||
return matcher;
|
||||
}
|
||||
@ -284,6 +285,7 @@ public class ApkProvider extends FDroidProvider {
|
||||
this.orderBy = orderBy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder suffix = new StringBuilder();
|
||||
@ -403,7 +405,7 @@ public class ApkProvider extends FDroidProvider {
|
||||
public Uri insert(Uri uri, ContentValues values) {
|
||||
removeRepoFields(values);
|
||||
validateFields(DataColumns.ALL, values);
|
||||
long id = write().insertOrThrow(getTableName(), null, values);
|
||||
write().insertOrThrow(getTableName(), null, values);
|
||||
if (!isApplyingBatch()) {
|
||||
getContext().getContentResolver().notifyChange(uri, null);
|
||||
}
|
||||
|
@ -266,6 +266,7 @@ public class AppProvider extends FDroidProvider {
|
||||
return AUTHORITY + "." + PROVIDER_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UriMatcher getMatcher() {
|
||||
return matcher;
|
||||
}
|
||||
@ -458,7 +459,7 @@ public class AppProvider extends FDroidProvider {
|
||||
|
||||
@Override
|
||||
public Uri insert(Uri uri, ContentValues values) {
|
||||
long id = write().insertOrThrow(getTableName(), null, values);
|
||||
write().insertOrThrow(getTableName(), null, values);
|
||||
if (!isApplyingBatch()) {
|
||||
getContext().getContentResolver().notifyChange(uri, null);
|
||||
}
|
||||
|
@ -2,11 +2,9 @@ package org.fdroid.fdroid.data;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import org.fdroid.fdroid.*;
|
||||
|
||||
|
@ -72,6 +72,7 @@ public class Repo extends ValueObject {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return address;
|
||||
}
|
||||
|
@ -234,6 +234,7 @@ public class RepoProvider extends FDroidProvider {
|
||||
return "RepoProvider";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UriMatcher getMatcher() {
|
||||
return matcher;
|
||||
}
|
||||
|
@ -202,6 +202,7 @@ public class NsdHelper {
|
||||
//in order for it to update the ListView without error
|
||||
Handler refresh = new Handler(Looper.getMainLooper());
|
||||
refresh.post(new Runnable() {
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
notifyDataSetChanged();
|
||||
|
@ -268,6 +268,7 @@ abstract public class RepoUpdater {
|
||||
|
||||
public static class UpdateException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -4492452418826132803L;
|
||||
public final Repo repo;
|
||||
|
||||
public UpdateException(Repo repo, String message) {
|
||||
|
@ -84,6 +84,7 @@ public class SignedRepoUpdater extends RepoUpdater {
|
||||
return indexFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getIndexAddress() {
|
||||
return repo.address + "/index.jar?client_version=" + context.getString(R.string.version_name);
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import android.content.pm.PackageInfo;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.support.v4.widget.CursorAdapter;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -45,6 +45,7 @@ public class RepoAdapter extends CursorAdapter {
|
||||
enabledListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStableIds() {
|
||||
return true;
|
||||
}
|
||||
|
@ -1,23 +1,18 @@
|
||||
package org.fdroid.fdroid.views.fragments;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.listener.PauseOnScrollListener;
|
||||
|
@ -37,6 +37,7 @@ public class AvailableAppsFragment extends AppListFragment implements
|
||||
return "Available";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AppListAdapter getAppListAdapter() {
|
||||
if (adapter == null) {
|
||||
final AppListAdapter a = new AvailableAppListAdapter(getActivity(), null);
|
||||
@ -53,7 +54,7 @@ public class AvailableAppsFragment extends AppListFragment implements
|
||||
|
||||
private class CategoryObserver extends ContentObserver {
|
||||
|
||||
private ArrayAdapter adapter;
|
||||
private ArrayAdapter<String> adapter;
|
||||
|
||||
public CategoryObserver(ArrayAdapter<String> adapter) {
|
||||
super(null);
|
||||
|
@ -1,10 +1,6 @@
|
||||
package org.fdroid.fdroid.views.fragments;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
import org.fdroid.fdroid.R;
|
||||
import org.fdroid.fdroid.data.AppProvider;
|
||||
import org.fdroid.fdroid.views.AppListAdapter;
|
||||
|
@ -1,10 +1,6 @@
|
||||
package org.fdroid.fdroid.views.fragments;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
import org.fdroid.fdroid.R;
|
||||
import org.fdroid.fdroid.data.AppProvider;
|
||||
import org.fdroid.fdroid.views.AppListAdapter;
|
||||
|
@ -62,6 +62,7 @@ public class RepoDetailsFragment extends Fragment {
|
||||
// best way to go about this...
|
||||
private Repo repo;
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
}
|
||||
@ -80,6 +81,7 @@ public class RepoDetailsFragment extends Fragment {
|
||||
return RepoProvider.Helper.findById(getActivity(), getRepoId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
repo = loadRepoDetails();
|
||||
@ -346,11 +348,13 @@ public class RepoDetailsFragment extends Fragment {
|
||||
repoFingerprintView.setTextColor(repoFingerprintColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package org.fdroid.fdroid;
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
|
||||
import org.fdroid.fdroid.data.Apk;
|
||||
import org.fdroid.fdroid.data.ApkProvider;
|
||||
import org.fdroid.fdroid.data.RepoProvider;
|
||||
|
@ -2,9 +2,10 @@ package org.fdroid.fdroid;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
|
||||
import mock.MockCategoryResources;
|
||||
import mock.MockInstallablePackageManager;
|
||||
|
||||
import org.fdroid.fdroid.data.ApkProvider;
|
||||
import org.fdroid.fdroid.data.App;
|
||||
import org.fdroid.fdroid.data.AppProvider;
|
||||
@ -24,6 +25,7 @@ public class AppProviderTest extends FDroidProviderTest<AppProvider> {
|
||||
getSwappableContext().setResources(new MockCategoryResources());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getMinimalProjection() {
|
||||
return new String[] {
|
||||
AppProvider.DataColumns.APP_ID,
|
||||
|
@ -2,7 +2,6 @@ package org.fdroid.fdroid;
|
||||
|
||||
import android.content.*;
|
||||
import android.net.Uri;
|
||||
import android.test.mock.MockContentResolver;
|
||||
import junit.framework.AssertionFailedError;
|
||||
import org.fdroid.fdroid.data.ApkProvider;
|
||||
import org.fdroid.fdroid.data.AppProvider;
|
||||
|
Loading…
x
Reference in New Issue
Block a user