Don't show run button for apps which cannot be launched.

The feedback from ACRA was:

> tried to run an app that doesn't have a launcher (termux api)
This commit is contained in:
Peter Serwylo 2017-04-18 18:24:07 +10:00
parent 4cc6e5bc89
commit 1eb224fc5e

View File

@ -322,7 +322,11 @@ public class AppListItemController extends RecyclerView.ViewHolder {
actionButton.setVisibility(View.VISIBLE);
if (wasSuccessfullyInstalled(app) != null) {
actionButton.setText(R.string.menu_launch);
if (activity.getPackageManager().getLaunchIntentForPackage(currentApp.packageName) != null) {
actionButton.setText(R.string.menu_launch);
} else {
actionButton.setVisibility(View.GONE);
}
} else if (isReadyToInstall(app)) {
if (app.isInstalled()) {
actionButton.setText(R.string.app__install_downloaded_update);
@ -520,12 +524,14 @@ public class AppListItemController extends RecyclerView.ViewHolder {
AppUpdateStatusManager.AppUpdateStatus successfullyInstalledStatus = wasSuccessfullyInstalled(currentApp);
if (successfullyInstalledStatus != null) {
Intent intent = activity.getPackageManager().getLaunchIntentForPackage(currentApp.packageName);
activity.startActivity(intent);
if (intent != null) {
activity.startActivity(intent);
// Once it is explicitly launched by the user, then we can pretty much forget about
// any sort of notification that the app was successfully installed. It should be
// apparent to the user because they just launched it.
AppUpdateStatusManager.getInstance(activity).removeApk(successfullyInstalledStatus.getUniqueKey());
// Once it is explicitly launched by the user, then we can pretty much forget about
// any sort of notification that the app was successfully installed. It should be
// apparent to the user because they just launched it.
AppUpdateStatusManager.getInstance(activity).removeApk(successfullyInstalledStatus.getUniqueKey());
}
return;
}