Skip to content

Commit ad35907

Browse files
committed
Fix android 15 edge to edge
1 parent 80ead51 commit ad35907

File tree

8 files changed

+242
-254
lines changed

8 files changed

+242
-254
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,35 @@
2828
android:theme="@style/Theme.MyApplication">
2929
<activity
3030
android:name=".ui.AdvancedSyncSettingsActivity"
31+
android:windowSoftInputMode="adjustResize"
3132
android:exported="false" />
3233
<activity
3334
android:name=".ui.SyncErrorsActivity"
35+
android:windowSoftInputMode="adjustResize"
3436
android:exported="false"
3537
android:label="@string/sync_errors_activity_title"
3638
android:launchMode="singleTop" />
3739
<activity
3840
android:name=".ui.PermissionsActivity"
41+
android:windowSoftInputMode="adjustResize"
3942
android:exported="false"
4043
android:label="@string/permissions_activity_title"
4144
android:launchMode="singleTop" />
4245
<activity
4346
android:name=".ui.DavSettingsActivity"
47+
android:windowSoftInputMode="adjustResize"
4448
android:exported="false"
4549
android:label="@string/dav_settings_activity_title"
4650
android:launchMode="singleTop" />
4751
<activity
4852
android:name=".ui.SyncSettingsActivity"
53+
android:windowSoftInputMode="adjustResize"
4954
android:exported="false"
5055
android:label="@string/sync_settings_activity_title"
5156
android:launchMode="singleTop" />
5257
<activity
5358
android:name=".ui.MainActivity"
59+
android:windowSoftInputMode="adjustResize"
5460
android:exported="true"
5561
android:launchMode="singleTop">
5662
<intent-filter>

app/src/main/java/com/phpbg/easysync/ui/AdvancedSyncSettingsActivity.kt

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import androidx.compose.material.icons.Icons
4040
import androidx.compose.material.icons.filled.Warning
4141
import androidx.compose.material3.CircularProgressIndicator
4242
import androidx.compose.material3.MaterialTheme
43-
import androidx.compose.material3.Surface
4443
import androidx.compose.runtime.Composable
4544
import androidx.compose.runtime.livedata.observeAsState
4645
import androidx.compose.ui.Modifier
@@ -53,7 +52,7 @@ import com.phpbg.easysync.ui.components.StatusTitle
5352
import com.phpbg.easysync.ui.components.StdText
5453
import com.phpbg.easysync.ui.components.SwitchSetting
5554
import com.phpbg.easysync.ui.components.Title
56-
import com.phpbg.easysync.ui.theme.EasySyncTheme
55+
import com.phpbg.easysync.ui.theme.ThemeSurface
5756

