mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-04-24 07:07:22 +02:00
make the storage analyzer items clickable
This commit is contained in:
parent
0961ceb096
commit
cc58ea1b87
@ -3,8 +3,10 @@ package com.simplemobiletools.filemanager.pro.fragments
|
|||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.usage.StorageStatsManager
|
import android.app.usage.StorageStatsManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import android.os.storage.StorageManager
|
import android.os.storage.StorageManager
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
|
import android.provider.Settings
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
@ -16,6 +18,7 @@ import kotlinx.android.synthetic.main.storage_fragment.view.*
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.HashMap
|
import kotlin.collections.HashMap
|
||||||
|
|
||||||
|
|
||||||
class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) {
|
class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) {
|
||||||
private val IMAGES = "images"
|
private val IMAGES = "images"
|
||||||
private val VIDEOS = "videos"
|
private val VIDEOS = "videos"
|
||||||
@ -82,6 +85,22 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
|||||||
others_progressbar.progress = (othersSize / SIZE_DIVIDER).toInt()
|
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() {}
|
override fun refreshFragment() {}
|
||||||
|
@ -5,7 +5,16 @@
|
|||||||
android:id="@+id/storage_fragment"
|
android:id="@+id/storage_fragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="@dimen/activity_margin">
|
tools:ignore="RelativeOverlap">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/free_space_holder"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:paddingStart="@dimen/activity_margin"
|
||||||
|
android:paddingTop="@dimen/activity_margin"
|
||||||
|
android:paddingEnd="@dimen/activity_margin">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextView
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
android:id="@+id/free_space_value"
|
android:id="@+id/free_space_value"
|
||||||
@ -46,13 +55,23 @@
|
|||||||
android:layout_marginBottom="@dimen/big_margin"
|
android:layout_marginBottom="@dimen/big_margin"
|
||||||
android:textSize="@dimen/big_text_size"
|
android:textSize="@dimen/big_text_size"
|
||||||
tools:text="Total storage: 64 GB" />
|
tools:text="Total storage: 64 GB" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/images_holder"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
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">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextView
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
android:id="@+id/images_label"
|
android:id="@+id/images_label"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/total_space"
|
|
||||||
android:layout_marginTop="@dimen/big_margin"
|
|
||||||
android:text="@string/images"
|
android:text="@string/images"
|
||||||
android:textSize="@dimen/bigger_text_size" />
|
android:textSize="@dimen/bigger_text_size" />
|
||||||
|
|
||||||
@ -60,9 +79,7 @@
|
|||||||
android:id="@+id/images_size"
|
android:id="@+id/images_size"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/total_space"
|
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginTop="@dimen/big_margin"
|
|
||||||
android:alpha="0.7"
|
android:alpha="0.7"
|
||||||
android:textSize="@dimen/normal_text_size"
|
android:textSize="@dimen/normal_text_size"
|
||||||
tools:text="20 GB" />
|
tools:text="20 GB" />
|
||||||
@ -76,13 +93,23 @@
|
|||||||
android:layout_marginBottom="@dimen/medium_margin"
|
android:layout_marginBottom="@dimen/medium_margin"
|
||||||
android:max="100"
|
android:max="100"
|
||||||
app:trackThickness="2dp" />
|
app:trackThickness="2dp" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/videos_holder"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
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">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextView
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
android:id="@+id/videos_label"
|
android:id="@+id/videos_label"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/images_progressbar"
|
|
||||||
android:layout_marginTop="@dimen/big_margin"
|
|
||||||
android:text="@string/videos"
|
android:text="@string/videos"
|
||||||
android:textSize="@dimen/bigger_text_size" />
|
android:textSize="@dimen/bigger_text_size" />
|
||||||
|
|
||||||
@ -90,9 +117,7 @@
|
|||||||
android:id="@+id/videos_size"
|
android:id="@+id/videos_size"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/images_progressbar"
|
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginTop="@dimen/big_margin"
|
|
||||||
android:alpha="0.7"
|
android:alpha="0.7"
|
||||||
android:textSize="@dimen/normal_text_size"
|
android:textSize="@dimen/normal_text_size"
|
||||||
tools:text="20 GB" />
|
tools:text="20 GB" />
|
||||||
@ -106,13 +131,23 @@
|
|||||||
android:layout_marginBottom="@dimen/medium_margin"
|
android:layout_marginBottom="@dimen/medium_margin"
|
||||||
android:max="100"
|
android:max="100"
|
||||||
app:trackThickness="2dp" />
|
app:trackThickness="2dp" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/audio_holder"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
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">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextView
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
android:id="@+id/audio_label"
|
android:id="@+id/audio_label"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/videos_progressbar"
|
|
||||||
android:layout_marginTop="@dimen/big_margin"
|
|
||||||
android:text="@string/audio"
|
android:text="@string/audio"
|
||||||
android:textSize="@dimen/bigger_text_size" />
|
android:textSize="@dimen/bigger_text_size" />
|
||||||
|
|
||||||
@ -120,9 +155,7 @@
|
|||||||
android:id="@+id/audio_size"
|
android:id="@+id/audio_size"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/videos_progressbar"
|
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginTop="@dimen/big_margin"
|
|
||||||
android:alpha="0.7"
|
android:alpha="0.7"
|
||||||
android:textSize="@dimen/normal_text_size"
|
android:textSize="@dimen/normal_text_size"
|
||||||
tools:text="20 GB" />
|
tools:text="20 GB" />
|
||||||
@ -136,13 +169,23 @@
|
|||||||
android:layout_marginBottom="@dimen/medium_margin"
|
android:layout_marginBottom="@dimen/medium_margin"
|
||||||
android:max="100"
|
android:max="100"
|
||||||
app:trackThickness="2dp" />
|
app:trackThickness="2dp" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/documents_holder"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
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">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextView
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
android:id="@+id/documents_label"
|
android:id="@+id/documents_label"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/audio_progressbar"
|
|
||||||
android:layout_marginTop="@dimen/big_margin"
|
|
||||||
android:text="@string/documents"
|
android:text="@string/documents"
|
||||||
android:textSize="@dimen/bigger_text_size" />
|
android:textSize="@dimen/bigger_text_size" />
|
||||||
|
|
||||||
@ -150,9 +193,7 @@
|
|||||||
android:id="@+id/documents_size"
|
android:id="@+id/documents_size"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/audio_progressbar"
|
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginTop="@dimen/big_margin"
|
|
||||||
android:alpha="0.7"
|
android:alpha="0.7"
|
||||||
android:textSize="@dimen/normal_text_size"
|
android:textSize="@dimen/normal_text_size"
|
||||||
tools:text="20 GB" />
|
tools:text="20 GB" />
|
||||||
@ -166,13 +207,23 @@
|
|||||||
android:layout_marginBottom="@dimen/medium_margin"
|
android:layout_marginBottom="@dimen/medium_margin"
|
||||||
android:max="100"
|
android:max="100"
|
||||||
app:trackThickness="2dp" />
|
app:trackThickness="2dp" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/archives_holder"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
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">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextView
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
android:id="@+id/archives_label"
|
android:id="@+id/archives_label"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/documents_progressbar"
|
|
||||||
android:layout_marginTop="@dimen/big_margin"
|
|
||||||
android:text="@string/archives"
|
android:text="@string/archives"
|
||||||
android:textSize="@dimen/bigger_text_size" />
|
android:textSize="@dimen/bigger_text_size" />
|
||||||
|
|
||||||
@ -180,9 +231,7 @@
|
|||||||
android:id="@+id/archives_size"
|
android:id="@+id/archives_size"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/documents_progressbar"
|
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginTop="@dimen/big_margin"
|
|
||||||
android:alpha="0.7"
|
android:alpha="0.7"
|
||||||
android:textSize="@dimen/normal_text_size"
|
android:textSize="@dimen/normal_text_size"
|
||||||
tools:text="20 GB" />
|
tools:text="20 GB" />
|
||||||
@ -196,13 +245,23 @@
|
|||||||
android:layout_marginBottom="@dimen/medium_margin"
|
android:layout_marginBottom="@dimen/medium_margin"
|
||||||
android:max="100"
|
android:max="100"
|
||||||
app:trackThickness="2dp" />
|
app:trackThickness="2dp" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/others_holder"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
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">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextView
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
android:id="@+id/others_label"
|
android:id="@+id/others_label"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/archives_progressbar"
|
|
||||||
android:layout_marginTop="@dimen/big_margin"
|
|
||||||
android:text="@string/others"
|
android:text="@string/others"
|
||||||
android:textSize="@dimen/bigger_text_size" />
|
android:textSize="@dimen/bigger_text_size" />
|
||||||
|
|
||||||
@ -210,9 +269,7 @@
|
|||||||
android:id="@+id/others_size"
|
android:id="@+id/others_size"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/archives_progressbar"
|
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginTop="@dimen/big_margin"
|
|
||||||
android:alpha="0.7"
|
android:alpha="0.7"
|
||||||
android:textSize="@dimen/normal_text_size"
|
android:textSize="@dimen/normal_text_size"
|
||||||
tools:text="20 GB" />
|
tools:text="20 GB" />
|
||||||
@ -226,5 +283,5 @@
|
|||||||
android:layout_marginBottom="@dimen/medium_margin"
|
android:layout_marginBottom="@dimen/medium_margin"
|
||||||
android:max="100"
|
android:max="100"
|
||||||
app:trackThickness="2dp" />
|
app:trackThickness="2dp" />
|
||||||
|
</RelativeLayout>
|
||||||
</com.simplemobiletools.filemanager.pro.fragments.StorageFragment>
|
</com.simplemobiletools.filemanager.pro.fragments.StorageFragment>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user