From 316949a6b5d5856cc11214e72f73470d11953f54 Mon Sep 17 00:00:00 2001 From: Billy Brawner Date: Wed, 15 Jun 2022 20:53:16 -0600 Subject: [PATCH] Fix compilation/runtime errors The app is still in a horribly barely-usable state but it's at least usable now --- android/build.gradle | 1 - .../com/wbrawner/budget/ui/MainActivity.kt | 8 ++--- .../java/com/wbrawner/budget/ui/base/Theme.kt | 30 +++++++++---------- .../layout/fragment_list_with_add_button.xml | 2 +- .../src/main/res/layout/fragment_overview.xml | 2 +- .../res/layout/fragment_transaction_list.xml | 2 +- 6 files changed, 22 insertions(+), 23 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 275a8e7..e78235f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -55,7 +55,6 @@ dependencies { implementation 'androidx.media:media:1.4.1' implementation 'androidx.constraintlayout:constraintlayout:2.1.0' implementation 'com.google.android.material:material:1.4.0' - implementation 'androidx.emoji:emoji-bundled:1.1.0' implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version" // Dagger implementation "com.google.dagger:hilt-android:$dagger" diff --git a/android/src/main/java/com/wbrawner/budget/ui/MainActivity.kt b/android/src/main/java/com/wbrawner/budget/ui/MainActivity.kt index 427d50e..555a37c 100644 --- a/android/src/main/java/com/wbrawner/budget/ui/MainActivity.kt +++ b/android/src/main/java/com/wbrawner/budget/ui/MainActivity.kt @@ -22,9 +22,9 @@ import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.res.painterResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import androidx.emoji.text.EmojiCompat import androidx.lifecycle.lifecycleScope import androidx.navigation.NavController +import androidx.navigation.compose.rememberNavController import androidx.navigation.findNavController import androidx.navigation.ui.setupWithNavController import com.google.android.material.navigation.NavigationView @@ -150,7 +150,6 @@ fun TwigsDrawer(navController: NavController, budgets: List) { ) } val currentBudget = navController.currentBackStackEntry?.arguments?.getString("id") - navController.currentDestination?.arguments?.get() } } @@ -175,7 +174,7 @@ fun DrawerItem(@DrawableRes image: Int, text: String, selected: Boolean) { @Preview fun DrawerItem_Preview() { TwigsApp { - DrawerItem(R.drawable.ic_folder_open) + DrawerItem(R.drawable.ic_folder_open, "Budget", false) } } @@ -183,10 +182,11 @@ fun DrawerItem_Preview() { @Preview fun TwigsDrawer_Preview() { val scaffoldState = rememberScaffoldState(rememberDrawerState(initialValue = DrawerValue.Open)) + val navController = rememberNavController() TwigsApp { Scaffold( scaffoldState = scaffoldState, - drawerContent = { TwigsDrawer() } + drawerContent = { TwigsDrawer(navController, emptyList()) } ) { } diff --git a/android/src/main/java/com/wbrawner/budget/ui/base/Theme.kt b/android/src/main/java/com/wbrawner/budget/ui/base/Theme.kt index ee2c4de..a13722e 100644 --- a/android/src/main/java/com/wbrawner/budget/ui/base/Theme.kt +++ b/android/src/main/java/com/wbrawner/budget/ui/base/Theme.kt @@ -28,21 +28,21 @@ val darkColors = darkColors( fun TwigsTheme(darkMode: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) { MaterialTheme( colors = if (darkMode) darkColors else lightColors, - typography = MaterialTheme.typography.copy( - h1 = MaterialTheme.typography.h1.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), - h2 = MaterialTheme.typography.h2.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), - h3 = MaterialTheme.typography.h3.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), - h4 = MaterialTheme.typography.h4.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), - h5 = MaterialTheme.typography.h5.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), - h6 = MaterialTheme.typography.h6.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), - subtitle1 = MaterialTheme.typography.subtitle1.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), - subtitle2 = MaterialTheme.typography.subtitle2.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), - body1 = MaterialTheme.typography.body1.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), - body2 = MaterialTheme.typography.body2.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), - button = MaterialTheme.typography.button.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), - caption = MaterialTheme.typography.caption.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), - overline = MaterialTheme.typography.overline.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), - ), +// typography = MaterialTheme.typography.copy( +// h1 = MaterialTheme.typography.h1.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), +// h2 = MaterialTheme.typography.h2.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), +// h3 = MaterialTheme.typography.h3.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), +// h4 = MaterialTheme.typography.h4.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), +// h5 = MaterialTheme.typography.h5.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), +// h6 = MaterialTheme.typography.h6.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), +// subtitle1 = MaterialTheme.typography.subtitle1.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), +// subtitle2 = MaterialTheme.typography.subtitle2.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), +// body1 = MaterialTheme.typography.body1.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), +// body2 = MaterialTheme.typography.body2.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), +// button = MaterialTheme.typography.button.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), +// caption = MaterialTheme.typography.caption.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), +// overline = MaterialTheme.typography.overline.copy(fontFamily = FontFamily(Font(R.font.ubuntu))), +// ), content = content ) } diff --git a/android/src/main/res/layout/fragment_list_with_add_button.xml b/android/src/main/res/layout/fragment_list_with_add_button.xml index 7248e65..aba4f4d 100644 --- a/android/src/main/res/layout/fragment_list_with_add_button.xml +++ b/android/src/main/res/layout/fragment_list_with_add_button.xml @@ -30,7 +30,7 @@ - - -