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

Feature/implement onboarding UI #13

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.goalpanzi.mission_mate.core.designsystem.ext

import android.graphics.BlurMaskFilter
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Paint
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.drawOutline
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp

fun Modifier.dropShadow(
shape: Shape,
color: Color = Color.Black.copy(0.1f),
blur: Dp = 4.dp,
offsetY: Dp = 0.dp,
offsetX: Dp = 0.dp,
spread: Dp = 0.dp
) = this.drawBehind {

val shadowSize = Size(size.width + spread.toPx(), size.height + spread.toPx())
val shadowOutline = shape.createOutline(shadowSize, layoutDirection, this)

val paint = Paint()
paint.color = color

if (blur.toPx() > 0) {
paint.asFrameworkPaint().apply {
maskFilter = BlurMaskFilter(blur.toPx(), BlurMaskFilter.Blur.NORMAL)
}
}

drawIntoCanvas { canvas ->
canvas.save()
canvas.translate(offsetX.toPx(), offsetY.toPx())
canvas.drawOutline(shadowOutline, paint)
canvas.restore()
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_creating_board.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="40dp"
android:height="40dp"
android:viewportWidth="40"
android:viewportHeight="40">
<path
android:pathData="M21.482,11.851L25.505,7.829C26.838,6.495 27.505,5.829 28.333,5.829C29.162,5.829 29.828,6.495 31.162,7.829L32.171,8.838C33.505,10.172 34.171,10.838 34.171,11.667C34.171,12.495 33.505,13.162 32.171,14.495L28.185,18.482C25.417,16.872 23.112,14.584 21.482,11.851ZM20.028,13.306L7.523,25.81C7.098,26.236 6.885,26.448 6.745,26.709C6.606,26.97 6.547,27.265 6.429,27.854L5.147,34.265C5.08,34.597 5.047,34.764 5.142,34.858C5.236,34.953 5.403,34.92 5.735,34.853L5.735,34.853L5.735,34.853L12.146,33.571C12.735,33.453 13.03,33.394 13.291,33.255C13.552,33.115 13.764,32.902 14.189,32.477L26.727,19.94C24.009,18.265 21.719,15.991 20.028,13.306Z"
android:fillColor="#FF5858"
android:fillType="evenOdd"/>
</vector>
25 changes: 25 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_invitation_friend.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="40dp"
android:height="40dp"
android:viewportWidth="40"
android:viewportHeight="40">
<path
android:pathData="M26.079,25.642C24.24,24.935 22.206,24.561 20.132,24.561C17.177,24.561 14.305,25.319 11.961,26.718C9.993,27.893 8.49,29.464 7.605,31.251C7.338,31.791 7.689,32.407 8.279,32.529L11.971,33.299C16.619,34.268 21.396,34.4 26.079,33.696V32.035H23.114C21.457,32.035 20.114,30.692 20.114,29.035C20.114,27.378 21.457,26.035 23.114,26.035L26.079,26.035V25.642ZM32.079,32.505C32.334,32.425 32.536,32.251 32.649,32.035H32.079V32.505Z"
android:fillColor="#FBBC05"
android:fillType="evenOdd"/>
<path
android:pathData="M29.08,23.07L29.08,35"
android:strokeWidth="2.5"
android:fillColor="#00000000"
android:strokeColor="#FBBC05"
android:strokeLineCap="round"/>
<path
android:pathData="M35.045,29.035L23.115,29.035"
android:strokeWidth="2.5"
android:fillColor="#00000000"
android:strokeColor="#FBBC05"
android:strokeLineCap="round"/>
<path
android:pathData="M20.133,14.123m-7.456,0a7.456,7.456 0,1 1,14.912 0a7.456,7.456 0,1 1,-14.912 0"
android:fillColor="#FBBC05"/>
</vector>
10 changes: 10 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_setting.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="28dp"
android:height="28dp"
android:viewportWidth="28"
android:viewportHeight="28">
<path
android:pathData="M16.273,3.855C16.436,4.064 16.466,4.363 16.526,4.961V4.961C16.639,6.096 16.696,6.664 17.017,6.907C17.142,7.001 17.289,7.062 17.445,7.084C17.843,7.139 18.285,6.778 19.168,6.055C19.633,5.675 19.866,5.484 20.129,5.452C20.235,5.438 20.343,5.444 20.447,5.468C20.706,5.526 20.918,5.739 21.343,6.164L22.302,7.123C22.727,7.548 22.94,7.76 22.998,8.019C23.022,8.123 23.027,8.231 23.014,8.337C22.981,8.6 22.791,8.833 22.41,9.298C21.688,10.181 21.326,10.623 21.382,11.021C21.403,11.177 21.464,11.324 21.559,11.449C21.801,11.77 22.369,11.827 23.505,11.94C24.103,12 24.402,12.03 24.612,12.193C24.696,12.259 24.768,12.339 24.825,12.429C24.967,12.654 24.967,12.954 24.967,13.555V14.912C24.967,15.512 24.967,15.813 24.825,16.037C24.768,16.128 24.696,16.208 24.612,16.273C24.402,16.436 24.103,16.466 23.505,16.526C22.37,16.639 21.803,16.696 21.56,17.017C21.465,17.142 21.404,17.29 21.383,17.446C21.328,17.843 21.689,18.285 22.411,19.168C22.791,19.632 22.982,19.865 23.014,20.128C23.028,20.234 23.022,20.342 22.999,20.446C22.94,20.705 22.727,20.917 22.303,21.342L22.303,21.342L21.343,22.301C20.918,22.726 20.706,22.939 20.447,22.998C20.343,23.021 20.236,23.027 20.129,23.014C19.866,22.981 19.633,22.79 19.168,22.41C18.285,21.687 17.843,21.326 17.445,21.381C17.29,21.403 17.142,21.464 17.017,21.558C16.696,21.801 16.639,22.369 16.526,23.505C16.466,24.103 16.436,24.402 16.273,24.612C16.207,24.696 16.128,24.768 16.038,24.825C15.813,24.966 15.512,24.966 14.911,24.966H13.555C12.954,24.966 12.653,24.966 12.429,24.825C12.339,24.768 12.259,24.696 12.193,24.611C12.03,24.402 12,24.103 11.94,23.505C11.827,22.369 11.77,21.801 11.449,21.559C11.324,21.464 11.177,21.403 11.021,21.382C10.623,21.326 10.181,21.688 9.298,22.41C8.833,22.791 8.6,22.981 8.337,23.014C8.231,23.027 8.123,23.022 8.019,22.998C7.76,22.939 7.548,22.727 7.123,22.302L6.164,21.343C5.739,20.918 5.527,20.705 5.468,20.447C5.444,20.343 5.439,20.235 5.452,20.129C5.485,19.865 5.675,19.633 6.055,19.168C6.778,18.285 7.139,17.843 7.084,17.445C7.062,17.29 7.001,17.142 6.906,17.017C6.664,16.696 6.096,16.639 4.961,16.526C4.363,16.466 4.064,16.436 3.855,16.273C3.771,16.208 3.698,16.128 3.641,16.037C3.5,15.813 3.5,15.512 3.5,14.911L3.5,13.555C3.5,12.954 3.5,12.654 3.642,12.429C3.698,12.339 3.771,12.259 3.855,12.193C4.064,12.03 4.363,12 4.962,11.94C6.098,11.827 6.666,11.77 6.908,11.449C7.003,11.324 7.064,11.177 7.085,11.021C7.141,10.623 6.779,10.181 6.056,9.298C5.675,8.832 5.485,8.599 5.452,8.336C5.439,8.23 5.444,8.123 5.468,8.019C5.527,7.76 5.739,7.547 6.164,7.122L7.123,6.163C7.548,5.738 7.761,5.526 8.019,5.467C8.124,5.443 8.231,5.438 8.337,5.451C8.601,5.484 8.833,5.674 9.298,6.055C10.181,6.777 10.623,7.139 11.021,7.084C11.177,7.062 11.324,7.001 11.45,6.906C11.77,6.663 11.827,6.096 11.94,4.961C12,4.363 12.03,4.064 12.193,3.855C12.259,3.77 12.339,3.698 12.429,3.641C12.654,3.5 12.954,3.5 13.555,3.5H14.911C15.512,3.5 15.813,3.5 16.037,3.641C16.128,3.698 16.208,3.77 16.273,3.855ZM14.233,18.527C16.604,18.527 18.526,16.604 18.526,14.233C18.526,11.862 16.604,9.94 14.233,9.94C11.862,9.94 9.94,11.862 9.94,14.233C9.94,16.604 11.862,18.527 14.233,18.527Z"
android:fillColor="#404249"
android:fillType="evenOdd"/>
</vector>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,15 @@ import kotlinx.serialization.Serializable
sealed interface RouteModel {
@Serializable
data object Login : RouteModel

@Serializable
data object Onboarding : RouteModel
}

sealed interface OnboardingRouteModel {
@Serializable
data object BoardSetup : OnboardingRouteModel

@Serializable
data object InvitationCode : OnboardingRouteModel
}
1 change: 1 addition & 0 deletions feature/main/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@ dependencies {
implementation(project(":core:navigation"))
implementation(project(":core:domain"))
implementation(project(":feature:login"))
implementation(project(":feature:onboarding"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.compose.NavHost
import com.goalpanzi.mission_mate.feature.login.loginNavGraph
import com.goalpanzi.mission_mate.feature.onboarding.boardSetupNavGraph
import com.goalpanzi.mission_mate.feature.onboarding.invitationCodeNavGraph
import com.goalpanzi.mission_mate.feature.onboarding.onboardingNavGraph

@Composable
internal fun MainNavHost(
Expand All @@ -28,6 +31,13 @@ internal fun MainNavHost(
loginNavGraph(
onBackClick = { navigator.popBackStack() }
)
onboardingNavGraph(
onClickBoardSetup = { },
onClickInvitationCode = { },
onClickSetting = { }
)
boardSetupNavGraph()
invitationCodeNavGraph()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import androidx.navigation.NavHostController
import androidx.navigation.compose.rememberNavController
import com.goalpanzi.mission_mate.core.navigation.RouteModel
import com.goalpanzi.mission_mate.feature.login.navigateToLogin
import com.goalpanzi.mission_mate.feature.onboarding.navigateToBoardSetup
import com.goalpanzi.mission_mate.feature.onboarding.navigateToInvitationCode
import com.goalpanzi.mission_mate.feature.onboarding.navigateToOnboarding

class MainNavigator(
val navController: NavHostController
Expand All @@ -21,6 +24,18 @@ class MainNavigator(
fun navigateToLogin() {
navController.navigateToLogin()
}

fun navigationToOnboarding() {
navController.navigateToOnboarding()
}

fun navigationToBoardSetup() {
navController.navigateToBoardSetup()
}

fun navigationToInvitationCode() {
navController.navigateToInvitationCode()
}
}

@Composable
Expand Down
1 change: 1 addition & 0 deletions feature/onboarding/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
70 changes: 70 additions & 0 deletions feature/onboarding/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.jetbrains.kotlin.android)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.kotlin.ksp)
alias(libs.plugins.hilt.android)
}

android {
namespace = "com.goalpanzi.mission_mate.feature.onboarding"
compileSdk = 34

defaultConfig {
minSdk = 26

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}
buildFeatures {
compose = true
}
composeCompiler {
enableStrongSkippingMode = true
}
}

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.bundles.lifecycle)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.bundles.compose)
implementation(libs.bundles.coroutines)

testImplementation(libs.bundles.test)
androidTestImplementation(libs.bundles.android.test)
androidTestImplementation(platform(libs.androidx.compose.bom))
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)

implementation(libs.androidx.hilt.navigation.compose)
implementation(libs.hilt.android)
ksp(libs.hilt.compiler)

implementation(libs.coil.compose)

implementation(project(":core:designsystem"))
implementation(project(":core:navigation"))
}
Empty file.
21 changes: 21 additions & 0 deletions feature/onboarding/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.goalpanzi.mission_mate.feature.onboarding

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.goalpanzi.mission_mate.feature.onboarding.test", appContext.packageName)
}
}
4 changes: 4 additions & 0 deletions feature/onboarding/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.goalpanzi.mission_mate.feature.onboarding

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.goalpanzi.mission_mate.core.navigation.OnboardingRouteModel
import com.goalpanzi.mission_mate.core.navigation.RouteModel

fun NavController.navigateToOnboarding() {
this.navigate(RouteModel.Onboarding)
}

fun NavController.navigateToBoardSetup() {
this.navigate(OnboardingRouteModel.BoardSetup)
}

fun NavController.navigateToInvitationCode() {
this.navigate(OnboardingRouteModel.InvitationCode)
}

fun NavGraphBuilder.onboardingNavGraph(
onClickBoardSetup : () -> Unit,
onClickInvitationCode : () -> Unit,
onClickSetting : () -> Unit
) {
composable<RouteModel.Onboarding> {
OnboardingRoute(
onClickBoardSetup = onClickBoardSetup,
onClickInvitationCode = onClickInvitationCode,
onClickSetting = onClickSetting
)
}
}

fun NavGraphBuilder.boardSetupNavGraph() {
composable<OnboardingRouteModel.BoardSetup> {

}
}

fun NavGraphBuilder.invitationCodeNavGraph() {
composable<OnboardingRouteModel.InvitationCode> {

}
}
Loading
Loading