Fix some small issues / typos / colors
This commit is contained in:
parent
d91dda3013
commit
4fdbaa66a5
16 changed files with 68 additions and 42 deletions
Binary file not shown.
Binary file not shown.
|
|
@ -3,6 +3,7 @@ package com.pixelized.headache
|
|||
import android.Manifest.permission.READ_CALENDAR
|
||||
import android.Manifest.permission.WRITE_CALENDAR
|
||||
import android.content.pm.PackageManager.PERMISSION_GRANTED
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
|
|
@ -33,6 +34,11 @@ class MainActivity : ComponentActivity() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
// Force the 3-button navigation bar to be transparent
|
||||
// See: https://developer.android.com/develop/ui/views/layout/edge-to-edge#create-transparent
|
||||
window.isNavigationBarContrastEnforced = false
|
||||
}
|
||||
|
||||
if (ContextCompat.checkSelfPermission(this, READ_CALENDAR) != PERMISSION_GRANTED) {
|
||||
requestPermissionLauncher.launch(READ_CALENDAR)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package com.pixelized.headache.ui.common.toolbar
|
||||
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.material3.BottomAppBarDefaults
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarColors
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.material3.TopAppBarScrollBehavior
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.Dp
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
inline fun Toolbar(
|
||||
modifier: Modifier = Modifier,
|
||||
noinline title: @Composable () -> Unit,
|
||||
noinline navigationIcon: @Composable () -> Unit = {},
|
||||
noinline actions: @Composable RowScope.() -> Unit = {},
|
||||
expandedHeight: Dp = TopAppBarDefaults.TopAppBarExpandedHeight,
|
||||
windowInsets: WindowInsets = TopAppBarDefaults.windowInsets,
|
||||
colors: TopAppBarColors = TopAppBarDefaults.topAppBarColors(
|
||||
containerColor = BottomAppBarDefaults.containerColor,
|
||||
),
|
||||
scrollBehavior: TopAppBarScrollBehavior? = null,
|
||||
) {
|
||||
TopAppBar(
|
||||
title = title,
|
||||
modifier = modifier,
|
||||
navigationIcon = navigationIcon,
|
||||
actions = actions,
|
||||
expandedHeight = expandedHeight,
|
||||
windowInsets = windowInsets,
|
||||
colors = colors,
|
||||
scrollBehavior = scrollBehavior,
|
||||
)
|
||||
}
|
||||
|
|
@ -15,6 +15,6 @@ class HomeNavigator(
|
|||
fun popBackstack() = backStack.removeLastOrNull()
|
||||
|
||||
fun goTo(destination: HomeDestination) {
|
||||
backStack.add(destination)
|
||||
backStack[0] = destination
|
||||
}
|
||||
}
|
||||
|
|
@ -13,8 +13,6 @@ import androidx.compose.material3.MaterialTheme
|
|||
import androidx.compose.material3.NavigationBarDefaults
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
|
|
@ -24,6 +22,7 @@ import androidx.compose.ui.unit.dp
|
|||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.pixelized.headache.R
|
||||
import com.pixelized.headache.ui.common.toolbar.Toolbar
|
||||
import com.pixelized.headache.ui.navigation.main.LocalMainNavigator
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
|
|
@ -65,10 +64,7 @@ private fun CalendarContent(
|
|||
Scaffold(
|
||||
modifier = modifier,
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
colors = TopAppBarDefaults.topAppBarColors(
|
||||
containerColor = NavigationBarDefaults.containerColor,
|
||||
),
|
||||
Toolbar(
|
||||
navigationIcon = {
|
||||
IconButton(
|
||||
onClick = onBack,
|
||||
|
|
|
|||
|
|
@ -80,9 +80,9 @@ fun EventItem(
|
|||
Box(
|
||||
modifier = Modifier
|
||||
.clickable { onItem(item) }
|
||||
.fillMaxWidth()
|
||||
.heightIn(min = minHeigh)
|
||||
.height(IntrinsicSize.Min)
|
||||
.fillMaxWidth()
|
||||
.then(other = modifier),
|
||||
contentAlignment = Alignment.CenterStart,
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
package com.pixelized.headache.ui.page.event.list
|
||||
|
||||
import androidx.compose.animation.AnimatedContent
|
||||
import androidx.compose.animation.animateColorAsState
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.togetherWith
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
|
|
@ -22,12 +18,10 @@ import androidx.compose.material3.FloatingActionButton
|
|||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.NavigationBarDefaults
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.material3.minimumInteractiveComponentSize
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.Stable
|
||||
import androidx.compose.runtime.State
|
||||
|
|
@ -44,6 +38,7 @@ import androidx.compose.ui.unit.dp
|
|||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.pixelized.headache.R
|
||||
import com.pixelized.headache.ui.common.toolbar.Toolbar
|
||||
import com.pixelized.headache.ui.navigation.main.LocalMainNavigator
|
||||
import com.pixelized.headache.ui.page.event.edit.EventEditBottomSheet
|
||||
import com.pixelized.headache.ui.page.event.edit.EventEditBottomSheetViewModel
|
||||
|
|
@ -107,10 +102,7 @@ private fun EventContent(
|
|||
Scaffold(
|
||||
modifier = modifier,
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
colors = TopAppBarDefaults.topAppBarColors(
|
||||
containerColor = NavigationBarDefaults.containerColor,
|
||||
),
|
||||
Toolbar(
|
||||
navigationIcon = {
|
||||
IconButton(
|
||||
onClick = onBack,
|
||||
|
|
@ -186,20 +178,13 @@ private fun EventContent(
|
|||
key = { it.id },
|
||||
contentType = { "EventItem" },
|
||||
) { item ->
|
||||
AnimatedContent(
|
||||
modifier = Modifier.animateItem(),
|
||||
targetState = item,
|
||||
transitionSpec = { fadeIn() togetherWith fadeOut() },
|
||||
) { animatedItem ->
|
||||
EventItem(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
item = animatedItem,
|
||||
item = item,
|
||||
onItem = onEvent,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,12 +25,9 @@ import androidx.compose.material3.Icon
|
|||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.NavigationBar
|
||||
import androidx.compose.material3.NavigationBarDefaults
|
||||
import androidx.compose.material3.NavigationBarItem
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.Stable
|
||||
import androidx.compose.runtime.State
|
||||
|
|
@ -44,6 +41,7 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import com.pixelized.headache.R
|
||||
import com.pixelized.headache.ui.common.toolbar.Toolbar
|
||||
import com.pixelized.headache.ui.navigation.destination.MonthSummaryDestination
|
||||
import com.pixelized.headache.ui.navigation.destination.ReportDestination
|
||||
import com.pixelized.headache.ui.navigation.destination.YearSummaryDestination
|
||||
|
|
@ -167,10 +165,7 @@ private fun HomePageContent(
|
|||
Scaffold(
|
||||
modifier = modifier,
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
colors = TopAppBarDefaults.topAppBarColors(
|
||||
containerColor = NavigationBarDefaults.containerColor,
|
||||
),
|
||||
Toolbar(
|
||||
title = {
|
||||
Text(
|
||||
text = stringResource(R.string.app_name),
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import androidx.compose.foundation.gestures.snapping.rememberSnapFlingBehavior
|
|||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.LazyListState
|
||||
|
|
@ -14,6 +15,7 @@ import androidx.compose.foundation.lazy.items
|
|||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.minimumInteractiveComponentSize
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.Stable
|
||||
import androidx.compose.runtime.State
|
||||
|
|
@ -93,7 +95,6 @@ private fun MonthSummaryContent(
|
|||
events.value.forEach { entry ->
|
||||
item {
|
||||
MonthSummaryTitle(
|
||||
modifier = Modifier.padding(top = 16.dp),
|
||||
item = entry.key,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ fun MonthSummaryItem(
|
|||
Column(
|
||||
modifier = Modifier
|
||||
.clickable { onItem(item) }
|
||||
.fillMaxWidth()
|
||||
.padding(paddingValues = padding)
|
||||
.then(other = modifier),
|
||||
verticalArrangement = Arrangement.spacedBy(space = spacing.height)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ data class MonthSummaryTitleUio(
|
|||
object MonthSummaryTitleDefault {
|
||||
|
||||
@Stable
|
||||
val padding: PaddingValues = PaddingValues(horizontal = 16.dp)
|
||||
val padding: PaddingValues = PaddingValues(start = 16.dp, top = 16.dp, end = 16.dp,)
|
||||
|
||||
@SuppressLint("ConstantLocale")
|
||||
@Stable
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package com.pixelized.headache.ui.page.summary.report
|
||||
|
||||
import android.R
|
||||
import android.annotation.SuppressLint
|
||||
import android.icu.text.DateFormat
|
||||
import android.icu.text.SimpleDateFormat
|
||||
import android.icu.util.Calendar
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ object HeadacheColorPalette {
|
|||
|
||||
@Immutable
|
||||
object Calendar {
|
||||
val Headache = Additional.LightRed
|
||||
val Headache = Additional.VeryLightRed
|
||||
val Pill = Additional.DarkRed
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<string name="error_edit_calendar">L\'édition du calendrier a échouée</string>
|
||||
|
||||
<string name="calendar_chooser_title">Choix du calendrier</string>
|
||||
<string name="event_title">Évennement migraineux</string>
|
||||
<string name="event_title">Évènements migraineux</string>
|
||||
<string name="month_summary_title">Suivi mensuel</string>
|
||||
<string name="year_summary_title">Suivi annuel</string>
|
||||
</resources>
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
<string name="error_edit_calendar">Calendar edit failed.</string>
|
||||
|
||||
<string name="calendar_chooser_title">Choose your calendar</string>
|
||||
<string name="event_title">Headache event</string>
|
||||
<string name="event_title">Headache events</string>
|
||||
<string name="month_summary_title">Monthly follow-up</string>
|
||||
<string name="year_summary_title">Annual follow-up</string>
|
||||
</resources>
|
||||
Loading…
Add table
Add a link
Reference in a new issue