-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from TeamTripmate/setting/navigator
[setting] Splash,개인화 모듈 및 네비게이션 설정 및 리소스 추가
- Loading branch information
Showing
50 changed files
with
854 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
core/common/src/main/kotlin/com/tripmate/android/core/common/extension/Activity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.tripmate.android.core.common.extension | ||
|
||
import android.app.Activity | ||
import android.content.Intent | ||
import android.net.Uri | ||
import android.os.Build | ||
import android.provider.Settings | ||
|
||
inline fun <reified T : Activity> Activity.startActivityWithAnimation( | ||
withFinish: Boolean, | ||
intentBuilder: Intent.() -> Intent = { this }, | ||
) { | ||
startActivity(Intent(this, T::class.java).intentBuilder()) | ||
if (Build.VERSION.SDK_INT >= 34) { | ||
overrideActivityTransition( | ||
Activity.OVERRIDE_TRANSITION_OPEN, | ||
android.R.anim.fade_in, | ||
android.R.anim.fade_out, | ||
) | ||
} else { | ||
@Suppress("DEPRECATION") | ||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out) | ||
} | ||
if (withFinish) finish() | ||
} | ||
|
||
fun Activity.goToAppSettings() { | ||
Intent( | ||
Settings.ACTION_APPLICATION_DETAILS_SETTINGS, | ||
Uri.fromParts("package", packageName, null), | ||
).also(::startActivity) | ||
} |
19 changes: 19 additions & 0 deletions
19
core/common/src/main/kotlin/com/tripmate/android/core/common/extension/Modifier.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.tripmate.android.core.common.extension | ||
|
||
import android.annotation.SuppressLint | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.interaction.MutableInteractionSource | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.composed | ||
|
||
// https://stackoverflow.com/questions/66703448/how-to-disable-ripple-effect-when-clicking-in-jetpack-compose | ||
@SuppressLint("ModifierFactoryUnreferencedReceiver") | ||
inline fun Modifier.noRippleClickable(crossinline onClick: () -> Unit): Modifier = composed { | ||
clickable( | ||
indication = null, | ||
interactionSource = remember { MutableInteractionSource() }, | ||
) { | ||
onClick() | ||
} | ||
} |
Empty file.
18 changes: 18 additions & 0 deletions
18
core/data/src/main/kotlin/com/tripmate/android/core/data/di/RepositoryModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.tripmate.android.core.data.di | ||
|
||
import com.tripmate.android.core.data.repository.PersonalizationRepository | ||
import com.tripmate.android.core.data.repository.PersonalizationRepositoryImpl | ||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
internal abstract class RepositoryModule { | ||
|
||
@Binds | ||
@Singleton | ||
abstract fun bindPersonalizationRepository(personalizationRepositoryImpl: PersonalizationRepositoryImpl): PersonalizationRepository | ||
} |
Empty file.
6 changes: 6 additions & 0 deletions
6
...ta/src/main/kotlin/com/tripmate/android/core/data/repository/PersonalizationRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.tripmate.android.core.data.repository | ||
|
||
interface PersonalizationRepository { | ||
suspend fun checkPersonalizationCompletion(): Boolean | ||
suspend fun completePersonalization(flag: Boolean) | ||
} |
16 changes: 16 additions & 0 deletions
16
...rc/main/kotlin/com/tripmate/android/core/data/repository/PersonalizationRepositoryImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.tripmate.android.core.data.repository | ||
|
||
import com.tripmate.android.core.datastore.PersonalizationDataSource | ||
import javax.inject.Inject | ||
|
||
internal class PersonalizationRepositoryImpl @Inject constructor( | ||
private val personalizationDataSource: PersonalizationDataSource, | ||
) : PersonalizationRepository { | ||
override suspend fun checkPersonalizationCompletion(): Boolean { | ||
return personalizationDataSource.checkPersonalizationCompletion() | ||
} | ||
|
||
override suspend fun completePersonalization(flag: Boolean) { | ||
personalizationDataSource.completePersonalization(flag) | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...atastore/src/main/kotlin/com/tripmate/android/core/datastore/PersonalizationDataSource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.tripmate.android.core.datastore | ||
|
||
interface PersonalizationDataSource { | ||
suspend fun checkPersonalizationCompletion(): Boolean | ||
suspend fun completePersonalization(flag: Boolean) | ||
} |
30 changes: 30 additions & 0 deletions
30
...tore/src/main/kotlin/com/tripmate/android/core/datastore/PersonalizationDataSourceImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.tripmate.android.core.datastore | ||
|
||
import androidx.datastore.core.DataStore | ||
import androidx.datastore.preferences.core.Preferences | ||
import androidx.datastore.preferences.core.booleanPreferencesKey | ||
import androidx.datastore.preferences.core.edit | ||
import androidx.datastore.preferences.core.emptyPreferences | ||
import com.tripmate.android.core.datastore.di.PersonalizationDataStore | ||
import kotlinx.coroutines.flow.catch | ||
import kotlinx.coroutines.flow.first | ||
import java.io.IOException | ||
import javax.inject.Inject | ||
|
||
class PersonalizationDataSourceImpl @Inject constructor( | ||
@PersonalizationDataStore private val dataStore: DataStore<Preferences>, | ||
) : PersonalizationDataSource { | ||
private companion object { | ||
private val KEY_PERSONALIZATION_COMPLETE = booleanPreferencesKey("Personalization_complete") | ||
} | ||
|
||
override suspend fun checkPersonalizationCompletion(): Boolean = dataStore.data | ||
.catch { exception -> | ||
if (exception is IOException) emit(emptyPreferences()) | ||
else throw exception | ||
}.first()[KEY_PERSONALIZATION_COMPLETE] ?: false | ||
|
||
override suspend fun completePersonalization(flag: Boolean) { | ||
dataStore.edit { preferences -> preferences[KEY_PERSONALIZATION_COMPLETE] = flag } | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
core/datastore/src/main/kotlin/com/tripmate/android/core/datastore/di/DataSourceModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.tripmate.android.core.datastore.di | ||
|
||
import com.tripmate.android.core.datastore.PersonalizationDataSource | ||
import com.tripmate.android.core.datastore.PersonalizationDataSourceImpl | ||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
abstract class DataSourceModule { | ||
@Binds | ||
@Singleton | ||
abstract fun bindPersonalizationDataSource(personalizationDataSourceImpl: PersonalizationDataSourceImpl): PersonalizationDataSource | ||
} |
25 changes: 25 additions & 0 deletions
25
core/datastore/src/main/kotlin/com/tripmate/android/core/datastore/di/DataStoreModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.tripmate.android.core.datastore.di | ||
|
||
import android.content.Context | ||
import androidx.datastore.core.DataStore | ||
import androidx.datastore.preferences.core.Preferences | ||
import androidx.datastore.preferences.preferencesDataStore | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
private const val PERSONALIZATION_DATASTORE = "personalization_datastore" | ||
private val Context.personalizationDataStore: DataStore<Preferences> by preferencesDataStore(name = PERSONALIZATION_DATASTORE) | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
internal object DataStoreModule { | ||
|
||
@PersonalizationDataStore | ||
@Singleton | ||
@Provides | ||
internal fun providePersonalizationDataStore(@ApplicationContext context: Context) = context.personalizationDataStore | ||
} |
7 changes: 7 additions & 0 deletions
7
core/datastore/src/main/kotlin/com/tripmate/android/core/datastore/di/DataStoreQualifier.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.tripmate.android.core.datastore.di | ||
|
||
import javax.inject.Qualifier | ||
|
||
@Qualifier | ||
@Retention(AnnotationRetention.BINARY) | ||
annotation class PersonalizationDataStore |
6 changes: 6 additions & 0 deletions
6
core/designsystem/src/main/kotlin/com/tripmate/android/core/designsystem/ComponentPreview.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.tripmate.android.core.designsystem | ||
|
||
import androidx.compose.ui.tooling.preview.Preview | ||
|
||
@Preview(showBackground = true) | ||
annotation class ComponentPreview |
31 changes: 31 additions & 0 deletions
31
...gnsystem/src/main/kotlin/com/tripmate/android/core/designsystem/component/LoadingWheel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.tripmate.android.core.designsystem.component | ||
|
||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.material3.CircularProgressIndicator | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import com.tripmate.android.core.common.extension.noRippleClickable | ||
import com.tripmate.android.core.designsystem.ComponentPreview | ||
import com.tripmate.android.core.designsystem.theme.Primary01 | ||
import com.tripmate.android.core.designsystem.theme.TripmateTheme | ||
|
||
@Composable | ||
fun LoadingWheel( | ||
modifier: Modifier = Modifier, | ||
) { | ||
Box( | ||
modifier = modifier.noRippleClickable { }, | ||
contentAlignment = Alignment.Center, | ||
) { | ||
CircularProgressIndicator(color = Primary01) | ||
} | ||
} | ||
|
||
@ComponentPreview | ||
@Composable | ||
fun LoadingWheelPreview() { | ||
TripmateTheme { | ||
LoadingWheel() | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
core/designsystem/src/main/kotlin/com/tripmate/android/core/designsystem/theme/Color.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.tripmate.android.core.designsystem.theme | ||
|
||
import androidx.compose.ui.graphics.Color | ||
|
||
// Light mode colors | ||
val Primary01 = Color(0xFF0B57D0) | ||
val Primary02 = Color(0xFF1742A6) | ||
val Primary03 = Color(0xFF1A73E8) | ||
|
||
val Background01 = Color(0xFFF3F6FC) | ||
val Background02 = Color(0xFFFFFFFF) | ||
val Background03 = Color(0xFFD3E3FD) | ||
|
||
// Dark mode colors | ||
val Primary01Dark = Color(0xFFA8C7FA) | ||
val Primary02Dark = Color(0xFFD2E3FC) | ||
val Primary03Dark = Color(0xFF8AB4F8) | ||
|
||
val Background01Dark = Color(0xFF222327) | ||
val Background02Dark = Color(0xFF18191B) | ||
val Background03Dark = Color(0xFF2A2A2A) | ||
|
||
// Light mode gray scale | ||
val Gray001 = Color(0xFF1F1F1F) | ||
val Gray002 = Color(0xFF3C4043) | ||
val Gray003 = Color(0xFF5F6368) | ||
val Gray004 = Color(0xFF6F7277) | ||
val Gray005 = Color(0xFF83878B) | ||
val Gray006 = Color(0xFF989BA0) | ||
val Gray007 = Color(0xFFA9ADB1) | ||
val Gray008 = Color(0xFFC4C7CA) | ||
val Gray009 = Color(0xFFF5F5F5) | ||
|
||
// Dark mode gray scale | ||
val Gray001Dark = Color(0xFFE2E2E2) | ||
val Gray002Dark = Color(0xFFCDCDCD) | ||
val Gray003Dark = Color(0xFFBFBFBF) | ||
val Gray004Dark = Color(0xFFA0A0A0) | ||
val Gray005Dark = Color(0xFF8C8C8C) | ||
val Gray006Dark = Color(0xFF77797C) | ||
val Gray007Dark = Color(0xFF5E5F63) | ||
val Gray008Dark = Color(0xFF3A3B3F) | ||
val Gray009Dark = Color(0xFF2A2A2A) |
21 changes: 21 additions & 0 deletions
21
core/designsystem/src/main/kotlin/com/tripmate/android/core/designsystem/theme/Font.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.tripmate.android.core.designsystem.theme | ||
|
||
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.FontStyle | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.sp | ||
import com.tripmate.android.core.designsystem.R | ||
|
||
val pretendardFamily = FontFamily( | ||
Font(R.font.pretendard_bold, FontWeight.Bold, FontStyle.Normal), | ||
Font(R.font.pretendard_regular, FontWeight.Normal, FontStyle.Normal), | ||
Font(R.font.pretendard_light, FontWeight.Light, FontStyle.Normal), | ||
) | ||
|
||
val Title0 = TextStyle( | ||
fontFamily = pretendardFamily, | ||
fontWeight = FontWeight.Bold, | ||
fontSize = 24.sp, | ||
) |
47 changes: 47 additions & 0 deletions
47
core/designsystem/src/main/kotlin/com/tripmate/android/core/designsystem/theme/Theme.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.tripmate.android.core.designsystem.theme | ||
|
||
import androidx.compose.foundation.isSystemInDarkTheme | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.darkColorScheme | ||
import androidx.compose.material3.lightColorScheme | ||
import androidx.compose.runtime.Composable | ||
|
||
private val DarkColorScheme = darkColorScheme( | ||
primary = Primary01Dark, | ||
secondary = Primary02Dark, | ||
tertiary = Primary03Dark, | ||
background = Background01Dark, | ||
surface = Background02Dark, | ||
onPrimary = Gray009Dark, | ||
onSecondary = Gray009Dark, | ||
onTertiary = Gray009Dark, | ||
onBackground = Gray001Dark, | ||
onSurface = Gray001Dark, | ||
) | ||
|
||
private val LightColorScheme = lightColorScheme( | ||
primary = Primary01, | ||
secondary = Primary02, | ||
tertiary = Primary03, | ||
background = Background01, | ||
surface = Background02, | ||
onPrimary = Gray009, | ||
onSecondary = Gray009, | ||
onTertiary = Gray009, | ||
onBackground = Gray001, | ||
onSurface = Gray001, | ||
) | ||
|
||
@Composable | ||
fun TripmateTheme( | ||
darkTheme: Boolean = isSystemInDarkTheme(), | ||
content: @Composable () -> Unit, | ||
) { | ||
val colorScheme = if (darkTheme) DarkColorScheme else LightColorScheme | ||
|
||
MaterialTheme( | ||
colorScheme = colorScheme, | ||
typography = Typography, | ||
content = content, | ||
) | ||
} |
17 changes: 17 additions & 0 deletions
17
core/designsystem/src/main/kotlin/com/tripmate/android/core/designsystem/theme/Type.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.tripmate.android.core.designsystem.theme | ||
|
||
import androidx.compose.material3.Typography | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.font.FontFamily | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.sp | ||
|
||
val Typography = Typography( | ||
bodyLarge = TextStyle( | ||
fontFamily = FontFamily.Default, | ||
fontWeight = FontWeight.Normal, | ||
fontSize = 16.sp, | ||
lineHeight = 24.sp, | ||
letterSpacing = 0.5.sp, | ||
), | ||
) |
Empty file removed
0
core/designsystem/src/main/kotlin/com/tripmate/android/core/designsystem/theme/dummy
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
|
||
<style name="Theme.Tripmate.Splash" parent="Theme.SplashScreen"> | ||
<item name="postSplashScreenTheme">@style/Theme.Tripmateandroid</item> | ||
<item name="windowSplashScreenAnimatedIcon">@mipmap/ic_launcher</item> | ||
<item name="android:windowLightStatusBar">true</item> | ||
</style> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.