mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 20:38:40 +00:00
More fixes
This commit is contained in:
committed by
Benoit Marty
parent
bf1462f9b1
commit
97de57fd79
+4
-4
@@ -207,7 +207,7 @@ fun AdvancedSettingsView(
|
|||||||
if (state.liveLocationMinimumDistanceUpdate != null) {
|
if (state.liveLocationMinimumDistanceUpdate != null) {
|
||||||
LiveLocationUpdatesSection(
|
LiveLocationUpdatesSection(
|
||||||
value = state.liveLocationMinimumDistanceUpdate,
|
value = state.liveLocationMinimumDistanceUpdate,
|
||||||
onValueSaved = { value ->
|
onSaveValue = { value ->
|
||||||
state.eventSink(AdvancedSettingsEvents.SetLiveLocationMinimumDistanceUpdate(value))
|
state.eventSink(AdvancedSettingsEvents.SetLiveLocationMinimumDistanceUpdate(value))
|
||||||
},
|
},
|
||||||
onOpenAppPermissionsClick = onOpenAppSettingsClick,
|
onOpenAppPermissionsClick = onOpenAppSettingsClick,
|
||||||
@@ -340,11 +340,11 @@ private fun ModerationAndSafety(
|
|||||||
@Composable
|
@Composable
|
||||||
private fun LiveLocationUpdatesSection(
|
private fun LiveLocationUpdatesSection(
|
||||||
value: Int,
|
value: Int,
|
||||||
onValueSaved: (Int) -> Unit,
|
onSaveValue: (Int) -> Unit,
|
||||||
onOpenAppPermissionsClick: () -> Unit,
|
onOpenAppPermissionsClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val updatedOnValueSaved by rememberUpdatedState(onValueSaved)
|
val updatedOnSaveValue by rememberUpdatedState(onSaveValue)
|
||||||
PreferenceCategory(
|
PreferenceCategory(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
showTopDivider = true,
|
showTopDivider = true,
|
||||||
@@ -384,7 +384,7 @@ private fun LiveLocationUpdatesSection(
|
|||||||
value = sliderValue.toFloat(),
|
value = sliderValue.toFloat(),
|
||||||
onValueChange = { sliderValue = it.roundToInt() },
|
onValueChange = { sliderValue = it.roundToInt() },
|
||||||
onValueChangeFinish = {
|
onValueChangeFinish = {
|
||||||
updatedOnValueSaved(sliderValue)
|
updatedOnSaveValue(sliderValue)
|
||||||
},
|
},
|
||||||
valueRange = valueRange,
|
valueRange = valueRange,
|
||||||
colors = SliderDefaults.colors(
|
colors = SliderDefaults.colors(
|
||||||
|
|||||||
+1
-1
@@ -41,7 +41,7 @@ class AddRoomToSpaceNode(
|
|||||||
AddRoomToSpaceView(
|
AddRoomToSpaceView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackClick = callback::onFinish,
|
onBackClick = callback::onFinish,
|
||||||
onRoomsAdded = callback::onFinish,
|
onAddRoom = callback::onFinish,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-3
@@ -23,6 +23,8 @@ import androidx.compose.foundation.lazy.rememberLazyListState
|
|||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.rememberUpdatedState
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
@@ -57,9 +59,10 @@ import kotlinx.collections.immutable.toImmutableList
|
|||||||
fun AddRoomToSpaceView(
|
fun AddRoomToSpaceView(
|
||||||
state: AddRoomToSpaceState,
|
state: AddRoomToSpaceState,
|
||||||
onBackClick: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onRoomsAdded: () -> Unit,
|
onAddRoom: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
val updatedOnAddRoom by rememberUpdatedState(onAddRoom)
|
||||||
fun onRoomToggled(room: SelectRoomInfo) {
|
fun onRoomToggled(room: SelectRoomInfo) {
|
||||||
state.eventSink(AddRoomToSpaceEvent.ToggleRoom(room))
|
state.eventSink(AddRoomToSpaceEvent.ToggleRoom(room))
|
||||||
}
|
}
|
||||||
@@ -78,7 +81,7 @@ fun AddRoomToSpaceView(
|
|||||||
// Navigate back on success
|
// Navigate back on success
|
||||||
LaunchedEffect(state.saveAction) {
|
LaunchedEffect(state.saveAction) {
|
||||||
if (state.saveAction is AsyncAction.Success) {
|
if (state.saveAction is AsyncAction.Success) {
|
||||||
onRoomsAdded()
|
updatedOnAddRoom()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,6 +250,6 @@ internal fun AddRoomToSpaceViewPreview(
|
|||||||
AddRoomToSpaceView(
|
AddRoomToSpaceView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackClick = {},
|
onBackClick = {},
|
||||||
onRoomsAdded = {},
|
onAddRoom = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -125,7 +125,7 @@ private fun AndroidComposeUiTest<ComponentActivity>.setAddRoomToSpaceView(
|
|||||||
AddRoomToSpaceView(
|
AddRoomToSpaceView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackClick = onBackClick,
|
onBackClick = onBackClick,
|
||||||
onRoomsAdded = onRoomsAdded,
|
onAddRoom = onRoomsAdded,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -32,6 +32,7 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.movableContentOf
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
@@ -419,7 +420,7 @@ fun TextComposer(
|
|||||||
|
|
||||||
// Re-focus the text input when voice recording ends so the user can continue typing
|
// Re-focus the text input when voice recording ends so the user can continue typing
|
||||||
var previousVoiceMessageState by remember { mutableStateOf(voiceMessageState) }
|
var previousVoiceMessageState by remember { mutableStateOf(voiceMessageState) }
|
||||||
LaunchedEffect(voiceMessageState) {
|
LaunchedEffect(voiceMessageState, onRequestFocus) {
|
||||||
if (voiceMessageState is VoiceMessageState.Idle && previousVoiceMessageState !is VoiceMessageState.Idle) {
|
if (voiceMessageState is VoiceMessageState.Idle && previousVoiceMessageState !is VoiceMessageState.Idle) {
|
||||||
onRequestFocus()
|
onRequestFocus()
|
||||||
}
|
}
|
||||||
@@ -522,6 +523,7 @@ private fun StandardLayout(
|
|||||||
.padding(bottom = 8.dp, top = 8.dp)
|
.padding(bottom = 8.dp, top = 8.dp)
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
) {
|
) {
|
||||||
|
val movableVoiceRecording = remember { movableContentOf { voiceRecording() } }
|
||||||
if (voiceMessageState is VoiceMessageState.Idle) {
|
if (voiceMessageState is VoiceMessageState.Idle) {
|
||||||
textInput()
|
textInput()
|
||||||
} else if (composerMode is MessageComposerMode.Special) {
|
} else if (composerMode is MessageComposerMode.Special) {
|
||||||
@@ -530,10 +532,10 @@ private fun StandardLayout(
|
|||||||
onResetComposerMode = onResetComposerMode,
|
onResetComposerMode = onResetComposerMode,
|
||||||
isTextEmpty = true,
|
isTextEmpty = true,
|
||||||
) {
|
) {
|
||||||
voiceRecording()
|
movableVoiceRecording()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
voiceRecording()
|
movableVoiceRecording()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// To avoid loosing keyboard focus, the IconButton has to be defined here and has to be always enabled.
|
// To avoid loosing keyboard focus, the IconButton has to be defined here and has to be always enabled.
|
||||||
|
|||||||
Reference in New Issue
Block a user