Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix activity resize not interacting well with IME keyboard #220

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.NanoLedger"
android:windowSoftInputMode="adjustResize"
>
<activity
android:name=".ui.main.MainActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize"
android:theme="@style/Theme.NanoLedger"
android:launchMode="singleInstance">
<intent-filter>
Expand All @@ -23,17 +23,14 @@
<activity
android:exported="false"
android:name=".ui.preferences.PreferencesActivity"
android:windowSoftInputMode="adjustResize"
/>
<activity
android:exported="false"
android:name=".ui.add.AddActivity"
android:windowSoftInputMode="adjustResize"
/>
<activity
android:exported="false"
android:name=".ui.edit.EditActivity"
android:windowSoftInputMode="adjustResize"
/>
</application>

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/be/chvp/nanoledger/ui/add/AddActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.activity.compose.BackHandler
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.compose.foundation.layout.imePadding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.Done
Expand All @@ -30,6 +31,7 @@ import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import be.chvp.nanoledger.R
Expand Down Expand Up @@ -107,6 +109,7 @@ class AddActivity() : ComponentActivity() {
}
}
},
modifier = Modifier.imePadding(),
) { contentPadding ->
TransactionForm(addViewModel, contentPadding, snackbarHostState)
}
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/be/chvp/nanoledger/ui/edit/EditActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.activity.compose.BackHandler
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.compose.foundation.layout.imePadding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.Done
Expand All @@ -30,6 +31,7 @@ import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import be.chvp.nanoledger.R
Expand Down Expand Up @@ -109,6 +111,7 @@ class EditActivity() : ComponentActivity() {
}
}
},
modifier = Modifier.imePadding(),
) { contentPadding ->
TransactionForm(editViewModel, contentPadding, snackbarHostState)
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/be/chvp/nanoledger/ui/main/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.text.KeyboardActions
Expand Down Expand Up @@ -147,6 +148,7 @@ class MainActivity : ComponentActivity() {
}
}
},
modifier = Modifier.imePadding(),
) { contentPadding ->
if (fileUri != null) {
MainContent(contentPadding)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.activity.viewModels
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.KeyboardOptions
Expand Down Expand Up @@ -85,7 +86,7 @@ class PreferencesActivity() : ComponentActivity() {
"," to stringResource(R.string.separator_comma),
)
NanoLedgerTheme {
Scaffold(topBar = { Bar() }) { contentPadding ->
Scaffold(topBar = { Bar() }, modifier = Modifier.imePadding()) { contentPadding ->
Column(
modifier =
Modifier
Expand Down
Loading