Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17db209f authored by Gabriele M's avatar Gabriele M Committed by Joey
Browse files

Always show the size of the updates

This is now possible since the size is included in the JSON.

Change-Id: Ie38ccfbdc7abb0e4b86e8e625ed8d131376402e7
parent ec4f3146
Loading
Loading
Loading
Loading
+33 −16
Original line number Diff line number Diff line
@@ -43,13 +43,17 @@
                android:textSize="14sp"
                tools:text="29 February 2018" />

            <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

                <ProgressBar
                    android:id="@+id/progress_bar"
                    style="@style/Widget.AppCompat.ProgressBar.Horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                android:paddingTop="8dp"
                android:visibility="gone"
                    android:paddingTop="4sp"
                    android:visibility="invisible"
                    tools:progress="65"
                    tools:visibility="visible" />

@@ -57,9 +61,22 @@
                    android:id="@+id/progress_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/progress_bar"
                    android:ellipsize="marquee"
                    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>

        <Button
+9 −2
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.

        private TextView mBuildDate;
        private TextView mBuildVersion;
        private TextView mBuildSize;

        private ProgressBar mProgressBar;
        private TextView mProgressText;
@@ -92,6 +93,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.

            mBuildDate = (TextView) view.findViewById(R.id.build_date);
            mBuildVersion = (TextView) view.findViewById(R.id.build_version);
            mBuildSize = (TextView) view.findViewById(R.id.build_size);

            mProgressBar = (ProgressBar) view.findViewById(R.id.progress_bar);
            mProgressText = (TextView) view.findViewById(R.id.progress_text);
@@ -172,6 +174,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
                viewHolder.mBuildDate));
        viewHolder.mProgressBar.setVisibility(View.VISIBLE);
        viewHolder.mProgressText.setVisibility(View.VISIBLE);
        viewHolder.mBuildSize.setVisibility(View.INVISIBLE);
    }

    private void handleNotActiveStatus(ViewHolder viewHolder, UpdateInfo update) {
@@ -190,8 +193,12 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
                    getLongClickListener(update, false, viewHolder.mBuildDate));
            setButtonAction(viewHolder.mAction, Action.DOWNLOAD, update.getDownloadId(), !isBusy());
        }
        viewHolder.mProgressBar.setVisibility(View.GONE);
        viewHolder.mProgressText.setVisibility(View.GONE);
        String fileSize = Formatter.formatShortFileSize(mActivity, update.getFileSize());
        viewHolder.mBuildSize.setText(fileSize);

        viewHolder.mProgressBar.setVisibility(View.INVISIBLE);
        viewHolder.mProgressText.setVisibility(View.INVISIBLE);
        viewHolder.mBuildSize.setVisibility(View.VISIBLE);
    }

    @Override