5857
class AdvancedSyncSettingsActivity : ComponentActivity() {
5958

@@ -67,18 +66,17 @@ class AdvancedSyncSettingsActivity : ComponentActivity() {
6766
override fun onCreate(savedInstanceState: Bundle?) {
6867
super.onCreate(savedInstanceState)
6968
setContent {
70-
EasySyncTheme {
71-
Surface(
72-
modifier = Modifier.fillMaxSize(),
73-
color = MaterialTheme.colorScheme.background
74-
) {
75-
val uiState = viewModel.advancedSyncSettingsUiState.observeAsState()
76-
Main(
77-
uiState = uiState.value ?: AdvancedSyncSettingsUiState(paths = listOf(), errorMsg = null),
78-
toggleExclusionHandler = viewModel::toggleExclusion
79-
)
80-
}
69+
ThemeSurface {
70+
val uiState = viewModel.advancedSyncSettingsUiState.observeAsState()
71+
Main(
72+
uiState = uiState.value ?: AdvancedSyncSettingsUiState(
73+
paths = listOf(),
74+
errorMsg = null
75+
),
76+
toggleExclusionHandler = viewModel::toggleExclusion
77+
)
8178
}
79+
8280
}
8381
}
8482
}
@@ -126,7 +124,7 @@ private fun Main(
126124
@Preview(name = "Dark Mode", uiMode = Configuration.UI_MODE_NIGHT_YES, showBackground = false)
127125
@Composable
128126
private fun MainPreview() {
129-
EasySyncTheme {
127+
ThemeSurface {
130128
Main(
131129
uiState = AdvancedSyncSettingsUiState(
132130
paths = listOf(
@@ -147,7 +145,7 @@ private fun MainPreview() {
147145
@Preview(name = "Light Mode", showBackground = true)
148146
@Composable
149147
private fun MainPreviewError() {
150-
EasySyncTheme {
148+
ThemeSurface {
151149
Main(
152150
uiState = AdvancedSyncSettingsUiState(
153151
paths = listOf(

app/src/main/java/com/phpbg/easysync/ui/DavSettingsActivity.kt

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,14 @@ import androidx.compose.material3.ExperimentalMaterial3Api
4747
import androidx.compose.material3.Icon
4848
import androidx.compose.material3.IconButton
4949
import androidx.compose.material3.MaterialTheme
50-
import androidx.compose.material3.Surface
5150
import androidx.compose.material3.Text
5251
import androidx.compose.material3.TextField
5352
import androidx.compose.runtime.Composable
5453
import androidx.compose.runtime.collectAsState
5554
import androidx.compose.runtime.getValue
5655
import androidx.compose.runtime.mutableStateOf
57-
import androidx.compose.runtime.setValue
5856
import androidx.compose.runtime.saveable.rememberSaveable
57+
import androidx.compose.runtime.setValue
5958
import androidx.compose.ui.Modifier
6059
import androidx.compose.ui.res.stringResource
6160
import androidx.compose.ui.text.input.KeyboardCapitalization
@@ -67,7 +66,7 @@ import androidx.compose.ui.unit.dp
6766
import com.phpbg.easysync.R
6867
import com.phpbg.easysync.settings.Settings
6968
import com.phpbg.easysync.ui.components.Title
70-
import com.phpbg.easysync.ui.theme.EasySyncTheme
69+
import com.phpbg.easysync.ui.theme.ThemeSurface
7170

7271
class DavSettingsActivity : ComponentActivity() {
7372

@@ -78,23 +77,18 @@ class DavSettingsActivity : ComponentActivity() {
7877
viewModel.load()
7978

8079
setContent {
81-
EasySyncTheme {
82-
// A surface container using the 'background' color from the theme
83-
Surface(
84-
modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background
85-
) {
86-
val uiState = viewModel.uiState.collectAsState()
87-
88-
if (uiState.value.davConnected == true) {
89-
finish()
90-
}
80+
ThemeSurface {
81+
val uiState = viewModel.uiState.collectAsState()
9182

92-
Preferences(
93-
uiState = uiState.value,
94-
stateChangeHandler = viewModel::stateChangeHandler,
95-
saveHandler = viewModel::save
96-
)
83+
if (uiState.value.davConnected == true) {
84+
finish()
9785
}
86+
87+
Preferences(
88+
uiState = uiState.value,
89+
stateChangeHandler = viewModel::stateChangeHandler,
90+
saveHandler = viewModel::save
91+
)
9892
}
9993
}
10094
}
@@ -117,7 +111,10 @@ private fun Preferences(
117111
Title(text = stringResource(R.string.dav_settings_title))
118112
Spacer(modifier = Modifier.height(8.dp))
119113
if (uiState.hasFilesSynced == true) {
120-
Text(text = "Synchronization already started. Changing URL or path is highly discouraged and will lead to data loss. You should only change login/password", color = MaterialTheme.colorScheme.error)
114+
Text(
115+
text = "Synchronization already started. Changing URL or path is highly discouraged and will lead to data loss. You should only change login/password",
116+
color = MaterialTheme.colorScheme.error
117+
)
121118
Spacer(modifier = Modifier.height(8.dp))
122119
}
123120
TextField(
@@ -135,7 +132,10 @@ private fun Preferences(
135132
)
136133
Spacer(modifier = Modifier.height(8.dp))
137134
if (uiState.settings.url.startsWith("http://", true)) {
138-
Text(text = stringResource(R.string.dav_settings_url_insecure), color = MaterialTheme.colorScheme.error)
135+
Text(
136+
text = stringResource(R.string.dav_settings_url_insecure),
137+
color = MaterialTheme.colorScheme.error
138+
)
139139
Spacer(modifier = Modifier.height(8.dp))
140140
}
141141
TextField(value = uiState.settings.username,
@@ -179,14 +179,21 @@ private fun Preferences(
179179
)
180180
Spacer(modifier = Modifier.height(8.dp))
181181
if (uiState.showRemoteNotEmpty) {
182-
Text(text = stringResource(R.string.dav_settings_remote_not_empty), color = MaterialTheme.colorScheme.error)
182+
Text(
183+
text = stringResource(R.string.dav_settings_remote_not_empty),
184+
color = MaterialTheme.colorScheme.error
185+
)
183186
Spacer(modifier = Modifier.height(8.dp))
184187
}
185188
Button(onClick = saveHandler, enabled = !uiState.ongoingIO) {
186189
if (uiState.ongoingIO) {
187190
CircularProgressIndicator(color = MaterialTheme.colorScheme.outline)
188191
} else {
189-
val text = if (uiState.showRemoteNotEmpty) {R.string.dav_settings_save_anyway} else {R.string.dav_settings_save}
192+
val text = if (uiState.showRemoteNotEmpty) {
193+
R.string.dav_settings_save_anyway
194+
} else {
195+
R.string.dav_settings_save
196+
}
190197
Text(text = stringResource(text))
191198
}
192199
}
@@ -203,15 +210,18 @@ private fun Preferences(
203210
@Preview(name = "FR", showBackground = true, locale = "fr")
204211
@Composable
205212
private fun PreferencesPreview() {
206-
EasySyncTheme {
213+
ThemeSurface {
207214
Preferences(uiState = DavSettingsUiState(), stateChangeHandler = { }, saveHandler = { })
208215
}
209216
}
210217

211218
@Preview(name = "Light Mode", showBackground = true)
212219
@Composable
213220
private fun PreferencesPreviewWithCircularIndicator() {
214-
EasySyncTheme {
215-
Preferences(uiState = DavSettingsUiState(ongoingIO = true), stateChangeHandler = { }, saveHandler = { })
221+
ThemeSurface {
222+
Preferences(
223+
uiState = DavSettingsUiState(ongoingIO = true),
224+
stateChangeHandler = { },
225+
saveHandler = { })
216226
}
217227
}

app/src/main/java/com/phpbg/easysync/ui/MainActivity.kt

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import androidx.compose.foundation.layout.padding
4545
import androidx.compose.foundation.rememberScrollState
4646
import androidx.compose.foundation.verticalScroll
4747
import androidx.compose.material.icons.Icons
48-
import androidx.compose.material.icons.filled.Help
48+
import androidx.compose.material.icons.automirrored.filled.Help
4949
import androidx.compose.material.icons.filled.Cancel
5050
import androidx.compose.material.icons.filled.CheckCircle
5151
import androidx.compose.material.icons.filled.Info
@@ -57,7 +57,6 @@ import androidx.compose.material3.MaterialTheme
5757
import androidx.compose.material3.SnackbarDuration
5858
import androidx.compose.material3.SnackbarHost
5959
import androidx.compose.material3.SnackbarHostState
60-
import androidx.compose.material3.Surface
6160
import androidx.compose.material3.Text
6261
import androidx.compose.runtime.Composable
6362
import androidx.compose.runtime.IntState
@@ -84,7 +83,7 @@ import com.phpbg.easysync.ui.components.StatusTitle
8483
import com.phpbg.easysync.ui.components.StatusTitleClickable
8584
import com.phpbg.easysync.ui.components.StdText
8685
import com.phpbg.easysync.ui.components.Title
87-
import com.phpbg.easysync.ui.theme.EasySyncTheme
86+
import com.phpbg.easysync.ui.theme.ThemeSurface
8887
import kotlinx.coroutines.launch
8988
import kotlin.math.round
9089

@@ -111,32 +110,27 @@ class MainActivity : ComponentActivity() {
111110
super.onCreate(savedInstanceState)
112111

113112
setContent {
114-
EasySyncTheme {
115-
// A surface container using the 'background' color from the theme
116-
Surface(
117-
modifier = Modifier.fillMaxSize(),
118-
color = MaterialTheme.colorScheme.background
119-
) {
120-
val workerState = viewModel.workInfosList.observeAsState()
121-
val syncedCount = viewModel.syncedFileCount.observeAsState()
122-
val localCount = viewModel.localFilesCount.observeAsState()
123-
val jobCount = viewModel.jobCount.observeAsState()
124-
val syncronizationErrorCount = viewModel.synchronizationErrorCount.observeAsState()
125-
Main(
126-
workerState = workerState.value,
127-
fullSyncNowHandler = viewModel::fullSyncNowHandler,
128-
syncedCount = syncedCount.value ?: -1,
129-
localCount = localCount.value ?: -1,
130-
jobCount = jobCount.value ?: -1,
131-
showDavStatus = viewModel.showDavStatus,
132-
isDavLoading = viewModel.isDavLoading,
133-
isDavConnected = viewModel.isDavConnected,
134-
isTrial = viewModel.isTrial,
135-
hasOptionalPermissions = hasOptionalPermissions,
136-
trialRemainingDays = viewModel.trialRemainingDays,
137-
syncronizationErrorCount = syncronizationErrorCount.value ?: -1,
138-
)
139-
}
113+
ThemeSurface {
114+
val workerState = viewModel.workInfosList.observeAsState()
115+
val syncedCount = viewModel.syncedFileCount.observeAsState()
116+
val localCount = viewModel.localFilesCount.observeAsState()
117+
val jobCount = viewModel.jobCount.observeAsState()
118+
val syncronizationErrorCount =
119+
viewModel.synchronizationErrorCount.observeAsState()
120+
Main(
121+
workerState = workerState.value,
122+
fullSyncNowHandler = viewModel::fullSyncNowHandler,
123+
syncedCount = syncedCount.value ?: -1,
124+
localCount = localCount.value ?: -1,
125+
jobCount = jobCount.value ?: -1,
126+
showDavStatus = viewModel.showDavStatus,
127+
isDavLoading = viewModel.isDavLoading,
128+
isDavConnected = viewModel.isDavConnected,
129+
isTrial = viewModel.isTrial,
130+
hasOptionalPermissions = hasOptionalPermissions,
131+
trialRemainingDays = viewModel.trialRemainingDays,
132+
syncronizationErrorCount = syncronizationErrorCount.value ?: -1,
133+
)
140134
}
141135
}
142136
}
@@ -263,7 +257,7 @@ private fun Main(
263257
title = null,
264258
actionTitle = stringResource(R.string.about),
265259
statusColor = Color.Gray,
266-
statusIcon = Icons.Default.Help,
260+
statusIcon = Icons.AutoMirrored.Filled.Help,
267261
clickHandler = {
268262
val i = Intent(Intent.ACTION_VIEW)
269263
i.data = Uri.parse("https://github.com/phpbg/easysync#easysync")
@@ -426,7 +420,7 @@ private fun Main(
426420
@Preview(name = "Dark Mode", uiMode = Configuration.UI_MODE_NIGHT_YES, showBackground = false)
427421
@Composable
428422
private fun MainPreview() {
429-
EasySyncTheme {
423+
ThemeSurface {
430424
Main(
431425
fullSyncNowHandler = {},
432426
workerState = WorkInfo.State.RUNNING,
@@ -447,7 +441,7 @@ private fun MainPreview() {
447441
@Preview(name = "Trial Mode", showBackground = false)
448442
@Composable
449443
private fun MainPreviewTrial() {
450-
EasySyncTheme {
444+
ThemeSurface {
451445
Main(
452446
fullSyncNowHandler = {},
453447
workerState = WorkInfo.State.RUNNING,

0 commit comments

Comments
 (0)