show the videos size too

This commit is contained in:
tibbi 2021-10-11 22:57:09 +02:00
parent bf25cdfb2b
commit 49103cc405
2 changed files with 40 additions and 3 deletions

View File

@ -30,6 +30,9 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
activity.runOnUiThread {
images_size.text = imagesSize.formatSize()
images_progressbar.progress = (imagesSize / 1000000).toInt()
videos_size.text = videosSize.formatSize()
videos_progressbar.progress = (videosSize / 1000000).toInt()
}
}
}
@ -45,6 +48,10 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
val redColor = context.resources.getColor(R.color.md_red_700)
images_progressbar.setIndicatorColor(redColor)
images_progressbar.trackColor = redColor.adjustAlpha(0.3f)
val greenColor = context.resources.getColor(R.color.md_green_700)
videos_progressbar.setIndicatorColor(greenColor)
videos_progressbar.trackColor = greenColor.adjustAlpha(0.3f)
}
private fun getMediaTypeSize(uri: Uri): Long {
@ -82,7 +89,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
val freeSpace = storageStatsManager.getFreeBytes(uuid)
activity.runOnUiThread {
arrayOf(main_storage_usage_progressbar, images_progressbar).forEach {
arrayOf(main_storage_usage_progressbar, images_progressbar, videos_progressbar).forEach {
it.max = (totalSpace / 1000000).toInt()
}

View File

@ -52,7 +52,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/total_space"
android:layout_marginTop="@dimen/big_text_size"
android:layout_marginTop="@dimen/big_margin"
android:text="@string/images"
android:textSize="@dimen/bigger_text_size" />
@ -62,7 +62,7 @@
android:layout_height="wrap_content"
android:layout_below="@+id/total_space"
android:layout_alignParentEnd="true"
android:layout_marginTop="@dimen/big_text_size"
android:layout_marginTop="@dimen/big_margin"
android:alpha="0.7"
android:textSize="@dimen/normal_text_size"
tools:text="20 GB" />
@ -77,4 +77,34 @@
android:max="100"
app:trackThickness="2dp" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/videos_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/images_progressbar"
android:layout_marginTop="@dimen/big_margin"
android:text="@string/videos"
android:textSize="@dimen/bigger_text_size" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/videos_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/images_progressbar"
android:layout_alignParentEnd="true"
android:layout_marginTop="@dimen/big_margin"
android:alpha="0.7"
android:textSize="@dimen/normal_text_size"
tools:text="20 GB" />
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/videos_progressbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/videos_label"
android:layout_marginTop="@dimen/medium_margin"
android:layout_marginBottom="@dimen/medium_margin"
android:max="100"
app:trackThickness="2dp" />
</com.simplemobiletools.filemanager.pro.fragments.StorageFragment>