summaryrefslogtreecommitdiffhomepage
path: root/ui/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'ui/src/main/java')
-rw-r--r--ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt8
1 files changed, 4 insertions, 4 deletions
diff --git a/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt b/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt
index 32fbe387..301ac5f4 100644
--- a/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt
+++ b/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt
@@ -204,9 +204,9 @@ class TvMainActivity : AppCompatActivity() {
val storageManager: StorageManager = getSystemService() ?: return@withContext list
list.addAll(storageManager.storageVolumes.mapNotNull { volume ->
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
- volume.directory?.let { KeyedFile(it.canonicalPath) }
+ volume.directory?.let { KeyedFile(it.canonicalPath, volume.getDescription(this@TvMainActivity)) }
} else {
- KeyedFile((StorageVolume::class.java.getMethod("getPathFile").invoke(volume) as File).canonicalPath)
+ KeyedFile((StorageVolume::class.java.getMethod("getPathFile").invoke(volume) as File).canonicalPath, volume.getDescription(this@TvMainActivity))
}
})
} else {
@@ -319,9 +319,9 @@ class TvMainActivity : AppCompatActivity() {
}
}
- class KeyedFile(pathname: String) : File(pathname), Keyed<String> {
+ class KeyedFile(pathname: String, private val forcedKey: String? = null) : File(pathname), Keyed<String> {
override val key: String
- get() = if (isDirectory) "$name/" else name
+ get() = forcedKey ?: if (isDirectory) "$name/" else name
}
companion object {