Skip to content

Commit

Permalink
Release 0.2.0
Browse files Browse the repository at this point in the history
[Fixed TopBar title may be obscured in landscape mode]
[Push release]
  • Loading branch information
Z-Siqi committed Oct 20, 2024
1 parent 3123fa3 commit 35ccc95
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId = "com.sqz.checklist"
minSdk = 26
targetSdk = 35
versionCode = 10
versionName = "0.2.0-Beta03-Build_CI"
versionCode = 20
versionName = "0.2.0-Build_CI"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 10,
"versionName": "0.2.0-Beta03",
"versionCode": 20,
"versionName": "0.2.0",
"outputFile": "app-release.apk"
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package com.sqz.checklist.ui.main.task.history

import android.os.Build
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.displayCutout
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
Expand All @@ -11,6 +16,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
Expand All @@ -25,6 +31,11 @@ fun HistoryTopBar(
) {
val localConfig = LocalConfiguration.current
val screenIsWidth = localConfig.screenWidthDp > localConfig.screenHeightDp * 1.2
val left = WindowInsets.displayCutout.asPaddingValues()
.calculateLeftPadding(LocalLayoutDirection.current)
val safePaddingForFullscreen = if (
Build.VERSION.SDK_INT > Build.VERSION_CODES.UPSIDE_DOWN_CAKE && screenIsWidth
) modifier.padding(start = left - if (left > 20.dp) 10.dp else 0.dp) else modifier
TopAppBar(
colors = TopAppBarDefaults.topAppBarColors(
containerColor = if (screenIsWidth) MaterialTheme.colorScheme.secondaryContainer else MaterialTheme.colorScheme.primaryContainer,
Expand All @@ -38,9 +49,9 @@ fun HistoryTopBar(
navigationIcon = {
TextTooltipBox(
textRid = R.string.back,
topLeftExtraPadding = true
topLeftExtraPadding = true,
) {
IconButton(onClick = { onClick() }) {
IconButton(onClick = { onClick() }, modifier = safePaddingForFullscreen) {
Icon(
painter = painterResource(R.drawable.back),
contentDescription = stringResource(R.string.back)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.sqz.checklist.ui.main.task.layout

import android.annotation.SuppressLint
import android.os.Build
import android.view.SoundEffectConstants
import android.view.View
import androidx.compose.animation.AnimatedVisibility
Expand All @@ -10,6 +11,9 @@ import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideOutHorizontally
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.displayCutout
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
Expand All @@ -35,6 +39,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -62,18 +67,27 @@ fun TaskLayoutTopBar(
var menu by remember { mutableStateOf(false) }
onMenuClick(menu) { menu = it } // able to add the menu UI inside this

val screenHeight = LocalConfiguration.current.screenHeightDp
val localConfig = LocalConfiguration.current
val screenHeight = localConfig.screenHeightDp
val topBarForLowScreen = screenHeight <= (CardHeight + 24) * 3.8
val screenWidth = LocalConfiguration.current.screenWidthDp
val screenWidth = localConfig.screenWidthDp
val topBarForLowAndWidthScreen = screenWidth > 800 && topBarForLowScreen

val screenIsWidth = localConfig.screenWidthDp > localConfig.screenHeightDp * 1.2
val left = WindowInsets.displayCutout.asPaddingValues()
.calculateLeftPadding(LocalLayoutDirection.current)
val safePaddingForFullscreen = if (
Build.VERSION.SDK_INT > Build.VERSION_CODES.UPSIDE_DOWN_CAKE && screenIsWidth
) modifier.padding(start = left - if (left > 8.dp) 5.dp else 0.dp) else modifier

val topAppBarTitle = stringResource(R.string.time_format)
val year = "YYYY"
val week = "EEEE"

val title = @Composable {
if (topBarState.heightOffset <= topBarState.heightOffsetLimit * 0.7 && !topBarForLowScreen) {
Row(
modifier = safePaddingForFullscreen,
verticalAlignment = Alignment.Bottom
) {
Text(
Expand All @@ -90,7 +104,10 @@ fun TaskLayoutTopBar(
)
}
} else {
Row(verticalAlignment = Alignment.Bottom) {
Row(
modifier = safePaddingForFullscreen,
verticalAlignment = Alignment.Bottom
) {
val formatWithSize = if (topBarForLowScreen) {
if (topBarForLowAndWidthScreen) {
topBarContent(week + ", " + stringResource(R.string.top_bar_date))
Expand Down Expand Up @@ -169,7 +186,10 @@ fun TaskLayoutTopBar(
exit = slideOutHorizontally() + fadeOut()
) {
Row(
modifier = modifier.padding(top = 22.dp, start = 4.dp),
modifier = modifier.padding(
top = 22.dp,
start = 4.dp
) then safePaddingForFullscreen,
verticalAlignment = Alignment.Bottom
) {
Spacer(modifier = modifier.width(10.dp))
Expand Down

0 comments on commit 35ccc95

Please sign in to comment.