make sure the storage usage progressbar has the proper color

This commit is contained in:
tibbi 2021-10-11 22:28:33 +02:00
parent 1741888d74
commit ff4ccbf439
2 changed files with 8 additions and 5 deletions

View file

@ -33,6 +33,9 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
override fun setupColors(textColor: Int, primaryColor: Int) {
context.updateTextColors(storage_fragment)
main_storage_usage_progressbar.setIndicatorColor(primaryColor)
main_storage_usage_progressbar.trackColor = primaryColor.adjustAlpha(0.3f)
}
private fun getMediaTypeSize(uri: Uri): Long {
@ -70,9 +73,9 @@ 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()
main_storage_usage_progressbar.max = (totalSpace / 1000000).toInt()
main_storage_usage_progressbar.progress = ((totalSpace - freeSpace) / 1000000).toInt()
main_storage_usage_progressbar.beVisible()
free_space_value.text = freeSpace.formatSizeThousand()
total_space.text = String.format(context.getString(R.string.total_storage), totalSpace.formatSizeThousand())

View file

@ -27,7 +27,7 @@
android:visibility="gone" />
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/storage_usage_progressbar"
android:id="@+id/main_storage_usage_progressbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/free_space_value"
@ -40,7 +40,7 @@
android:id="@+id/total_space"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/storage_usage_progressbar"
android:layout_below="@+id/main_storage_usage_progressbar"
android:textSize="@dimen/big_text_size"
tools:text="Total storage: 64 GB" />