Skip to content

Commit 8799f13

Browse files
committed
Fix tab FAB when disconnected
1 parent b59caae commit 8799f13

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ android {
4444
}
4545

4646
defaultConfig {
47-
buildConfigField("String", "MIN_MAC_APP_VERSION", "\"2.6.0\"")
47+
buildConfigField("String", "MIN_MAC_APP_VERSION", "\"2.5.0\"")
4848
}
4949
}
5050

app/src/main/java/com/sameerasw/airsync/presentation/ui/screens/AirSyncMainScreen.kt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -930,17 +930,18 @@ fun AirSyncMainScreen(
930930
},
931931
scrollBehavior = exitAlwaysScrollBehavior,
932932
floatingActionButton = {
933+
val currentTab = tabs.getOrNull(pagerState.currentPage)
933934
FloatingToolbarDefaults.StandardFloatingActionButton(
934935
onClick = {
935936
HapticUtil.performClick(haptics)
936-
when (pagerState.currentPage) {
937-
1 -> { // Remote Tab
937+
when (currentTab?.title) {
938+
"Remote" -> {
938939
showKeyboard = !showKeyboard
939940
}
940-
2 -> { // Clipboard Tab
941+
"Clipboard" -> {
941942
viewModel.clearClipboardHistory()
942943
}
943-
else -> { // Connect (0) or Settings (3)
944+
else -> { // Connect or Settings
944945
if (uiState.isConnected) {
945946
disconnect()
946947
} else {
@@ -950,14 +951,14 @@ fun AirSyncMainScreen(
950951
}
951952
}
952953
) {
953-
when (pagerState.currentPage) {
954-
1 -> { // Remote Tab
954+
when (currentTab?.title) {
955+
"Remote" -> {
955956
Icon(Icons.Rounded.Keyboard, contentDescription = "Keyboard")
956957
}
957-
2 -> { // Clipboard Tab
958+
"Clipboard" -> {
958959
Icon(Icons.Rounded.Delete, contentDescription = "Clear History")
959960
}
960-
else -> { // Connect (0) or Settings (3)
961+
else -> { // Connect or Settings
961962
if (uiState.isConnected) {
962963
Icon(imageVector = Icons.Filled.LinkOff, contentDescription = "Disconnect")
963964
} else {

0 commit comments

Comments
 (0)