No need to move around app ids around any more

This commit is contained in:
Daniel Martí 2013-07-07 10:20:57 +02:00
parent 9c4aa9127f
commit eaa94bdf83

View File

@ -510,7 +510,7 @@ public class AppDetails extends ListActivity {
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, public void onClick(DialogInterface dialog,
int whichButton) { int whichButton) {
install(app.id); install();
} }
}); });
ask_alrt.setNegativeButton(getString(R.string.no), ask_alrt.setNegativeButton(getString(R.string.no),
@ -523,7 +523,7 @@ public class AppDetails extends ListActivity {
AlertDialog alert = ask_alrt.create(); AlertDialog alert = ask_alrt.create();
alert.show(); alert.show();
} else } else
install(app.id); install();
} }
@Override @Override
@ -601,7 +601,7 @@ public class AppDetails extends ListActivity {
// Note that this handles updating as well as installing. // Note that this handles updating as well as installing.
curapk = app.getCurrentVersion(); curapk = app.getCurrentVersion();
if (curapk != null) if (curapk != null)
install(app.id); install();
return true; return true;
case UNINSTALL: case UNINSTALL:
@ -641,7 +641,7 @@ public class AppDetails extends ListActivity {
} }
// Install the version of this app denoted by 'curapk'. // Install the version of this app denoted by 'curapk'.
private void install(final String id) { private void install() {
String ra = null; String ra = null;
try { try {
@ -666,7 +666,7 @@ public class AppDetails extends ListActivity {
public void onClick(DialogInterface dialog, public void onClick(DialogInterface dialog,
int whichButton) { int whichButton) {
downloadHandler = new DownloadHandler(curapk, downloadHandler = new DownloadHandler(curapk,
repoaddress, id); repoaddress);
} }
}); });
ask_alrt.setNegativeButton(getString(R.string.no), ask_alrt.setNegativeButton(getString(R.string.no),
@ -694,7 +694,7 @@ public class AppDetails extends ListActivity {
alert.show(); alert.show();
return; return;
} }
downloadHandler = new DownloadHandler(curapk, repoaddress, id); downloadHandler = new DownloadHandler(curapk, repoaddress);
} }
private void removeApk(String id) { private void removeApk(String id) {
@ -711,7 +711,7 @@ public class AppDetails extends ListActivity {
} }
private void installApk(File file, String id) { private void installApk(File file) {
Intent intent = new Intent(); Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW); intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file://" + file.getPath()), intent.setDataAndType(Uri.parse("file://" + file.getPath()),
@ -753,10 +753,8 @@ public class AppDetails extends ListActivity {
private Downloader download; private Downloader download;
private ProgressDialog pd; private ProgressDialog pd;
private boolean updating; private boolean updating;
private String id;
public DownloadHandler(DB.Apk apk, String repoaddress, String appid) { public DownloadHandler(DB.Apk apk, String repoaddress) {
id = appid;
download = new Downloader(apk, repoaddress); download = new Downloader(apk, repoaddress);
download.start(); download.start();
startUpdates(); startUpdates();
@ -794,7 +792,7 @@ public class AppDetails extends ListActivity {
case DONE: case DONE:
if (pd != null) if (pd != null)
pd.dismiss(); pd.dismiss();
installApk(download.localFile(), id); installApk(download.localFile());
finished = true; finished = true;
break; break;
case CANCELLED: case CANCELLED: