feat: add new icon

This commit is contained in:
Kagura 2024-10-17 22:09:17 +08:00
parent 2e3a85ff38
commit 52483f05fd
13 changed files with 146 additions and 25 deletions

View file

@ -7,6 +7,8 @@
android:name="android.permission.MANAGE_EXTERNAL_STORAGE" android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" /> tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<application <application
android:allowBackup="true" android:allowBackup="true"

View file

@ -10,6 +10,7 @@ import android.view.View
import android.widget.AdapterView import android.widget.AdapterView
import android.widget.GridView import android.widget.GridView
import android.widget.ImageView import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import android.widget.Toast import android.widget.Toast
import androidx.activity.enableEdgeToEdge import androidx.activity.enableEdgeToEdge
@ -143,6 +144,11 @@ class document_page : AppCompatActivity() {
val adapter = DocumentAdapter(this@document_page, models) val adapter = DocumentAdapter(this@document_page, models)
documentGrid.setAdapter(adapter) documentGrid.setAdapter(adapter)
findViewById<TextView>(R.id.LoadingBlankText).visibility = View.GONE findViewById<TextView>(R.id.LoadingBlankText).visibility = View.GONE
findViewById<LinearLayout>(R.id.NothingFoundHint).visibility = if (models.isEmpty){ // 没有东西则显示空
View.VISIBLE
}else{
View.GONE
}
} }
} }
} }
@ -274,6 +280,12 @@ class document_page : AppCompatActivity() {
runOnUiThread { runOnUiThread {
val grid = findViewById<GridView>(R.id.DocumentGrid) val grid = findViewById<GridView>(R.id.DocumentGrid)
grid.setAdapter(adapter) grid.setAdapter(adapter)
findViewById<LinearLayout>(R.id.NothingFoundHint).visibility = if (models.isEmpty){ // 没有东西则显示空
View.VISIBLE
}else{
View.GONE
}
} }
runSomethingMore?.invoke() runSomethingMore?.invoke()
} }

View file

@ -129,19 +129,13 @@ class WrappedFile(private val f: File, skipCalculateDirectorySize: Boolean = fal
} }
fun getSizeString(): String { fun getSizeString(): String {
if (size == 0L) { if (size == 0L && type == Type.DIRECTORY && !isSizeCalculated) {
if (type == Type.DIRECTORY) {
if (!isSizeCalculated) {
// Calculate Size // Calculate Size
size = getFolderSize(f) size = getFolderSize(f)
isSizeCalculated = true isSizeCalculated = true
} else { } else {
return "0B" return "0B"
} }
} else {
return "未知"
}
}
return getSizeString(size.toULong()) return getSizeString(size.toULong())
} }

View file

@ -9,6 +9,7 @@ import android.view.View
import android.widget.AdapterView import android.widget.AdapterView
import android.widget.GridView import android.widget.GridView
import android.widget.ImageView import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import android.widget.Toast import android.widget.Toast
import androidx.activity.enableEdgeToEdge import androidx.activity.enableEdgeToEdge
@ -18,6 +19,7 @@ import androidx.core.content.FileProvider
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsCompat.Type import androidx.core.view.WindowInsetsCompat.Type
import androidx.core.view.isVisible
import com.dazuoye.filemanager.fileSystem.adapters.MusicAdapter import com.dazuoye.filemanager.fileSystem.adapters.MusicAdapter
import com.dazuoye.filemanager.fileSystem.adapters.MusicModel import com.dazuoye.filemanager.fileSystem.adapters.MusicModel
import com.dazuoye.filemanager.compose.SearchActivity import com.dazuoye.filemanager.compose.SearchActivity
@ -122,6 +124,11 @@ class music_page : AppCompatActivity() {
val adapter = MusicAdapter(this@music_page, models) val adapter = MusicAdapter(this@music_page, models)
musicGrid.setAdapter(adapter) musicGrid.setAdapter(adapter)
findViewById<TextView>(R.id.LoadingBlankText).visibility = View.GONE findViewById<TextView>(R.id.LoadingBlankText).visibility = View.GONE
findViewById<LinearLayout>(R.id.NothingFoundHint).visibility = if (models.isEmpty){ // 没有东西则显示空
View.VISIBLE
}else{
View.GONE
}
} }
} }
} }
@ -253,6 +260,12 @@ class music_page : AppCompatActivity() {
runOnUiThread { runOnUiThread {
val grid = findViewById<GridView>(R.id.MusicGrid) val grid = findViewById<GridView>(R.id.MusicGrid)
grid.setAdapter(adapter) grid.setAdapter(adapter)
findViewById<LinearLayout>(R.id.NothingFoundHint).visibility = if (models.isEmpty){ // 没有东西则显示空
View.VISIBLE
}else{
View.GONE
}
} }
runSomethingMore?.invoke() runSomethingMore?.invoke()
} }

View file

@ -9,6 +9,7 @@ import android.view.View
import android.widget.AdapterView import android.widget.AdapterView
import android.widget.GridView import android.widget.GridView
import android.widget.ImageView import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import android.widget.Toast import android.widget.Toast
import androidx.activity.enableEdgeToEdge import androidx.activity.enableEdgeToEdge
@ -116,14 +117,19 @@ class picture_page : AppCompatActivity() {
val defaultText = loadingTextView.text val defaultText = loadingTextView.text
launch { loadingText(loadingTextView, defaultText) } launch { loadingText(loadingTextView, defaultText) }
imageList = instance.dateOrderedList() imageList = instance.dateOrderedList()
val imageModels = ArrayList<ImageModel>() val models = ArrayList<ImageModel>()
for (path in imageList) { for (path in imageList) {
imageModels.add(ImageModel(File(path))) models.add(ImageModel(File(path)))
} }
runOnUiThread { runOnUiThread {
val adapter = ImageAdapter(this@picture_page, imageModels) val adapter = ImageAdapter(this@picture_page, models)
pictureGrid.setAdapter(adapter) pictureGrid.setAdapter(adapter)
findViewById<TextView>(R.id.LoadingBlankText).visibility = View.GONE findViewById<TextView>(R.id.LoadingBlankText).visibility = View.GONE
findViewById<LinearLayout>(R.id.NothingFoundHint).visibility = if (models.isEmpty){ // 没有东西则显示空
View.VISIBLE
}else{
View.GONE
}
} }
} }
} }
@ -247,14 +253,19 @@ class picture_page : AppCompatActivity() {
1 -> instance.sizeOrderedList() 1 -> instance.sizeOrderedList()
else -> listOf() else -> listOf()
} }
val imageModels = ArrayList<ImageModel>() val models = ArrayList<ImageModel>()
for (path in imageList) { for (path in imageList) {
imageModels.add(ImageModel(File(path))) models.add(ImageModel(File(path)))
} }
val adapter = ImageAdapter(this, imageModels) val adapter = ImageAdapter(this, models)
runOnUiThread { runOnUiThread {
val grid = findViewById<GridView>(R.id.PicturePageGrid) val grid = findViewById<GridView>(R.id.PicturePageGrid)
grid.setAdapter(adapter) grid.setAdapter(adapter)
findViewById<LinearLayout>(R.id.NothingFoundHint).visibility = if (models.isEmpty){ // 没有东西则显示空
View.VISIBLE
}else{
View.GONE
}
} }
runSomethingMore?.invoke() runSomethingMore?.invoke()
} }

View file

@ -9,6 +9,7 @@ import android.view.View
import android.widget.AdapterView import android.widget.AdapterView
import android.widget.GridView import android.widget.GridView
import android.widget.ImageView import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import android.widget.Toast import android.widget.Toast
import androidx.activity.enableEdgeToEdge import androidx.activity.enableEdgeToEdge
@ -115,14 +116,19 @@ class video_page : AppCompatActivity() {
val defaultText = loadingTextView.text val defaultText = loadingTextView.text
launch { loadingText(loadingTextView, defaultText) } launch { loadingText(loadingTextView, defaultText) }
videoList = instance.dateOrderedList() videoList = instance.dateOrderedList()
val videoModels = ArrayList<VideoModel>() val models = ArrayList<VideoModel>()
for (path in videoList) { for (path in videoList) {
videoModels.add(VideoModel(File(path))) models.add(VideoModel(File(path)))
} }
runOnUiThread { runOnUiThread {
val adapter = VideoAdapter(this@video_page, videoModels) val adapter = VideoAdapter(this@video_page, models)
videoGrid.setAdapter(adapter) videoGrid.setAdapter(adapter)
findViewById<TextView>(R.id.LoadingBlankText).visibility = View.GONE findViewById<TextView>(R.id.LoadingBlankText).visibility = View.GONE
findViewById<LinearLayout>(R.id.NothingFoundHint).visibility = if (models.isEmpty){ // 没有东西则显示空
View.VISIBLE
}else{
View.GONE
}
} }
} }
} }
@ -246,14 +252,19 @@ class video_page : AppCompatActivity() {
1 -> instance.sizeOrderedList() 1 -> instance.sizeOrderedList()
else -> listOf() else -> listOf()
} }
val videoModels = ArrayList<VideoModel>() val models = ArrayList<VideoModel>()
for (path in videoList) { for (path in videoList) {
videoModels.add(VideoModel(File(path))) models.add(VideoModel(File(path)))
} }
val adapter = VideoAdapter(this, videoModels) val adapter = VideoAdapter(this, models)
runOnUiThread { runOnUiThread {
val grid = findViewById<GridView>(R.id.VideoGrid) val grid = findViewById<GridView>(R.id.VideoGrid)
grid.setAdapter(adapter) grid.setAdapter(adapter)
findViewById<LinearLayout>(R.id.NothingFoundHint).visibility = if (models.isEmpty){ // 没有东西则显示空
View.VISIBLE
}else{
View.GONE
}
} }
runSomethingMore?.invoke() runSomethingMore?.invoke()
} }

