Skip to content

Commit

Permalink
Merge pull request #30
Browse files Browse the repository at this point in the history
summary-fix
  • Loading branch information
DenisGithuku authored Oct 6, 2023
2 parents 1a61ac3 + ba89bc9 commit 00eeaf4
Show file tree
Hide file tree
Showing 14 changed files with 213 additions and 154 deletions.
19 changes: 19 additions & 0 deletions .idea/appInsightsSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ android {
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("debug")
}
}
compileOptions {
Expand Down
Binary file added app/release/app-release.aab
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import androidx.navigation.compose.NavHost
import com.githukudenis.intimo.IntimoAppState
import com.githukudenis.intimo.feature.habit.navigation.activeHabitRoute
import com.githukudenis.intimo.feature.habit.navigation.activeHabitScreen
import com.githukudenis.intimo.feature.habit.navigation.addHabitRoute
import com.githukudenis.intimo.feature.habit.navigation.addHabitScreen
import com.githukudenis.intimo.feature.habit.navigation.detailScreen
import com.githukudenis.intimo.feature.habit.navigation.habitDetailRoute
import com.githukudenis.intimo.feature.onboarding.navigation.onBoardingNavigationRoute
Expand Down Expand Up @@ -93,7 +91,7 @@ fun IntimoNavHost(
onOpenLicenses = {
appState.navigate(licensesRoute)
},
onRequestInAppReview = onRequestInAppReview
onRequestInAppReview = onRequestInAppReview,
)
licensesScreen(onNavigateUp = {
appState.popBackStack()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ fun ActiveHabitRoute(
habitData.habitName,
content = context.getString(R.string.habit_notification_description),
duration = state.timerState.currentTime,
habitId = habitData.habitId,
habitName = habitData.habitName
id = habitData.habitId,
name = habitData.habitName
)
},
onPauseTimer = {
Expand All @@ -103,8 +103,8 @@ fun ActiveHabitRoute(
habitData.habitName,
content = context.getString(R.string.habit_notification_description),
duration = state.timerState.currentTime,
habitId = habitData.habitId,
habitName = habitData.habitName
id = habitData.habitId,
name = habitData.habitName
)
},
onRestartHabit = {
Expand All @@ -115,8 +115,8 @@ fun ActiveHabitRoute(
habitData.habitName,
content = context.getString(R.string.habit_notification_description),
duration = habitData.duration,
habitId = habitData.habitId,
habitName = habitData.habitName
id = habitData.habitId,
name = habitData.habitName
)

},
Expand Down Expand Up @@ -190,16 +190,16 @@ fun startTimerService(
context: Context,
title: String,
content: String,
habitName: String,
name: String,
duration: Long,
habitId: Long
id: Long
) {
val intent = Intent(context, ActiveHabitService::class.java).apply {
putExtra("title", title)
putExtra("content", content)
putExtra("duration", duration)
putExtra("habitId", habitId)
putExtra("habitType", habitName)
putExtra("id", id)
putExtra("name", name)
action = ActiveHabitService.NotificationAction.START.toString()
}
context.startService(intent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ class ActiveHabitService : Service() {
title = extras.getString("title"),
content = extras.getString("content"),
habit = RunningHabit(
habitId = extras.getLong("habitId"),
habitId = extras.getLong("id"),
totalTime = extras.getLong("duration"),
isRunning = true,
remainingTime = extras.getLong("duration"),
habitName = extras.getString("habitName") ?: return@innerLet
habitName = extras.getString("name") ?: return@innerLet
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Check
Expand All @@ -32,7 +33,7 @@ fun DatePill(
) {

val animatedBackground =
animateColorAsState(targetValue = if (selected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onPrimary)
animateColorAsState(targetValue = if (selected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.background)


Column(
Expand All @@ -46,19 +47,19 @@ fun DatePill(
)
Spacer(modifier = Modifier.height(4.dp))
Box(modifier = Modifier
.size(40.dp)
.clip(CircleShape)
.border(
border = BorderStroke(
width = if (dateItem.isToday) 1.dp else 0.dp,
color = if (dateItem.isToday) MaterialTheme.colorScheme.primary.copy(alpha = 0.1f) else MaterialTheme.colorScheme.onPrimary
color = if (dateItem.isToday) MaterialTheme.colorScheme.primary.copy(alpha = 0.2f) else MaterialTheme.colorScheme.background
), shape = CircleShape
)
.background(
color = animatedBackground.value, shape = CircleShape
)
.clickableOnce { onChangeDate(dateItem.date) }) {
.clickableOnce { onChangeDate(dateItem.date) }, contentAlignment = Alignment.Center) {
Text(
modifier = Modifier.padding(12.dp),
text = "${dateItem.date.dayOfMonth}",
style = MaterialTheme.typography.labelMedium,
color = if (selected) MaterialTheme.colorScheme.onPrimary else MaterialTheme.colorScheme.onBackground
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
Expand All @@ -34,9 +30,9 @@ import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.ArrowForward
import androidx.compose.material3.Button
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
Expand All @@ -46,7 +42,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
Expand Down Expand Up @@ -132,7 +127,8 @@ internal fun PagerRoute(
verticalAlignment = Alignment.CenterVertically
) {
pageItems.forEachIndexed { index, _ ->
val scale = animateFloatAsState(targetValue = if (index == pagerState.currentPage) 1.2f else 1f)
val scale =
animateFloatAsState(targetValue = if (index == pagerState.currentPage) 1.2f else 1f)
Box(
modifier = Modifier
.size(14.dp)
Expand Down Expand Up @@ -201,11 +197,11 @@ internal fun PagerRoute(
AnimatedContent(targetState = pagerState.currentPage == pageItems.size - 1) { state ->
when (state) {
true -> {
OutlinedButton(onClick = onGetStarted) {
Button(onClick = onGetStarted) {
Text(
text = "Start",
style = MaterialTheme.typography.labelMedium,
color = MaterialTheme.colorScheme.primary
color = MaterialTheme.colorScheme.onPrimary
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const val settingsRoute = "settings"
fun NavGraphBuilder.settingsScreen(
onNavigateUp: () -> Unit,
onOpenLicenses: () -> Unit,
onRequestInAppReview: () -> Unit
onRequestInAppReview: () -> Unit,
) {
composable(route = settingsRoute,
enterTransition = {
Expand All @@ -30,7 +30,7 @@ fun NavGraphBuilder.settingsScreen(
SettingsRoute(
onNavigateUp = onNavigateUp,
onOpenLicenses = onOpenLicenses,
onRequestInAppReview = onRequestInAppReview
onRequestInAppReview = onRequestInAppReview,
)
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.githukudenis.intimo.feature.settings.ui

import android.content.Context
import android.util.Log
import android.util.TimeUtils
import android.content.Intent
import android.net.Uri
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
Expand All @@ -12,8 +12,11 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.Divider
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
Expand All @@ -28,12 +31,14 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.DpOffset
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
Expand All @@ -56,11 +61,13 @@ fun SettingsRoute(
viewModel: SettingsViewModel = hiltViewModel(),
onNavigateUp: () -> Unit,
onOpenLicenses: () -> Unit,
onRequestInAppReview: () -> Unit
onRequestInAppReview: () -> Unit,
) {

val uiState by viewModel.uiState.collectAsStateWithLifecycle()

val context = LocalContext.current

val snackbarHostState = remember {
SnackbarHostState()
}
Expand All @@ -71,6 +78,14 @@ fun SettingsRoute(
MultipleClicksCutter.get()
}

var optionsMenuIsVisible by rememberSaveable {
mutableStateOf(false)
}

var optionsMenuOffset by remember {
mutableStateOf(DpOffset.Zero)
}

Scaffold(
snackbarHost = { SnackbarHost(hostState = snackbarHostState) },
modifier = Modifier.nestedScroll(scrollBehaviour.nestedScrollConnection),
Expand All @@ -87,11 +102,49 @@ fun SettingsRoute(
contentDescription = stringResource(id = R.string.navigate_up_icon)
)
}
}, scrollBehavior = scrollBehaviour
},
scrollBehavior = scrollBehaviour,
actions = {
IconButton(
onClick = {
optionsMenuIsVisible = true
}) {
Icon(
imageVector = Icons.Default.MoreVert,
contentDescription = "More"
)
}
DropdownMenu(
expanded = optionsMenuIsVisible,
onDismissRequest = { optionsMenuIsVisible = false },
) {
DropdownMenuItem(
text = {
Text(
text = "Privacy policy",
)
}, onClick = {
optionsMenuIsVisible = false
val policyUrl =
"https://sites.google.com/view/gitsoftapps-intimo/home"
val intent = Intent(Intent.ACTION_VIEW).apply {
data = Uri.parse(policyUrl)
}
context.startActivity(intent)
})
DropdownMenuItem(
text = { Text(text= "Open source licenses") },
onClick = {
optionsMenuIsVisible = false
onOpenLicenses()
})
}

}
)
}
) { paddingValues ->
val context = LocalContext.current

SettingsScreen(
contentPadding = PaddingValues(
top = paddingValues.calculateTopPadding(),
Expand Down Expand Up @@ -337,17 +390,5 @@ fun SettingsScreen(
}
)
}
item {
SettingsListView(
clickable = true,
onClick = onOpenLicenses,
title = {
Text(
text = "Licenses",
style = MaterialTheme.typography.titleSmall
)
}
)
}
}
}
4 changes: 2 additions & 2 deletions feature/settings/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<string name="device_usage_title">Device usage</string>
<string name="device_usage_description">%s app usage monitoring</string>
<string name="other_settings_section_tittle">Other</string>
<string name="app_version_description">Version %s</string>
<string name="app_version_title">App version</string>
<string name="app_version_description">%s</string>
<string name="app_version_title">Current version</string>
<string name="open_source_licenses_settings_list_item">Open source licenses</string>
<string name="oss_licenses_activity_title">Intimo open source licenses</string>
<string name="rate_app_description">Loving this app? Leave a rating</string>
Expand Down
Loading

0 comments on commit 00eeaf4

Please sign in to comment.