Choose layout depending on the update persistent status

Using the persistent status is simpler and less error prone. This
fixes the view of verified downloads, which aren't shown as such.
This commit is contained in:
Gabriele M
2017-07-17 19:34:32 +02:00
parent c6a60d78f5
commit 4674d68eb3

View File

@@ -208,20 +208,18 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
}
boolean activeLayout;
switch (update.getStatus()) {
case DOWNLOADING:
case INSTALLING:
case VERIFYING:
case STARTING:
case DOWNLOADED:
activeLayout = update.getPersistentStatus() != UpdateStatus.Persistent.VERIFIED;
switch (update.getPersistentStatus()) {
case UpdateStatus.Persistent.UNKNOWN:
activeLayout = update.getStatus() == UpdateStatus.STARTING;
break;
case PAUSED:
case PAUSED_ERROR:
activeLayout = update.getFile() != null && update.getFile().exists();
case UpdateStatus.Persistent.VERIFIED:
activeLayout = false;
break;
case UpdateStatus.Persistent.INCOMPLETE:
activeLayout = true;
break;
default:
activeLayout = false;
throw new RuntimeException("Unknown update status");
}
if (activeLayout) {