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:
@@ -37,6 +37,7 @@
|
|||||||
<string name="download_button">Download</string>
|
<string name="download_button">Download</string>
|
||||||
<string name="pause_button">Pause</string>
|
<string name="pause_button">Pause</string>
|
||||||
<string name="resume_button">Resume</string>
|
<string name="resume_button">Resume</string>
|
||||||
|
<string name="verify_button">Verify</string>
|
||||||
<string name="cancel_button">Delete</string>
|
<string name="cancel_button">Delete</string>
|
||||||
<string name="install_button">Install</string>
|
<string name="install_button">Install</string>
|
||||||
|
|
||||||
|
@@ -43,6 +43,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
|
|||||||
DOWNLOAD,
|
DOWNLOAD,
|
||||||
PAUSE,
|
PAUSE,
|
||||||
RESUME,
|
RESUME,
|
||||||
|
VERIFY,
|
||||||
CANCEL,
|
CANCEL,
|
||||||
INSTALL
|
INSTALL
|
||||||
}
|
}
|
||||||
@@ -119,8 +120,12 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
|
|||||||
Utils.canInstall(update) && !mUpdaterController.isVerifyingUpdate();
|
Utils.canInstall(update) && !mUpdaterController.isVerifyingUpdate();
|
||||||
int persistentStatus = update.getPersistentStatus();
|
int persistentStatus = update.getPersistentStatus();
|
||||||
if (persistentStatus == UpdateStatus.Persistent.INCOMPLETE) {
|
if (persistentStatus == UpdateStatus.Persistent.INCOMPLETE) {
|
||||||
setButtonAction(viewHolder.mButton1, Action.RESUME, downloadId,
|
if (update.getFile().length() == update.getFileSize()) {
|
||||||
enabled && update.getAvailableOnline());
|
setButtonAction(viewHolder.mButton1, Action.VERIFY, downloadId, enabled);
|
||||||
|
} else {
|
||||||
|
setButtonAction(viewHolder.mButton1, Action.RESUME, downloadId,
|
||||||
|
enabled && update.getAvailableOnline());
|
||||||
|
}
|
||||||
setButtonAction(viewHolder.mButton2, Action.CANCEL, downloadId, enabled);
|
setButtonAction(viewHolder.mButton2, Action.CANCEL, downloadId, enabled);
|
||||||
} else if (persistentStatus == UpdateStatus.Persistent.VERIFIED) {
|
} else if (persistentStatus == UpdateStatus.Persistent.VERIFIED) {
|
||||||
setButtonAction(viewHolder.mButton1, Action.INSTALL, downloadId, enabled);
|
setButtonAction(viewHolder.mButton1, Action.INSTALL, downloadId, enabled);
|
||||||
@@ -185,6 +190,16 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
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:
|
case CANCEL:
|
||||||
button.setText(R.string.cancel_button);
|
button.setText(R.string.cancel_button);
|
||||||
button.setEnabled(enabled);
|
button.setEnabled(enabled);
|
||||||
|
Reference in New Issue
Block a user