Show "verify" for complete INCOMPLETE updates

INCOMPLETE is used for any update that isn't verified, even if the
file has been completed. This change is mostly needed to support
imported downloads, which we take as complete, but unverified.
This commit is contained in:
Gabriele M
2017-07-08 01:07:59 +02:00
parent 26f149bef1
commit 6534932b20
2 changed files with 18 additions and 2 deletions

View File

@@ -37,6 +37,7 @@
<string name="download_button">Download</string>
<string name="pause_button">Pause</string>
<string name="resume_button">Resume</string>
<string name="verify_button">Verify</string>
<string name="cancel_button">Delete</string>
<string name="install_button">Install</string>

View File

@@ -43,6 +43,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
DOWNLOAD,
PAUSE,
RESUME,
VERIFY,
CANCEL,
INSTALL
}
@@ -119,8 +120,12 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
Utils.canInstall(update) && !mUpdaterController.isVerifyingUpdate();
int persistentStatus = update.getPersistentStatus();
if (persistentStatus == UpdateStatus.Persistent.INCOMPLETE) {
if (update.getFile().length() == update.getFileSize()) {
setButtonAction(viewHolder.mButton1, Action.VERIFY, downloadId, enabled);
} else {
setButtonAction(viewHolder.mButton1, Action.RESUME, downloadId,
enabled && update.getAvailableOnline());
}
setButtonAction(viewHolder.mButton2, Action.CANCEL, downloadId, enabled);
} else if (persistentStatus == UpdateStatus.Persistent.VERIFIED) {
setButtonAction(viewHolder.mButton1, Action.INSTALL, downloadId, enabled);
@@ -185,6 +190,16 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
}
});
break;
case VERIFY:
button.setText(R.string.verify_button);
button.setEnabled(enabled);
button.setOnClickListener(!enabled ? null : new View.OnClickListener() {
@Override
public void onClick(View view) {
mUpdaterController.resumeDownload(downloadId);
}
});
break;
case CANCEL:
button.setText(R.string.cancel_button);
button.setEnabled(enabled);