-
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 #1 from Techwaste/home_splash_maps_screen
Home splash maps screen
- Loading branch information
Showing
186 changed files
with
11,268 additions
and
672 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
217 changes: 217 additions & 0 deletions
217
app/src/main/java/com/capstone/techwasmark02/TechwasApp.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,217 @@ | ||
package com.capstone.techwasmark02 | ||
|
||
import androidx.compose.animation.AnimatedContentScope | ||
import androidx.compose.animation.ExperimentalAnimationApi | ||
import androidx.compose.animation.core.tween | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.navigation.NavType | ||
import androidx.navigation.navArgument | ||
import com.capstone.techwasmark02.ui.navigation.Screen.* | ||
import com.capstone.techwasmark02.ui.screen.forumCreate.ForumCreateScreen | ||
import com.capstone.techwasmark02.ui.screen.article.ArticleScreen | ||
import com.capstone.techwasmark02.ui.screen.camera.CameraScreen | ||
import com.capstone.techwasmark02.ui.screen.catalog.CatalogScreen | ||
import com.capstone.techwasmark02.ui.screen.catalogSingleComponent.CatalogSingleComponentScreen | ||
import com.capstone.techwasmark02.ui.screen.detectionResult.DetectionResultScreen | ||
import com.capstone.techwasmark02.ui.screen.forum.ForumScreen | ||
import com.capstone.techwasmark02.ui.screen.forumSingle.ForumSingleScreen | ||
import com.capstone.techwasmark02.ui.screen.home.HomeScreen | ||
import com.capstone.techwasmark02.ui.screen.main.MainScreen | ||
import com.capstone.techwasmark02.ui.screen.maps.MapsScreen | ||
import com.capstone.techwasmark02.ui.screen.onBoarding.OnBoardingScreen | ||
import com.capstone.techwasmark02.ui.screen.profileUser.ProfileUserScreen | ||
import com.capstone.techwasmark02.ui.screen.setting.SettingScreen | ||
import com.capstone.techwasmark02.ui.screen.signIn.SignInScreen | ||
import com.capstone.techwasmark02.ui.screen.signUp.SignUpScreen | ||
import com.capstone.techwasmark02.ui.screen.singleArticle.SingleArticleScreen | ||
import com.capstone.techwasmark02.ui.screen.splashScreen.SplashScreen | ||
import com.google.accompanist.navigation.animation.AnimatedNavHost | ||
import com.google.accompanist.navigation.animation.composable | ||
import com.google.accompanist.navigation.animation.rememberAnimatedNavController | ||
|
||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalAnimationApi::class) | ||
@Composable | ||
fun TechwasApp() { | ||
val navController = rememberAnimatedNavController() | ||
|
||
Scaffold { innerPadding -> | ||
AnimatedNavHost( | ||
navController = navController, | ||
startDestination = Splash.route, | ||
modifier = Modifier | ||
.padding(innerPadding), | ||
|
||
) { | ||
|
||
composable( | ||
route = Splash.route, | ||
enterTransition = Splash.enterTransition, | ||
exitTransition = Splash.exitTransition | ||
) { | ||
SplashScreen(navController = navController) | ||
} | ||
|
||
composable( | ||
route = OnBoarding.route, | ||
enterTransition = { | ||
slideIntoContainer(AnimatedContentScope.SlideDirection.Left, animationSpec = tween(700)) | ||
}, | ||
exitTransition = OnBoarding.exitTransition | ||
) { | ||
OnBoardingScreen(navController = navController) | ||
} | ||
|
||
composable(SignIn.route) { | ||
SignInScreen(navController = navController) | ||
} | ||
|
||
composable(SignUp.route) { | ||
SignUpScreen(navController = navController) | ||
} | ||
|
||
composable( | ||
route = Main.route + "/{page}", | ||
enterTransition = Main.enterTransition, | ||
exitTransition = Main.exitTransition, | ||
arguments = listOf( | ||
navArgument("page") { | ||
type = NavType.IntType | ||
defaultValue = 0 | ||
} | ||
) | ||
) { navBackStackEntry -> | ||
val page = navBackStackEntry.arguments?.getInt("page") | ||
if (page != null) { | ||
MainScreen(navController = navController, page = page) | ||
} | ||
} | ||
|
||
composable( | ||
route = Home.route, | ||
enterTransition = Home.enterTransition, | ||
exitTransition = Home.exitTransition | ||
) { | ||
HomeScreen(navController = navController) | ||
} | ||
|
||
composable( | ||
route = Article.route, | ||
enterTransition = Article.enterTransition, | ||
exitTransition = Article.exitTransition | ||
) { | ||
ArticleScreen(navController = navController) | ||
} | ||
|
||
composable( | ||
route = SingleArticle.route + "/{idArticle}", | ||
arguments = listOf( | ||
navArgument("idArticle") { | ||
type = NavType.IntType | ||
defaultValue = 1 | ||
} | ||
) | ||
) { navBackStackEntry -> | ||
val idArticle = navBackStackEntry.arguments?.getInt("idArticle") | ||
|
||
if(idArticle != null) { | ||
SingleArticleScreen(idArticle = idArticle, navController = navController) | ||
} | ||
} | ||
|
||
composable(Forum.route) { | ||
ForumScreen(navController = navController) | ||
} | ||
|
||
composable( | ||
route = SingleForum.route + "/{forumId}", | ||
arguments = listOf( | ||
navArgument("forumId") { | ||
type = NavType.IntType | ||
defaultValue = 1 | ||
} | ||
) | ||
) { navBackStackEntry -> | ||
val forumId = navBackStackEntry.arguments?.getInt("forumId") | ||
if (forumId != null) { | ||
ForumSingleScreen(navController = navController, forumId = forumId) | ||
} | ||
} | ||
|
||
composable( | ||
route = CreateForum.route | ||
) { | ||
ForumCreateScreen(navController = navController) | ||
} | ||
|
||
composable(Profile.route) { | ||
ProfileUserScreen(navController = navController) | ||
} | ||
|
||
composable( | ||
route = Setting.route, | ||
enterTransition = Setting.enterTransition, | ||
exitTransition = Setting.exitTransition | ||
) { | ||
SettingScreen(navController = navController) | ||
} | ||
|
||
composable(Catalog.route) { | ||
CatalogScreen(navController = navController) | ||
} | ||
|
||
composable( | ||
route = SingleCatalog.route + "/{componentJson}", | ||
arguments = listOf( | ||
navArgument("componentJson") { | ||
type = NavType.StringType | ||
defaultValue = "U fucked up" | ||
} | ||
) | ||
) { navBackStackEntry -> | ||
val componentJson = navBackStackEntry.arguments?.getString("componentJson") | ||
|
||
if (componentJson != null) { | ||
CatalogSingleComponentScreen(componentJson = componentJson, navController = navController) | ||
} | ||
} | ||
|
||
composable( | ||
route = Camera.route, | ||
enterTransition = Camera.enterTransition, | ||
exitTransition = Camera.exitTransition | ||
) { | ||
CameraScreen(navController = navController) | ||
} | ||
|
||
composable( | ||
route = DetectionResult.route + "/{uri}/{result}", | ||
arguments = listOf( | ||
navArgument("uri") { | ||
type = NavType.StringType | ||
defaultValue = "Image to sent doesn't exist" | ||
}, | ||
navArgument("result") { | ||
type = NavType.StringType | ||
defaultValue = "Nothing to predict" | ||
} | ||
) | ||
) { navBackStackEntry -> | ||
val uri = navBackStackEntry.arguments?.getString("uri") | ||
val result = navBackStackEntry.arguments?.getString("result") | ||
|
||
if (uri != null && result != null) { | ||
DetectionResultScreen(stringUri = uri, detectionResult = result, navController = navController) | ||
} | ||
|
||
} | ||
|
||
composable(Maps.route) { | ||
MapsScreen(navController = navController) | ||
} | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/capstone/techwasmark02/data/local/database/FavoriteArticleDatabase.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,14 @@ | ||
package com.capstone.techwasmark02.data.local.database | ||
|
||
import androidx.room.Database | ||
import androidx.room.RoomDatabase | ||
import com.capstone.techwasmark02.data.local.database.dao.FavoriteArticleEntityDao | ||
import com.capstone.techwasmark02.data.local.database.entity.FavoriteArticleEntity | ||
|
||
@Database( | ||
entities = [FavoriteArticleEntity::class], | ||
version = 1 | ||
) | ||
abstract class FavoriteArticleDatabase: RoomDatabase() { | ||
abstract val favoriteArticleDao: FavoriteArticleEntityDao | ||
} |
28 changes: 28 additions & 0 deletions
28
.../main/java/com/capstone/techwasmark02/data/local/database/dao/FavoriteArticleEntityDao.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,28 @@ | ||
package com.capstone.techwasmark02.data.local.database.dao | ||
|
||
import androidx.room.Dao | ||
import androidx.room.Delete | ||
import androidx.room.Query | ||
import androidx.room.Upsert | ||
import com.capstone.techwasmark02.data.local.database.entity.FavoriteArticleEntity | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
|
||
@Dao | ||
interface FavoriteArticleEntityDao { | ||
|
||
@Upsert | ||
suspend fun upsertFavoriteArticle(favoriteArticle: FavoriteArticleEntity) | ||
|
||
@Delete | ||
suspend fun deleteFavoriteArticle( | ||
favoriteArticle: FavoriteArticleEntity | ||
) | ||
|
||
@Query("SELECT * FROM fav_article_entity") | ||
fun getFavoriteArticles(): Flow<List<FavoriteArticleEntity>> | ||
|
||
@Query("SELECT * FROM fav_article_entity WHERE id = :id") | ||
fun getFavoriteArticleById(id: Int): Flow<FavoriteArticleEntity> | ||
|
||
} |
Oops, something went wrong.