Explorar el Código

Working on home navigation screens

minhaj hace 1 mes
padre
commit
9ca4c13518
Se han modificado 29 ficheros con 408 adiciones y 71 borrados
  1. 13 0
      .idea/runConfigurations.xml
  2. 0 2
      app/src/main/AndroidManifest.xml
  3. 38 0
      app/src/main/java/com/fastest/pass/BaseFragment.kt
  4. 6 5
      app/src/main/java/com/fastest/pass/forgotpassword/presentation/ui/ForgotPasswordFragment.kt
  5. 5 4
      app/src/main/java/com/fastest/pass/forgotpassword/presentation/ui/ForgotPasswordVerifyFragment.kt
  6. 1 1
      app/src/main/java/com/fastest/pass/forgotpassword/presentation/components/ForgotPasswordScreen.kt
  7. 2 2
      app/src/main/java/com/fastest/pass/forgotpassword/presentation/components/ForgotPasswordVerifyScreen.kt
  8. 21 0
      app/src/main/java/com/fastest/pass/home/di/HomeModule.kt
  9. 10 0
      app/src/main/java/com/fastest/pass/home/domain/model/Screen.kt
  10. 89 0
      app/src/main/java/com/fastest/pass/home/presentation/ui/component/HomeScreen.kt
  11. 61 0
      app/src/main/java/com/fastest/pass/home/presentation/ui/fragment/HomeFragment.kt
  12. 17 0
      app/src/main/java/com/fastest/pass/home/presentation/viewmodel/HomeViewModel.kt
  13. 28 0
      app/src/main/java/com/fastest/pass/home/utils/HomeNavigation.kt
  14. 10 0
      app/src/main/java/com/fastest/pass/home/utils/HomeNavigationRoute.kt
  15. 5 4
      app/src/main/java/com/fastest/pass/login/presentation/ui/LoginFragment.kt
  16. 1 1
      app/src/main/java/com/fastest/pass/login/presentation/components/LoginScreen.kt
  17. 8 5
      app/src/main/java/com/fastest/pass/masterlogin/presentation/ui/MasterLoginFragment.kt
  18. 1 1
      app/src/main/java/com/fastest/pass/masterlogin/presentation/components/MasterLoginScreen.kt
  19. 4 1
      app/src/main/java/com/fastest/pass/masterlogin/utils/MasterLoginNavigation.kt
  20. 5 4
      app/src/main/java/com/fastest/pass/mastersignup/presentation/ui/MasterSignUpFragment.kt
  21. 1 1
      app/src/main/java/com/fastest/pass/mastersignup/presentation/components/MasterSignUpScreen.kt
  22. 5 4
      app/src/main/java/com/fastest/pass/signup/presentation/ui/SignUpFragment.kt
  23. 1 1
      app/src/main/java/com/fastest/pass/signup/presentation/components/SignUpScreen.kt
  24. 3 2
      app/src/main/java/com/fastest/pass/splash/presentation/ui/SplashFragment.kt
  25. 1 1
      app/src/main/java/com/fastest/pass/splash/presentation/components/SplashScreen.kt
  26. 1 0
      app/src/main/java/com/fastest/pass/ui/theme/Type.kt
  27. 65 31
      app/src/main/java/com/fastest/pass/welcome/presentation/ui/component/WelcomeScreen.kt
  28. 2 1
      app/src/main/java/com/fastest/pass/welcome/presentation/ui/fragment/WelcomeFragment.kt
  29. 4 0
      app/src/main/res/navigation/nav_graph.xml

+ 13 - 0
.idea/runConfigurations.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RunConfigurationProducerService">
+    <option name="ignoredProducers">
+      <set>
+        <option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
+        <option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
+        <option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
+        <option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
+      </set>
+    </option>
+  </component>
+</project>

+ 0 - 2
app/src/main/AndroidManifest.xml

@@ -16,8 +16,6 @@
         <activity
             android:name=".MainActivity"
             android:exported="true"
-            android:label="@string/app_name"
-            android:theme="@style/Theme.MyApp.Splash"
             >
 <!--            <meta-data-->
 <!--                android:name="android.support.splashscreen.SPLASH_SCREEN_THEME"-->

+ 38 - 0
app/src/main/java/com/fastest/pass/BaseFragment.kt

