diff --git a/.idea/appInsightsSettings.xml b/.idea/appInsightsSettings.xml
new file mode 100644
index 00000000..5c682537
--- /dev/null
+++ b/.idea/appInsightsSettings.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
index 5dd2abd2..0c0c3383 100644
--- a/.idea/deploymentTargetDropDown.xml
+++ b/.idea/deploymentTargetDropDown.xml
@@ -1,17 +1,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index ae388c2a..0897082f 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -4,16 +4,15 @@
-
-
-
+
+
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index fdf8d994..ae3f30ae 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/migrations.xml b/.idea/migrations.xml
new file mode 100644
index 00000000..f8051a6f
--- /dev/null
+++ b/.idea/migrations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 45672751..fc963b09 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -58,7 +58,7 @@ android {
}
composeOptions {
- kotlinCompilerExtensionVersion '1.5.2'
+ kotlinCompilerExtensionVersion '1.5.6'
}
packagingOptions {
resources {
@@ -75,16 +75,18 @@ aboutLibraries {
dependencies {
- def composeBom = platform('androidx.compose:compose-bom:2023.08.00')
+ def composeBom = platform('androidx.compose:compose-bom:2023.10.01')
implementation composeBom
androidTestImplementation composeBom
// Android core components.
implementation 'androidx.core:core-ktx:1.12.0'
+ implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
- implementation 'androidx.activity:activity-compose:1.8.0'
+ implementation 'androidx.activity:activity-compose:1.8.2'
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.6.2"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.6.2"
+ implementation "androidx.navigation:navigation-compose:2.7.6"
// Jetpack compose.
implementation "androidx.compose.ui:ui"
implementation "androidx.compose.ui:ui-tooling-preview"
@@ -94,22 +96,19 @@ dependencies {
implementation "androidx.compose.material3:material3"
// Accompanist compose.
implementation "com.google.accompanist:accompanist-systemuicontroller:0.28.0"
- implementation "com.google.accompanist:accompanist-navigation-animation:0.33.1-alpha"
// Material theme for main activity.
- implementation 'com.google.android.material:material:1.10.0'
+ implementation 'com.google.android.material:material:1.11.0'
// Android 12+ splash API.
implementation 'androidx.core:core-splashscreen:1.0.1'
// Room database
- implementation "androidx.room:room-ktx:2.5.2"
- implementation 'androidx.appcompat:appcompat:1.6.1'
- implementation 'androidx.core:core-ktx:1.12.0'
- ksp "androidx.room:room-compiler:2.5.2"
- androidTestImplementation "androidx.room:room-testing:2.5.2"
+ implementation "androidx.room:room-ktx:$room_version"
+ ksp "androidx.room:room-compiler:$room_version"
+ androidTestImplementation "androidx.room:room-testing:$room_version"
// Dagger - Hilt.
implementation "com.google.dagger:hilt-android:$hilt_version"
- implementation "androidx.hilt:hilt-navigation-compose:1.0.0"
+ implementation "androidx.hilt:hilt-navigation-compose:1.1.0"
ksp "com.google.dagger:hilt-android-compiler:$hilt_version"
- ksp "androidx.hilt:hilt-compiler:1.0.0"
+ ksp "androidx.hilt:hilt-compiler:1.1.0"
// DataStore Preferences.
implementation("androidx.datastore:datastore-preferences:1.0.0")
// Gson JSON parser.
@@ -129,7 +128,7 @@ dependencies {
// Crash Handler.
implementation 'cat.ereza:customactivityoncrash:2.4.0'
// Oreo back-ports for API 24 (N)
- coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3'
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
// Testing components.
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
diff --git a/app/src/main/java/com/starry/greenstash/MainActivity.kt b/app/src/main/java/com/starry/greenstash/MainActivity.kt
index f9ec6be8..b3d6e697 100644
--- a/app/src/main/java/com/starry/greenstash/MainActivity.kt
+++ b/app/src/main/java/com/starry/greenstash/MainActivity.kt
@@ -45,13 +45,12 @@ import androidx.compose.ui.unit.dp
import androidx.core.content.ContextCompat
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.lifecycle.ViewModelProvider
-import com.google.accompanist.navigation.animation.rememberAnimatedNavController
+import androidx.navigation.compose.rememberNavController
import com.google.accompanist.systemuicontroller.rememberSystemUiController
import com.starry.greenstash.ui.navigation.NavGraph
import com.starry.greenstash.ui.screens.settings.viewmodels.SettingsViewModel
import com.starry.greenstash.ui.screens.settings.viewmodels.ThemeMode
import com.starry.greenstash.ui.theme.GreenStashTheme
-import com.starry.greenstash.utils.PreferenceUtils
import com.starry.greenstash.utils.Utils
import com.starry.greenstash.utils.toToast
import dagger.hilt.android.AndroidEntryPoint
@@ -77,12 +76,14 @@ class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- PreferenceUtils.initialize(this)
settingsViewModel = ViewModelProvider(this)[SettingsViewModel::class.java]
mainViewModel = ViewModelProvider(this)[MainViewModel::class.java]
// Setup app theme according to user's settings.
- settingsViewModel.setUpAppTheme()
+ ThemeMode.entries.find { it.ordinal == settingsViewModel.getThemeValue() }
+ ?.let { settingsViewModel.setTheme(it) }
+ settingsViewModel.setMaterialYou(settingsViewModel.getMaterialYouValue())
+
// show splash screen until we figure out start nav destination.
installSplashScreen().setKeepOnScreenCondition {
@@ -92,7 +93,7 @@ class MainActivity : AppCompatActivity() {
// refresh reminders
mainViewModel.refreshReminders()
- val appLockStatus = PreferenceUtils.getBoolean(PreferenceUtils.APP_LOCK, false)
+ val appLockStatus = settingsViewModel.getAppLockValue()
if (appLockStatus && !mainViewModel.appUnlocked) {
executor = ContextCompat.getMainExecutor(this)
@@ -121,7 +122,7 @@ class MainActivity : AppCompatActivity() {
if (biometricManager.canAuthenticate(Utils.getAuthenticators()) != BiometricManager.BIOMETRIC_SUCCESS) {
setAppContents()
mainViewModel.appUnlocked = true
- PreferenceUtils.putBoolean(PreferenceUtils.APP_LOCK, false)
+ settingsViewModel.setAppLock(false)
} else {
finish() // close the app.
}
@@ -159,7 +160,7 @@ class MainActivity : AppCompatActivity() {
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
- val navController = rememberAnimatedNavController()
+ val navController = rememberNavController()
val screen by mainViewModel.startDestination
NavGraph(navController = navController, screen)
}
diff --git a/app/src/main/java/com/starry/greenstash/database/core/AppDatabase.kt b/app/src/main/java/com/starry/greenstash/database/core/AppDatabase.kt
index 1824d977..a5f4c7a0 100644
--- a/app/src/main/java/com/starry/greenstash/database/core/AppDatabase.kt
+++ b/app/src/main/java/com/starry/greenstash/database/core/AppDatabase.kt
@@ -25,7 +25,11 @@
package com.starry.greenstash.database.core
import android.content.Context
-import androidx.room.*
+import androidx.room.AutoMigration
+import androidx.room.Database
+import androidx.room.Room
+import androidx.room.RoomDatabase
+import androidx.room.TypeConverters
import com.starry.greenstash.database.goal.Goal
import com.starry.greenstash.database.goal.GoalDao
import com.starry.greenstash.database.transaction.Transaction
diff --git a/app/src/main/java/com/starry/greenstash/database/goal/GoalDao.kt b/app/src/main/java/com/starry/greenstash/database/goal/GoalDao.kt
index 41a0beab..3ebe689e 100644
--- a/app/src/main/java/com/starry/greenstash/database/goal/GoalDao.kt
+++ b/app/src/main/java/com/starry/greenstash/database/goal/GoalDao.kt
@@ -26,7 +26,11 @@
package com.starry.greenstash.database.goal
import androidx.lifecycle.LiveData
-import androidx.room.*
+import androidx.room.Dao
+import androidx.room.Insert
+import androidx.room.Query
+import androidx.room.Transaction
+import androidx.room.Update
import com.starry.greenstash.database.core.GoalWithTransactions
import kotlinx.coroutines.flow.Flow
diff --git a/app/src/main/java/com/starry/greenstash/database/widget/WidgetDao.kt b/app/src/main/java/com/starry/greenstash/database/widget/WidgetDao.kt
index b6a4b3ac..6ef80717 100644
--- a/app/src/main/java/com/starry/greenstash/database/widget/WidgetDao.kt
+++ b/app/src/main/java/com/starry/greenstash/database/widget/WidgetDao.kt
@@ -25,7 +25,12 @@
package com.starry.greenstash.database.widget
-import androidx.room.*
+import androidx.room.Dao
+import androidx.room.Delete
+import androidx.room.Insert
+import androidx.room.OnConflictStrategy
+import androidx.room.Query
+import androidx.room.Update
@Dao
interface WidgetDao {
diff --git a/app/src/main/java/com/starry/greenstash/di/MianModule.kt b/app/src/main/java/com/starry/greenstash/di/MainModule.kt
similarity index 85%
rename from app/src/main/java/com/starry/greenstash/di/MianModule.kt
rename to app/src/main/java/com/starry/greenstash/di/MainModule.kt
index 396e9439..2de4e2ae 100644
--- a/app/src/main/java/com/starry/greenstash/di/MianModule.kt
+++ b/app/src/main/java/com/starry/greenstash/di/MainModule.kt
@@ -37,13 +37,16 @@ import com.starry.greenstash.database.goal.GoalDao
import com.starry.greenstash.other.WelcomeDataStore
import com.starry.greenstash.reminder.ReminderManager
import com.starry.greenstash.reminder.ReminderNotificationSender
+import com.starry.greenstash.utils.PreferenceUtil
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
+import kotlinx.coroutines.ExperimentalCoroutinesApi
import javax.inject.Singleton
+@ExperimentalCoroutinesApi
@ExperimentalMaterialApi
@ExperimentalFoundationApi
@ExperimentalComposeUiApi
@@ -51,7 +54,7 @@ import javax.inject.Singleton
@ExperimentalMaterial3Api
@InstallIn(SingletonComponent::class)
@Module
-class MianModule {
+class MainModule {
@Singleton
@Provides
@@ -66,6 +69,9 @@ class MianModule {
@Provides
fun provideWidgetDao(appDatabase: AppDatabase) = appDatabase.getWidgetDao()
+ @Provides
+ fun providePreferenceUtil(@ApplicationContext context: Context) = PreferenceUtil(context)
+
@Provides
@Singleton
fun provideDataStoreRepository(
@@ -78,11 +84,14 @@ class MianModule {
@Provides
@Singleton
- fun provideReminderNotificationSender(@ApplicationContext context: Context) =
- ReminderNotificationSender(context)
+ fun provideReminderNotificationSender(
+ @ApplicationContext context: Context,
+ preferenceUtil: PreferenceUtil
+ ) =
+ ReminderNotificationSender(context, preferenceUtil)
@Provides
@Singleton
- fun providebackupmanager(@ApplicationContext context: Context, goalDao: GoalDao) =
+ fun provideBackupManager(@ApplicationContext context: Context, goalDao: GoalDao) =
BackupManager(context = context, goalDao = goalDao)
}
\ No newline at end of file
diff --git a/app/src/main/java/com/starry/greenstash/reminder/ReminderNotificationSender.kt b/app/src/main/java/com/starry/greenstash/reminder/ReminderNotificationSender.kt
index a5a596f4..ee3c7247 100644
--- a/app/src/main/java/com/starry/greenstash/reminder/ReminderNotificationSender.kt
+++ b/app/src/main/java/com/starry/greenstash/reminder/ReminderNotificationSender.kt
@@ -25,20 +25,16 @@
package com.starry.greenstash.reminder
-import android.Manifest
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
-import android.content.pm.PackageManager
-import android.os.Build
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.core.app.NotificationCompat
-import androidx.core.content.ContextCompat
import com.starry.greenstash.MainActivity
import com.starry.greenstash.R
import com.starry.greenstash.database.core.GoalWithTransactions
@@ -46,39 +42,30 @@ import com.starry.greenstash.database.goal.GoalPriority
import com.starry.greenstash.reminder.receivers.ReminderDepositReceiver
import com.starry.greenstash.reminder.receivers.ReminderDismissReceiver
import com.starry.greenstash.utils.GoalTextUtils
-import com.starry.greenstash.utils.PreferenceUtils
+import com.starry.greenstash.utils.PreferenceUtil
import com.starry.greenstash.utils.Utils
import kotlinx.coroutines.ExperimentalCoroutinesApi
+
@ExperimentalCoroutinesApi
@ExperimentalMaterial3Api
@ExperimentalAnimationApi
@ExperimentalComposeUiApi
@ExperimentalFoundationApi
@ExperimentalMaterialApi
-class ReminderNotificationSender(private val context: Context) {
-
+class ReminderNotificationSender(
+ private val context: Context,
+ private val preferenceUtil: PreferenceUtil
+) {
companion object {
const val REMINDER_CHANNEL_ID = "reminder_notification_channel"
const val REMINDER_CHANNEL_NAME = "Goal Reminders"
private const val INTENT_UNIQUE_CODE = 7546
}
- init {
- PreferenceUtils.initialize(context)
- }
-
private val notificationManager =
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
- fun hasNotificationPermission() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
- ContextCompat.checkSelfPermission(
- context, Manifest.permission.POST_NOTIFICATIONS
- ) == PackageManager.PERMISSION_GRANTED
- } else {
- true
- }
-
fun sendNotification(goalItem: GoalWithTransactions) {
val goal = goalItem.goal
@@ -96,10 +83,10 @@ class ReminderNotificationSender(private val context: Context) {
.setContentIntent(createActivityIntent())
val remainingAmount = (goal.targetAmount - goalItem.getCurrentlySavedAmount())
- val defCurrency = PreferenceUtils.getString(PreferenceUtils.DEFAULT_CURRENCY, "")
+ val defCurrency = preferenceUtil.getString(PreferenceUtil.DEFAULT_CURRENCY_STR, "")
if (goal.deadline.isNotEmpty() && goal.deadline.isNotBlank()) {
- val calculatedDays = GoalTextUtils.calcRemainingDays(goal)
+ val calculatedDays = GoalTextUtils(preferenceUtil).calcRemainingDays(goal)
when (goal.priority) {
GoalPriority.High -> {
val amountDay = remainingAmount / calculatedDays.remainingDays
@@ -145,7 +132,7 @@ class ReminderNotificationSender(private val context: Context) {
}
fun updateWithDepositNotification(goalId: Long, amount: Double) {
- val defCurrency = PreferenceUtils.getString(PreferenceUtils.DEFAULT_CURRENCY, "")
+ val defCurrency = preferenceUtil.getString(PreferenceUtil.DEFAULT_CURRENCY_STR, "")
val notification = NotificationCompat.Builder(context, REMINDER_CHANNEL_ID)
.setSmallIcon(R.drawable.ic_reminder_notification)
.setContentTitle(context.getString(R.string.notification_deposited_title))
diff --git a/app/src/main/java/com/starry/greenstash/reminder/receivers/AlarmReceiver.kt b/app/src/main/java/com/starry/greenstash/reminder/receivers/AlarmReceiver.kt
index 6ee23be7..160ac7e0 100644
--- a/app/src/main/java/com/starry/greenstash/reminder/receivers/AlarmReceiver.kt
+++ b/app/src/main/java/com/starry/greenstash/reminder/receivers/AlarmReceiver.kt
@@ -42,12 +42,14 @@ import com.starry.greenstash.reminder.ReminderNotificationSender
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.launch
import java.time.DayOfWeek
import java.time.LocalDate
import java.time.LocalDateTime
import javax.inject.Inject
+@ExperimentalCoroutinesApi
@ExperimentalMaterialApi
@ExperimentalFoundationApi
@ExperimentalComposeUiApi
diff --git a/app/src/main/java/com/starry/greenstash/ui/navigation/DrawerScreens.kt b/app/src/main/java/com/starry/greenstash/ui/navigation/DrawerScreens.kt
index e4d55a8b..6f9c628a 100644
--- a/app/src/main/java/com/starry/greenstash/ui/navigation/DrawerScreens.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/navigation/DrawerScreens.kt
@@ -28,9 +28,9 @@ package com.starry.greenstash.ui.navigation
import com.starry.greenstash.R
sealed class DrawerScreens(val route: String, val nameResId: Int, val iconResId: Int) {
- object Home : DrawerScreens("home", R.string.drawer_home, R.drawable.ic_nav_home)
- object Backups : DrawerScreens("backups", R.string.drawer_backups, R.drawable.ic_nav_backups)
- object Settings :
+ data object Home : DrawerScreens("home", R.string.drawer_home, R.drawable.ic_nav_home)
+ data object Backups : DrawerScreens("backups", R.string.drawer_backups, R.drawable.ic_nav_backups)
+ data object Settings :
DrawerScreens("settings", R.string.drawer_settings, R.drawable.ic_nav_settings)
}
diff --git a/app/src/main/java/com/starry/greenstash/ui/navigation/NavGraph.kt b/app/src/main/java/com/starry/greenstash/ui/navigation/NavGraph.kt
index 932bc05e..649015f6 100644
--- a/app/src/main/java/com/starry/greenstash/ui/navigation/NavGraph.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/navigation/NavGraph.kt
@@ -42,9 +42,9 @@ import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import androidx.navigation.NavType
+import androidx.navigation.compose.NavHost
+import androidx.navigation.compose.composable
import androidx.navigation.navArgument
-import com.google.accompanist.navigation.animation.AnimatedNavHost
-import com.google.accompanist.navigation.animation.composable
import com.starry.greenstash.ui.screens.backups.BackupScreen
import com.starry.greenstash.ui.screens.home.composables.HomeScreen
import com.starry.greenstash.ui.screens.info.composables.GoalInfoScreen
@@ -55,6 +55,33 @@ import com.starry.greenstash.ui.screens.settings.composables.SettingsScreen
import com.starry.greenstash.ui.screens.welcome.composables.WelcomeScreen
import kotlinx.coroutines.ExperimentalCoroutinesApi
+
+private const val NAVIGATION_ANIM_DURATION = 300
+
+private fun enterTransition() = slideInHorizontally(
+ initialOffsetX = { NAVIGATION_ANIM_DURATION }, animationSpec = tween(
+ durationMillis = NAVIGATION_ANIM_DURATION, easing = FastOutSlowInEasing
+ )
+) + fadeIn(animationSpec = tween(NAVIGATION_ANIM_DURATION))
+
+private fun exitTransition() = slideOutHorizontally(
+ targetOffsetX = { -NAVIGATION_ANIM_DURATION }, animationSpec = tween(
+ durationMillis = NAVIGATION_ANIM_DURATION, easing = FastOutSlowInEasing
+ )
+) + fadeOut(animationSpec = tween(NAVIGATION_ANIM_DURATION))
+
+private fun popEnterTransition() = slideInHorizontally(
+ initialOffsetX = { -NAVIGATION_ANIM_DURATION }, animationSpec = tween(
+ durationMillis = NAVIGATION_ANIM_DURATION, easing = FastOutSlowInEasing
+ )
+) + fadeIn(animationSpec = tween(NAVIGATION_ANIM_DURATION))
+
+private fun popExitTransition() = slideOutHorizontally(
+ targetOffsetX = { NAVIGATION_ANIM_DURATION }, animationSpec = tween(
+ durationMillis = NAVIGATION_ANIM_DURATION, easing = FastOutSlowInEasing
+ )
+) + fadeOut(animationSpec = tween(NAVIGATION_ANIM_DURATION))
+
@ExperimentalCoroutinesApi
@ExperimentalMaterialApi
@ExperimentalFoundationApi
@@ -66,7 +93,7 @@ fun NavGraph(
navController: NavHostController,
startDestination: String
) {
- AnimatedNavHost(
+ NavHost(
navController = navController,
startDestination = startDestination,
modifier = Modifier.background(MaterialTheme.colorScheme.background)
@@ -75,21 +102,8 @@ fun NavGraph(
/** Welcome Screen */
composable(
route = Screens.WelcomeScreen.route,
- exitTransition = {
- slideOutHorizontally(
- targetOffsetX = { -300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeOut(animationSpec = tween(300))
- },
- popEnterTransition = {
- slideInHorizontally(
- initialOffsetX = { -300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeIn(animationSpec = tween(300))
-
- },
+ exitTransition = { exitTransition() },
+ popEnterTransition = { popEnterTransition() },
) {
WelcomeScreen(navController = navController)
}
@@ -97,21 +111,8 @@ fun NavGraph(
/** Home Screen */
composable(
route = DrawerScreens.Home.route,
- exitTransition = {
- slideOutHorizontally(
- targetOffsetX = { -300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeOut(animationSpec = tween(300))
- },
- popEnterTransition = {
- slideInHorizontally(
- initialOffsetX = { -300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeIn(animationSpec = tween(300))
-
- },
+ exitTransition = { exitTransition() },
+ popEnterTransition = { popEnterTransition() },
) {
HomeScreen(navController)
}
@@ -119,36 +120,10 @@ fun NavGraph(
/** Goal Info Screen */
composable(
route = Screens.GoalInfoScreen.route,
- enterTransition = {
- slideInHorizontally(
- initialOffsetX = { 300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeIn(animationSpec = tween(300))
- },
- exitTransition = {
- slideOutHorizontally(
- targetOffsetX = { -300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeOut(animationSpec = tween(300))
-
- },
- popEnterTransition = {
- slideInHorizontally(
- initialOffsetX = { -300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeIn(animationSpec = tween(300))
-
- },
- popExitTransition = {
- slideOutHorizontally(
- targetOffsetX = { 300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeOut(animationSpec = tween(300))
- },
+ enterTransition = { enterTransition() },
+ exitTransition = { exitTransition() },
+ popEnterTransition = { popEnterTransition() },
+ popExitTransition = { popExitTransition() },
arguments = listOf(
navArgument(GOAL_INFO_ARG_KEY) {
type = NavType.StringType
@@ -159,40 +134,13 @@ fun NavGraph(
GoalInfoScreen(goalId = goalId, navController)
}
-
/** Input Screen */
composable(
route = Screens.InputScreen.route,
- enterTransition = {
- slideInHorizontally(
- initialOffsetX = { 300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeIn(animationSpec = tween(300))
- },
- exitTransition = {
- slideOutHorizontally(
- targetOffsetX = { -300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeOut(animationSpec = tween(300))
-
- },
- popEnterTransition = {
- slideInHorizontally(
- initialOffsetX = { -300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeIn(animationSpec = tween(300))
-
- },
- popExitTransition = {
- slideOutHorizontally(
- targetOffsetX = { 300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeOut(animationSpec = tween(300))
- },
+ enterTransition = { enterTransition() },
+ exitTransition = { exitTransition() },
+ popEnterTransition = { popEnterTransition() },
+ popExitTransition = { popExitTransition() },
arguments = listOf(navArgument(EDIT_GOAL_ARG_KEY) {
nullable = true
defaultValue = null
@@ -206,36 +154,10 @@ fun NavGraph(
/** Backup Screen */
composable(
route = DrawerScreens.Backups.route,
- enterTransition = {
- slideInHorizontally(
- initialOffsetX = { 300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeIn(animationSpec = tween(300))
- },
- exitTransition = {
- slideOutHorizontally(
- targetOffsetX = { -300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeOut(animationSpec = tween(300))
-
- },
- popEnterTransition = {
- slideInHorizontally(
- initialOffsetX = { -300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeIn(animationSpec = tween(300))
-
- },
- popExitTransition = {
- slideOutHorizontally(
- targetOffsetX = { 300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeOut(animationSpec = tween(300))
- }
+ enterTransition = { enterTransition() },
+ exitTransition = { exitTransition() },
+ popEnterTransition = { popEnterTransition() },
+ popExitTransition = { popExitTransition() },
) {
BackupScreen(navController)
}
@@ -243,36 +165,10 @@ fun NavGraph(
/** Settings Screen */
composable(
route = DrawerScreens.Settings.route,
- enterTransition = {
- slideInHorizontally(
- initialOffsetX = { 300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeIn(animationSpec = tween(300))
- },
- exitTransition = {
- slideOutHorizontally(
- targetOffsetX = { -300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeOut(animationSpec = tween(300))
-
- },
- popEnterTransition = {
- slideInHorizontally(
- initialOffsetX = { -300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeIn(animationSpec = tween(300))
-
- },
- popExitTransition = {
- slideOutHorizontally(
- targetOffsetX = { 300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeOut(animationSpec = tween(300))
- }
+ enterTransition = { enterTransition() },
+ exitTransition = { exitTransition() },
+ popEnterTransition = { popEnterTransition() },
+ popExitTransition = { popExitTransition() },
) {
SettingsScreen(navController)
}
@@ -280,20 +176,8 @@ fun NavGraph(
/** Open Source Licenses Screen */
composable(
route = Screens.OSLScreen.route,
- enterTransition = {
- slideInHorizontally(
- initialOffsetX = { 300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeIn(animationSpec = tween(300))
- },
- popExitTransition = {
- slideOutHorizontally(
- targetOffsetX = { 300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeOut(animationSpec = tween(300))
- },
+ enterTransition = { enterTransition() },
+ popExitTransition = { popExitTransition() },
) {
OSLScreen(navController = navController)
}
@@ -301,20 +185,8 @@ fun NavGraph(
/** About Screen */
composable(
route = Screens.AboutScreen.route,
- enterTransition = {
- slideInHorizontally(
- initialOffsetX = { 300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeIn(animationSpec = tween(300))
- },
- popExitTransition = {
- slideOutHorizontally(
- targetOffsetX = { 300 }, animationSpec = tween(
- durationMillis = 300, easing = FastOutSlowInEasing
- )
- ) + fadeOut(animationSpec = tween(300))
- },
+ enterTransition = { enterTransition() },
+ popExitTransition = { popExitTransition() },
) {
AboutScreen(navController = navController)
}
diff --git a/app/src/main/java/com/starry/greenstash/ui/navigation/Screens.kt b/app/src/main/java/com/starry/greenstash/ui/navigation/Screens.kt
index 566308d8..67d39cd7 100644
--- a/app/src/main/java/com/starry/greenstash/ui/navigation/Screens.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/navigation/Screens.kt
@@ -29,19 +29,19 @@ const val EDIT_GOAL_ARG_KEY = "editGoal"
const val GOAL_INFO_ARG_KEY = "goalId"
sealed class Screens(val route: String) {
- object InputScreen : Screens("input_screen?$EDIT_GOAL_ARG_KEY={$EDIT_GOAL_ARG_KEY}") {
+ data object InputScreen : Screens("input_screen?$EDIT_GOAL_ARG_KEY={$EDIT_GOAL_ARG_KEY}") {
fun withGoalToEdit(goalId: String): String {
return route.replace("{$EDIT_GOAL_ARG_KEY}", goalId)
}
}
- object GoalInfoScreen : Screens("goal_info_screen/{$GOAL_INFO_ARG_KEY}") {
+ data object GoalInfoScreen : Screens("goal_info_screen/{$GOAL_INFO_ARG_KEY}") {
fun withGoalId(goalId: String): String {
return route.replace("{$GOAL_INFO_ARG_KEY}", goalId)
}
}
- object AboutScreen : Screens("about_screen")
- object OSLScreen : Screens("osl_screen")
- object WelcomeScreen : Screens("welcome_screen")
+ data object AboutScreen : Screens("about_screen")
+ data object OSLScreen : Screens("osl_screen")
+ data object WelcomeScreen : Screens("welcome_screen")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/GoalItem.kt b/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/GoalItem.kt
index 6eccf87a..e6d3bfb3 100644
--- a/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/GoalItem.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/GoalItem.kt
@@ -63,6 +63,7 @@ import androidx.compose.ui.unit.sp
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.starry.greenstash.R
+import com.starry.greenstash.ui.theme.greenstashFont
@Composable
fun GoalItem(
@@ -148,7 +149,8 @@ fun GoalItem(
Text(
text = stringResource(id = R.string.deposit_button).uppercase(),
fontWeight = FontWeight.SemiBold,
- color = MaterialTheme.colorScheme.onSurface
+ color = MaterialTheme.colorScheme.onSurface,
+ fontFamily = greenstashFont
)
}
TextButton(
@@ -157,7 +159,8 @@ fun GoalItem(
Text(
text = stringResource(id = R.string.withdraw_button).uppercase(),
fontWeight = FontWeight.SemiBold,
- color = MaterialTheme.colorScheme.onSurface
+ color = MaterialTheme.colorScheme.onSurface,
+ fontFamily = greenstashFont
)
}
diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/GoalLazyItem.kt b/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/GoalLazyItem.kt
index 94f0dc77..3de96154 100644
--- a/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/GoalLazyItem.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/GoalLazyItem.kt
@@ -46,7 +46,6 @@ import com.starry.greenstash.database.core.GoalWithTransactions
import com.starry.greenstash.ui.navigation.Screens
import com.starry.greenstash.ui.screens.home.viewmodels.BottomSheetType
import com.starry.greenstash.ui.screens.home.viewmodels.HomeViewModel
-import com.starry.greenstash.utils.GoalTextUtils
import com.starry.greenstash.utils.Utils
import com.starry.greenstash.utils.validateAmount
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -79,8 +78,8 @@ fun GoalLazyColumnItem(
val hapticFeedback = LocalHapticFeedback.current
GoalItem(title = item.goal.title,
- primaryText = GoalTextUtils.buildPrimaryText(context, progressPercent, item),
- secondaryText = GoalTextUtils.buildSecondaryText(context, item),
+ primaryText = viewModel.goalTextUtil.buildPrimaryText(context, progressPercent, item),
+ secondaryText = viewModel.goalTextUtil.buildSecondaryText(context, item),
goalProgress = progressPercent.toFloat() / 100,
goalImage = item.goal.goalImage,
onDepositClicked = {
diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/HomeAppBars.kt b/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/HomeAppBars.kt
index 8bc52098..833dc629 100644
--- a/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/HomeAppBars.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/HomeAppBars.kt
@@ -58,6 +58,7 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import com.starry.greenstash.R
import com.starry.greenstash.ui.screens.home.viewmodels.SearchWidgetState
+import com.starry.greenstash.ui.theme.greenstashFont
@ExperimentalMaterial3Api
@Composable
@@ -108,6 +109,7 @@ fun DefaultAppBar(
stringResource(id = R.string.home_screen_header),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
+ fontFamily = greenstashFont
)
}, navigationIcon = {
IconButton(onClick = { onMenuClicked() }) {
diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/HomeScreen.kt b/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/HomeScreen.kt
index 6d33b5bd..de1495db 100644
--- a/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/HomeScreen.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/screens/home/composables/HomeScreen.kt
@@ -117,6 +117,7 @@ import com.starry.greenstash.ui.screens.home.viewmodels.FilterField
import com.starry.greenstash.ui.screens.home.viewmodels.FilterSortType
import com.starry.greenstash.ui.screens.home.viewmodels.HomeViewModel
import com.starry.greenstash.ui.screens.home.viewmodels.SearchWidgetState
+import com.starry.greenstash.utils.Utils
import com.starry.greenstash.utils.isScrollingUp
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
@@ -197,18 +198,19 @@ fun HomeScreenContent(
Spacer(Modifier.height(14.dp))
Text(
- text = stringResource(id = R.string.app_name),
+ text = Utils.getGreeting(),
modifier = Modifier.padding(start = 16.dp, top = 12.dp),
- fontSize = 18.sp,
- fontWeight = FontWeight.Medium,
+ fontSize = 24.sp,
+ fontWeight = FontWeight.SemiBold,
+ color = MaterialTheme.colorScheme.onSurface
)
Divider(
- thickness = 1.dp,
+ thickness = 0.5.dp,
modifier = Modifier
.fillMaxWidth()
.padding(top = 16.dp, bottom = 16.dp),
- color = MaterialTheme.colorScheme.onSurface
+ color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.2f)
)
items.forEach { item ->
@@ -528,7 +530,7 @@ fun FilterMenuSheet(viewModel: HomeViewModel) {
)
Row(modifier = Modifier.fillMaxWidth()) {
Column(modifier = Modifier.weight(1f), verticalArrangement = Arrangement.Center) {
- FilterField.values().forEach {
+ FilterField.entries.forEach {
FilterButton(
text = it.name,
isSelected = it == viewModel.filterFlowData.value.filterField,
@@ -536,7 +538,7 @@ fun FilterMenuSheet(viewModel: HomeViewModel) {
}
}
Column(modifier = Modifier.weight(1f), verticalArrangement = Arrangement.Center) {
- FilterSortType.values().forEach {
+ FilterSortType.entries.forEach {
FilterButton(
text = it.name,
isSelected = viewModel.filterFlowData.value.sortType.name == it.name,
diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/home/viewmodels/HomeViewModel.kt b/app/src/main/java/com/starry/greenstash/ui/screens/home/viewmodels/HomeViewModel.kt
index f2159ab7..53fc2341 100644
--- a/app/src/main/java/com/starry/greenstash/ui/screens/home/viewmodels/HomeViewModel.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/screens/home/viewmodels/HomeViewModel.kt
@@ -42,6 +42,8 @@ import com.starry.greenstash.database.transaction.Transaction
import com.starry.greenstash.database.transaction.TransactionDao
import com.starry.greenstash.database.transaction.TransactionType
import com.starry.greenstash.reminder.ReminderManager
+import com.starry.greenstash.utils.GoalTextUtils
+import com.starry.greenstash.utils.PreferenceUtil
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -68,9 +70,12 @@ data class FilterFlowData(val filterField: FilterField, val sortType: FilterSort
class HomeViewModel @Inject constructor(
private val goalDao: GoalDao,
private val transactionDao: TransactionDao,
- private val reminderManager: ReminderManager
+ private val reminderManager: ReminderManager,
+ private val preferenceUtil: PreferenceUtil
) : ViewModel() {
+ val goalTextUtil = GoalTextUtils(preferenceUtil)
+
private val _filterFlowData: MutableState = mutableStateOf(
FilterFlowData(
FilterField.Title,
diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/info/composables/GoalInfoScreen.kt b/app/src/main/java/com/starry/greenstash/ui/screens/info/composables/GoalInfoScreen.kt
index b166434f..81b5bf88 100644
--- a/app/src/main/java/com/starry/greenstash/ui/screens/info/composables/GoalInfoScreen.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/screens/info/composables/GoalInfoScreen.kt
@@ -25,7 +25,6 @@
package com.starry.greenstash.ui.screens.info.composables
-import android.content.Context
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
@@ -85,7 +84,6 @@ import com.airbnb.lottie.compose.animateLottieCompositionAsState
import com.airbnb.lottie.compose.rememberLottieComposition
import com.starry.greenstash.MainActivity
import com.starry.greenstash.R
-import com.starry.greenstash.database.core.GoalWithTransactions
import com.starry.greenstash.database.goal.GoalPriority
import com.starry.greenstash.database.goal.GoalPriority.High
import com.starry.greenstash.database.goal.GoalPriority.Low
@@ -97,8 +95,7 @@ import com.starry.greenstash.ui.common.ExpandableCard
import com.starry.greenstash.ui.common.ExpandableTextCard
import com.starry.greenstash.ui.screens.info.viewmodels.InfoViewModel
import com.starry.greenstash.ui.screens.settings.viewmodels.ThemeMode
-import com.starry.greenstash.utils.GoalTextUtils
-import com.starry.greenstash.utils.PreferenceUtils
+import com.starry.greenstash.ui.theme.greenstashFont
import com.starry.greenstash.utils.Utils
import com.starry.greenstash.utils.getActivity
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -125,6 +122,7 @@ fun GoalInfoScreen(goalId: String, navController: NavController) {
text = stringResource(id = R.string.info_screen_header),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
+ fontFamily = greenstashFont
)
}, navigationIcon = {
IconButton(onClick = { navController.navigateUp() }) {
@@ -150,8 +148,7 @@ fun GoalInfoScreen(goalId: String, navController: NavController) {
CircularProgressIndicator()
}
} else {
- val currencySymbol =
- PreferenceUtils.getString(PreferenceUtils.DEFAULT_CURRENCY, "$")!!
+ val currencySymbol = viewModel.getDefaultCurrencyValue()
val progressPercent =
((state.goalData!!.getCurrentlySavedAmount() / state.goalData.goal.targetAmount) * 100).toInt()
@@ -164,7 +161,9 @@ fun GoalInfoScreen(goalId: String, navController: NavController) {
currencySymbol = currencySymbol,
targetAmount = state.goalData.goal.targetAmount,
savedAmount = state.goalData.getCurrentlySavedAmount(),
- daysLeftText = getRemainingDaysText(context, state.goalData),
+ daysLeftText = viewModel.goalTextUtils.getRemainingDaysText(
+ context, state.goalData
+ ),
progress = progressPercent.toFloat() / 100
)
GoalPriorityCard(goalPriority = state.goalData.goal.priority)
@@ -423,22 +422,6 @@ fun TransactionItem(transactionType: TransactionType, amount: String, date: Stri
thickness = 0.8.dp
)
}
-
-}
-
-
-private fun getRemainingDaysText(context: Context, goalItem: GoalWithTransactions): String {
- return if (goalItem.getCurrentlySavedAmount() >= goalItem.goal.targetAmount) {
- context.getString(R.string.info_card_goal_achieved)
- } else {
- if (goalItem.goal.deadline.isNotEmpty() && goalItem.goal.deadline.isNotBlank()) {
- val calculatedDays = GoalTextUtils.calcRemainingDays(goalItem.goal)
- context.getString(R.string.info_card_remaining_days)
- .format(calculatedDays.remainingDays)
- } else {
- context.getString(R.string.info_card_no_deadline_set)
- }
- }
}
@ExperimentalCoroutinesApi
diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/info/viewmodels/InfoViewModel.kt b/app/src/main/java/com/starry/greenstash/ui/screens/info/viewmodels/InfoViewModel.kt
index 346383fd..9c6dc5b5 100644
--- a/app/src/main/java/com/starry/greenstash/ui/screens/info/viewmodels/InfoViewModel.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/screens/info/viewmodels/InfoViewModel.kt
@@ -32,6 +32,8 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.starry.greenstash.database.core.GoalWithTransactions
import com.starry.greenstash.database.goal.GoalDao
+import com.starry.greenstash.utils.GoalTextUtils
+import com.starry.greenstash.utils.PreferenceUtil
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
@@ -44,8 +46,14 @@ data class InfoScreenState(
)
@HiltViewModel
-class InfoViewModel @Inject constructor(private val goalDao: GoalDao) : ViewModel() {
+class InfoViewModel @Inject constructor(
+ private val goalDao: GoalDao,
+ private val preferenceUtil: PreferenceUtil
+) : ViewModel() {
+
+ val goalTextUtils = GoalTextUtils(preferenceUtil)
var state by mutableStateOf(InfoScreenState())
+
fun loadGoalData(goalId: Long) {
viewModelScope.launch(Dispatchers.IO) {
val goalWithTransactions = goalDao.getGoalWithTransactionById(goalId)
@@ -53,4 +61,8 @@ class InfoViewModel @Inject constructor(private val goalDao: GoalDao) : ViewMode
state = state.copy(isLoading = false, goalData = goalWithTransactions)
}
}
+
+ fun getDefaultCurrencyValue() = preferenceUtil.getString(
+ PreferenceUtil.DEFAULT_CURRENCY_STR, "$"
+ )!!
}
\ No newline at end of file
diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/input/composables/InputScreen.kt b/app/src/main/java/com/starry/greenstash/ui/screens/input/composables/InputScreen.kt
index 6e64dfde..701fc011 100644
--- a/app/src/main/java/com/starry/greenstash/ui/screens/input/composables/InputScreen.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/screens/input/composables/InputScreen.kt
@@ -129,14 +129,13 @@ import com.starry.greenstash.BuildConfig
import com.starry.greenstash.MainActivity
import com.starry.greenstash.R
import com.starry.greenstash.database.goal.GoalPriority
-import com.starry.greenstash.reminder.ReminderNotificationSender
import com.starry.greenstash.ui.common.SelectableChipGroup
import com.starry.greenstash.ui.navigation.DrawerScreens
import com.starry.greenstash.ui.screens.input.viewmodels.InputViewModel
-import com.starry.greenstash.ui.screens.settings.viewmodels.DateStyle
-import com.starry.greenstash.utils.PreferenceUtils
+import com.starry.greenstash.ui.theme.greenstashFont
import com.starry.greenstash.utils.Utils
import com.starry.greenstash.utils.getActivity
+import com.starry.greenstash.utils.hasNotificationPermission
import com.starry.greenstash.utils.toToast
import com.starry.greenstash.utils.validateAmount
import kotlinx.coroutines.CoroutineScope
@@ -196,13 +195,7 @@ fun InputScreen(editGoalId: String?, navController: NavController) {
CalendarDialog(
state = calenderState, selection = CalendarSelection.Date { date ->
viewModel.state = viewModel.state.copy(
- deadline = date.format(
- DateTimeFormatter.ofPattern(
- PreferenceUtils.getString(
- PreferenceUtils.DATE_FORMAT, DateStyle.DateMonthYear.pattern
- )
- )
- )
+ deadline = date.format(DateTimeFormatter.ofPattern(viewModel.getDateStyleValue()))
)
}, config = CalendarConfig(
monthSelection = true, yearSelection = true, disabledTimeline = CalendarTimeline.PAST
@@ -245,6 +238,7 @@ fun InputScreen(editGoalId: String?, navController: NavController) {
text = topBarText,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
+ fontFamily = greenstashFont
)
}, navigationIcon = {
IconButton(onClick = { navController.navigateUp() }) {
@@ -612,9 +606,7 @@ fun GoalReminderMenu(
snackbarHostState: SnackbarHostState,
coroutineScope: CoroutineScope
) {
- var hasNotificationPermission by remember {
- mutableStateOf(ReminderNotificationSender(context).hasNotificationPermission())
- }
+ var hasNotificationPermission by remember { mutableStateOf(context.hasNotificationPermission()) }
val launcher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.RequestPermission(),
diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/input/viewmodels/InputViewModel.kt b/app/src/main/java/com/starry/greenstash/ui/screens/input/viewmodels/InputViewModel.kt
index 4f2079c0..81d9670b 100644
--- a/app/src/main/java/com/starry/greenstash/ui/screens/input/viewmodels/InputViewModel.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/screens/input/viewmodels/InputViewModel.kt
@@ -42,7 +42,9 @@ import com.starry.greenstash.database.goal.Goal
import com.starry.greenstash.database.goal.GoalDao
import com.starry.greenstash.database.goal.GoalPriority
import com.starry.greenstash.reminder.ReminderManager
+import com.starry.greenstash.ui.screens.settings.viewmodels.DateStyle
import com.starry.greenstash.utils.ImageUtils
+import com.starry.greenstash.utils.PreferenceUtil
import com.starry.greenstash.utils.Utils
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
@@ -68,7 +70,8 @@ data class InputScreenState(
@HiltViewModel
class InputViewModel @Inject constructor(
private val goalDao: GoalDao,
- private val reminderManager: ReminderManager
+ private val reminderManager: ReminderManager,
+ private val preferenceUtil: PreferenceUtil
) : ViewModel() {
var state by mutableStateOf(InputScreenState())
@@ -83,7 +86,7 @@ class InputViewModel @Inject constructor(
uri = state.goalImageUri!!, context = context, maxSize = 1024
) else null,
additionalNotes = state.additionalNotes,
- priority = GoalPriority.values().find { it.name == state.priority }!!,
+ priority = GoalPriority.entries.find { it.name == state.priority }!!,
reminder = state.reminder
)
@@ -124,7 +127,7 @@ class InputViewModel @Inject constructor(
uri = state.goalImageUri!!, context = context, maxSize = 1024
) else goal.goalImage,
additionalNotes = state.additionalNotes,
- priority = GoalPriority.values().find { it.name == state.priority }!!,
+ priority = GoalPriority.entries.find { it.name == state.priority }!!,
reminder = state.reminder
)
// copy id of already saved goal to update it.
@@ -145,4 +148,8 @@ class InputViewModel @Inject constructor(
state = state.copy(deadline = "")
}
+ fun getDateStyleValue() = preferenceUtil.getString(
+ PreferenceUtil.DATE_FORMAT_STR, DateStyle.DateMonthYear.pattern
+ )
+
}
\ No newline at end of file
diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/settings/composables/SettingsScreen.kt b/app/src/main/java/com/starry/greenstash/ui/screens/settings/composables/SettingsScreen.kt
index 3e3587d3..7ea5adad 100644
--- a/app/src/main/java/com/starry/greenstash/ui/screens/settings/composables/SettingsScreen.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/screens/settings/composables/SettingsScreen.kt
@@ -80,7 +80,7 @@ import com.starry.greenstash.R
import com.starry.greenstash.ui.navigation.Screens
import com.starry.greenstash.ui.screens.settings.viewmodels.DateStyle
import com.starry.greenstash.ui.screens.settings.viewmodels.ThemeMode
-import com.starry.greenstash.utils.PreferenceUtils
+import com.starry.greenstash.ui.theme.greenstashFont
import com.starry.greenstash.utils.Utils
import com.starry.greenstash.utils.getActivity
import com.starry.greenstash.utils.toToast
@@ -111,7 +111,8 @@ fun SettingsScreen(navController: NavController) {
Text(
stringResource(id = R.string.settings_screen_header),
maxLines = 1,
- overflow = TextOverflow.Ellipsis
+ overflow = TextOverflow.Ellipsis,
+ fontFamily = greenstashFont
)
}, navigationIcon = {
IconButton(onClick = { navController.navigateUp() }) {
@@ -130,9 +131,7 @@ fun SettingsScreen(navController: NavController) {
LazyColumn(modifier = Modifier.padding(it)) {
/** Display Settings */
item {
- val themeValue = when (PreferenceUtils.getInt(
- PreferenceUtils.APP_THEME, ThemeMode.Auto.ordinal
- )) {
+ val themeValue = when (viewModel.getThemeValue()) {
ThemeMode.Light.ordinal -> "Light"
ThemeMode.Dark.ordinal -> "Dark"
else -> "System"
@@ -144,12 +143,7 @@ fun SettingsScreen(navController: NavController) {
}
val materialYouSwitch = remember {
- mutableStateOf(
- PreferenceUtils.getBoolean(
- PreferenceUtils.MATERIAL_YOU,
- Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
- )
- )
+ mutableStateOf(viewModel.getMaterialYouValue())
}
Column(
@@ -174,14 +168,12 @@ fun SettingsScreen(navController: NavController) {
if (newValue) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
viewModel.setMaterialYou(true)
- PreferenceUtils.putBoolean(PreferenceUtils.MATERIAL_YOU, true)
} else {
materialYouSwitch.value = false
context.getString(R.string.material_you_error).toToast(context)
}
} else {
viewModel.setMaterialYou(false)
- PreferenceUtils.putBoolean(PreferenceUtils.MATERIAL_YOU, false)
}
}
)
@@ -235,30 +227,15 @@ fun SettingsScreen(navController: NavController) {
when (selectedThemeOption) {
"Light" -> {
- viewModel.setTheme(
- ThemeMode.Light
- )
- PreferenceUtils.putInt(
- PreferenceUtils.APP_THEME, ThemeMode.Light.ordinal
- )
+ viewModel.setTheme(ThemeMode.Light)
}
"Dark" -> {
- viewModel.setTheme(
- ThemeMode.Dark
- )
- PreferenceUtils.putInt(
- PreferenceUtils.APP_THEME, ThemeMode.Dark.ordinal
- )
+ viewModel.setTheme(ThemeMode.Dark)
}
"System" -> {
- viewModel.setTheme(
- ThemeMode.Auto
- )
- PreferenceUtils.putInt(
- PreferenceUtils.APP_THEME, ThemeMode.Auto.ordinal
- )
+ viewModel.setTheme(ThemeMode.Auto)
}
}
}) {
@@ -278,9 +255,7 @@ fun SettingsScreen(navController: NavController) {
/** Locales Setting */
item {
- val dateValue = if (PreferenceUtils.getString(
- PreferenceUtils.DATE_FORMAT, DateStyle.DateMonthYear.pattern
- ) == DateStyle.YearMonthDate.pattern
+ val dateValue = if (viewModel.getDateStyleValue() == DateStyle.YearMonthDate.pattern
) {
"YYYY/MM/DD"
} else {
@@ -296,11 +271,9 @@ fun SettingsScreen(navController: NavController) {
val currencyEntries = context.resources.getStringArray(R.array.currency_entries)
val currencyValues = context.resources.getStringArray(R.array.currency_values)
- val currencyValue = currencyEntries[currencyValues.indexOf(
- PreferenceUtils.getString(
- PreferenceUtils.DEFAULT_CURRENCY, currencyValues.first()
- )
- )]
+ val currencyValue = currencyEntries[
+ currencyValues.indexOf(viewModel.getDefaultCurrencyValue())
+ ]
val currencyDialog = remember { mutableStateOf(false) }
val (selectedCurrencyOption, onCurrencyOptionSelected) = remember {
@@ -371,17 +344,11 @@ fun SettingsScreen(navController: NavController) {
when (selectedDateOption) {
"DD/MM/YYYY" -> {
- PreferenceUtils.putString(
- PreferenceUtils.DATE_FORMAT,
- DateStyle.DateMonthYear.pattern
- )
+ viewModel.setDateStyle(DateStyle.DateMonthYear.pattern)
}
"YYYY/MM/DD" -> {
- PreferenceUtils.putString(
- PreferenceUtils.DATE_FORMAT,
- DateStyle.YearMonthDate.pattern
- )
+ viewModel.setDateStyle(DateStyle.YearMonthDate.pattern)
}
}
}) {
@@ -448,7 +415,7 @@ fun SettingsScreen(navController: NavController) {
currencyDialog.value = false
val choice =
currencyValues[currencyEntries.indexOf(selectedCurrencyOption)]
- PreferenceUtils.putString(PreferenceUtils.DEFAULT_CURRENCY, choice)
+ viewModel.setDefaultCurrency(choice)
}) {
Text(stringResource(id = R.string.dialog_confirm_button))
}
@@ -465,13 +432,7 @@ fun SettingsScreen(navController: NavController) {
/** Security Settings. */
item {
- val appLockSwitch = remember {
- mutableStateOf(
- PreferenceUtils.getBoolean(
- PreferenceUtils.APP_LOCK, false
- )
- )
- }
+ val appLockSwitch = remember { mutableStateOf(viewModel.getAppLockValue()) }
Column(
modifier = Modifier.padding(top = 10.dp)
@@ -507,10 +468,7 @@ fun SettingsScreen(navController: NavController) {
context.getString(R.string.auth_successful)
.toToast(context)
mainActivity.mainViewModel.appUnlocked = true
- PreferenceUtils.putBoolean(
- PreferenceUtils.APP_LOCK,
- true
- )
+ viewModel.setAppLock(true)
}
override fun onAuthenticationFailed() {
@@ -528,7 +486,7 @@ fun SettingsScreen(navController: NavController) {
biometricPrompt.authenticate(promptInfo)
} else {
- PreferenceUtils.putBoolean(PreferenceUtils.APP_LOCK, false)
+ viewModel.setAppLock(false)
}
}
)
diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/settings/viewmodels/SettingsViewModel.kt b/app/src/main/java/com/starry/greenstash/ui/screens/settings/viewmodels/SettingsViewModel.kt
index 2a467fff..798ef352 100644
--- a/app/src/main/java/com/starry/greenstash/ui/screens/settings/viewmodels/SettingsViewModel.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/screens/settings/viewmodels/SettingsViewModel.kt
@@ -31,18 +31,24 @@ import androidx.compose.runtime.Composable
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
-import com.starry.greenstash.utils.PreferenceUtils
+import com.starry.greenstash.utils.PreferenceUtil
+import dagger.hilt.android.lifecycle.HiltViewModel
+import javax.inject.Inject
enum class ThemeMode {
Light, Dark, Auto
}
sealed class DateStyle(val pattern: String) {
- object DateMonthYear : DateStyle("dd/MM/yyyy")
- object YearMonthDate : DateStyle("yyyy/MM/dd")
+ data object DateMonthYear : DateStyle("dd/MM/yyyy")
+ data object YearMonthDate : DateStyle("yyyy/MM/dd")
}
-class SettingsViewModel : ViewModel() {
+@HiltViewModel
+class SettingsViewModel @Inject constructor(
+ private val preferenceUtil: PreferenceUtil
+) : ViewModel() {
+
private val _theme = MutableLiveData(ThemeMode.Auto)
private val _materialYou = MutableLiveData(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
@@ -51,29 +57,50 @@ class SettingsViewModel : ViewModel() {
fun setTheme(newTheme: ThemeMode) {
_theme.postValue(newTheme)
+ preferenceUtil.putInt(PreferenceUtil.APP_THEME_INT, newTheme.ordinal)
}
fun setMaterialYou(newValue: Boolean) {
_materialYou.postValue(newValue)
+ preferenceUtil.putBoolean(PreferenceUtil.MATERIAL_YOU_BOOL, newValue)
+ }
+
+ fun setDateStyle(newValue: String) {
+ preferenceUtil.putString(PreferenceUtil.DATE_FORMAT_STR, newValue)
+ }
+
+ fun setDefaultCurrency(newValue: String) {
+ preferenceUtil.putString(PreferenceUtil.DEFAULT_CURRENCY_STR, newValue)
+ }
+
+ fun setAppLock(newValue: Boolean) {
+ preferenceUtil.putBoolean(PreferenceUtil.APP_LOCK_BOOL, newValue)
}
+ fun getThemeValue() = preferenceUtil.getInt(
+ PreferenceUtil.APP_THEME_INT, ThemeMode.Auto.ordinal
+ )
+
+ fun getMaterialYouValue() = preferenceUtil.getBoolean(
+ PreferenceUtil.MATERIAL_YOU_BOOL, Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
+ )
+
+ fun getDateStyleValue() = preferenceUtil.getString(
+ PreferenceUtil.DATE_FORMAT_STR, DateStyle.DateMonthYear.pattern
+ )
+
+ fun getDefaultCurrencyValue() = preferenceUtil.getString(
+ PreferenceUtil.DEFAULT_CURRENCY_STR, "$"
+ )
+
+ fun getAppLockValue() = preferenceUtil.getBoolean(
+ PreferenceUtil.APP_LOCK_BOOL, false
+ )
+
@Composable
fun getCurrentTheme(): ThemeMode {
return if (theme.value == ThemeMode.Auto) {
if (isSystemInDarkTheme()) ThemeMode.Dark else ThemeMode.Light
} else theme.value!!
}
-
- fun setUpAppTheme() {
- when (PreferenceUtils.getInt(PreferenceUtils.APP_THEME, ThemeMode.Auto.ordinal)) {
- ThemeMode.Auto.ordinal -> setTheme(ThemeMode.Auto)
- ThemeMode.Dark.ordinal -> setTheme(ThemeMode.Dark)
- ThemeMode.Light.ordinal -> setTheme(ThemeMode.Light)
- }
- setMaterialYou(
- PreferenceUtils.getBoolean(
- PreferenceUtils.MATERIAL_YOU, Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
- )
- )
- }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/welcome/composables/WelcomeScreen.kt b/app/src/main/java/com/starry/greenstash/ui/screens/welcome/composables/WelcomeScreen.kt
index d592a650..ddec6dce 100644
--- a/app/src/main/java/com/starry/greenstash/ui/screens/welcome/composables/WelcomeScreen.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/screens/welcome/composables/WelcomeScreen.kt
@@ -73,7 +73,6 @@ import com.airbnb.lottie.compose.rememberLottieComposition
import com.starry.greenstash.R
import com.starry.greenstash.ui.navigation.DrawerScreens
import com.starry.greenstash.ui.screens.welcome.viewmodels.WelcomeViewModel
-import com.starry.greenstash.utils.PreferenceUtils
@Composable
fun WelcomeScreen(navController: NavController) {
@@ -82,12 +81,7 @@ fun WelcomeScreen(navController: NavController) {
val currencyEntries = context.resources.getStringArray(R.array.currency_entries)
val currencyValues = context.resources.getStringArray(R.array.currency_values)
-
- val currencyValue = currencyEntries[currencyValues.indexOf(
- PreferenceUtils.getString(
- PreferenceUtils.DEFAULT_CURRENCY, currencyValues.first()
- )
- )]
+ val currencyValue = currencyEntries[currencyValues.indexOf(viewModel.getDefaultCurrencyValue())]
val currencyDialog = remember { mutableStateOf(false) }
val (selectedCurrencyOption, onCurrencyOptionSelected) = remember {
@@ -222,9 +216,8 @@ fun WelcomeScreen(navController: NavController) {
}, confirmButton = {
TextButton(onClick = {
currencyDialog.value = false
- val choice =
- currencyValues[currencyEntries.indexOf(selectedCurrencyOption)]
- PreferenceUtils.putString(PreferenceUtils.DEFAULT_CURRENCY, choice)
+ val choice = currencyValues[currencyEntries.indexOf(selectedCurrencyOption)]
+ viewModel.setDefaultCurrency(choice)
}) {
Text(stringResource(id = R.string.dialog_confirm_button))
}
diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/welcome/viewmodels/WelcomeViewModel.kt b/app/src/main/java/com/starry/greenstash/ui/screens/welcome/viewmodels/WelcomeViewModel.kt
index 911e5d87..63399fc8 100644
--- a/app/src/main/java/com/starry/greenstash/ui/screens/welcome/viewmodels/WelcomeViewModel.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/screens/welcome/viewmodels/WelcomeViewModel.kt
@@ -28,6 +28,7 @@ package com.starry.greenstash.ui.screens.welcome.viewmodels
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.starry.greenstash.other.WelcomeDataStore
+import com.starry.greenstash.utils.PreferenceUtil
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -35,7 +36,8 @@ import javax.inject.Inject
@HiltViewModel
class WelcomeViewModel @Inject constructor(
- private val welcomeDataStore: WelcomeDataStore
+ private val welcomeDataStore: WelcomeDataStore,
+ private val preferenceUtil: PreferenceUtil
) : ViewModel() {
fun saveOnBoardingState(completed: Boolean) {
@@ -43,4 +45,12 @@ class WelcomeViewModel @Inject constructor(
welcomeDataStore.saveOnBoardingState(completed = completed)
}
}
+
+ fun setDefaultCurrency(newValue: String) {
+ preferenceUtil.putString(PreferenceUtil.DEFAULT_CURRENCY_STR, newValue)
+ }
+
+ fun getDefaultCurrencyValue() = preferenceUtil.getString(
+ PreferenceUtil.DEFAULT_CURRENCY_STR, "$"
+ )
}
\ No newline at end of file
diff --git a/app/src/main/java/com/starry/greenstash/ui/theme/Type.kt b/app/src/main/java/com/starry/greenstash/ui/theme/Type.kt
index d86e5857..48e22f89 100644
--- a/app/src/main/java/com/starry/greenstash/ui/theme/Type.kt
+++ b/app/src/main/java/com/starry/greenstash/ui/theme/Type.kt
@@ -27,14 +27,49 @@ package com.starry.greenstash.ui.theme
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
+import com.starry.greenstash.R
+
+val greenstashFont = FontFamily(
+ listOf(
+ Font(
+ resId = R.font.redhatdisplay_black,
+ weight = FontWeight.Black
+ ),
+ Font(
+ resId = R.font.redhatdisplay_bold,
+ weight = FontWeight.Bold
+ ),
+ Font(
+ resId = R.font.redhatdisplay_extrabold,
+ weight = FontWeight.ExtraBold
+ ),
+ Font(
+ resId = R.font.redhatdisplay_light,
+ weight = FontWeight.Light
+ ),
+ Font(
+ resId = R.font.redhatdisplay_medium,
+ weight = FontWeight.Medium
+ ),
+ Font(
+ resId = R.font.redhatdisplay_regular,
+ weight = FontWeight.Normal
+ ),
+ Font(
+ resId = R.font.redhatdisplay_semibold,
+ weight = FontWeight.SemiBold
+ ),
+ )
+)
// Set of Material typography styles to start with
val Typography = Typography(
bodyLarge = TextStyle(
- fontFamily = FontFamily.Default,
+ fontFamily = greenstashFont,
fontWeight =
FontWeight.Normal,
fontSize = 16.sp,
diff --git a/app/src/main/java/com/starry/greenstash/utils/Extensions.kt b/app/src/main/java/com/starry/greenstash/utils/Extensions.kt
index 779a86b5..b34878a8 100644
--- a/app/src/main/java/com/starry/greenstash/utils/Extensions.kt
+++ b/app/src/main/java/com/starry/greenstash/utils/Extensions.kt
@@ -25,8 +25,11 @@
package com.starry.greenstash.utils
+import android.Manifest
import android.content.Context
import android.content.ContextWrapper
+import android.content.pm.PackageManager
+import android.os.Build
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.lazy.LazyListState
@@ -36,6 +39,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
+import androidx.core.content.ContextCompat
import java.io.File
import java.io.PrintWriter
@@ -45,6 +49,15 @@ fun Context.getActivity(): AppCompatActivity? = when (this) {
else -> null
}
+fun Context.hasNotificationPermission() =
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ ContextCompat.checkSelfPermission(
+ this, Manifest.permission.POST_NOTIFICATIONS
+ ) == PackageManager.PERMISSION_GRANTED
+ } else {
+ true
+ }
+
@Composable
fun LazyListState.isScrollingUp(): Boolean {
var previousIndex by remember(this) { mutableIntStateOf(firstVisibleItemIndex) }
diff --git a/app/src/main/java/com/starry/greenstash/utils/GoalTextUtils.kt b/app/src/main/java/com/starry/greenstash/utils/GoalTextUtils.kt
index 99fcf90b..0d6fc974 100644
--- a/app/src/main/java/com/starry/greenstash/utils/GoalTextUtils.kt
+++ b/app/src/main/java/com/starry/greenstash/utils/GoalTextUtils.kt
@@ -35,7 +35,7 @@ import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoUnit
-object GoalTextUtils {
+class GoalTextUtils(private val preferenceUtil: PreferenceUtil) {
data class CalculatedDays(
val remainingDays: Long,
@@ -66,7 +66,7 @@ object GoalTextUtils {
context.getString(R.string.progress_greet5)
}
}
- val defCurrency = PreferenceUtils.getString(PreferenceUtils.DEFAULT_CURRENCY, "")
+ val defCurrency = preferenceUtil.getString(PreferenceUtil.DEFAULT_CURRENCY_STR, "")
text += if (progressPercent < 100) {
"\n" + context.getString(R.string.currently_saved_incomplete)
} else {
@@ -84,7 +84,7 @@ object GoalTextUtils {
if ((remainingAmount > 0f)) {
if (item.goal.deadline.isNotEmpty() && item.goal.deadline.isNotBlank()) {
val calculatedDays = calcRemainingDays(item.goal)
- val defCurrency = PreferenceUtils.getString(PreferenceUtils.DEFAULT_CURRENCY, "")
+ val defCurrency = preferenceUtil.getString(PreferenceUtil.DEFAULT_CURRENCY_STR, "")
// build description string.
var text = context.getString(R.string.goal_days_left)
.format(calculatedDays.parsedEndDate, calculatedDays.remainingDays) + "\n"
@@ -140,10 +140,25 @@ object GoalTextUtils {
}
+ fun getRemainingDaysText(context: Context, goalItem: GoalWithTransactions): String {
+ return if (goalItem.getCurrentlySavedAmount() >= goalItem.goal.targetAmount) {
+ context.getString(R.string.info_card_goal_achieved)
+ } else {
+ if (goalItem.goal.deadline.isNotEmpty() && goalItem.goal.deadline.isNotBlank()) {
+ val calculatedDays = calcRemainingDays(goalItem.goal)
+ context.getString(R.string.info_card_remaining_days)
+ .format(calculatedDays.remainingDays)
+ } else {
+ context.getString(R.string.info_card_no_deadline_set)
+ }
+ }
+ }
+
+
fun calcRemainingDays(goal: Goal): CalculatedDays {
// calculate remaining days between today and endDate (deadline).
- val preferredDateFormat = PreferenceUtils.getString(
- PreferenceUtils.DATE_FORMAT, DateStyle.DateMonthYear.pattern
+ val preferredDateFormat = preferenceUtil.getString(
+ PreferenceUtil.DATE_FORMAT_STR, DateStyle.DateMonthYear.pattern
)
val dateFormatter: DateTimeFormatter =
DateTimeFormatter.ofPattern(preferredDateFormat)
@@ -156,16 +171,17 @@ object GoalTextUtils {
val reverseDate: (String) -> String = {
goal.deadline.split("/").reversed().joinToString(separator = "/")
}
- val endDate = if (goal.deadline.split("/")
- .first().length == 2 && preferredDateFormat != DateStyle.DateMonthYear.pattern
- ) {
- reverseDate(goal.deadline)
- } else if (goal.deadline.split("/")
- .first().length == 4 && preferredDateFormat != DateStyle.YearMonthDate.pattern
- ) {
- reverseDate(goal.deadline)
- } else {
- goal.deadline
+
+ val endDate = when {
+ goal.deadline.split("/").first().length == 2 &&
+ preferredDateFormat != DateStyle.DateMonthYear.pattern ->
+ reverseDate(goal.deadline)
+
+ goal.deadline.split("/").first().length == 4 &&
+ preferredDateFormat != DateStyle.YearMonthDate.pattern ->
+ reverseDate(goal.deadline)
+
+ else -> goal.deadline
}
val startDateValue: LocalDate = LocalDate.parse(startDate, dateFormatter)
diff --git a/app/src/main/java/com/starry/greenstash/utils/PreferenceUtils.kt b/app/src/main/java/com/starry/greenstash/utils/PreferenceUtil.kt
similarity index 76%
rename from app/src/main/java/com/starry/greenstash/utils/PreferenceUtils.kt
rename to app/src/main/java/com/starry/greenstash/utils/PreferenceUtil.kt
index f065efae..f2e7ec9d 100644
--- a/app/src/main/java/com/starry/greenstash/utils/PreferenceUtils.kt
+++ b/app/src/main/java/com/starry/greenstash/utils/PreferenceUtil.kt
@@ -29,32 +29,34 @@ import android.content.Context
import android.content.SharedPreferences
import com.starry.greenstash.ui.screens.settings.viewmodels.DateStyle
-object PreferenceUtils {
- private lateinit var prefs: SharedPreferences
- private const val PREFS_NAME = "myne_settings"
+class PreferenceUtil(context: Context) {
- // Preference keys
- const val APP_THEME = "theme_settings"
- const val MATERIAL_YOU = "material_you"
- const val DEFAULT_CURRENCY = "default_currency"
- const val DATE_FORMAT = "date_format"
- const val APP_LOCK = "app_lock"
+ companion object {
+ private const val PREFS_NAME = "greenstash_settings"
- fun initialize(context: Context) {
+ // Preference keys
+ const val APP_THEME_INT = "theme_settings"
+ const val MATERIAL_YOU_BOOL = "material_you"
+ const val DEFAULT_CURRENCY_STR = "default_currency"
+ const val DATE_FORMAT_STR = "date_format"
+ const val APP_LOCK_BOOL = "app_lock"
+ }
+
+ private var prefs: SharedPreferences
+
+ init {
prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
// Pre-populate some preference data with default values
- if (!keyExists(DEFAULT_CURRENCY)) {
- putString(DEFAULT_CURRENCY, "$")
+ if (!keyExists(DEFAULT_CURRENCY_STR)) {
+ putString(DEFAULT_CURRENCY_STR, "$")
}
- if (!keyExists(DATE_FORMAT)) {
- putString(DATE_FORMAT, DateStyle.DateMonthYear.pattern)
+ if (!keyExists(DATE_FORMAT_STR)) {
+ putString(DATE_FORMAT_STR, DateStyle.DateMonthYear.pattern)
}
}
private fun keyExists(key: String): Boolean {
- if (prefs.contains(key))
- return true
- return false
+ return prefs.contains(key)
}
fun putString(key: String, value: String) {
diff --git a/app/src/main/java/com/starry/greenstash/utils/Utils.kt b/app/src/main/java/com/starry/greenstash/utils/Utils.kt
index 268d775b..6e42e1e4 100644
--- a/app/src/main/java/com/starry/greenstash/utils/Utils.kt
+++ b/app/src/main/java/com/starry/greenstash/utils/Utils.kt
@@ -32,6 +32,8 @@ import androidx.biometric.BiometricManager.Authenticators.DEVICE_CREDENTIAL
import java.math.RoundingMode
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
+import java.text.SimpleDateFormat
+import java.util.Date
import java.util.Locale
object Utils {
@@ -75,4 +77,17 @@ object Utils {
} else {
BIOMETRIC_STRONG or DEVICE_CREDENTIAL
}
+
+ fun getGreeting(): String {
+ val currentTime = System.currentTimeMillis()
+ val simpleDateFormat = SimpleDateFormat("HH", Locale.US)
+
+ return when (simpleDateFormat.format(Date(currentTime)).toInt()) {
+ in 0..11 -> "Good Morning!"
+ in 12..16 -> "Good Afternoon!"
+ in 17..20 -> "Good Evening!"
+ else -> "Good Night!"
+ }
+ }
+
}
\ No newline at end of file
diff --git a/app/src/main/java/com/starry/greenstash/widget/GoalWidget.kt b/app/src/main/java/com/starry/greenstash/widget/GoalWidget.kt
index 74566691..728f24f9 100644
--- a/app/src/main/java/com/starry/greenstash/widget/GoalWidget.kt
+++ b/app/src/main/java/com/starry/greenstash/widget/GoalWidget.kt
@@ -39,7 +39,7 @@ import android.widget.RemoteViews
import com.starry.greenstash.R
import com.starry.greenstash.database.core.GoalWithTransactions
import com.starry.greenstash.utils.GoalTextUtils
-import com.starry.greenstash.utils.PreferenceUtils
+import com.starry.greenstash.utils.PreferenceUtil
import com.starry.greenstash.utils.Utils
import dagger.hilt.EntryPoints
@@ -89,6 +89,8 @@ class GoalWidget : AppWidgetProvider() {
fun updateWidgetContents(
context: Context, appWidgetId: Int, goalItem: GoalWithTransactions
) {
+ val preferenceUtil = PreferenceUtil(context)
+ val goalTextUtils = GoalTextUtils(preferenceUtil)
val appWidgetManager = AppWidgetManager.getInstance(context)
val views = RemoteViews(context.packageName, R.layout.goal_widget)
@@ -103,7 +105,7 @@ class GoalWidget : AppWidgetProvider() {
views.setCharSequence(R.id.widgetTitle, "setText", goalItem.goal.title)
// Set Widget description.
- val defCurrency = PreferenceUtils.getString(PreferenceUtils.DEFAULT_CURRENCY, "")
+ val defCurrency = preferenceUtil.getString(PreferenceUtil.DEFAULT_CURRENCY_STR, "$")
val widgetDesc = context.getString(R.string.goal_widget_desc)
.format(
"$defCurrency${Utils.formatCurrency(goalItem.getCurrentlySavedAmount())} / $defCurrency${
@@ -118,7 +120,7 @@ class GoalWidget : AppWidgetProvider() {
val remainingAmount = (goalItem.goal.targetAmount - goalItem.getCurrentlySavedAmount())
if (remainingAmount > 0f) {
if (goalItem.goal.deadline.isNotEmpty() && goalItem.goal.deadline.isNotBlank()) {
- val calculatedDays = GoalTextUtils.calcRemainingDays(goalItem.goal)
+ val calculatedDays = goalTextUtils.calcRemainingDays(goalItem.goal)
if (calculatedDays.remainingDays > 2) {
val amountDays = "$defCurrency${
Utils.formatCurrency(
@@ -145,6 +147,7 @@ class GoalWidget : AppWidgetProvider() {
views.setCharSequence(R.id.widgetAmountWeek, "setText", amountWeeks)
views.setViewVisibility(R.id.widgetAmountWeek, View.VISIBLE)
}
+ views.setViewVisibility(R.id.widgetNoDeadlineSet, View.GONE)
} else {
views.setViewVisibility(R.id.widgetNoDeadlineSet, View.VISIBLE)
}
@@ -189,9 +192,9 @@ class GoalWidget : AppWidgetProvider() {
private fun initialiseVm(context: Context) {
if (!this::viewModel.isInitialized) {
- viewModel = EntryPoints.get(context.applicationContext, WidgetEntryPoint::class.java)
- .getViewModel()
- PreferenceUtils.initialize(context)
+ println("viewmodel not initialised")
+ viewModel = EntryPoints
+ .get(context.applicationContext, WidgetEntryPoint::class.java).getViewModel()
}
}
diff --git a/app/src/main/java/com/starry/greenstash/widget/WidgetViewModel.kt b/app/src/main/java/com/starry/greenstash/widget/WidgetViewModel.kt
index aac2669c..5270d525 100644
--- a/app/src/main/java/com/starry/greenstash/widget/WidgetViewModel.kt
+++ b/app/src/main/java/com/starry/greenstash/widget/WidgetViewModel.kt
@@ -30,6 +30,7 @@ import androidx.lifecycle.viewModelScope
import com.starry.greenstash.database.core.GoalWithTransactions
import com.starry.greenstash.database.goal.GoalDao
import com.starry.greenstash.database.widget.WidgetDao
+import com.starry.greenstash.utils.PreferenceUtil
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@@ -37,7 +38,8 @@ import javax.inject.Inject
class WidgetViewModel @Inject constructor(
private val widgetDao: WidgetDao,
- private val goalDao: GoalDao
+ private val goalDao: GoalDao,
+ private val preferenceUtil: PreferenceUtil
) : ViewModel() {
fun getGoalFromWidgetId(
diff --git a/app/src/main/java/com/starry/greenstash/widget/configuration/WidgetConfigActivity.kt b/app/src/main/java/com/starry/greenstash/widget/configuration/WidgetConfigActivity.kt
index 02ef2889..f7d1c58d 100644
--- a/app/src/main/java/com/starry/greenstash/widget/configuration/WidgetConfigActivity.kt
+++ b/app/src/main/java/com/starry/greenstash/widget/configuration/WidgetConfigActivity.kt
@@ -93,7 +93,6 @@ import com.starry.greenstash.R
import com.starry.greenstash.ui.screens.settings.viewmodels.SettingsViewModel
import com.starry.greenstash.ui.screens.settings.viewmodels.ThemeMode
import com.starry.greenstash.ui.theme.GreenStashTheme
-import com.starry.greenstash.utils.PreferenceUtils
import com.starry.greenstash.widget.GoalWidget
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -114,9 +113,11 @@ class WidgetConfigActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- PreferenceUtils.initialize(this)
settingsViewModel = ViewModelProvider(this)[SettingsViewModel::class.java]
- settingsViewModel.setUpAppTheme()
+ // Setup app theme according to user's settings.
+ ThemeMode.entries.find { it.ordinal == settingsViewModel.getThemeValue() }
+ ?.let { settingsViewModel.setTheme(it) }
+ settingsViewModel.setMaterialYou(settingsViewModel.getMaterialYouValue())
setContent {
GreenStashTheme(settingsViewModel = settingsViewModel) {
@@ -236,8 +237,7 @@ class WidgetConfigActivity : AppCompatActivity() {
.fillMaxSize()
.padding(top = 4.dp)
) {
- val defCurrency =
- PreferenceUtils.getString(PreferenceUtils.DEFAULT_CURRENCY, "")
+ val defCurrency = settingsViewModel.getDefaultCurrencyValue()
items(allGoals.size) { idx ->
val item = allGoals[idx]
diff --git a/app/src/main/res/drawable/ic_goal_delete.xml b/app/src/main/res/drawable/ic_goal_delete.xml
index 92001b4d..0906950c 100644
--- a/app/src/main/res/drawable/ic_goal_delete.xml
+++ b/app/src/main/res/drawable/ic_goal_delete.xml
@@ -1,9 +1,15 @@
+
+
+ android:fillColor="#1C274C"
+ android:pathData="M3 6.38597C3 5.90152 3.34538 5.50879 3.77143 5.50879L6.43567 5.50832C6.96502 5.49306 7.43202 5.11033 7.61214 4.54412C7.61688 4.52923 7.62232 4.51087 7.64185 4.44424L7.75665 4.05256C7.8269 3.81241 7.8881 3.60318 7.97375 3.41617C8.31209 2.67736 8.93808 2.16432 9.66147 2.03297C9.84457 1.99972 10.0385 1.99986 10.2611 2.00002H13.7391C13.9617 1.99986 14.1556 1.99972 14.3387 2.03297C15.0621 2.16432 15.6881 2.67736 16.0264 3.41617C16.1121 3.60318 16.1733 3.81241 16.2435 4.05256L16.3583 4.44424C16.3778 4.51087 16.3833 4.52923 16.388 4.54412C16.5682 5.11033 17.1278 5.49353 17.6571 5.50879H20.2286C20.6546 5.50879 21 5.90152 21 6.38597C21 6.87043 20.6546 7.26316 20.2286 7.26316H3.77143C3.34538 7.26316 3 6.87043 3 6.38597Z" />
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_goal_edit.xml b/app/src/main/res/drawable/ic_goal_edit.xml
index 4fedcd4d..ebcafd9c 100644
--- a/app/src/main/res/drawable/ic_goal_edit.xml
+++ b/app/src/main/res/drawable/ic_goal_edit.xml
@@ -1,9 +1,14 @@
+
+
+ android:fillColor="#1C274C"
+ android:pathData="M11.4001 18.1612L11.4001 18.1612L18.796 10.7653C17.7894 10.3464 16.5972 9.6582 15.4697 8.53068C14.342 7.40298 13.6537 6.21058 13.2348 5.2039L5.83882 12.5999L5.83879 12.5999C5.26166 13.1771 4.97307 13.4657 4.7249 13.7838C4.43213 14.1592 4.18114 14.5653 3.97634 14.995C3.80273 15.3593 3.67368 15.7465 3.41556 16.5208L2.05445 20.6042C1.92743 20.9852 2.0266 21.4053 2.31063 21.6894C2.59466 21.9734 3.01478 22.0726 3.39584 21.9456L7.47918 20.5844C8.25351 20.3263 8.6407 20.1973 9.00498 20.0237C9.43469 19.8189 9.84082 19.5679 10.2162 19.2751C10.5343 19.0269 10.823 18.7383 11.4001 18.1612Z" />
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_goal_info.xml b/app/src/main/res/drawable/ic_goal_info.xml
index e3d03104..1ba50119 100644
--- a/app/src/main/res/drawable/ic_goal_info.xml
+++ b/app/src/main/res/drawable/ic_goal_info.xml
@@ -1,9 +1,12 @@
+
+
+ android:fillColor="#1C274C"
+ android:fillType="evenOdd"
+ android:pathData="M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12ZM12 17.75C12.4142 17.75 12.75 17.4142 12.75 17V11C12.75 10.5858 12.4142 10.25 12 10.25C11.5858 10.25 11.25 10.5858 11.25 11V17C11.25 17.4142 11.5858 17.75 12 17.75ZM12 7C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9C11.4477 9 11 8.55228 11 8C11 7.44772 11.4477 7 12 7Z" />
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_nav_backups.xml b/app/src/main/res/drawable/ic_nav_backups.xml
index 09ca29eb..7c945841 100644
--- a/app/src/main/res/drawable/ic_nav_backups.xml
+++ b/app/src/main/res/drawable/ic_nav_backups.xml
@@ -1,10 +1,14 @@
+
+
-
+ android:fillColor="#1C274C"
+ android:pathData="M16.7137 2.12656C15.8784 1.69663 14.7918 2.39036 12.6187 3.77783L12.0565 4.13679C11.4389 4.53106 11.1301 4.7282 10.7836 4.78478C10.4371 4.84135 10.092 4.75097 9.40191 4.57019L8.77361 4.4056C6.34506 3.76944 5.13079 3.45136 4.43551 4.1312C3.74024 4.81103 4.02442 6.03855 4.59279 8.4936L4.73983 9.12875C4.90135 9.82639 4.9821 10.1752 4.91653 10.5216C4.85096 10.868 4.64648 11.1727 4.23754 11.7821L3.86521 12.3369C2.42609 14.4815 1.70653 15.5538 2.11218 16.4039C2.51782 17.254 3.78002 17.3189 6.30442 17.4487L6.95753 17.4823C7.67487 17.5192 8.03356 17.5377 8.33956 17.6952C8.64557 17.8526 8.86425 18.1314 9.30163 18.6888L9.69981 19.1963C11.2389 21.1578 12.0085 22.1386 12.9545 21.9842C13.9005 21.8297 14.3964 20.6423 15.3882 18.2675L15.6448 17.6531C15.9266 16.9783 16.0675 16.6409 16.3222 16.3918C16.5769 16.1428 16.9165 16.0104 17.5958 15.7454L18.2142 15.5043C20.6046 14.572 21.7997 14.1059 21.9787 13.1603C22.1577 12.2148 21.202 11.416 19.2906 9.81846L18.7961 9.40516C18.2529 8.9512 17.9813 8.7242 17.8327 8.4128C17.6841 8.10139 17.6753 7.74082 17.6578 7.01967L17.6418 6.36312C17.58 3.82537 17.5491 2.5565 16.7137 2.12656Z" />
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_nav_home.xml b/app/src/main/res/drawable/ic_nav_home.xml
index 993f3ab0..c6643e5a 100644
--- a/app/src/main/res/drawable/ic_nav_home.xml
+++ b/app/src/main/res/drawable/ic_nav_home.xml
@@ -1,10 +1,10 @@
-
+ android:fillColor="#1C274C"
+ android:fillType="evenOdd"
+ android:pathData="M2.519,7.823C2,8.771 2,9.915 2,12.204V13.725C2,17.626 2,19.576 3.172,20.788C4.343,22 6.229,22 10,22H14C17.771,22 19.657,22 20.828,20.788C22,19.576 22,17.626 22,13.725V12.204C22,9.915 22,8.771 21.481,7.823C20.962,6.874 20.013,6.286 18.116,5.108L16.116,3.867C14.111,2.622 13.108,2 12,2C10.892,2 9.889,2.622 7.884,3.867L5.884,5.108C3.987,6.286 3.038,6.874 2.519,7.823ZM9.447,15.398C9.114,15.151 8.644,15.221 8.397,15.553C8.151,15.886 8.221,16.356 8.553,16.603C9.526,17.323 10.715,17.75 12,17.75C13.285,17.75 14.474,17.323 15.447,16.603C15.779,16.356 15.849,15.886 15.602,15.553C15.356,15.221 14.886,15.151 14.553,15.398C13.825,15.937 12.946,16.25 12,16.25C11.054,16.25 10.175,15.937 9.447,15.398Z" />
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_nav_settings.xml b/app/src/main/res/drawable/ic_nav_settings.xml
index b0a938c0..1ee6b02f 100644
--- a/app/src/main/res/drawable/ic_nav_settings.xml
+++ b/app/src/main/res/drawable/ic_nav_settings.xml
@@ -1,10 +1,10 @@
-
+ android:fillColor="#1C274C"
+ android:fillType="evenOdd"
+ android:pathData="M14.279,2.152C13.908,2 13.439,2 12.5,2C11.561,2 11.092,2 10.721,2.152C10.227,2.355 9.835,2.745 9.631,3.235C9.537,3.458 9.501,3.718 9.486,4.098C9.465,4.656 9.177,5.172 8.69,5.451C8.203,5.73 7.609,5.72 7.111,5.459C6.773,5.281 6.528,5.183 6.286,5.151C5.756,5.082 5.22,5.224 4.796,5.547C4.478,5.789 4.243,6.193 3.774,7C3.304,7.807 3.07,8.21 3.017,8.605C2.948,9.131 3.091,9.663 3.417,10.083C3.565,10.276 3.774,10.437 4.098,10.639C4.574,10.936 4.88,11.442 4.88,12C4.88,12.558 4.574,13.064 4.098,13.361C3.774,13.563 3.565,13.724 3.416,13.917C3.091,14.337 2.947,14.869 3.017,15.395C3.07,15.789 3.304,16.193 3.774,17C4.243,17.807 4.478,18.211 4.796,18.453C5.22,18.776 5.756,18.918 6.286,18.849C6.528,18.817 6.773,18.719 7.111,18.541C7.609,18.28 8.203,18.27 8.69,18.549C9.177,18.828 9.465,19.344 9.486,19.902C9.501,20.281 9.537,20.542 9.631,20.765C9.835,21.255 10.227,21.645 10.721,21.848C11.092,22 11.561,22 12.5,22C13.439,22 13.908,22 14.279,21.848C14.773,21.645 15.165,21.255 15.369,20.765C15.463,20.542 15.499,20.281 15.514,19.902C15.535,19.344 15.823,18.828 16.31,18.549C16.797,18.27 17.391,18.28 17.889,18.541C18.227,18.719 18.472,18.817 18.714,18.849C19.244,18.918 19.78,18.776 20.204,18.453C20.522,18.211 20.757,17.807 21.226,17C21.696,16.193 21.93,15.789 21.983,15.395C22.052,14.869 21.909,14.337 21.583,13.916C21.435,13.724 21.226,13.563 20.902,13.361C20.426,13.064 20.12,12.558 20.12,12C20.12,11.442 20.426,10.936 20.902,10.639C21.226,10.437 21.435,10.276 21.584,10.083C21.909,9.663 22.052,9.131 21.983,8.605C21.93,8.211 21.696,7.807 21.226,7C20.757,6.193 20.522,5.789 20.204,5.547C19.78,5.224 19.244,5.082 18.714,5.151C18.472,5.183 18.227,5.281 17.889,5.459C17.392,5.72 16.797,5.73 16.31,5.451C15.823,5.172 15.535,4.656 15.514,4.098C15.499,3.718 15.463,3.458 15.369,3.235C15.165,2.745 14.773,2.355 14.279,2.152ZM12.5,15C14.17,15 15.523,13.657 15.523,12C15.523,10.343 14.17,9 12.5,9C10.83,9 9.477,10.343 9.477,12C9.477,13.657 10.83,15 12.5,15Z" />
+
\ No newline at end of file
diff --git a/app/src/main/res/font/redhatdisplay_black.ttf b/app/src/main/res/font/redhatdisplay_black.ttf
new file mode 100644
index 00000000..c2e6c8a6
Binary files /dev/null and b/app/src/main/res/font/redhatdisplay_black.ttf differ
diff --git a/app/src/main/res/font/redhatdisplay_bold.ttf b/app/src/main/res/font/redhatdisplay_bold.ttf
new file mode 100644
index 00000000..c9520566
Binary files /dev/null and b/app/src/main/res/font/redhatdisplay_bold.ttf differ
diff --git a/app/src/main/res/font/redhatdisplay_bolditalic.ttf b/app/src/main/res/font/redhatdisplay_bolditalic.ttf
new file mode 100644
index 00000000..428c430f
Binary files /dev/null and b/app/src/main/res/font/redhatdisplay_bolditalic.ttf differ
diff --git a/app/src/main/res/font/redhatdisplay_extrabold.ttf b/app/src/main/res/font/redhatdisplay_extrabold.ttf
new file mode 100644
index 00000000..53fa55a3
Binary files /dev/null and b/app/src/main/res/font/redhatdisplay_extrabold.ttf differ
diff --git a/app/src/main/res/font/redhatdisplay_italic.ttf b/app/src/main/res/font/redhatdisplay_italic.ttf
new file mode 100644
index 00000000..353c11c9
Binary files /dev/null and b/app/src/main/res/font/redhatdisplay_italic.ttf differ
diff --git a/app/src/main/res/font/redhatdisplay_light.ttf b/app/src/main/res/font/redhatdisplay_light.ttf
new file mode 100644
index 00000000..fe33d8ac
Binary files /dev/null and b/app/src/main/res/font/redhatdisplay_light.ttf differ
diff --git a/app/src/main/res/font/redhatdisplay_medium.ttf b/app/src/main/res/font/redhatdisplay_medium.ttf
new file mode 100644
index 00000000..032e44d3
Binary files /dev/null and b/app/src/main/res/font/redhatdisplay_medium.ttf differ
diff --git a/app/src/main/res/font/redhatdisplay_regular.ttf b/app/src/main/res/font/redhatdisplay_regular.ttf
new file mode 100644
index 00000000..a1cee815
Binary files /dev/null and b/app/src/main/res/font/redhatdisplay_regular.ttf differ
diff --git a/app/src/main/res/font/redhatdisplay_semibold.ttf b/app/src/main/res/font/redhatdisplay_semibold.ttf
new file mode 100644
index 00000000..da13756d
Binary files /dev/null and b/app/src/main/res/font/redhatdisplay_semibold.ttf differ
diff --git a/build.gradle b/build.gradle
index fa2aed75..16d1daef 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,14 +1,16 @@
buildscript {
ext {
- kotlin_version = '1.9.0'
- hilt_version = '2.48'
+ kotlin_version = '1.9.21'
+ gradle_version = '8.2.0'
+ hilt_version = '2.49'
+ room_version = '2.6.1'
}
repositories {
google()
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:8.1.1'
+ classpath "com.android.tools.build:gradle:$gradle_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
// NOTE: Do not place your application dependencies here; they belong
@@ -16,10 +18,9 @@ buildscript {
}
}
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
- id 'com.android.application' version '8.1.1' apply false
- id 'com.android.library' version '8.1.1' apply false
+ id 'com.android.application' version "$gradle_version" apply false
+ id 'com.android.library' version "$gradle_version" apply false
id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false
- id 'com.google.devtools.ksp' version '1.9.0-1.0.13' apply false
+ id 'com.google.devtools.ksp' version '1.9.21-1.0.16' apply false
}
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 904f6064..bfffcd91 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Mon Jan 23 11:16:57 IST 2023
distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME