Treat download resume and verification in the same way

Allowing to verify downloads, but not install them makes no sense
currently, so don't treat the two cases differently.
This commit is contained in:
Gabriele M
2017-07-17 23:49:11 +02:00
parent 4674d68eb3
commit fe21c2cd49
2 changed files with 3 additions and 11 deletions

View File

@@ -79,7 +79,6 @@
<string name="action_description_pause">Pause download</string> <string name="action_description_pause">Pause download</string>
<string name="action_description_resume">Resume download</string> <string name="action_description_resume">Resume download</string>
<string name="action_description_install">Install update</string> <string name="action_description_install">Install update</string>
<string name="action_description_verify">Verify update</string>
<string name="confirm_delete_dialog_title">Delete file</string> <string name="confirm_delete_dialog_title">Delete file</string>
<string name="confirm_delete_dialog_message">Delete the selected update file?</string> <string name="confirm_delete_dialog_message">Delete the selected update file?</string>

View File

@@ -54,7 +54,6 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
DOWNLOAD, DOWNLOAD,
PAUSE, PAUSE,
RESUME, RESUME,
VERIFY,
INSTALL INSTALL
} }
@@ -150,12 +149,8 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
viewHolder.mProgressBar.setIndeterminate(true); viewHolder.mProgressBar.setIndeterminate(true);
viewHolder.mProgressPercentage.setText(NumberFormat.getPercentInstance().format(1)); viewHolder.mProgressPercentage.setText(NumberFormat.getPercentInstance().format(1));
} else { } else {
if (update.getFile().length() == update.getFileSize()) {
setButtonAction(viewHolder.mAction, Action.VERIFY, downloadId, !busy);
} else {
setButtonAction(viewHolder.mAction, Action.RESUME, downloadId, enabled);
}
canDelete = true; canDelete = true;
setButtonAction(viewHolder.mAction, Action.RESUME, downloadId, enabled);
String downloaded = Formatter.formatBytes(mContext.getResources(), String downloaded = Formatter.formatBytes(mContext.getResources(),
update.getFile().length(), Formatter.FLAG_SHORTER).value; update.getFile().length(), Formatter.FLAG_SHORTER).value;
String total = Formatter.formatShortFileSize(mContext, update.getFileSize()); String total = Formatter.formatShortFileSize(mContext, update.getFileSize());
@@ -281,11 +276,9 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
}); });
break; break;
case RESUME: case RESUME:
case VERIFY:
button.setImageResource(R.drawable.ic_resume); button.setImageResource(R.drawable.ic_resume);
button.setContentDescription(action == Action.RESUME ? button.setContentDescription(
mContext.getString(R.string.action_description_resume) : mContext.getString(R.string.action_description_resume));
mContext.getString(R.string.action_description_verify));
button.setEnabled(enabled); button.setEnabled(enabled);
button.setOnClickListener(!enabled ? null : new View.OnClickListener() { button.setOnClickListener(!enabled ? null : new View.OnClickListener() {
@Override @Override