Appese checkstyle + pmd
This commit is contained in:
parent
5e263c0e0f
commit
4b5481b8f2
@ -26,7 +26,6 @@ import android.app.PendingIntent;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
@ -28,6 +28,11 @@ public class AppPrefs extends ValueObject {
|
||||
((AppPrefs) o).ignoreThisUpdate == ignoreThisUpdate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (ignoreThisUpdate + "-" + ignoreAllUpdates).hashCode();
|
||||
}
|
||||
|
||||
public AppPrefs createClone() {
|
||||
return new AppPrefs(ignoreThisUpdate, ignoreAllUpdates);
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ class DBHelper extends SQLiteOpenHelper {
|
||||
// The other tables are transient and can just be reset. Do this after
|
||||
// the repo table changes though, because it also clears the lastetag
|
||||
// fields which didn't always exist.
|
||||
resetTransient(db, oldVersion);
|
||||
resetTransientPre42(db, oldVersion);
|
||||
|
||||
addNameAndDescriptionToRepo(db, oldVersion);
|
||||
addFingerprintToRepo(db, oldVersion);
|
||||
@ -672,6 +672,17 @@ class DBHelper extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
private void resetTransient(SQLiteDatabase db, int oldVersion) {
|
||||
context.getSharedPreferences("FDroid", Context.MODE_PRIVATE).edit()
|
||||
.putBoolean("triedEmptyUpdate", false).apply();
|
||||
db.execSQL("drop table " + AppTable.NAME);
|
||||
db.execSQL("drop table " + ApkTable.NAME);
|
||||
clearRepoEtags(db);
|
||||
db.execSQL(CREATE_TABLE_APP);
|
||||
db.execSQL(CREATE_TABLE_APK);
|
||||
ensureIndexes(db);
|
||||
}
|
||||
|
||||
private void resetTransientPre42(SQLiteDatabase db, int oldVersion) {
|
||||
// Before version 42, only transient info was stored in here. As of some time
|
||||
// just before 42 (F-Droid 0.60ish) it now has "ignore this version" info which
|
||||
// was is specified by the user. We don't want to weely-neely nuke that data.
|
||||
@ -681,7 +692,7 @@ class DBHelper extends SQLiteOpenHelper {
|
||||
return;
|
||||
}
|
||||
context.getSharedPreferences("FDroid", Context.MODE_PRIVATE).edit()
|
||||
.putBoolean("triedEmptyUpdate", false).commit();
|
||||
.putBoolean("triedEmptyUpdate", false).apply();
|
||||
db.execSQL("drop table " + AppTable.NAME);
|
||||
db.execSQL("drop table " + ApkTable.NAME);
|
||||
clearRepoEtags(db);
|
||||
|
@ -18,7 +18,7 @@ public interface Schema {
|
||||
String IGNORE_ALL_UPDATES = "ignoreAllUpdates";
|
||||
String IGNORE_THIS_UPDATE = "ignoreThisUpdate";
|
||||
|
||||
String[] ALL = {APP_ID, IGNORE_ALL_UPDATES, IGNORE_THIS_UPDATE,};
|
||||
String[] ALL = {APP_ID, IGNORE_ALL_UPDATES, IGNORE_THIS_UPDATE};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,6 @@ import android.app.Application;
|
||||
|
||||
import org.fdroid.fdroid.Assert;
|
||||
import org.fdroid.fdroid.BuildConfig;
|
||||
import org.fdroid.fdroid.TestUtils;
|
||||
import org.fdroid.fdroid.data.Schema.AppPrefsTable.Cols;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@ -13,7 +11,7 @@ import org.robolectric.RobolectricGradleTestRunner;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.shadows.ShadowContentResolver;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
@ -22,8 +20,6 @@ import static org.junit.Assert.assertNull;
|
||||
@RunWith(RobolectricGradleTestRunner.class)
|
||||
public class AppPrefsProviderTest extends FDroidProviderTest {
|
||||
|
||||
private static final String[] PROJ = Cols.ALL;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
ShadowContentResolver.registerProvider(AppProvider.getAuthority(), new AppProvider());
|
||||
|
Loading…
x
Reference in New Issue
Block a user