@@ -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