diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..f376cde --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,43 @@ +name: Android CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'zulu' + cache: gradle + + - name: Cache Gradle packages + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build + + - name: Upload build artifacts + uses: actions/upload-artifact@v2 + with: + name: build + path: app/build/outputs/apk/release/*.apk + diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml index 5f6e9e3..b8b08a8 100644 --- a/.idea/deploymentTargetSelector.xml +++ b/.idea/deploymentTargetSelector.xml @@ -13,6 +13,9 @@ + + \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 6d2872e..08cbff3 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -30,11 +30,11 @@ android { } } compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "17" } buildFeatures { compose = true @@ -77,6 +77,8 @@ dependencies { // ViewModel utilities for Compose implementation(libs.androidx.lifecycle.viewmodel.compose) + + // Splash screen implementation(libs.androidx.core.splashscreen) diff --git a/app/src/main/java/com/example/rememberme/RememberMeApp.kt b/app/src/main/java/com/example/rememberme/RememberMeApp.kt index c0abf3d..6d28fb7 100644 --- a/app/src/main/java/com/example/rememberme/RememberMeApp.kt +++ b/app/src/main/java/com/example/rememberme/RememberMeApp.kt @@ -1,6 +1,5 @@ package com.example.rememberme -import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material3.ExperimentalMaterial3Api @@ -12,16 +11,16 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview -import com.example.rememberme.common.composable.ListItem +import com.example.rememberme.presentation.people.PeopleScreen import com.example.rememberme.ui.theme.RememberMeTheme @OptIn(ExperimentalMaterial3Api::class) @Composable -fun RememberMeApp(){ - RememberMeTheme{ +fun RememberMeApp() { + RememberMeTheme { Surface( modifier = Modifier.fillMaxSize(), - ){ + ) { Scaffold( topBar = { TopAppBar( @@ -30,16 +29,8 @@ fun RememberMeApp(){ } ) } - ){ - Column( - modifier = Modifier.padding(it) - ) { - ListItem(name = "Otba", meetPlace = "Abu Dhabi",{ println("Clicked!")}) - ListItem(name = "Otba", meetPlace = "Abu Dhabi",{println("Clicked!")}) - ListItem(name = "Otba", meetPlace = "Abu Dhabi",{println("Clicked!")}) - ListItem(name = "Otba", meetPlace = "Abu Dhabi",{println("Clicked!")}) - - } + ) { + PeopleScreen(modifier = Modifier.padding(it)) } } } @@ -48,6 +39,6 @@ fun RememberMeApp(){ @Preview(showBackground = true) @Composable -fun RememberMeAppPreview(){ +fun RememberMeAppPreview() { RememberMeApp() } diff --git a/app/src/main/java/com/example/rememberme/data/FakeDataSource.kt b/app/src/main/java/com/example/rememberme/data/FakeDataSource.kt new file mode 100644 index 0000000..06b617d --- /dev/null +++ b/app/src/main/java/com/example/rememberme/data/FakeDataSource.kt @@ -0,0 +1,72 @@ +package com.example.rememberme.data + +import com.example.rememberme.R +import com.example.rememberme.data.database.People + +object FakeDataSource { + fun getPeopleList(): List { + val firstNames = listOf( + "John", "Jane", "Michael", "Emily", "Robert", "Linda", "David", "Sarah", "James", "Jessica", + "William", "Amanda", "Joseph", "Ashley", "Charles", "Melissa", "Thomas", "Stephanie", "Daniel", "Laura", + "Matthew", "Rachel", "Andrew", "Megan", "Joshua", "Jennifer", "Anthony", "Samantha", "Mark", "Elizabeth" + ) + val lastNames = listOf( + "Doe", "Smith", "Johnson", "Davis", "Brown", "Taylor", "Wilson", "Moore", "Jackson", "White", + "Harris", "Martin", "Thompson", "Garcia", "Martinez", "Robinson", "Clark", "Rodriguez", "Lewis", "Lee", + "Walker", "Hall", "Allen", "Young", "King", "Wright", "Scott", "Torres", "Nguyen", "Hill" + ) + val places = listOf( + "Central Park", "Starbucks", "Office", "Gym", "Conference Hall", "Library", "Mall", "Restaurant", "Beach", "Museum", + "Cinema", "Zoo", "Amusement Park", "Aquarium", "Sports Arena", "Theater", "Cafe", "Bookstore", "Airport", "Train Station", + "Bus Stop", "Hotel", "Hospital", "Clinic", "School", "University", "Park", "Playground", "Concert Hall", "Night Club" + ) + val times = listOf( + "12:00 PM", "9:00 AM", "10:00 AM", "6:00 PM", "3:00 PM", "2:00 PM", "11:00 AM", "1:00 PM", "4:00 PM", "5:00 PM", + "7:00 PM", "8:00 PM", "6:30 PM", "9:30 AM", "10:30 AM", "11:30 AM", "12:30 PM", "1:30 PM", "2:30 PM", "3:30 PM", + "4:30 PM", "5:30 PM", "6:00 AM", "7:00 AM", "8:00 AM", "8:30 AM", "7:30 AM", "6:00 AM", "9:00 PM", "10:00 PM" + ) + val notes = listOf( + "Met during lunch break", "Had a coffee together", "Discussed project details", "Met during workout", "Attended a seminar", "Studied together", + "Shopped for clothes", "Had dinner together", "Relaxed on the beach", "Visited an exhibition", "Watched a movie", "Saw animals", "Enjoyed rides", + "Saw marine life", "Watched a game", "Watched a play", "Had a snack", "Bought books", "Caught a flight", "Caught a train", "Waited for the bus", + "Stayed overnight", "Had a checkup", "Received treatment", "Attended classes", "Studied together", "Walked in the park", "Played together", + "Attended a concert", "Danced at the club" + ) + + return List(30) { index -> + People( + firstName = firstNames[index % firstNames.size], + secondName = lastNames[index % lastNames.size], + place = places[index % places.size], + time = times[index % times.size], + note = notes[index % notes.size], + gender = if (index % 2 == 0) "Male" else "Female", + avatar = if (index % 2 == 0) { + getMaleAvatar(index) + } else { + getFemaleAvatar(index) + } + ) + } + } + + private fun getMaleAvatar(index: Int): Int { + return when (index % 5) { + 0 -> R.drawable.ic_m1 + 1 -> R.drawable.ic_m2 + 2 -> R.drawable.ic_m3 + 3 -> R.drawable.ic_m4 + else -> R.drawable.ic_m5 + } + } + + private fun getFemaleAvatar(index: Int): Int { + return when (index % 5) { + 0 -> R.drawable.ic_f1 + 1 -> R.drawable.ic_f2 + 2 -> R.drawable.ic_f3 + 3 -> R.drawable.ic_f4 + else -> R.drawable.ic_f5 + } + } +} diff --git a/app/src/main/java/com/example/rememberme/data/database/People.kt b/app/src/main/java/com/example/rememberme/data/database/People.kt index 827d698..f0a9615 100644 --- a/app/src/main/java/com/example/rememberme/data/database/People.kt +++ b/app/src/main/java/com/example/rememberme/data/database/People.kt @@ -12,7 +12,7 @@ data class People ( @ColumnInfo(name = "second_name") var secondName: String, @ColumnInfo(name = "meeting_place") var place: String, @ColumnInfo(name = "meeting_time") var time: String, - @ColumnInfo(name ="note")var note:String?, + @ColumnInfo(name ="note")var note:String? = null, @ColumnInfo(name = "registration_time")val registrationTime: Long = System.currentTimeMillis(), var gender:String, var avatar: Int) \ No newline at end of file diff --git a/app/src/main/java/com/example/rememberme/common/composable/ListItem.kt b/app/src/main/java/com/example/rememberme/presentation/composable/PeopleListItem.kt similarity index 62% rename from app/src/main/java/com/example/rememberme/common/composable/ListItem.kt rename to app/src/main/java/com/example/rememberme/presentation/composable/PeopleListItem.kt index e36d384..077330c 100644 --- a/app/src/main/java/com/example/rememberme/common/composable/ListItem.kt +++ b/app/src/main/java/com/example/rememberme/presentation/composable/PeopleListItem.kt @@ -1,5 +1,6 @@ -package com.example.rememberme.common.composable +package com.example.rememberme.presentation.composable +import android.content.res.Configuration import androidx.compose.foundation.Image import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.padding @@ -14,16 +15,21 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.example.rememberme.R +import com.example.rememberme.data.database.People import com.example.rememberme.ui.theme.RememberMeTheme @Composable -fun ListItem(name: String, meetPlace: String,onClickListener: () -> Unit, modifier: Modifier = Modifier) { +fun PeopleListItem( + people: People, + onClickListener: () -> Unit, + modifier: Modifier = Modifier +) { ListItem( modifier = modifier .padding(horizontal = 8.dp, vertical = 4.dp) .clip(shape = RoundedCornerShape(8.dp)) .clickable { - onClickListener() + onClickListener() }, leadingContent = { Image( @@ -33,10 +39,13 @@ fun ListItem(name: String, meetPlace: String,onClickListener: () -> Unit, modifi ) }, headlineContent = { - Text(name) + Text(people.firstName +" "+ people.secondName) }, supportingContent = { - Text(meetPlace) + Text(people.place) + }, + trailingContent = { + Text(people.time) }, tonalElevation = 2.dp, // Adjust tonal elevation shadowElevation = 4.dp // Adjust shadow elevation, @@ -44,9 +53,20 @@ fun ListItem(name: String, meetPlace: String,onClickListener: () -> Unit, modifi } @Preview() +@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES) @Composable fun ListItemPreview() { RememberMeTheme { - ListItem("Omer", "Abu Dhabi",{}) + PeopleListItem( + people = People( + firstName = "Sara", + secondName = "Mustafa", + place = "London", + id = 1L, + avatar = R.drawable.ic_f4, + gender = "Female", + time = "10:10 AM" + ) + , {}) } } \ No newline at end of file diff --git a/app/src/main/java/com/example/rememberme/presentation/people/PeopleListScreen.kt b/app/src/main/java/com/example/rememberme/presentation/people/PeopleListScreen.kt new file mode 100644 index 0000000..83667d6 --- /dev/null +++ b/app/src/main/java/com/example/rememberme/presentation/people/PeopleListScreen.kt @@ -0,0 +1,46 @@ +package com.example.rememberme.presentation.people + +import android.content.res.Configuration +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import com.example.rememberme.data.FakeDataSource +import com.example.rememberme.presentation.composable.PeopleListItem +import com.example.rememberme.ui.theme.RememberMeTheme + +@Composable +fun PeopleScreen( + modifier: Modifier = Modifier, + viewModel: PeopleViewModel = PeopleViewModel() +) { + PeopleScreenContent(modifier) +} + +@Composable +fun PeopleScreenContent(modifier: Modifier = Modifier) { + + val peopleList = remember { FakeDataSource.getPeopleList() } + LazyColumn( + modifier = modifier + .fillMaxSize() + ) { + items(count = peopleList.size) { index -> + PeopleListItem(peopleList[index], {}) + } + } + +} + +@Preview(showBackground = true) +@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES) +@Composable +fun PeopleScreenContentPreview() { + RememberMeTheme { + PeopleScreenContent() + } +} + + diff --git a/app/src/main/java/com/example/rememberme/presentation/people/PeopleViewModel.kt b/app/src/main/java/com/example/rememberme/presentation/people/PeopleViewModel.kt new file mode 100644 index 0000000..e88ebcd --- /dev/null +++ b/app/src/main/java/com/example/rememberme/presentation/people/PeopleViewModel.kt @@ -0,0 +1,4 @@ +package com.example.rememberme.presentation.people + +class PeopleViewModel { +} \ No newline at end of file