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

File location changes #15

Merged
merged 3 commits into from
Jan 6, 2025
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
File renamed without changes
File renamed without changes.
10 changes: 5 additions & 5 deletions app/src/main/java/com/example/estiaseek/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import androidx.compose.ui.Modifier
import androidx.lifecycle.ViewModelProvider
import com.example.estiaseek.data.EstiaSeekDatabase
import com.example.estiaseek.data.OfflineUsersRepository
import com.example.estiaseek.ui.screens.CandidateSearchScreen
import com.example.estiaseek.ui.screens.CandidateSearchViewModel
import com.example.estiaseek.ui.screens.CandidateSearchViewModelFactory
import com.example.estiaseek.ui.screens.CreateApplicantViewModel
import com.example.estiaseek.ui.navigation.NavigationHelper
import com.example.estiaseek.ui.viewmodels.CandidateSearchViewModel
import com.example.estiaseek.ui.viewmodels.CandidateSearchViewModelFactory
import com.example.estiaseek.ui.viewmodels.CreateApplicantViewModel
import com.example.estiaseek.ui.theme.EstiaSeekTheme

class MainActivity : ComponentActivity() {
Expand All @@ -37,7 +37,7 @@ class MainActivity : ComponentActivity() {
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
EstiaSeekScreen(
NavigationHelper(
viewModel = candidateSearchViewModel,
createApplicantViewModel = createApplicantViewModel
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.estiaseek.ui.screens
package com.example.estiaseek.ui

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*
Expand Down Expand Up @@ -38,10 +38,11 @@ fun HomeScreen(
Column(
modifier = Modifier
.fillMaxSize()
.padding(16.dp),
.padding(10.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Spacer(modifier = Modifier.height(16.dp))
// Heading
Text(
text = "Welcome to EstiaSeek",
Expand All @@ -56,7 +57,7 @@ fun HomeScreen(
painter = painterResource(id = R.drawable.emp),
contentDescription = "Example Image",
modifier = Modifier
.size(150.dp)
.size(300.dp)
.padding(bottom = 24.dp)
)

Expand All @@ -69,7 +70,7 @@ fun HomeScreen(
.fillMaxWidth()
.padding(horizontal = 32.dp)
) {
Text(text = "Search Candidate")
Text(text = "Search for Candidates")
}

Spacer(modifier = Modifier.height(16.dp))
Expand All @@ -83,7 +84,7 @@ fun HomeScreen(
.fillMaxWidth()
.padding(horizontal = 32.dp)
) {
Text(text = "Create Applicant")
Text(text = "Create Candidates")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.estiaseek
package com.example.estiaseek.ui.navigation

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
Expand All @@ -7,18 +7,18 @@ import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.example.estiaseek.ui.profile.Profile
import com.example.estiaseek.ui.screens.CandidateSearchScreen
import com.example.estiaseek.ui.screens.CandidateSearchViewModel
import com.example.estiaseek.ui.screens.CreateApplicant
import com.example.estiaseek.ui.screens.CreateApplicantViewModel
import com.example.estiaseek.ui.screens.HomeScreen
import com.example.estiaseek.ui.screens.ResultsScreen
import com.example.estiaseek.ui.profile.ApplicantProfile
import com.example.estiaseek.ui.search.CandidateSearchScreen
import com.example.estiaseek.ui.viewmodels.CandidateSearchViewModel
import com.example.estiaseek.ui.profile.CreateApplicant
import com.example.estiaseek.ui.viewmodels.CreateApplicantViewModel
import com.example.estiaseek.ui.HomeScreen
import com.example.estiaseek.ui.search.ResultsScreen
import com.example.estiaseek.ui.viewmodels.ProfileViewModel
import com.example.estiaseek.ui.viewmodels.SearchViewModel


enum class EstiaSeekScreen() {
enum class NavigationHelper() {
Start,
CreateApplicant,
ShowResults,
Expand All @@ -27,7 +27,7 @@ enum class EstiaSeekScreen() {
}

@Composable
fun EstiaSeekScreen(
fun NavigationHelper(
navController: NavHostController = rememberNavController(),
searchViewModel: SearchViewModel = viewModel(),
profileViewModel: ProfileViewModel = viewModel(),
Expand All @@ -36,36 +36,36 @@ fun EstiaSeekScreen(
) {
NavHost(
navController = navController,
startDestination = EstiaSeekScreen.Start.name,
startDestination = NavigationHelper.Start.name,
modifier = Modifier,
) {
composable(route = EstiaSeekScreen.Start.name) {
composable(route = NavigationHelper.Start.name) {
HomeScreen(
onSearchButtonClicked = { navController.navigate(EstiaSeekScreen.Search.name) },
onCreateApplicantButtonClicked = { navController.navigate(EstiaSeekScreen.CreateApplicant.name) }
onSearchButtonClicked = { navController.navigate(NavigationHelper.Search.name) },
onCreateApplicantButtonClicked = { navController.navigate(NavigationHelper.CreateApplicant.name) }
)
}
composable(route = EstiaSeekScreen.CreateApplicant.name) {
composable(route = NavigationHelper.CreateApplicant.name) {
CreateApplicant(
onCreateApplicantButtonClicked = { navController.navigate(EstiaSeekScreen.Start.name)},
onCreateApplicantButtonClicked = { navController.navigate(NavigationHelper.Start.name)},
viewModel = createApplicantViewModel //fixme
)
}
composable(route = EstiaSeekScreen.ShowResults.name) {
composable(route = NavigationHelper.ShowResults.name) {
ResultsScreen(
onProfileClicked = { navController.navigate(EstiaSeekScreen.Profile.name)},
onProfileClicked = { navController.navigate(NavigationHelper.Profile.name)},
searchViewModel = searchViewModel,
profileViewModel = profileViewModel
)
}
composable(route = EstiaSeekScreen.Profile.name) {
Profile(
composable(route = NavigationHelper.Profile.name) {
ApplicantProfile(
profileViewModel = profileViewModel
)
}
composable(route = EstiaSeekScreen.Search.name) {
composable(route = NavigationHelper.Search.name) {
CandidateSearchScreen(
onSearchButtonClicked = { navController.navigate(EstiaSeekScreen.ShowResults.name)},
onSearchButtonClicked = { navController.navigate(NavigationHelper.ShowResults.name)},
searchViewModel = searchViewModel,
viewModel = viewModel
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import com.example.estiaseek.ui.viewmodels.ProfileViewModel

@OptIn(UnstableApi::class)
@Composable
fun Profile(
fun ApplicantProfile(
profileViewModel: ProfileViewModel
) {
val context = LocalContext.current
Expand All @@ -44,7 +44,7 @@ fun Profile(
// Remember ExoPlayer instance
val exoPlayer = remember {
ExoPlayer.Builder(context).build().apply {
setMediaItem(MediaItem.fromUri(Uri.parse("file:///android_asset/test.mp4")))
setMediaItem(MediaItem.fromUri(Uri.parse("file:///android_asset/videos/test.mp4")))
prepare()
playWhenReady = true
volume = 0f // Mute by default
Expand Down Expand Up @@ -89,7 +89,7 @@ fun Profile(

// com.example.estiaseek.ui.profile.Profile Picture Overlay
Image(
painter = rememberAsyncImagePainter("file:///android_asset/lilpop.jpg"), // Load from assets
painter = rememberAsyncImagePainter("file:///android_asset/images/lilpop.jpg"), // Load from assets
contentDescription = "com.example.estiaseek.ui.profile.Profile Picture",
contentScale = ContentScale.Crop,
modifier = Modifier
Expand Down Expand Up @@ -201,8 +201,8 @@ fun Profile(

@Preview
@Composable
fun PreviewProfile() {
Profile(
fun PreviewApplicantProfile() {
ApplicantProfile(
profileViewModel = ProfileViewModel()
)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.estiaseek.ui.screens
package com.example.estiaseek.ui.profile

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
Expand Down Expand Up @@ -38,6 +38,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.example.estiaseek.R
import com.example.estiaseek.ui.components.DropdownMenuField
import com.example.estiaseek.ui.viewmodels.CreateApplicantViewModel
import kotlin.Unit


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.estiaseek.ui.screens
package com.example.estiaseek.ui.search

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
Expand All @@ -10,7 +10,6 @@ import androidx.compose.material.icons.rounded.LocationOn
import androidx.compose.material.icons.rounded.Person
import androidx.compose.material.icons.rounded.Search
import androidx.compose.material.icons.rounded.Star
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand All @@ -31,6 +30,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import com.example.estiaseek.ui.viewmodels.CandidateSearchViewModel


@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.estiaseek.ui.screens
package com.example.estiaseek.ui.search

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.example.estiaseek.ui.screens
package com.example.estiaseek.ui.viewmodels

import android.util.Log
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.estiaseek.data.User
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.estiaseek.ui.screens
package com.example.estiaseek.ui.viewmodels

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.estiaseek.ui.screens
package com.example.estiaseek.ui.viewmodels

import android.util.Patterns
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.estiaseek.data.User
Expand All @@ -22,7 +23,7 @@ class CreateApplicantViewModel(private val usersRepository: UsersRepository) : V
if (name.isBlank()) {
errors["name"] = "name_required"
}
if (email.isBlank() || !android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
if (email.isBlank() || !Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
errors["email"] = "email_required"
}
if (jobTitle.isBlank()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.estiaseek.ui.screens
package com.example.estiaseek.ui.viewmodels

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
Expand Down
Loading