From cc58ea1b8741ce3503db739f1ec146f5b2e3693e Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 11:09:45 +0200 Subject: [PATCH] make the storage analyzer items clickable --- .../pro/fragments/StorageFragment.kt | 19 + app/src/main/res/layout/storage_fragment.xml | 449 ++++++++++-------- 2 files changed, 272 insertions(+), 196 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index 4b021ad8..a5e8d34e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -3,8 +3,10 @@ package com.simplemobiletools.filemanager.pro.fragments import android.annotation.SuppressLint import android.app.usage.StorageStatsManager import android.content.Context +import android.content.Intent import android.os.storage.StorageManager import android.provider.MediaStore +import android.provider.Settings import android.util.AttributeSet import androidx.appcompat.app.AppCompatActivity import com.simplemobiletools.commons.extensions.* @@ -16,6 +18,7 @@ import kotlinx.android.synthetic.main.storage_fragment.view.* import java.util.* import kotlin.collections.HashMap + class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) { private val IMAGES = "images" private val VIDEOS = "videos" @@ -82,6 +85,22 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage others_progressbar.progress = (othersSize / SIZE_DIVIDER).toInt() } } + + free_space_holder.setOnClickListener { + try { + val storageSettingsIntent = Intent(Settings.ACTION_INTERNAL_STORAGE_SETTINGS) + activity.startActivity(storageSettingsIntent) + } catch (e: Exception) { + activity.showErrorToast(e) + } + } + + images_holder.setOnClickListener { } + videos_holder.setOnClickListener { } + audio_holder.setOnClickListener { } + documents_holder.setOnClickListener { } + archives_holder.setOnClickListener { } + others_holder.setOnClickListener { } } override fun refreshFragment() {} diff --git a/app/src/main/res/layout/storage_fragment.xml b/app/src/main/res/layout/storage_fragment.xml index ec88b237..196b8662 100644 --- a/app/src/main/res/layout/storage_fragment.xml +++ b/app/src/main/res/layout/storage_fragment.xml @@ -5,226 +5,283 @@ android:id="@+id/storage_fragment" android:layout_width="match_parent" android:layout_height="match_parent" - android:padding="@dimen/activity_margin"> + tools:ignore="RelativeOverlap"> - + android:background="?attr/selectableItemBackground" + android:paddingStart="@dimen/activity_margin" + android:paddingTop="@dimen/activity_margin" + android:paddingEnd="@dimen/activity_margin"> - + + + + + + + + + + android:layout_below="@+id/free_space_holder" + android:background="?attr/selectableItemBackground" + android:paddingStart="@dimen/activity_margin" + android:paddingTop="@dimen/normal_margin" + android:paddingEnd="@dimen/activity_margin" + android:paddingBottom="@dimen/normal_margin"> - + - + + + + + + android:layout_below="@+id/images_holder" + android:background="?attr/selectableItemBackground" + android:paddingStart="@dimen/activity_margin" + android:paddingTop="@dimen/normal_margin" + android:paddingEnd="@dimen/activity_margin" + android:paddingBottom="@dimen/normal_margin"> - + + + + + + + + android:layout_below="@+id/videos_holder" + android:background="?attr/selectableItemBackground" + android:paddingStart="@dimen/activity_margin" + android:paddingTop="@dimen/normal_margin" + android:paddingEnd="@dimen/activity_margin" + android:paddingBottom="@dimen/normal_margin"> - + + + + + + + + android:layout_below="@+id/audio_holder" + android:background="?attr/selectableItemBackground" + android:paddingStart="@dimen/activity_margin" + android:paddingTop="@dimen/normal_margin" + android:paddingEnd="@dimen/activity_margin" + android:paddingBottom="@dimen/normal_margin"> - + - + + + + + + android:layout_below="@+id/documents_holder" + android:background="?attr/selectableItemBackground" + android:paddingStart="@dimen/activity_margin" + android:paddingTop="@dimen/normal_margin" + android:paddingEnd="@dimen/activity_margin" + android:paddingBottom="@dimen/normal_margin"> - + + + + + + + + android:layout_below="@+id/archives_holder" + android:background="?attr/selectableItemBackground" + android:paddingStart="@dimen/activity_margin" + android:paddingTop="@dimen/normal_margin" + android:paddingEnd="@dimen/activity_margin" + android:paddingBottom="@dimen/normal_margin"> - + - - - - - - - - - - - - - - - - - - - - - - - + + +