Added an update button to the app details menu where appropriate
This commit is contained in:
parent
adc4e0631e
commit
77e99933cd
@ -22,6 +22,7 @@
|
|||||||
<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>
|
||||||
<string name="menu_market">Market</string>
|
<string name="menu_market">Market</string>
|
||||||
|
<string name="menu_update">Update</string>
|
||||||
</resources>
|
</resources>
|
||||||
<!--
|
<!--
|
||||||
* Copyright (C) 2009 Roberto Jacinto
|
* Copyright (C) 2009 Roberto Jacinto
|
||||||
|
@ -227,17 +227,15 @@ public class AppDetails extends ListActivity {
|
|||||||
install();
|
install();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
p.setButton2(getString(R.string.uninstall),
|
p.setButton2(getString(R.string.uninstall),
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
p.dismiss();
|
p.dismiss();
|
||||||
removeApk(app.id);
|
removeApk(app.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
p.show();
|
p.show();
|
||||||
}
|
}
|
||||||
@ -264,13 +262,19 @@ public class AppDetails extends ListActivity {
|
|||||||
|
|
||||||
super.onCreateOptionsMenu(menu);
|
super.onCreateOptionsMenu(menu);
|
||||||
menu.clear();
|
menu.clear();
|
||||||
if (app.installedVersion == null && app.getCurrentVersion() != null) {
|
DB.Apk curver = app.getCurrentVersion();
|
||||||
|
if (app.installedVersion == null && curver != null) {
|
||||||
menu.add(Menu.NONE, INSTALL, 1, R.string.menu_install).setIcon(
|
menu.add(Menu.NONE, INSTALL, 1, R.string.menu_install).setIcon(
|
||||||
android.R.drawable.ic_menu_add);
|
android.R.drawable.ic_menu_add);
|
||||||
} else {
|
} else {
|
||||||
menu.add(Menu.NONE, UNINSTALL, 1, R.string.menu_uninstall).setIcon(
|
menu.add(Menu.NONE, UNINSTALL, 1, R.string.menu_uninstall).setIcon(
|
||||||
android.R.drawable.ic_menu_delete);
|
android.R.drawable.ic_menu_delete);
|
||||||
}
|
}
|
||||||
|
if (app.installedVersion != null
|
||||||
|
&& !app.installedVersion.equals(curver.version)) {
|
||||||
|
menu.add(Menu.NONE, INSTALL, 1, R.string.menu_update).setIcon(
|
||||||
|
android.R.drawable.ic_menu_add);
|
||||||
|
}
|
||||||
if (app.webURL.length() > 0) {
|
if (app.webURL.length() > 0) {
|
||||||
menu.add(Menu.NONE, WEBSITE, 2, R.string.menu_website).setIcon(
|
menu.add(Menu.NONE, WEBSITE, 2, R.string.menu_website).setIcon(
|
||||||
android.R.drawable.ic_menu_view);
|
android.R.drawable.ic_menu_view);
|
||||||
@ -294,6 +298,7 @@ public class AppDetails extends ListActivity {
|
|||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
|
||||||
case INSTALL:
|
case INSTALL:
|
||||||
|
// Note that this handles updating as well as installing.
|
||||||
curapk = app.getCurrentVersion();
|
curapk = app.getCurrentVersion();
|
||||||
install();
|
install();
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user