adding a storage usage progress indicator

This commit is contained in:
tibbi 2021-10-11 22:21:51 +02:00
parent 17343f5448
commit 1741888d74
2 changed files with 15 additions and 1 deletions

View file

@ -70,6 +70,10 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
val freeSpace = storageStatsManager.getFreeBytes(uuid)
activity.runOnUiThread {
storage_usage_progressbar.max = (totalSpace / 1000).toInt()
storage_usage_progressbar.progress = ((totalSpace - freeSpace) / 1000).toInt()
storage_usage_progressbar.beVisible()
free_space_value.text = freeSpace.formatSizeThousand()
total_space.text = String.format(context.getString(R.string.total_storage), totalSpace.formatSizeThousand())
free_space_label.beVisible()

View file

@ -26,11 +26,21 @@
android:textSize="@dimen/big_text_size"
android:visibility="gone" />
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/storage_usage_progressbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/free_space_value"
android:layout_marginTop="@dimen/medium_margin"
android:layout_marginBottom="@dimen/medium_margin"
android:max="100"
android:visibility="gone" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/total_space"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/free_space_value"
android:layout_below="@+id/storage_usage_progressbar"
android:textSize="@dimen/big_text_size"
tools:text="Total storage: 64 GB" />