From f142743f4c49464e7305d7b7f6aeeda24a7e8f4a Mon Sep 17 00:00:00 2001 From: aro Date: Fri, 6 Jan 2023 19:44:47 +0100 Subject: [PATCH] feat: only show icons in minmode --- .../atnrch/wrench/components/AppBottomBar.kt | 8 ++--- .../filemanager/bottom/AddOutputButton.kt | 7 +++-- ...ormalFileBottomRow.kt => FileBottomRow.kt} | 14 ++++----- .../filemanager/bottom/MoveFilesButton.kt | 7 +++-- .../filemanager/bottom/RemoveOutputButton.kt | 7 +++-- .../bottom/bar/SmallFileBottomRow.kt | 31 ------------------- 6 files changed, 23 insertions(+), 51 deletions(-) rename src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/{bar/NormalFileBottomRow.kt => FileBottomRow.kt} (57%) delete mode 100644 src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/bar/SmallFileBottomRow.kt diff --git a/src/main/kotlin/xyz/atnrch/wrench/components/AppBottomBar.kt b/src/main/kotlin/xyz/atnrch/wrench/components/AppBottomBar.kt index 3fc7f53..780bd92 100644 --- a/src/main/kotlin/xyz/atnrch/wrench/components/AppBottomBar.kt +++ b/src/main/kotlin/xyz/atnrch/wrench/components/AppBottomBar.kt @@ -4,8 +4,7 @@ import androidx.compose.foundation.shape.CornerSize import androidx.compose.material.BottomAppBar import androidx.compose.material.MaterialTheme import androidx.compose.runtime.Composable -import xyz.atnrch.wrench.components.filemanager.bottom.bar.NormalFileBottomRow -import xyz.atnrch.wrench.components.filemanager.bottom.bar.SmallFileBottomRow +import xyz.atnrch.wrench.components.filemanager.bottom.FileBottomRow import xyz.atnrch.wrench.ui.UIColors import xyz.atnrch.wrench.watcher.Watcher import xyz.atnrch.wrench.watcher.WatcherManager @@ -26,9 +25,6 @@ fun AppBottomBar( ), backgroundColor = UIColors.DARK ) { - if (minMode) - NormalFileBottomRow(watcherManager, watcher, currentClick, outputs, onCurrentClick) - else - SmallFileBottomRow(watcherManager, watcher, currentClick, outputs, onCurrentClick) + FileBottomRow(minMode, watcherManager, watcher, currentClick, outputs, onCurrentClick) } } \ No newline at end of file diff --git a/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/AddOutputButton.kt b/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/AddOutputButton.kt index 3f5bb6a..11a0639 100644 --- a/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/AddOutputButton.kt +++ b/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/AddOutputButton.kt @@ -25,6 +25,7 @@ import java.nio.file.Path @Composable fun AddOutputButton( + minMode: Boolean, watcherManager: WatcherManager, outputs: MutableList, currentClick: Int @@ -58,7 +59,9 @@ fun AddOutputButton( contentDescription = "Add output", modifier = Modifier.size(22.dp) ) - Spacer(Modifier.size(ButtonDefaults.IconSpacing)) - Text("Add output...") + if(!minMode) { + Spacer(Modifier.size(ButtonDefaults.IconSpacing)) + Text("Add output...") + } } } \ No newline at end of file diff --git a/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/bar/NormalFileBottomRow.kt b/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/FileBottomRow.kt similarity index 57% rename from src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/bar/NormalFileBottomRow.kt rename to src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/FileBottomRow.kt index 0c69bd0..16f914c 100644 --- a/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/bar/NormalFileBottomRow.kt +++ b/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/FileBottomRow.kt @@ -1,19 +1,17 @@ -package xyz.atnrch.wrench.components.filemanager.bottom.bar +package xyz.atnrch.wrench.components.filemanager.bottom import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.width import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import xyz.atnrch.wrench.components.filemanager.bottom.AddOutputButton -import xyz.atnrch.wrench.components.filemanager.bottom.MoveFilesButton -import xyz.atnrch.wrench.components.filemanager.bottom.RemoveOutputButton import xyz.atnrch.wrench.watcher.Watcher import xyz.atnrch.wrench.watcher.WatcherManager import java.nio.file.Path @Composable -fun NormalFileBottomRow( +fun FileBottomRow( + minMode: Boolean, watcherManager: WatcherManager, watcher: Watcher, currentClick: Int, @@ -21,11 +19,11 @@ fun NormalFileBottomRow( onCurrentClick: (Int) -> Unit, ) { Spacer(Modifier.width(10.dp)) - MoveFilesButton(watcher) + MoveFilesButton(minMode, watcher) if (currentClick != -1) { Spacer(Modifier.width(10.dp)) - AddOutputButton(watcherManager, outputs, currentClick) + AddOutputButton(minMode, watcherManager, outputs, currentClick) Spacer(Modifier.width(10.dp)) - RemoveOutputButton(watcherManager, outputs, currentClick, onCurrentClick) + RemoveOutputButton(minMode, watcherManager, outputs, currentClick, onCurrentClick) } } \ No newline at end of file diff --git a/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/MoveFilesButton.kt b/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/MoveFilesButton.kt index d14ab72..2f8a8fa 100644 --- a/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/MoveFilesButton.kt +++ b/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/MoveFilesButton.kt @@ -21,6 +21,7 @@ import xyz.atnrch.wrench.watcher.Watcher @Composable fun MoveFilesButton( + minMode: Boolean, watcher: Watcher ) { Button( @@ -42,7 +43,9 @@ fun MoveFilesButton( contentDescription = "Start", modifier = Modifier.size(22.dp) ) - Spacer(Modifier.size(ButtonDefaults.IconSpacing)) - Text("Move files") + if(!minMode) { + Spacer(Modifier.size(ButtonDefaults.IconSpacing)) + Text("Move files") + } } } \ No newline at end of file diff --git a/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/RemoveOutputButton.kt b/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/RemoveOutputButton.kt index 1ee66f5..daac13c 100644 --- a/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/RemoveOutputButton.kt +++ b/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/RemoveOutputButton.kt @@ -23,6 +23,7 @@ import java.nio.file.Path @Composable fun RemoveOutputButton( + minMode: Boolean, watcherManager: WatcherManager, outputs: MutableList, currentClick: Int, @@ -53,7 +54,9 @@ fun RemoveOutputButton( contentDescription = "Remove file", modifier = Modifier.size(22.dp) ) - Spacer(Modifier.size(ButtonDefaults.IconSpacing)) - Text("Delete input") + if (!minMode) { + Spacer(Modifier.size(ButtonDefaults.IconSpacing)) + Text("Delete input") + } } } diff --git a/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/bar/SmallFileBottomRow.kt b/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/bar/SmallFileBottomRow.kt deleted file mode 100644 index 2818de2..0000000 --- a/src/main/kotlin/xyz/atnrch/wrench/components/filemanager/bottom/bar/SmallFileBottomRow.kt +++ /dev/null @@ -1,31 +0,0 @@ -package xyz.atnrch.wrench.components.filemanager.bottom.bar - -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.width -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import xyz.atnrch.wrench.components.filemanager.bottom.AddOutputButton -import xyz.atnrch.wrench.components.filemanager.bottom.MoveFilesButton -import xyz.atnrch.wrench.components.filemanager.bottom.RemoveOutputButton -import xyz.atnrch.wrench.watcher.Watcher -import xyz.atnrch.wrench.watcher.WatcherManager -import java.nio.file.Path - -@Composable -fun SmallFileBottomRow( - watcherManager: WatcherManager, - watcher: Watcher, - currentClick: Int, - outputs: MutableList, - onCurrentClick: (Int) -> Unit, -) { - Spacer(Modifier.width(5.dp)) - MoveFilesButton(watcher) - if (currentClick != -1) { - Spacer(Modifier.width(5.dp)) - AddOutputButton(watcherManager, outputs, currentClick) - Spacer(Modifier.width(5.dp)) - RemoveOutputButton(watcherManager, outputs, currentClick, onCurrentClick) - } -} \ No newline at end of file