New feature: "Ignore This Update".
This commit is contained in:
parent
1e5cda97c3
commit
f2500bec15
@ -88,7 +88,8 @@
|
|||||||
<string name="menu_share">Share</string>
|
<string name="menu_share">Share</string>
|
||||||
<string name="menu_install">Install</string>
|
<string name="menu_install">Install</string>
|
||||||
<string name="menu_uninstall">Uninstall</string>
|
<string name="menu_uninstall">Uninstall</string>
|
||||||
<string name="menu_ignore">Ignore Updates</string>
|
<string name="menu_ignore_all">Ignore All Updates</string>
|
||||||
|
<string name="menu_ignore_this">Ignore This Update</string>
|
||||||
<string name="menu_website">Website</string>
|
<string name="menu_website">Website</string>
|
||||||
<string name="menu_issues">Issues</string>
|
<string name="menu_issues">Issues</string>
|
||||||
<string name="menu_source">Source Code</string>
|
<string name="menu_source">Source Code</string>
|
||||||
|
@ -162,17 +162,18 @@ public class AppDetails extends ListActivity {
|
|||||||
|
|
||||||
private static final int INSTALL = Menu.FIRST;
|
private static final int INSTALL = Menu.FIRST;
|
||||||
private static final int UNINSTALL = Menu.FIRST + 1;
|
private static final int UNINSTALL = Menu.FIRST + 1;
|
||||||
private static final int IGNORE = Menu.FIRST + 2;
|
private static final int IGNOREALL = Menu.FIRST + 2;
|
||||||
private static final int WEBSITE = Menu.FIRST + 3;
|
private static final int IGNORETHIS = Menu.FIRST + 3;
|
||||||
private static final int ISSUES = Menu.FIRST + 4;
|
private static final int WEBSITE = Menu.FIRST + 4;
|
||||||
private static final int SOURCE = Menu.FIRST + 5;
|
private static final int ISSUES = Menu.FIRST + 5;
|
||||||
private static final int LAUNCH = Menu.FIRST + 6;
|
private static final int SOURCE = Menu.FIRST + 6;
|
||||||
private static final int SHARE = Menu.FIRST + 7;
|
private static final int LAUNCH = Menu.FIRST + 7;
|
||||||
private static final int DONATE = Menu.FIRST + 8;
|
private static final int SHARE = Menu.FIRST + 8;
|
||||||
private static final int BITCOIN = Menu.FIRST + 9;
|
private static final int DONATE = Menu.FIRST + 9;
|
||||||
private static final int LITECOIN = Menu.FIRST + 10;
|
private static final int BITCOIN = Menu.FIRST + 10;
|
||||||
private static final int FLATTR = Menu.FIRST + 11;
|
private static final int LITECOIN = Menu.FIRST + 11;
|
||||||
private static final int DONATE_URL = Menu.FIRST + 12;
|
private static final int FLATTR = Menu.FIRST + 12;
|
||||||
|
private static final int DONATE_URL = Menu.FIRST + 13;
|
||||||
|
|
||||||
private DB.App app;
|
private DB.App app;
|
||||||
private int app_currentvercode;
|
private int app_currentvercode;
|
||||||
@ -181,7 +182,9 @@ public class AppDetails extends ListActivity {
|
|||||||
private PackageManager mPm;
|
private PackageManager mPm;
|
||||||
private DownloadHandler downloadHandler;
|
private DownloadHandler downloadHandler;
|
||||||
private boolean stateRetained;
|
private boolean stateRetained;
|
||||||
private boolean ignoreToggled;
|
|
||||||
|
private boolean ignoreAllToggled;
|
||||||
|
private boolean ignoreThisToggled;
|
||||||
|
|
||||||
LinearLayout headerView;
|
LinearLayout headerView;
|
||||||
View infoView;
|
View infoView;
|
||||||
@ -252,7 +255,8 @@ public class AppDetails extends ListActivity {
|
|||||||
pref_antiNonFreeNet = prefs.getBoolean("antiNonFreeNet", false);
|
pref_antiNonFreeNet = prefs.getBoolean("antiNonFreeNet", false);
|
||||||
pref_antiNonFreeDep = prefs.getBoolean("antiNonFreeDep", false);
|
pref_antiNonFreeDep = prefs.getBoolean("antiNonFreeDep", false);
|
||||||
|
|
||||||
ignoreToggled = false;
|
ignoreAllToggled = false;
|
||||||
|
ignoreThisToggled = false;
|
||||||
|
|
||||||
startViews();
|
startViews();
|
||||||
|
|
||||||
@ -662,11 +666,17 @@ public class AppDetails extends ListActivity {
|
|||||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM |
|
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM |
|
||||||
MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
||||||
|
|
||||||
menu.add(Menu.NONE, IGNORE, 2, R.string.menu_ignore)
|
menu.add(Menu.NONE, IGNOREALL, 2, R.string.menu_ignore_all)
|
||||||
.setIcon(android.R.drawable.ic_menu_add)
|
.setIcon(android.R.drawable.ic_menu_close_clear_cancel)
|
||||||
.setCheckable(true)
|
.setCheckable(true)
|
||||||
.setChecked(app.ignoreUpdates);
|
.setChecked(app.ignoreAllUpdates);
|
||||||
|
|
||||||
|
if (app.hasUpdates) {
|
||||||
|
menu.add(Menu.NONE, IGNORETHIS, 2, R.string.menu_ignore_this)
|
||||||
|
.setIcon(android.R.drawable.ic_menu_close_clear_cancel)
|
||||||
|
.setCheckable(true)
|
||||||
|
.setChecked(app.ignoreThisUpdate);
|
||||||
|
}
|
||||||
if (app.detail_webURL.length() > 0) {
|
if (app.detail_webURL.length() > 0) {
|
||||||
menu.add(Menu.NONE, WEBSITE, 3, R.string.menu_website).setIcon(
|
menu.add(Menu.NONE, WEBSITE, 3, R.string.menu_website).setIcon(
|
||||||
android.R.drawable.ic_menu_view);
|
android.R.drawable.ic_menu_view);
|
||||||
@ -733,10 +743,16 @@ public class AppDetails extends ListActivity {
|
|||||||
removeApk(app.id);
|
removeApk(app.id);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case IGNORE:
|
case IGNOREALL:
|
||||||
app.ignoreUpdates ^= true;
|
app.ignoreAllUpdates ^= true;
|
||||||
item.setChecked(app.ignoreUpdates);
|
item.setChecked(app.ignoreAllUpdates);
|
||||||
ignoreToggled ^= true;
|
ignoreAllToggled ^= true;
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case IGNORETHIS:
|
||||||
|
app.ignoreThisUpdate ^= true;
|
||||||
|
item.setChecked(app.ignoreThisUpdate);
|
||||||
|
ignoreThisToggled ^= true;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case WEBSITE:
|
case WEBSITE:
|
||||||
@ -1015,10 +1031,11 @@ public class AppDetails extends ListActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void finish() {
|
public void finish() {
|
||||||
if (ignoreToggled) {
|
if (ignoreAllToggled || ignoreThisToggled) {
|
||||||
try {
|
try {
|
||||||
DB db = DB.getDB();
|
DB db = DB.getDB();
|
||||||
db.toggleIgnoreUpdates(app.id);
|
db.toggleIgnoreUpdates(app.id,
|
||||||
|
ignoreAllToggled, ignoreThisToggled);
|
||||||
} finally {
|
} finally {
|
||||||
DB.releaseDB();
|
DB.releaseDB();
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,9 @@ public class DB {
|
|||||||
+ "flattrID string," + "requirements string,"
|
+ "flattrID string," + "requirements string,"
|
||||||
+ "category string," + "added string,"
|
+ "category string," + "added string,"
|
||||||
+ "lastUpdated string," + "compatible int not null,"
|
+ "lastUpdated string," + "compatible int not null,"
|
||||||
+ "ignoreUpdates int not null," + "primary key(id));";
|
+ "ignoreAllUpdates int not null,"
|
||||||
|
+ "ignoreThisUpdate int not null,"
|
||||||
|
+ "primary key(id));";
|
||||||
|
|
||||||
public static class App implements Comparable<App> {
|
public static class App implements Comparable<App> {
|
||||||
|
|
||||||
@ -125,7 +127,8 @@ public class DB {
|
|||||||
apks = new ArrayList<Apk>();
|
apks = new ArrayList<Apk>();
|
||||||
detail_Populated = false;
|
detail_Populated = false;
|
||||||
compatible = false;
|
compatible = false;
|
||||||
ignoreUpdates = false;
|
ignoreAllUpdates = false;
|
||||||
|
ignoreThisUpdate = false;
|
||||||
filtered = false;
|
filtered = false;
|
||||||
iconUrl = null;
|
iconUrl = null;
|
||||||
}
|
}
|
||||||
@ -204,9 +207,11 @@ public class DB {
|
|||||||
// to be notified about them
|
// to be notified about them
|
||||||
public boolean toUpdate;
|
public boolean toUpdate;
|
||||||
|
|
||||||
// True if updates should not show up in the Updates tab for this
|
// True if all updates for this app are to be ignored
|
||||||
// application
|
public boolean ignoreAllUpdates;
|
||||||
public boolean ignoreUpdates;
|
|
||||||
|
// True if the current update for this app is to be ignored
|
||||||
|
public boolean ignoreThisUpdate;
|
||||||
|
|
||||||
// The name of the version that would be updated to.
|
// The name of the version that would be updated to.
|
||||||
public String updateVersion;
|
public String updateVersion;
|
||||||
@ -436,7 +441,7 @@ public class DB {
|
|||||||
public String lastetag; // last etag we updated from, null forces update
|
public String lastetag; // last etag we updated from, null forces update
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int DBVersion = 25;
|
private final int DBVersion = 26;
|
||||||
|
|
||||||
private static void createAppApk(SQLiteDatabase db) {
|
private static void createAppApk(SQLiteDatabase db) {
|
||||||
db.execSQL(CREATE_TABLE_APP);
|
db.execSQL(CREATE_TABLE_APP);
|
||||||
@ -758,7 +763,7 @@ public class DB {
|
|||||||
String cols[] = new String[] { "antiFeatures", "requirements",
|
String cols[] = new String[] { "antiFeatures", "requirements",
|
||||||
"id", "name", "summary", "icon", "license", "category",
|
"id", "name", "summary", "icon", "license", "category",
|
||||||
"curVersion", "curVercode", "added", "lastUpdated",
|
"curVersion", "curVercode", "added", "lastUpdated",
|
||||||
"compatible", "ignoreUpdates" };
|
"compatible", "ignoreAllUpdates", "ignoreThisUpdate" };
|
||||||
c = db.query(TABLE_APP, cols, null, null, null, null, null);
|
c = db.query(TABLE_APP, cols, null, null, null, null, null);
|
||||||
c.moveToFirst();
|
c.moveToFirst();
|
||||||
while (!c.isAfterLast()) {
|
while (!c.isAfterLast()) {
|
||||||
@ -782,7 +787,8 @@ public class DB {
|
|||||||
.length() == 0) ? null : mDateFormat
|
.length() == 0) ? null : mDateFormat
|
||||||
.parse(sLastUpdated);
|
.parse(sLastUpdated);
|
||||||
app.compatible = c.getInt(12) == 1;
|
app.compatible = c.getInt(12) == 1;
|
||||||
app.ignoreUpdates = c.getInt(13) == 1;
|
app.ignoreAllUpdates = c.getInt(13) == 1;
|
||||||
|
app.ignoreThisUpdate = c.getInt(14) == 1;
|
||||||
app.hasUpdates = false;
|
app.hasUpdates = false;
|
||||||
|
|
||||||
if (getinstalledinfo && systemApks.containsKey(app.id)) {
|
if (getinstalledinfo && systemApks.containsKey(app.id)) {
|
||||||
@ -1147,9 +1153,14 @@ public class DB {
|
|||||||
|
|
||||||
// Values to keep if already present
|
// Values to keep if already present
|
||||||
if (oldapp == null) {
|
if (oldapp == null) {
|
||||||
values.put("ignoreUpdates", upapp.ignoreUpdates ? 1 : 0);
|
values.put("ignoreAllUpdates", upapp.ignoreAllUpdates ? 1 : 0);
|
||||||
|
values.put("ignoreThisUpdate", upapp.ignoreThisUpdate ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
values.put("ignoreUpdates", oldapp.ignoreUpdates ? 1 : 0);
|
values.put("ignoreAllUpdates", oldapp.ignoreAllUpdates ? 1 : 0);
|
||||||
|
if (upapp.curVercode > oldapp.curVercode)
|
||||||
|
values.put("ignoreThisUpdate", upapp.ignoreThisUpdate ? 1 : 0);
|
||||||
|
else
|
||||||
|
values.put("ignoreThisUpdate", oldapp.ignoreThisUpdate ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldapp != null) {
|
if (oldapp != null) {
|
||||||
@ -1257,10 +1268,11 @@ public class DB {
|
|||||||
new String[] { address });
|
new String[] { address });
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toggleIgnoreUpdates(String appid) {
|
public void toggleIgnoreUpdates(String appid, boolean All, boolean This) {
|
||||||
db.execSQL("update " + TABLE_APP
|
db.execSQL("update " + TABLE_APP + " set "
|
||||||
+ " set ignoreUpdates=1-ignoreUpdates where id = ?",
|
+ (All ? "ignoreAllUpdates=1-ignoreAllUpdates " : "")
|
||||||
new String[] { appid });
|
+ (This ? "ignoreThisUpdate=1-ignoreThisUpdate " : "")
|
||||||
|
+ "where id = ?", new String[] { appid });
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRepoByAddress(Repo repo) {
|
public void updateRepoByAddress(Repo repo) {
|
||||||
|
@ -198,9 +198,9 @@ public class FDroidApp extends Application {
|
|||||||
for (DB.App app : apps) {
|
for (DB.App app : apps) {
|
||||||
app.filtered = appFilter.filter(app);
|
app.filtered = appFilter.filter(app);
|
||||||
|
|
||||||
app.toUpdate = (
|
app.toUpdate = (app.hasUpdates
|
||||||
!app.ignoreUpdates
|
&& !app.ignoreAllUpdates
|
||||||
&& app.hasUpdates
|
&& !app.ignoreThisUpdate
|
||||||
&& !app.filtered
|
&& !app.filtered
|
||||||
&& (showIncompatible || app.compatible));
|
&& (showIncompatible || app.compatible));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user