Always show the size of the updates
This is now possible since the size is included in the JSON. Change-Id: Ie38ccfbdc7abb0e4b86e8e625ed8d131376402e7
This commit is contained in:
@@ -43,13 +43,17 @@
|
|||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
tools:text="29 February 2018" />
|
tools:text="29 February 2018" />
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/progress_bar"
|
android:id="@+id/progress_bar"
|
||||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="4sp"
|
||||||
android:visibility="gone"
|
android:visibility="invisible"
|
||||||
tools:progress="65"
|
tools:progress="65"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
@@ -57,9 +61,22 @@
|
|||||||
android:id="@+id/progress_text"
|
android:id="@+id/progress_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/progress_bar"
|
||||||
android:ellipsize="marquee"
|
android:ellipsize="marquee"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
tools:text="162 of 300 MB (3 minutes left) • 65%" />
|
android:visibility="invisible"
|
||||||
|
tools:text="162 of 300 MB (3 minutes left) • 65%"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/build_size"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="8sp"
|
||||||
|
android:singleLine="true"
|
||||||
|
tools:text="300 MB"
|
||||||
|
tools:visibility="invisible" />
|
||||||
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
@@ -82,6 +82,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
|
|||||||
|
|
||||||
private TextView mBuildDate;
|
private TextView mBuildDate;
|
||||||
private TextView mBuildVersion;
|
private TextView mBuildVersion;
|
||||||
|
private TextView mBuildSize;
|
||||||
|
|
||||||
private ProgressBar mProgressBar;
|
private ProgressBar mProgressBar;
|
||||||
private TextView mProgressText;
|
private TextView mProgressText;
|
||||||
@@ -92,6 +93,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
|
|||||||
|
|
||||||
mBuildDate = (TextView) view.findViewById(R.id.build_date);
|
mBuildDate = (TextView) view.findViewById(R.id.build_date);
|
||||||
mBuildVersion = (TextView) view.findViewById(R.id.build_version);
|
mBuildVersion = (TextView) view.findViewById(R.id.build_version);
|
||||||
|
mBuildSize = (TextView) view.findViewById(R.id.build_size);
|
||||||
|
|
||||||
mProgressBar = (ProgressBar) view.findViewById(R.id.progress_bar);
|
mProgressBar = (ProgressBar) view.findViewById(R.id.progress_bar);
|
||||||
mProgressText = (TextView) view.findViewById(R.id.progress_text);
|
mProgressText = (TextView) view.findViewById(R.id.progress_text);
|
||||||
@@ -172,6 +174,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
|
|||||||
viewHolder.mBuildDate));
|
viewHolder.mBuildDate));
|
||||||
viewHolder.mProgressBar.setVisibility(View.VISIBLE);
|
viewHolder.mProgressBar.setVisibility(View.VISIBLE);
|
||||||
viewHolder.mProgressText.setVisibility(View.VISIBLE);
|
viewHolder.mProgressText.setVisibility(View.VISIBLE);
|
||||||
|
viewHolder.mBuildSize.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleNotActiveStatus(ViewHolder viewHolder, UpdateInfo update) {
|
private void handleNotActiveStatus(ViewHolder viewHolder, UpdateInfo update) {
|
||||||
@@ -190,8 +193,12 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
|
|||||||
getLongClickListener(update, false, viewHolder.mBuildDate));
|
getLongClickListener(update, false, viewHolder.mBuildDate));
|
||||||
setButtonAction(viewHolder.mAction, Action.DOWNLOAD, update.getDownloadId(), !isBusy());
|
setButtonAction(viewHolder.mAction, Action.DOWNLOAD, update.getDownloadId(), !isBusy());
|
||||||
}
|
}
|
||||||
viewHolder.mProgressBar.setVisibility(View.GONE);
|
String fileSize = Formatter.formatShortFileSize(mActivity, update.getFileSize());
|
||||||
viewHolder.mProgressText.setVisibility(View.GONE);
|
viewHolder.mBuildSize.setText(fileSize);
|
||||||
|
|
||||||
|
viewHolder.mProgressBar.setVisibility(View.INVISIBLE);
|
||||||
|
viewHolder.mProgressText.setVisibility(View.INVISIBLE);
|
||||||
|
viewHolder.mBuildSize.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user