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

Commit c920a58d authored by Varun Shah's avatar Varun Shah
Browse files

Add blob size to shared data dev options screens.

Bug: 156671006
Test: make RunSettingsRoboTests ROBOTEST_FILTER=SharedDataPreferenceControllerTest
Test: manual (visual)
Change-Id: Ia98c3d9812f6225ee834b4d1b0f12a1a73a87598
parent 03b20f86
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -47,4 +47,11 @@
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="?android:attr/textColorSecondary"/>

    <TextView
        android:id="@+id/blob_size"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
+1 −0
Original line number Diff line number Diff line
@@ -158,6 +158,7 @@ public class BlobInfoListView extends ListActivity {
            holder.blobId.setText(getString(R.string.blob_id_text, blob.getId()));
            holder.blobExpiry.setText(getString(R.string.blob_expires_text,
                    SharedDataUtils.formatTime(blob.getExpiryTimeMs())));
            holder.blobSize.setText(SharedDataUtils.formatSize(blob.getSizeBytes()));
            return convertView;
        }
    }
+2 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ class BlobInfoViewHolder {
    TextView blobLabel;
    TextView blobId;
    TextView blobExpiry;
    TextView blobSize;

    static BlobInfoViewHolder createOrRecycle(LayoutInflater inflater, View convertView) {
        if (convertView != null) {
@@ -42,6 +43,7 @@ class BlobInfoViewHolder {
        holder.blobLabel = convertView.findViewById(R.id.blob_label);
        holder.blobId = convertView.findViewById(R.id.blob_id);
        holder.blobExpiry = convertView.findViewById(R.id.blob_expiry);
        holder.blobSize = convertView.findViewById(R.id.blob_size);
        convertView.setTag(holder);
        return holder;
    }
+2 −0
Original line number Diff line number Diff line
@@ -93,11 +93,13 @@ public class LeaseInfoListView extends ListActivity {
        final TextView blobLabel = headerView.findViewById(R.id.blob_label);
        final TextView blobId = headerView.findViewById(R.id.blob_id);
        final TextView blobExpiry = headerView.findViewById(R.id.blob_expiry);
        final TextView blobSize = headerView.findViewById(R.id.blob_size);

        blobLabel.setText(mBlobInfo.getLabel());
        blobLabel.setTypeface(Typeface.DEFAULT_BOLD);
        blobId.setText(getString(R.string.blob_id_text, mBlobInfo.getId()));
        blobExpiry.setVisibility(View.GONE);
        blobSize.setText(SharedDataUtils.formatSize(mBlobInfo.getSizeBytes()));
        return headerView;
    }

+5 −0
Original line number Diff line number Diff line
@@ -39,4 +39,9 @@ class SharedDataUtils {
        CALENDAR.setTimeInMillis(millis);
        return FORMATTER.format(CALENDAR.getTime());
    }

    static String formatSize(long sizeBytes) {
        final double sizeInMb = sizeBytes / (1024.0 * 1024.0);
        return String.format("%.2f MB", sizeInMb);
    }
}
Loading