Skip to content

Commit

Permalink
Merge pull request #176 from carstenhag/feature/148-improve-landscape…
Browse files Browse the repository at this point in the history
…-support

Improve landscape support
  • Loading branch information
EmmaTellblom authored Nov 8, 2024
2 parents 67aab35 + 0bd7bd5 commit a6dd180
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
defaultConfig {
applicationId = "com.mensinator.app"
minSdk = 26
targetSdk = 34
targetSdk = 35
versionCode = 20
versionName = "1.9.1"

Expand Down
6 changes: 2 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.Mensinator"
tools:targetApi="31">
android:theme="@style/Theme.Mensinator">
<activity
android:name=".MainActivity"
android:exported="true"
android:theme="@style/Theme.Mensinator">
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/com/mensinator/app/CalendarScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,11 @@ fun CalendarScreen(
Column(
modifier = Modifier
.fillMaxSize()
.padding(16.dp)
.verticalScroll(rememberScrollState())
)
{
.displayCutoutPadding()
.statusBarsPadding()
.padding(16.dp)
) {
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
Expand Down
10 changes: 8 additions & 2 deletions app/src/main/java/com/mensinator/app/ManageSymptomScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.displayCutoutPadding
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
Expand Down Expand Up @@ -69,8 +72,10 @@ fun ManageSymptomScreen(
Column(
modifier = Modifier
.fillMaxSize()
.padding(15.dp)
.verticalScroll(rememberScrollState()), // Make the column scrollable
.verticalScroll(rememberScrollState()) // Make the column scrollable
.displayCutoutPadding()
.statusBarsPadding()
.padding(16.dp),
verticalArrangement = Arrangement.Top,
horizontalAlignment = Alignment.CenterHorizontally
) {
Expand Down Expand Up @@ -262,6 +267,7 @@ fun ManageSymptomScreen(
}
}
}
Spacer(modifier = Modifier.height(50.dp)) // To be able to overscroll the list, to not have the FloatingActionButton overlapping
}
if (showCreateSymptom.value) {
CreateNewSymptomDialog(
Expand Down
15 changes: 8 additions & 7 deletions app/src/main/java/com/mensinator/app/SettingsScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.core.app.NotificationManagerCompat
import com.mensinator.app.data.DataSource
import com.mensinator.app.ui.theme.isDarkMode
Expand Down Expand Up @@ -99,10 +99,11 @@ fun SettingsScreen(onSwitchProtectionScreen: (Boolean) -> Unit) {
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
.displayCutoutPadding()
.statusBarsPadding(),
) {//we have 2 columns so the scroll animation does get cut by the padding of the second column
Column(
modifier = Modifier
.padding(16.dp),
modifier = Modifier.padding(16.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.Start
) {
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/java/com/mensinator/app/StatisticsScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.displayCutoutPadding
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Text
Expand All @@ -15,10 +17,10 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import java.time.LocalDate

@Composable
Expand Down Expand Up @@ -46,6 +48,8 @@ fun StatisticsScreen(
modifier = Modifier
.fillMaxSize()
.verticalScroll(scrollState)
.displayCutoutPadding()
.statusBarsPadding()
.padding(16.dp)
) {
Text(
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/com/mensinator/app/SymptomDialogs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package com.mensinator.app

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
Expand Down Expand Up @@ -57,7 +59,7 @@ fun SymptomsDialog(
Text(text = stringResource(id = R.string.symptoms_dialog_title, date))
},
text = {
Column {
Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
symptoms.forEach { symptom ->
val symptomKey = ResourceMapper.getStringResourceId(symptom.name)
val symptomDisplayName = symptomKey?.let { stringResource(id = it) } ?: symptom.name
Expand Down Expand Up @@ -180,7 +182,6 @@ fun RenameSymptomDialog(
)
}
},

)
}

Expand Down
9 changes: 7 additions & 2 deletions app/src/main/java/com/mensinator/app/navigation/BottomBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import android.util.Log
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.displayCutoutPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
Expand Down Expand Up @@ -92,7 +94,9 @@ fun MensinatorBottomBar(
FloatingActionButton(
onClick = { showCreateSymptom.value = true },
shape = CircleShape,
modifier = Modifier.padding(5.dp)
modifier = Modifier
.displayCutoutPadding()
.padding(5.dp)
) {
Icon(
imageVector = Icons.Default.Add,
Expand Down Expand Up @@ -178,7 +182,8 @@ fun MensinatorBottomBar(
)
}
}
}
},
contentWindowInsets = WindowInsets(0, 0, 0, 0) // We want to handle insets ourselves at child screens
) { paddingValues ->
NavHost(
navController = navController,
Expand Down

0 comments on commit a6dd180

Please sign in to comment.