Skip to content

Commit

Permalink
Add a tip about compact goal card and intefrate custom font in most c…
Browse files Browse the repository at this point in the history
…omposables

Signed-off-by: starry-shivam <[email protected]>
  • Loading branch information
starry-shivam committed Mar 28, 2024
1 parent f51190a commit d5ffcf1
Show file tree
Hide file tree
Showing 25 changed files with 392 additions and 190 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ dependencies {
implementation 'com.maxkeppeler.sheets-compose-dialogs:date-time:1.3.0'
// Swipe actions.
implementation "me.saket.swipe:swipe:1.2.0"
// Taptarget compose.
implementation "com.pierfrancescosoffritti.taptargetcompose:core:1.1.0"
// Lottie animations.
implementation "com.airbnb.android:lottie-compose:4.1.0"
// Bio-metric authentication.
Expand Down
23 changes: 23 additions & 0 deletions app/src/main/java/com/starry/greenstash/other/WelcomeDataStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class WelcomeDataStore(context: Context) {

private object PreferencesKey {
val onBoardingKey = booleanPreferencesKey(name = "on_boarding_completed")
val newGoalTapTargetKey = booleanPreferencesKey(name = "new_goal_tap_target")
}

suspend fun saveOnBoardingState(completed: Boolean) {
Expand All @@ -66,4 +67,26 @@ class WelcomeDataStore(context: Context) {
onBoardingState
}
}

suspend fun saveNewGoalTapTargetState(completed: Boolean) {
dataStore.edit { preferences ->
preferences[PreferencesKey.newGoalTapTargetKey] = completed
}
}

fun readNewGoalTapTargetState(): Flow<Boolean> {
return dataStore.data
.catch { exception ->
if (exception is IOException) {
emit(emptyPreferences())
} else {
throw exception
}
}
.map { preferences ->
val newGoalTapTargetState = preferences[PreferencesKey.newGoalTapTargetKey] ?: false
newGoalTapTargetState
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import coil.compose.AsyncImage
import com.starry.greenstash.R
import com.starry.greenstash.ui.theme.greenstashFont
import kotlinx.coroutines.launch
import java.io.InputStreamReader
import java.io.Reader
Expand All @@ -97,6 +98,7 @@ fun BackupScreen(navController: NavController) {
text = stringResource(id = R.string.backup_screen_header),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
fontFamily = greenstashFont
)
}, navigationIcon = {
IconButton(onClick = { navController.navigateUp() }) {
Expand Down Expand Up @@ -196,12 +198,14 @@ fun BackupScreenContent(
Text(
text = stringResource(id = R.string.backup_screen_text),
style = MaterialTheme.typography.bodyLarge,
modifier = Modifier.padding(horizontal = 12.dp, vertical = 12.dp)
modifier = Modifier.padding(horizontal = 12.dp, vertical = 12.dp),
fontFamily = greenstashFont
)
Text(
text = stringResource(id = R.string.backup_screen_sub_text),
style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.padding(horizontal = 12.dp)
modifier = Modifier.padding(horizontal = 12.dp),
fontFamily = greenstashFont
)
Spacer(modifier = Modifier.height(12.dp))
}
Expand All @@ -219,7 +223,10 @@ fun BackupScreenContent(
.weight(0.45f),
shape = RoundedCornerShape(12.dp),
) {
Text(text = stringResource(id = R.string.backup_button))
Text(
text = stringResource(id = R.string.backup_button),
fontFamily = greenstashFont
)
}

Spacer(modifier = Modifier.weight(0.04f))
Expand All @@ -231,7 +238,10 @@ fun BackupScreenContent(
.weight(0.45f),
shape = RoundedCornerShape(12.dp),
) {
Text(text = stringResource(id = R.string.restore_button))
Text(
text = stringResource(id = R.string.restore_button),
fontFamily = greenstashFont
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ fun GoalItemClassic(
fontWeight = FontWeight.Medium,
lineHeight = 1.2f.em,
fontSize = 18.sp,
fontFamily = greenstashFont,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
color = MaterialTheme.colorScheme.onSurface
Expand All @@ -150,13 +151,15 @@ fun GoalItemClassic(
modifier = Modifier.padding(start = 8.dp, top = 6.dp),
lineHeight = 1.2f.em,
fontSize = 14.sp,
fontFamily = greenstashFont,
color = MaterialTheme.colorScheme.onSurface
)
Text(
text = secondaryText,
modifier = Modifier.padding(start = 8.dp, top = 8.dp),
lineHeight = 1.1f.em,
fontSize = 14.sp,
fontFamily = greenstashFont,
color = MaterialTheme.colorScheme.onSurface
)
}
Expand Down Expand Up @@ -410,6 +413,7 @@ fun GoalItemCompact(
text = title,
modifier = Modifier.padding(start = 4.dp, top = 10.dp),
fontWeight = FontWeight.Normal,
fontFamily = greenstashFont,
fontSize = 18.sp,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ fun SearchAppBar(
placeholder = {
Text(
text = stringResource(id = R.string.home_search_label),
color = MaterialTheme.colorScheme.onSurface
color = MaterialTheme.colorScheme.onSurface,
fontFamily = greenstashFont
)
},
singleLine = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.ui.res.stringResource
import com.starry.greenstash.R
import com.starry.greenstash.ui.theme.greenstashFont

@ExperimentalMaterial3Api
@Composable
Expand All @@ -53,6 +54,7 @@ fun HomeDialogs(
Text(
text = stringResource(id = R.string.goal_delete_confirmation),
color = MaterialTheme.colorScheme.onSurface,
fontFamily = greenstashFont,
)
}, confirmButton = {
FilledTonalButton(
Expand All @@ -65,13 +67,13 @@ fun HomeDialogs(
contentColor = MaterialTheme.colorScheme.onErrorContainer
)
) {
Text(stringResource(id = R.string.confirm))
Text(stringResource(id = R.string.confirm), fontFamily = greenstashFont)
}
}, dismissButton = {
TextButton(onClick = {
openDeleteDialog.value = false
}) {
Text(stringResource(id = R.string.cancel))
Text(stringResource(id = R.string.cancel), fontFamily = greenstashFont)
}
},
icon = {
Expand Down
Loading

0 comments on commit d5ffcf1

Please sign in to comment.