@@ -0,0 +1,38 @@
+package com.fastest.pass
+
+import android.os.Bundle
+import android.util.Log
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.compose.ui.platform.ComposeView
+import androidx.fragment.app.Fragment
+import androidx.fragment.app.viewModels
+import com.fastest.pass.home.presentation.ui.component.HomeScreen
+import com.fastest.pass.ui.theme.FastestPassTheme
+import com.fastest.pass.welcome.presentation.ui.component.ClickType.LOGIN_CLICK
+import com.fastest.pass.welcome.presentation.ui.component.ClickType.SIGNUP_CLICK
+import com.fastest.pass.welcome.presentation.ui.component.WelcomeTutorial
+import com.fastest.pass.welcome.presentation.viewmodel.WelcomeViewModel
+import com.fastest.pass.welcome.utils.WelcomeNavigation
+import com.fastest.pass.welcome.utils.WelcomeNavigationRoute
+import dagger.hilt.android.AndroidEntryPoint
+import javax.inject.Inject
+
+@AndroidEntryPoint
+open class BaseFragment : Fragment() {
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        this::class.simpleName?.let { Log.d("onScreen", it) }
+    }
+
+    override fun onCreateView(
+        inflater: LayoutInflater, container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View {
+        return ComposeView(requireActivity()).apply {
+
+        }
+    }
+}

+ 6 - 5
app/src/main/java/com/fastest/pass/forgotpassword/presentation/ui/ForgotPasswordFragment.kt

@@ -5,10 +5,10 @@ import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
 import androidx.compose.ui.platform.ComposeView
-import androidx.fragment.app.Fragment
 import androidx.fragment.app.viewModels
-import com.fastest.pass.forgotpassword.presentation.components.ClickType
-import com.fastest.pass.forgotpassword.presentation.components.ForgotPasswordScreen
+import com.fastest.pass.BaseFragment
+import com.fastest.pass.forgotpassword.presentation.ui.components.ClickType
+import com.fastest.pass.forgotpassword.presentation.ui.components.ForgotPasswordScreen
 import com.fastest.pass.forgotpassword.presentation.viewmodels.ForgotPasswordViewmodel
 import com.fastest.pass.forgotpassword.utils.ForgotPasswordNavigation
 import com.fastest.pass.forgotpassword.utils.ForgotPasswordRoute
@@ -17,7 +17,7 @@ import dagger.hilt.android.AndroidEntryPoint
 import javax.inject.Inject
 
 @AndroidEntryPoint