View file

@ -1,4 +1,4 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="40dp" android:tint="#FF00FF" android:viewportHeight="24" android:viewportWidth="24" android:width="40dp"> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="40dp" android:tint="#485B7A" android:viewportHeight="24" android:viewportWidth="24" android:width="40dp">
<path android:fillColor="@color/white" android:pathData="M5,20h14v-2H5V20zM19,9h-4V3H9v6H5l7,7L19,9z"/> <path android:fillColor="@color/white" android:pathData="M5,20h14v-2H5V20zM19,9h-4V3H9v6H5l7,7L19,9z"/>

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="128dp"
android:tint="#717171"
android:viewportHeight="960"
android:viewportWidth="960"
android:width="128dp">
<path
android:fillColor="@android:color/white"
android:pathData="M220,700Q128,700 64,636Q0,572 0,480Q0,388 64,324Q128,260 220,260Q257,260 291,273Q325,286 352,310L420,372L360,426L298,370Q282,356 262,348Q242,340 220,340Q162,340 121,381Q80,422 80,480Q80,538 121,579Q162,620 220,620Q242,620 262,612Q282,604 298,590L608,310Q635,286 669,273Q703,260 740,260Q832,260 896,324Q960,388 960,480Q960,572 896,636Q832,700 740,700Q703,700 669,687Q635,674 608,650L540,588L600,534L662,590Q678,604 698,612Q718,620 740,620Q798,620 839,579Q880,538 880,480Q880,422 839,381Q798,340 740,340Q718,340 698,348Q678,356 662,370L352,650Q325,674 291,687Q257,700 220,700Z" />
</vector>

View file

@ -98,4 +98,20 @@
android:textSize="78sp" android:textSize="78sp"
android:background="@color/WhiteSmoke"/> android:background="@color/WhiteSmoke"/>
<LinearLayout
android:id="@+id/NothingFoundHint"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="64sp"
android:text="@string/no_items"
app:drawableTopCompat="@drawable/outline_all_inclusive_24"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -98,4 +98,21 @@
android:textSize="78sp" android:textSize="78sp"
android:background="@color/WhiteSmoke"/> android:background="@color/WhiteSmoke"/>
<LinearLayout
android:id="@+id/NothingFoundHint"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="64sp"
android:text="@string/no_items"
app:drawableTopCompat="@drawable/outline_all_inclusive_24"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -107,5 +107,21 @@
android:background="@color/WhiteSmoke"/> android:background="@color/WhiteSmoke"/>
<LinearLayout
android:id="@+id/NothingFoundHint"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="64sp"
android:text="@string/no_items"
app:drawableTopCompat="@drawable/outline_all_inclusive_24"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -109,4 +109,20 @@
android:textSize="78sp" android:textSize="78sp"
android:background="@color/WhiteSmoke"/> android:background="@color/WhiteSmoke"/>
<LinearLayout
android:id="@+id/NothingFoundHint"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="64sp"
android:text="@string/no_items"
app:drawableTopCompat="@drawable/outline_all_inclusive_24"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -88,5 +88,6 @@
<string name="setting_hide_hidden_file">隐藏点文件</string> <string name="setting_hide_hidden_file">隐藏点文件</string>
<string name="setting_hide_hidden_file_description">隐藏所有以 . 开头的文件和文件夹\n. 开头的文件(或文件夹)通常表示隐藏文件(或文件夹)\n此选项只对查看全部文件功能有效</string> <string name="setting_hide_hidden_file_description">隐藏所有以 . 开头的文件和文件夹\n. 开头的文件(或文件夹)通常表示隐藏文件(或文件夹)\n此选项只对查看全部文件功能有效</string>
<string name="no_items">无内容</string>
<string name="about">关于</string> <string name="about">关于</string>
</resources> </resources>