Skip to content

Commit

Permalink
Merge pull request #1 from Techwaste/home_splash_maps_screen
Browse files Browse the repository at this point in the history
Home splash maps screen
  • Loading branch information
ardwiinoo authored Jun 16, 2023
2 parents 941169c + 0b67d88 commit bf06961
Show file tree
Hide file tree
Showing 186 changed files with 11,268 additions and 672 deletions.
2 changes: 1 addition & 1 deletion .idea/deploymentTargetDropDown.xml

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

7 changes: 7 additions & 0 deletions .idea/discord.xml

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

28 changes: 28 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id 'org.jetbrains.kotlin.android'
id 'org.jetbrains.kotlin.kapt'
id 'dagger.hilt.android.plugin'
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
}

android {
Expand Down Expand Up @@ -55,13 +56,20 @@ dependencies {
implementation 'androidx.activity:activity-compose:1.7.1'
implementation platform('androidx.compose:compose-bom:2022.10.00')
implementation 'androidx.compose.ui:ui'
implementation "androidx.compose.ui:ui-util"
implementation 'androidx.compose.ui:ui-graphics'
implementation 'androidx.compose.ui:ui-tooling-preview'
implementation 'androidx.compose.material3:material3'
implementation 'androidx.compose.material:material:1.4.3'

// compose
implementation 'androidx.navigation:navigation-compose:2.5.3'
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1'
implementation 'androidx.compose.foundation:foundation:1.4.3'
implementation 'com.google.accompanist:accompanist-navigation-animation:0.30.0'
implementation 'androidx.compose.animation:animation-graphics:1.4.3'
implementation 'androidx.compose.animation:animation:1.4.3'
implementation 'androidx.compose.animation:animation-core:1.4.3'

//lifecycle
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
Expand All @@ -85,6 +93,7 @@ dependencies {

// Dagger - Hilt
implementation 'com.google.dagger:hilt-android:2.45'
implementation 'com.google.android.gms:play-services-location:21.0.1'
kapt 'com.google.dagger:hilt-android-compiler:2.45'
kapt 'androidx.hilt:hilt-compiler:1.0.0'
implementation "androidx.hilt:hilt-navigation-compose:1.0.0"
Expand All @@ -96,6 +105,25 @@ dependencies {
implementation 'com.squareup.moshi:moshi:1.14.0'
implementation 'com.squareup.moshi:moshi-kotlin:1.14.0'

// Pager
implementation "com.google.accompanist:accompanist-pager:0.23.1"

// Maps
implementation 'com.google.maps.android:maps-compose:2.10.0'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.5.2'
implementation 'com.google.android.gms:play-services-location:21.0.1'

// CameraX
implementation "androidx.camera:camera-camera2:1.2.3"
implementation "androidx.camera:camera-lifecycle:1.2.3"
implementation "androidx.camera:camera-view:1.3.0-alpha07"

// Room
implementation "androidx.room:room-ktx:2.5.1"
kapt "androidx.room:room-compiler:2.5.1"
implementation "androidx.room:room-paging:2.5.1"

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@

<uses-permission android:name="android.permission.CAMERA"/>

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<application
android:usesCleartextTraffic="true"
android:name=".application.TechwasApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
Expand All @@ -23,6 +28,7 @@
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.TechwasMark02">
Expand All @@ -33,6 +39,10 @@
</intent-filter>
</activity>

<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${MAPS_API_KEY}" />

<provider
android:authorities="com.capstone.techwasmark02.fileprovider"
android:name=".utils.ComposeFileProvider"
Expand Down
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions app/src/main/java/com/capstone/techwasmark02/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier
import com.capstone.techwasmark02.ui.screen.imageDetection.ImageDetectionScreen
import com.capstone.techwasmark02.ui.screen.signIn.SignInScreen
import com.capstone.techwasmark02.ui.screen.article.ArticleScreen
import com.capstone.techwasmark02.ui.screen.catalog.CatalogScreen
import com.capstone.techwasmark02.ui.screen.home.HomeScreen
import com.capstone.techwasmark02.ui.screen.maps.MapsScreen
import com.capstone.techwasmark02.ui.theme.TechwasMark02Theme
import dagger.hilt.android.AndroidEntryPoint

Expand All @@ -23,7 +25,7 @@ class MainActivity : ComponentActivity() {
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
ImageDetectionScreen()
TechwasApp()
}
}
}
Expand Down
217 changes: 217 additions & 0 deletions app/src/main/java/com/capstone/techwasmark02/TechwasApp.kt
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)
}
}
}
}
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
}
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>

}
Loading

0 comments on commit bf06961

Please sign in to comment.