-class ForgotPasswordFragment : Fragment() {
+class ForgotPasswordFragment : BaseFragment() {
 
     val viewmodel: ForgotPasswordViewmodel by viewModels()
 
@@ -33,7 +33,7 @@ class ForgotPasswordFragment : Fragment() {
         inflater: LayoutInflater,
         container: ViewGroup?,
         savedInstanceState: Bundle?
-    ): View? {
+    ): View {
         return ComposeView(requireActivity()).apply {
             setContent {
                 FastestPassTheme {
@@ -42,6 +42,7 @@ class ForgotPasswordFragment : Fragment() {
                             ClickType.GO_BACK -> {
                                 viewmodel.navigateTo(ForgotPasswordRoute.GoBackToLogin)
                             }
+
                             ClickType.OPEN_FORGOT_VERIFY -> {
                                 viewmodel.navigateTo(ForgotPasswordRoute.OpenForgotVerifyScreen)
                             }

+ 5 - 4
app/src/main/java/com/fastest/pass/forgotpassword/presentation/ui/ForgotPasswordVerifyFragment.kt

@@ -7,8 +7,9 @@ import android.view.ViewGroup
 import androidx.compose.ui.platform.ComposeView
 import androidx.fragment.app.Fragment
 import androidx.fragment.app.viewModels
-import com.fastest.pass.forgotpassword.presentation.components.ClickTypeForgotVerify
-import com.fastest.pass.forgotpassword.presentation.components.ForgotPasswordVerifyScreen
+import com.fastest.pass.BaseFragment
+import com.fastest.pass.forgotpassword.presentation.ui.components.ClickTypeForgotVerify
+import com.fastest.pass.forgotpassword.presentation.ui.components.ForgotPasswordVerifyScreen
 import com.fastest.pass.forgotpassword.presentation.viewmodels.ForgotPasswordVerifyViewModel
 import com.fastest.pass.forgotpassword.utils.ForgotPasswordVerifyNavigation
 import com.fastest.pass.forgotpassword.utils.ForgotPasswordVerifyRoute
@@ -17,7 +18,7 @@ import dagger.hilt.android.AndroidEntryPoint
 import javax.inject.Inject
 
 @AndroidEntryPoint
-class ForgotPasswordVerifyFragment : Fragment() {
+class ForgotPasswordVerifyFragment : BaseFragment() {
 
     val viewmodel: ForgotPasswordVerifyViewModel by viewModels()
 
@@ -33,7 +34,7 @@ class ForgotPasswordVerifyFragment : Fragment() {
         inflater: LayoutInflater,
         container: ViewGroup?,
         savedInstanceState: Bundle?
-    ): View? {
+    ): View {
         return ComposeView(requireActivity()).apply {
             setContent {
                 FastestPassTheme {

+ 1 - 1
app/src/main/java/com/fastest/pass/forgotpassword/presentation/components/ForgotPasswordScreen.kt

@@ -1,4 +1,4 @@
-package com.fastest.pass.forgotpassword.presentation.components
+package com.fastest.pass.forgotpassword.presentation.ui.components
 
 import androidx.compose.foundation.Image
 import androidx.compose.foundation.background

+ 2 - 2
app/src/main/java/com/fastest/pass/forgotpassword/presentation/components/ForgotPasswordVerifyScreen.kt

@@ -1,4 +1,4 @@
-package com.fastest.pass.forgotpassword.presentation.components
+package com.fastest.pass.forgotpassword.presentation.ui.components
 
 import androidx.compose.foundation.Image
 import androidx.compose.foundation.background
@@ -54,7 +54,7 @@ import androidx.compose.ui.text.style.TextAlign
 import androidx.compose.ui.unit.dp
 import androidx.compose.ui.unit.sp
 import com.fastest.pass.R
-import com.fastest.pass.login.presentation.components.ClickType
+import com.fastest.pass.login.presentation.ui.components.ClickType
 
 enum class ClickTypeForgotVerify {
     GO_BACK,

+ 21 - 0
app/src/main/java/com/fastest/pass/home/di/HomeModule.kt

@@ -0,0 +1,21 @@
+package com.fastest.pass.home.di
+
+import com.fastest.pass.home.utils.HomeNavigation
+import com.fastest.pass.welcome.utils.WelcomeNavigation
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import javax.inject.Singleton
+
+@Module
+@InstallIn(SingletonComponent::class)
+object HomeModule {
+
+    @Provides
+    @Singleton
+    fun provideNavigation(): HomeNavigation {
+        return HomeNavigation()
+    }
+
+}

+ 10 - 0
app/src/main/java/com/fastest/pass/home/domain/model/Screen.kt

@@ -0,0 +1,10 @@
+package com.fastest.pass.home.domain.model
+
+import com.fastest.pass.R
+
+sealed class Screen(val route: String, val title: String, val icon: Int) {
+    object Home : Screen("home", "Home", R.drawable.profile_circle)
+    object Browse : Screen("browse", "Browse", R.drawable.profile_circle)
+    object Security : Screen("security", "Security", R.drawable.profile_circle)
+    object Account : Screen("account", "Account", R.drawable.profile_circle)
+}

+ 89 - 0
app/src/main/java/com/fastest/pass/home/presentation/ui/component/HomeScreen.kt

@@ -0,0 +1,89 @@
+package com.fastest.pass.home.presentation.ui.component
+
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material.BottomNavigation
+import androidx.compose.material.BottomNavigationItem
+import androidx.compose.material.Icon
+import androidx.compose.material.Scaffold
+import androidx.compose.material.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.painterResource
+import androidx.navigation.NavController
+import androidx.navigation.compose.NavHost
+import androidx.navigation.compose.composable
+import androidx.navigation.compose.currentBackStackEntryAsState
+import androidx.navigation.compose.rememberNavController
+import com.fastest.pass.home.domain.model.Screen
+import com.fastest.pass.welcome.presentation.ui.fragment.WelcomeFragment
+
+enum class HomeClickType {
+    HOME,
+    BROWSE,
+    SECURITY,
+    ACCOUNT
+}
+
+@Composable
+fun HomeScreen() {
+
+}
+
+@Composable
+fun BottomTabNavigation(onClick: (homeClick: HomeClickType) -> Unit) {
+    val navController = rememberNavController()
+
+    Scaffold(
+        bottomBar = {
+            BottomNavigationBar(navController = navController)
+        }
+    ) { paddingValues ->
+        // Host Fragments instead of Composables
+        NavHost(
+            navController = navController,
+            startDestination = Screen.Home.route,
+            modifier = Modifier.padding(paddingValues) // Using paddingValues from Scaffold
+        ) {
+            composable(Screen.Home.route) {
+                // Fragment or content for Home
+                WelcomeFragment()
+            }
+            composable(Screen.Browse.route) {
+                // Fragment or content for Browse
+            }
+            composable(Screen.Security.route) {
+                // Fragment or content for Security
+            }
+            composable(Screen.Account.route) {
+                // Fragment or content for Account
+            }
+        }
+    }
+
+}
+@Composable
+fun BottomNavigationBar(navController: NavController) {
+    val items = listOf(Screen.Home, Screen.Browse, Screen.Security, Screen.Account)
+    val currentBackStackEntry = navController.currentBackStackEntryAsState()
+    val currentRoute = currentBackStackEntry.value?.destination?.route
+
+    BottomNavigation {
+        items.forEach { screen ->
+            BottomNavigationItem(
+                icon = { Icon(painterResource(id = screen.icon), contentDescription = null) },
+                label = { Text(screen.title) },
+                selected = currentRoute == screen.route,
+                onClick = {
+                    navController.navigate(screen.route) {
+                        // Avoid multiple copies of the same destination
+                        popUpTo(navController.graph.startDestinationId) {
+                            saveState = true
+                        }
+                        launchSingleTop = true
+                        restoreState = true
+                    }
+                }
+            )
+        }
+    }
+}

+ 61 - 0
app/src/main/java/com/fastest/pass/home/presentation/ui/fragment/HomeFragment.kt

@@ -0,0 +1,61 @@
+package com.fastest.pass.home.presentation.ui.fragment
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.compose.ui.platform.ComposeView
+import androidx.fragment.app.viewModels
+import com.fastest.pass.BaseFragment
+import com.fastest.pass.home.presentation.ui.component.BottomTabNavigation
+import com.fastest.pass.home.presentation.ui.component.HomeClickType
+import com.fastest.pass.home.presentation.viewmodel.HomeViewModel
+import com.fastest.pass.home.utils.HomeNavigation
+import com.fastest.pass.home.utils.HomeNavigationRoute
+import com.fastest.pass.ui.theme.FastestPassTheme
+import dagger.hilt.android.AndroidEntryPoint
+import javax.inject.Inject
+
+@AndroidEntryPoint
+class HomeFragment : BaseFragment() {
+
+    val viewModel: HomeViewModel by viewModels()
+
+    @Inject
+    lateinit var navigation: HomeNavigation
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        navigation.navigate(this)
+    }
+
+    override fun onCreateView(
+        inflater: LayoutInflater, container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View {
+        return ComposeView(requireActivity()).apply {
+            setContent {
+                FastestPassTheme {
+                    BottomTabNavigation {
+                        when (it) {
+                            HomeClickType.HOME -> {
+                                viewModel.navigateTo(HomeNavigationRoute.OpenHome)
+                            }
+
+                            HomeClickType.BROWSE -> {
+                                viewModel.navigateTo(HomeNavigationRoute.OpenBrowse)
+                            }
+
+                            HomeClickType.SECURITY -> {
+                            }
+
+                            HomeClickType.ACCOUNT -> {
+                            }
+                            else -> {}
+                        }
+                    }
+                }
+            }
+        }
+    }
+}

+ 17 - 0
app/src/main/java/com/fastest/pass/home/presentation/viewmodel/HomeViewModel.kt

@@ -0,0 +1,17 @@
+package com.fastest.pass.home.presentation.viewmodel
+
+import androidx.lifecycle.ViewModel
+import com.fastest.pass.home.utils.HomeNavigationRoute
+import dagger.hilt.android.lifecycle.HiltViewModel
+import kotlinx.coroutines.flow.MutableStateFlow
+
+class HomeViewModel : ViewModel() {
+
+    private val _router = MutableStateFlow<HomeNavigationRoute>(HomeNavigationRoute.NoneScreen)
+    val router: MutableStateFlow<HomeNavigationRoute> = _router
+
+    fun navigateTo(splashRoute: HomeNavigationRoute) {
+        _router.value = splashRoute
+    }
+
+}

+ 28 - 0
app/src/main/java/com/fastest/pass/home/utils/HomeNavigation.kt

@@ -0,0 +1,28 @@
+package com.fastest.pass.home.utils
+
+import androidx.lifecycle.lifecycleScope
+import androidx.navigation.fragment.findNavController
+import com.fastest.pass.R
+import com.fastest.pass.home.presentation.ui.fragment.HomeFragment
+
+class HomeNavigation {
+
+    fun navigate(source:HomeFragment){
+        source.lifecycleScope.launchWhenStarted {
+            source.viewModel.router.collect{ route ->
+
+                when(route){
+                    is HomeNavigationRoute.OpenHome -> {
+                        source.findNavController().navigate(R.id.welcomeFragment)
+                    }
+                    is HomeNavigationRoute.OpenBrowse ->{
+                        source.findNavController().navigate(R.id.loginFragment)
+                    }
+
+                    else -> {}
+                }
+            }
+        }
+    }
+
+}

+ 10 - 0
app/src/main/java/com/fastest/pass/home/utils/HomeNavigationRoute.kt

@@ -0,0 +1,10 @@
+package com.fastest.pass.home.utils
+
+sealed class HomeNavigationRoute {
+
+    object OpenHome : HomeNavigationRoute()
+    object OpenBrowse : HomeNavigationRoute()
+    object OpenSecurity : HomeNavigationRoute()
+    object OpenAccount : HomeNavigationRoute()
+    object NoneScreen : HomeNavigationRoute()
+}

+ 5 - 4
app/src/main/java/com/fastest/pass/login/presentation/ui/LoginFragment.kt

@@ -7,8 +7,9 @@ import android.view.ViewGroup
 import androidx.compose.ui.platform.ComposeView
 import androidx.fragment.app.Fragment
 import androidx.fragment.app.viewModels
-import com.fastest.pass.login.presentation.components.ClickType
-import com.fastest.pass.login.presentation.components.LoginScreen
+import com.fastest.pass.BaseFragment
+import com.fastest.pass.login.presentation.ui.components.ClickType
+import com.fastest.pass.login.presentation.ui.components.LoginScreen
 import com.fastest.pass.login.presentation.viewmodels.LoginViewModel
 import com.fastest.pass.login.utils.LoginNavigation
 import com.fastest.pass.login.utils.LoginRoute
@@ -17,7 +18,7 @@ import dagger.hilt.android.AndroidEntryPoint
 import javax.inject.Inject
 
 @AndroidEntryPoint
-class LoginFragment : Fragment() {
+class LoginFragment : BaseFragment() {
 
     val viewmodel: LoginViewModel by viewModels()
 
@@ -32,7 +33,7 @@ class LoginFragment : Fragment() {
     override fun onCreateView(
         inflater: LayoutInflater, container: ViewGroup?,
         savedInstanceState: Bundle?
-    ): View? {
+    ): View {
         return ComposeView(requireActivity()).apply {
             setContent {
                 FastestPassTheme {

+ 1 - 1
app/src/main/java/com/fastest/pass/login/presentation/components/LoginScreen.kt

@@ -1,4 +1,4 @@
-package com.fastest.pass.login.presentation.components
+package com.fastest.pass.login.presentation.ui.components
 
 import androidx.compose.foundation.Image
 import androidx.compose.foundation.background

+ 8 - 5
app/src/main/java/com/fastest/pass/masterlogin/presentation/ui/MasterLoginFragment.kt

@@ -7,8 +7,9 @@ import android.view.ViewGroup
 import androidx.compose.ui.platform.ComposeView
 import androidx.fragment.app.Fragment
 import androidx.fragment.app.viewModels
-import com.fastest.pass.masterlogin.presentation.components.ClickType
-import com.fastest.pass.masterlogin.presentation.components.MasterLoginScreen
+import com.fastest.pass.BaseFragment
+import com.fastest.pass.masterlogin.presentation.ui.components.ClickType
+import com.fastest.pass.masterlogin.presentation.ui.components.MasterLoginScreen
 import com.fastest.pass.masterlogin.presentation.viewmodels.MasterLoginViewModel
 import com.fastest.pass.masterlogin.utils.MasterLoginNavigation
 import com.fastest.pass.masterlogin.utils.MasterLoginRoute
@@ -17,7 +18,7 @@ import dagger.hilt.android.AndroidEntryPoint
 import javax.inject.Inject
 
 @AndroidEntryPoint
-class MasterLoginFragment : Fragment() {
+class MasterLoginFragment : BaseFragment() {
 
     val viewmodel: MasterLoginViewModel by viewModels()
 
@@ -33,7 +34,7 @@ class MasterLoginFragment : Fragment() {
         inflater: LayoutInflater,
         container: ViewGroup?,
         savedInstanceState: Bundle?
-    ): View? {
+    ): View {
         return ComposeView(requireActivity()).apply {
             setContent {
                 FastestPassTheme {
@@ -42,7 +43,9 @@ class MasterLoginFragment : Fragment() {
                             ClickType.GO_BACK -> {
                                 viewmodel.navigateTo(MasterLoginRoute.GoBackToLoginScreen)
                             }
-                            ClickType.HOME_SCREEN -> {}
+                            ClickType.HOME_SCREEN -> {
+                                viewmodel.navigateTo(MasterLoginRoute.OpenHomeScreen)
+                            }
                         }
                     }
                 }

+ 1 - 1
app/src/main/java/com/fastest/pass/masterlogin/presentation/components/MasterLoginScreen.kt

@@ -1,4 +1,4 @@
-package com.fastest.pass.masterlogin.presentation.components
+package com.fastest.pass.masterlogin.presentation.ui.components
 
 import androidx.compose.foundation.Image
 import androidx.compose.foundation.background

+ 4 - 1
app/src/main/java/com/fastest/pass/masterlogin/utils/MasterLoginNavigation.kt

@@ -2,6 +2,7 @@ package com.fastest.pass.masterlogin.utils
 
 import androidx.lifecycle.lifecycleScope
 import androidx.navigation.fragment.findNavController
+import com.fastest.pass.R
 import com.fastest.pass.masterlogin.presentation.ui.MasterLoginFragment
 
 class MasterLoginNavigation {
@@ -11,7 +12,9 @@ class MasterLoginNavigation {
             masterLoginFragment.viewmodel.router.collect { router ->
                 when (router) {
                     MasterLoginRoute.OpenNoneScreen -> {}
-                    MasterLoginRoute.OpenHomeScreen -> {}
+                    MasterLoginRoute.OpenHomeScreen -> {
+                        masterLoginFragment.findNavController().navigate(R.id.homeFragment)
+                    }
                     MasterLoginRoute.GoBackToLoginScreen -> {
                         masterLoginFragment.findNavController().popBackStack()
                     }

+ 5 - 4
app/src/main/java/com/fastest/pass/mastersignup/presentation/ui/MasterSignUpFragment.kt

@@ -7,8 +7,9 @@ import android.view.ViewGroup
 import androidx.compose.ui.platform.ComposeView
 import androidx.fragment.app.Fragment
 import androidx.fragment.app.viewModels
-import com.fastest.pass.mastersignup.presentation.components.ClickType
-import com.fastest.pass.mastersignup.presentation.components.MasterSignUpScreen
+import com.fastest.pass.BaseFragment
+import com.fastest.pass.mastersignup.presentation.ui.components.ClickType
+import com.fastest.pass.mastersignup.presentation.ui.components.MasterSignUpScreen
 import com.fastest.pass.mastersignup.presentation.viewmodels.MasterSignUpViewModel
 import com.fastest.pass.mastersignup.utils.MasterSignUpNavigation
 import com.fastest.pass.mastersignup.utils.MasterSignUpRoute
@@ -17,7 +18,7 @@ import dagger.hilt.android.AndroidEntryPoint
 import javax.inject.Inject
 
 @AndroidEntryPoint
-class MasterSignUpFragment : Fragment() {
+class MasterSignUpFragment : BaseFragment() {
 
     val viewmodel: MasterSignUpViewModel by viewModels()
 
@@ -33,7 +34,7 @@ class MasterSignUpFragment : Fragment() {
         inflater: LayoutInflater,
         container: ViewGroup?,
         savedInstanceState: Bundle?
-    ): View? {
+    ): View {
         return ComposeView(requireActivity()).apply {
             setContent {
                 FastestPassTheme {

+ 1 - 1
app/src/main/java/com/fastest/pass/mastersignup/presentation/components/MasterSignUpScreen.kt

@@ -1,4 +1,4 @@
-package com.fastest.pass.mastersignup.presentation.components
+package com.fastest.pass.mastersignup.presentation.ui.components
 
 import androidx.compose.foundation.Image
 import androidx.compose.foundation.background

+ 5 - 4
app/src/main/java/com/fastest/pass/signup/presentation/ui/SignUpFragment.kt

@@ -7,8 +7,9 @@ import android.view.ViewGroup
 import androidx.compose.ui.platform.ComposeView
 import androidx.fragment.app.Fragment
 import androidx.fragment.app.viewModels
-import com.fastest.pass.signup.presentation.components.ClickType
-import com.fastest.pass.signup.presentation.components.SignUpScreen
+import com.fastest.pass.BaseFragment
+import com.fastest.pass.signup.presentation.ui.components.ClickType
+import com.fastest.pass.signup.presentation.ui.components.SignUpScreen
 import com.fastest.pass.signup.presentation.viewmodels.SignUpViewModel
 import com.fastest.pass.signup.utils.SignUpNavigation
 import com.fastest.pass.signup.utils.SignUpRoute
@@ -17,7 +18,7 @@ import dagger.hilt.android.AndroidEntryPoint
 import javax.inject.Inject
 
 @AndroidEntryPoint
-class SignUpFragment : Fragment() {
+class SignUpFragment : BaseFragment() {
 
     val viewmodel: SignUpViewModel by viewModels()
 
@@ -33,7 +34,7 @@ class SignUpFragment : Fragment() {
         inflater: LayoutInflater,
         container: ViewGroup?,
         savedInstanceState: Bundle?
-    ): View? {
+    ): View {
         return ComposeView(requireActivity()).apply {
             setContent {
                 FastestPassTheme {

+ 1 - 1
app/src/main/java/com/fastest/pass/signup/presentation/components/SignUpScreen.kt

@@ -1,4 +1,4 @@
-package com.fastest.pass.signup.presentation.components
+package com.fastest.pass.signup.presentation.ui.components
 
 import androidx.compose.foundation.Image
 import androidx.compose.foundation.background

+ 3 - 2
app/src/main/java/com/fastest/pass/splash/presentation/ui/SplashFragment.kt

@@ -6,17 +6,18 @@ import android.view.View
 import android.view.ViewGroup
 import androidx.compose.ui.platform.ComposeView
 import androidx.fragment.app.Fragment
-import com.fastest.pass.splash.presentation.components.SplashScreen
+import com.fastest.pass.splash.presentation.ui.components.SplashScreen
 import com.fastest.pass.splash.presentation.viewmodels.SplashViewModel
 import dagger.hilt.android.AndroidEntryPoint
 import androidx.fragment.app.viewModels
+import com.fastest.pass.BaseFragment
 import com.fastest.pass.splash.utils.SplashNavigation
 import com.fastest.pass.splash.utils.SplashRoute
 import com.fastest.pass.ui.theme.FastestPassTheme
 import javax.inject.Inject
 
 @AndroidEntryPoint
-class SplashFragment : Fragment() {
+class SplashFragment : BaseFragment() {
 
     val viewModel: SplashViewModel by viewModels()
 

+ 1 - 1
app/src/main/java/com/fastest/pass/splash/presentation/components/SplashScreen.kt

@@ -1,4 +1,4 @@
-package com.fastest.pass.splash.presentation.components
+package com.fastest.pass.splash.presentation.ui.components
 
 import androidx.compose.foundation.Image
 import androidx.compose.foundation.background

+ 1 - 0
app/src/main/java/com/fastest/pass/ui/theme/Type.kt

@@ -30,6 +30,7 @@ val Typography = Typography(
         fontFamily = outfitFontFamily,
         fontWeight = FontWeight.Normal,
         fontSize = 14.sp,
+
     ),
     displayMedium = TextStyle(
         fontFamily = outfitFontFamily,

+ 65 - 31
app/src/main/java/com/fastest/pass/welcome/presentation/ui/component/WelcomeScreen.kt

@@ -8,14 +8,11 @@ import androidx.compose.foundation.layout.Box
 import androidx.compose.foundation.layout.Column
 import androidx.compose.foundation.layout.Row
 import androidx.compose.foundation.layout.Spacer
-import androidx.compose.foundation.layout.WindowInsets
 import androidx.compose.foundation.layout.fillMaxSize
 import androidx.compose.foundation.layout.fillMaxWidth
 import androidx.compose.foundation.layout.height
-import androidx.compose.foundation.layout.navigationBars
 import androidx.compose.foundation.layout.padding
 import androidx.compose.foundation.layout.width
-import androidx.compose.foundation.layout.windowInsetsPadding
 import androidx.compose.material3.Text
 import androidx.compose.runtime.Composable
 import androidx.compose.ui.Alignment
@@ -25,10 +22,13 @@ import androidx.compose.ui.res.colorResource
 import androidx.compose.ui.res.painterResource
 import androidx.compose.ui.text.TextStyle
 import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.unit.TextUnit
+import androidx.compose.ui.unit.TextUnitType
 import androidx.compose.ui.unit.dp
 import androidx.compose.ui.unit.sp
 import com.fastest.pass.R
 import com.fastest.pass.ui.theme.Gray_Splash
+import com.fastest.pass.ui.theme.Typography
 import com.fastest.pass.ui.theme.Welcome_BG
 import com.fastest.pass.welcome.domain.model.Welcome
 import com.google.accompanist.pager.HorizontalPager
@@ -74,7 +74,9 @@ fun WelcomeTutorial(onClick: (ClickType) -> Unit) {
                 .background(colorResource(id = R.color.gray_splash))
         ) { }
 
-        Box(modifier = Modifier.fillMaxSize()) {
+        Box(modifier = Modifier
+            .fillMaxSize()
+            .padding(bottom = 50.dp)) {
 
             HorizontalPager(
                 count = pages.size,
@@ -119,38 +121,63 @@ fun WelcomePage(
             .fillMaxSize()
             .background(Welcome_BG)
     ) {
-        Column(modifier = Modifier.align(Alignment.Center)) {
-            Text(
-                text = title,
-                style = TextStyle(fontSize = 24.sp, textAlign = TextAlign.Center),
-                color = Gray_Splash,
-                modifier = Modifier.fillMaxWidth()
-            )
+        Column(
+            modifier = Modifier
+                .align(Alignment.TopCenter),
+            horizontalAlignment = Alignment.CenterHorizontally
+        ) {
+            // Reserve a fixed height for the title
+            Box(
+                modifier = Modifier
+                    .fillMaxWidth()
+                    .weight(1f)
+                    .height(50.dp), // Adjust this height as needed
+                contentAlignment = Alignment.Center
+            ) {
+                Text(
+                    text = title,
+                    style = Typography.headlineLarge.copy(textAlign = TextAlign.Center, fontSize = TextUnit(24f,
+                        TextUnitType.Sp)),
+                    color = Gray_Splash,
+                    modifier = Modifier.fillMaxWidth()
+                )
+            }
 
-            Spacer(Modifier.height(120.dp))
-            // Image at the Center
+            Spacer(Modifier.height(50.dp))
+
+            // Image in the center
             Image(
                 painter = painterResource(id = imageRes),
                 contentDescription = null,
                 modifier = Modifier
+                    .weight(1f)
                     .padding(horizontal = 20.dp)
                     .fillMaxWidth()
                     .height(250.dp)
-
             )
-            Spacer(Modifier.height(120.dp))
-            // Description at the Bottom
-            Text(
-                text = description,
-                style = TextStyle(fontSize = 15.sp, textAlign = TextAlign.Center),
-                color = Gray_Splash,
-                textAlign = TextAlign.Center,
+
+            Spacer(Modifier.height(50.dp))
+
+            // Reserve a fixed height for the description
+            Box(
                 modifier = Modifier
                     .fillMaxWidth()
+                    .weight(1f)
+                    .height(80.dp), // Adjust this height as needed
+                contentAlignment = Alignment.Center
+            ) {
+                Text(
+                    text = description,
+                    style = Typography.displaySmall.copy(textAlign = TextAlign.Center, fontSize = TextUnit(14f,
+                        TextUnitType.Sp)),
+                    color = Gray_Splash,
+                    textAlign = TextAlign.Center,
+                    modifier = Modifier.fillMaxWidth()
+                )
+            }
 
-            )
-            if (page == 2) {
-                Spacer(Modifier.height(50.dp))
+            Column(modifier = Modifier.weight(0.5f)) {
+                Spacer(Modifier.height(10.dp))
                 Row(
                     verticalAlignment = Alignment.CenterVertically,
                     horizontalArrangement = Arrangement.Center,
@@ -159,8 +186,11 @@ fun WelcomePage(
                         .padding(vertical = 10.dp)
                 ) {
                     Text(
-                        text = "LOG IN",
-                        style = TextStyle(fontSize = 18.sp),
+                        text = if (page == 2) "LOG IN" else "",
+                        style = Typography.displaySmall.copy(textAlign = TextAlign.Center,
+                            fontSize = TextUnit(18f,
+                            TextUnitType.Sp)),
+
                         color = Gray_Splash,
                         modifier = Modifier.clickable {
                             onClick.invoke(ClickType.LOGIN_CLICK)
@@ -168,14 +198,19 @@ fun WelcomePage(
                     )
                     Spacer(modifier = Modifier.width(8.dp)) // Add spacing between "Login" and "|"
                     Text(
-                        text = "|",
-                        style = TextStyle(fontSize = 18.sp),
+                        text = if (page == 2) "|" else "",
+                        style = Typography.displaySmall.copy(textAlign = TextAlign.Center,
+                            fontSize = TextUnit(18f,
+                            TextUnitType.Sp)),
+
                         color = Gray_Splash
                     )
                     Spacer(modifier = Modifier.width(8.dp)) // Add spacing between "|" and "SignUp"
                     Text(
-                        text = "SIGN UP",
-                        style = TextStyle(fontSize = 18.sp),
+                        text = if (page == 2) "SIGN UP" else "",
+                        style = Typography.displaySmall.copy(textAlign = TextAlign.Center, fontSize = TextUnit(18f,
+                            TextUnitType.Sp)),
+
                         color = Gray_Splash,
                         modifier = Modifier.clickable {
                             onClick.invoke(ClickType.SIGNUP_CLICK)
@@ -183,7 +218,6 @@ fun WelcomePage(
                     )
                 }
             }
-
         }
     }
 }

+ 2 - 1
app/src/main/java/com/fastest/pass/welcome/presentation/ui/fragment/WelcomeFragment.kt

@@ -7,6 +7,7 @@ import android.view.ViewGroup
 import androidx.compose.ui.platform.ComposeView
 import androidx.fragment.app.Fragment
 import androidx.fragment.app.viewModels
+import com.fastest.pass.BaseFragment
 import com.fastest.pass.ui.theme.FastestPassTheme
 import com.fastest.pass.welcome.presentation.ui.component.ClickType.LOGIN_CLICK
 import com.fastest.pass.welcome.presentation.ui.component.ClickType.SIGNUP_CLICK
@@ -18,7 +19,7 @@ import dagger.hilt.android.AndroidEntryPoint
 import javax.inject.Inject
 
 @AndroidEntryPoint
-class WelcomeFragment : Fragment() {
+class WelcomeFragment : BaseFragment() {
 
     val viewModel : WelcomeViewModel by viewModels()
 

+ 4 - 0
app/src/main/res/navigation/nav_graph.xml

@@ -41,5 +41,9 @@
         android:id="@+id/forgotPasswordVerifyFragment"
         android:name="com.fastest.pass.forgotpassword.presentation.ui.ForgotPasswordVerifyFragment"
         android:label="ForgotPasswordVerifyFragment" />
+    <fragment
+        android:id="@+id/homeFragment"
+        android:name="com.fastest.pass.home.presentation.ui.fragment.HomeFragment"
+        android:label="HomeFragment" />
 
 </navigation>