fix: resolve double-padding on chat screen when keyboard is opened
This commit is contained in:
@@ -11,10 +11,10 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
android:windowSoftInputMode="adjustResize"
|
|
||||||
android:theme="@style/Theme.HermesControl">
|
android:theme="@style/Theme.HermesControl">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
|
android:windowSoftInputMode="adjustResize"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|||||||
@@ -256,25 +256,20 @@ fun ChatScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
bottomBar = {
|
|
||||||
ChatInputBar(
|
|
||||||
inputText = inputText,
|
|
||||||
onInputChange = { inputText = it },
|
|
||||||
onSend = {
|
|
||||||
viewModel.sendMessage(inputText)
|
|
||||||
inputText = ""
|
|
||||||
},
|
|
||||||
onInterrupt = viewModel::interruptSession,
|
|
||||||
isAgentTyping = state.isAgentTyping,
|
|
||||||
isConnected = state.isConnected,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
Box(
|
Column(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(paddingValues),
|
.padding(paddingValues)
|
||||||
|
.navigationBarsPadding()
|
||||||
|
.imePadding(),
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier =
|
||||||
|
Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.fillMaxWidth(),
|
||||||
) {
|
) {
|
||||||
if (state.messages.isEmpty() && !state.isLoading) {
|
if (state.messages.isEmpty() && !state.isLoading) {
|
||||||
// Empty state
|
// Empty state
|
||||||
@@ -305,7 +300,7 @@ fun ChatScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Loading overlay
|
// Loading overlay
|
||||||
AnimatedVisibility(
|
androidx.compose.animation.AnimatedVisibility(
|
||||||
visible = state.isLoading,
|
visible = state.isLoading,
|
||||||
enter = fadeIn(),
|
enter = fadeIn(),
|
||||||
exit = fadeOut(),
|
exit = fadeOut(),
|
||||||
@@ -342,6 +337,19 @@ fun ChatScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChatInputBar(
|
||||||
|
inputText = inputText,
|
||||||
|
onInputChange = { inputText = it },
|
||||||
|
onSend = {
|
||||||
|
viewModel.sendMessage(inputText)
|
||||||
|
inputText = ""
|
||||||
|
},
|
||||||
|
onInterrupt = viewModel::interruptSession,
|
||||||
|
isAgentTyping = state.isAgentTyping,
|
||||||
|
isConnected = state.isConnected,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,11 +460,7 @@ private fun ChatInputBar(
|
|||||||
exit = slideOutVertically(targetOffsetY = { it }),
|
exit = slideOutVertically(targetOffsetY = { it }),
|
||||||
) {
|
) {
|
||||||
Card(
|
Card(
|
||||||
modifier =
|
modifier = Modifier.fillMaxWidth(),
|
||||||
Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.navigationBarsPadding()
|
|
||||||
.imePadding(),
|
|
||||||
shape = RoundedCornerShape(topStart = 16.dp, topEnd = 16.dp),
|
shape = RoundedCornerShape(topStart = 16.dp, topEnd = 16.dp),
|
||||||
colors =
|
colors =
|
||||||
CardDefaults.cardColors(
|
CardDefaults.cardColors(
|
||||||
|
|||||||
Reference in New Issue
Block a user