Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Material 3 #37

Merged
merged 9 commits into from
Oct 7, 2022
3 changes: 2 additions & 1 deletion .idea/dictionaries/jacob.xml

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

14 changes: 9 additions & 5 deletions app/src/main/java/com/jacob/wakatimeapp/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Scaffold
import androidx.compose.material.rememberScaffoldState
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
Expand All @@ -22,6 +25,7 @@ import com.ramcosta.composedestinations.DestinationsNavHost
import com.ramcosta.composedestinations.navigation.dependency
import dagger.hilt.android.AndroidEntryPoint

@ExperimentalMaterial3Api
@AndroidEntryPoint
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -30,17 +34,17 @@ class MainActivity : AppCompatActivity() {
installSplashScreen()
setContent {
WakaTimeAppTheme {
val scaffoldState = rememberScaffoldState()
val snackbarHostState = remember { SnackbarHostState() }
Scaffold(
scaffoldState = scaffoldState,
snackbarHost = { SnackbarHost(snackbarHostState) },
modifier = Modifier.fillMaxSize()
) {
LockScreenOrientation()
DestinationsNavHost(
navGraph = NavGraphs.root,
dependenciesContainerBuilder = {
dependency(ApplicationNavigator(navController))
dependency(scaffoldState)
dependency(snackbarHostState)
}
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.jacob.wakatimeapp.navigation

import androidx.compose.material.ScaffoldState
import androidx.compose.material3.SnackbarHostState
import androidx.compose.runtime.Composable
import com.jacob.wakatimeapp.home.ui.HomePageContent
import com.jacob.wakatimeapp.home.ui.HomePageNavigator
Expand All @@ -12,15 +12,15 @@ import com.ramcosta.composedestinations.annotation.RootNavGraph
@RootNavGraph(start = true)
@Destination
@Composable
fun LoginPage(loginPageNavigator: LoginPageNavigator, scaffoldState: ScaffoldState) =
LoginPageContent(loginPageNavigator = loginPageNavigator, scaffoldState = scaffoldState)
fun LoginPage(loginPageNavigator: LoginPageNavigator, scaffoldState: SnackbarHostState) =
LoginPageContent(loginPageNavigator = loginPageNavigator, snackbarHostState = scaffoldState)

@Composable
@Destination
fun HomePage(
homePageNavigator: HomePageNavigator,
scaffoldState: ScaffoldState,
scaffoldState: SnackbarHostState,
) = HomePageContent(
navigator = homePageNavigator,
scaffoldState = scaffoldState
snackbarHostState = scaffoldState
)
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ dependencies {

// Compose
implementation("androidx.compose.ui:ui:1.2.1")
implementation("androidx.compose.material:material:1.2.1")

implementation("com.google.android.material:material:1.7.0-rc01")
implementation("androidx.compose.material3:material3:1.0.0-rc01")
implementation("androidx.compose.ui:ui-tooling-preview:1.2.1")
implementation("androidx.activity:activity-compose:1.6.0")

Expand Down
3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/wakatimeapp.android.feature.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ dependencies {

implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.5.1")
implementation("com.google.android.material:material:1.7.0-rc01")

// Compose
implementation("androidx.compose.ui:ui:1.2.1")
implementation("androidx.compose.material:material:1.2.1")
implementation("androidx.compose.material3:material3:1.0.0-rc01")
implementation("androidx.compose.ui:ui-tooling-preview:1.2.1")
implementation("androidx.activity:activity-compose:1.6.0")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.jacob.wakatimeapp.core.common.di

import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.PreferenceDataStoreFactory
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.preferencesDataStoreFile
import com.jacob.wakatimeapp.core.common.auth.AuthDataStore.Companion.STORE_NAME
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
Expand All @@ -29,7 +27,7 @@ object DataModule {

@Singleton
@Provides
fun providePreferencesDataStore(@ApplicationContext appContext: Context): DataStore<Preferences> =
fun providePreferencesDataStore(@ApplicationContext appContext: Context) =
PreferenceDataStoreFactory.create(
scope = CoroutineScope(Dispatchers.IO + SupervisorJob()),
produceFile = { appContext.preferencesDataStoreFile(STORE_NAME) }
Expand Down Expand Up @@ -57,7 +55,7 @@ object DataModule {
@ExperimentalSerializationApi
@Singleton
@Provides
fun provideRetrofit(okHttpClient: OkHttpClient, json: Json): Retrofit = Retrofit.Builder()
fun provideRetrofit(okHttpClient: OkHttpClient, json: Json) = Retrofit.Builder()
.addConverterFactory(
json.asConverterFactory("application/json".toMediaType())
)
Expand Down
4 changes: 2 additions & 2 deletions core/ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ dependencies {

implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.5.1")
implementation("com.google.android.material:material:1.6.1")
implementation("com.google.android.material:material:1.7.0-rc01")
implementation("androidx.compose.material3:material3:1.0.0-rc01")

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")

// Compose
implementation("androidx.compose.ui:ui:1.2.1")
implementation("androidx.compose.material:material:1.2.1")
implementation("androidx.compose.ui:ui-tooling-preview:1.2.1")

implementation("com.airbnb.android:lottie-compose:5.0.3")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
Expand Down Expand Up @@ -41,7 +41,7 @@ fun WtaAnimation(
Spacer(modifier = Modifier.height(MaterialTheme.spacing.lMedium))
Text(
text = text,
style = MaterialTheme.typography.subtitle1,
style = MaterialTheme.typography.titleMedium,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -37,6 +37,6 @@ fun WtaIllustration(
Spacer(modifier = Modifier.height(MaterialTheme.spacing.lMedium))
Text(
text = text,
style = MaterialTheme.typography.subtitle1
style = MaterialTheme.typography.titleMedium
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.jacob.wakatimeapp.core.ui.components.cards
import androidx.annotation.DrawableRes
import androidx.compose.runtime.Composable
import androidx.compose.ui.unit.dp
import com.jacob.wakatimeapp.core.ui.theme.Gradient
import com.jacob.wakatimeapp.core.ui.theme.colors.Gradient

@Composable
fun OtherStatsCard(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand All @@ -26,8 +26,8 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.jacob.wakatimeapp.core.ui.theme.Gradient
import com.jacob.wakatimeapp.core.ui.theme.cardContent
import com.jacob.wakatimeapp.core.ui.theme.colors.Gradient
import com.jacob.wakatimeapp.core.ui.theme.spacing

@Composable
Expand Down Expand Up @@ -74,6 +74,7 @@ internal fun StatsCard(
maxLines = 2,
modifier = Modifier.weight(weights.first, true),
style = MaterialTheme.typography.cardContent,
color = gradient.onStartColor,
)
Text(
text = text,
Expand All @@ -82,8 +83,9 @@ internal fun StatsCard(
style = TextStyle(
color = Color.White,
fontSize = 20.sp,
fontWeight = FontWeight.Bold
)
fontWeight = FontWeight.Medium,
),
color = gradient.onEndColor,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package com.jacob.wakatimeapp.core.ui.components.cards

import android.content.res.Configuration
import androidx.annotation.DrawableRes
import androidx.compose.material.MaterialTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.jacob.wakatimeapp.core.models.Time
import com.jacob.wakatimeapp.core.ui.theme.Gradient
import com.jacob.wakatimeapp.core.ui.theme.colors.Gradient
import com.jacob.wakatimeapp.core.ui.theme.WakaTimeAppTheme
import com.jacob.wakatimeapp.core.ui.theme.assets
import com.jacob.wakatimeapp.core.ui.theme.gradients
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.jacob.wakatimeapp.core.ui.theme

import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Shapes
import androidx.compose.material3.Shapes
import androidx.compose.ui.unit.dp

val Shapes = Shapes(
Expand Down
Loading