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

impl Github Actions #1

Merged
merged 3 commits into from
Jun 12, 2024
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
43 changes: 43 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -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

3 changes: 3 additions & 0 deletions .idea/deploymentTargetSelector.xml

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

8 changes: 5 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -77,6 +77,8 @@ dependencies {

// ViewModel utilities for Compose
implementation(libs.androidx.lifecycle.viewmodel.compose)

// Splash screen
implementation(libs.androidx.core.splashscreen)


Expand Down
23 changes: 7 additions & 16 deletions app/src/main/java/com/example/rememberme/RememberMeApp.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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(
Expand All @@ -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))
}
}
}
Expand All @@ -48,6 +39,6 @@ fun RememberMeApp(){

@Preview(showBackground = true)
@Composable
fun RememberMeAppPreview(){
fun RememberMeAppPreview() {
RememberMeApp()
}
72 changes: 72 additions & 0 deletions app/src/main/java/com/example/rememberme/data/FakeDataSource.kt
Original file line number Diff line number Diff line change
@@ -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<People> {
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
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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(
Expand All @@ -33,20 +39,34 @@ 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,
)
}

@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"
)
, {})
}
}
Original file line number Diff line number Diff line change
@@ -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()
}
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.example.rememberme.presentation.people

class PeopleViewModel {
}
Loading