Skip to content

Commit 8055e25

Browse files
authored
Merge pull request #51 from hegocre/maintenance/updates
Maintenance updates
2 parents f51171f + e12123c commit 8055e25

13 files changed

Lines changed: 760 additions & 57 deletions

File tree

app/build.gradle

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
33
plugins {
44
id 'com.android.application'
55
id 'kotlin-android'
6-
//id 'com.google.devtools.ksp' version "$ksp_version"
7-
id 'org.jetbrains.kotlin.kapt'
6+
id 'com.google.devtools.ksp' version "$kotlin_version-$ksp_version"
87
id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlin_version"
98
}
109

@@ -20,8 +19,8 @@ android {
2019
applicationId "com.yara.raco"
2120
minSdk 26
2221
targetSdk 34
23-
versionCode 32
24-
versionName "1.0.6"
22+
versionCode 34
23+
versionName "1.0.7"
2524

2625
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2726
vectorDrawables {
@@ -45,6 +44,9 @@ android {
4544
}
4645
}
4746

47+
ksp {
48+
arg("room.schemaLocation", "$projectDir/schemas".toString())
49+
}
4850
buildTypes {
4951
release {
5052
minifyEnabled true
@@ -67,7 +69,7 @@ android {
6769
compose true
6870
}
6971
composeOptions {
70-
kotlinCompilerExtensionVersion '1.4.8'
72+
kotlinCompilerExtensionVersion '1.5.3'
7173
}
7274
packagingOptions {
7375
resources {
@@ -96,11 +98,7 @@ dependencies {
9698

9799
//Room dependencies
98100
implementation "androidx.room:room-ktx:$room_version"
99-
//annotationProcessor "androidx.room:room-compiler:$room_version"
100-
//ksp "androidx.room:room-compiler:$room_version"
101-
kapt "androidx.room:room-compiler:$room_version"
102-
103-
implementation 'com.google.accompanist:accompanist-swiperefresh:0.30.1'
101+
ksp "androidx.room:room-compiler:$room_version"
104102

105103
implementation 'androidx.work:work-runtime-ktx:2.8.1'
106104

@@ -111,10 +109,10 @@ dependencies {
111109
//Debug and test implementations
112110
testImplementation 'junit:junit:4.13.2'
113111
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
114-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
115-
implementation 'androidx.compose.ui:ui-test-junit4'
116-
debugImplementation "androidx.compose.ui:ui-tooling"
117-
debugImplementation "androidx.compose.ui:ui-test-manifest"
112+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
113+
androidTestImplementation 'androidx.compose.ui:ui-test-junit4:1.5.1'
114+
debugImplementation "androidx.compose.ui:ui-tooling:1.5.1"
115+
debugImplementation "androidx.compose.ui:ui-test-manifest:1.5.1"
118116
}
119117

120118
// Compiler flag to use experimental Compose APIs

app/src/main/java/com/yara/raco/model/evaluation/Evaluation.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ import com.yara.raco.model.grade.Grade
1515
*/
1616
@kotlinx.serialization.Serializable
1717
@Entity(tableName = "evaluation")
18-
data class Evaluation @JvmOverloads constructor(
18+
data class Evaluation(
1919
@PrimaryKey(autoGenerate = true)
2020
var id: Int,
2121
var subjectId: String,
2222
var name: String,
2323
@Ignore
2424
val listOfGrade: ArrayList<Grade> = arrayListOf()
25-
)
25+
) {
26+
// Constructor for ksp to not fail building
27+
constructor(id: Int, subjectId: String, name: String) : this(id, subjectId, name, arrayListOf())
28+
}

app/src/main/java/com/yara/raco/model/notices/Notice.kt

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import kotlinx.serialization.Transient
2121
*/
2222
@kotlinx.serialization.Serializable
2323
@Entity(tableName = "notices", primaryKeys = ["id"])
24-
data class Notice @JvmOverloads constructor(
24+
data class Notice(
2525
@SerialName("id")
2626
val id: Int,
2727
@SerialName("titol")
@@ -42,4 +42,27 @@ data class Notice @JvmOverloads constructor(
4242
@Transient
4343
@ColumnInfo(defaultValue = "1")
4444
var llegit: Boolean = false
45-
)
45+
) {
46+
// Constructor for ksp to not fail building
47+
constructor(
48+
id: Int,
49+
titol: String,
50+
codiAssig: String,
51+
text: String,
52+
dataInsercio: String,
53+
dataModificacio: String,
54+
dataCaducitat: String,
55+
llegit: Boolean
56+
) :
57+
this(
58+
id,
59+
titol,
60+
codiAssig,
61+
text,
62+
dataInsercio,
63+
dataModificacio,
64+
dataCaducitat,
65+
arrayListOf(),
66+
llegit
67+
)
68+
}

app/src/main/java/com/yara/raco/ui/components/RacoAboutScreen.kt

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,47 @@ package com.yara.raco.ui.components
22

33
import androidx.compose.foundation.Image
44
import androidx.compose.foundation.clickable
5-
import androidx.compose.foundation.layout.*
5+
import androidx.compose.foundation.layout.Column
6+
import androidx.compose.foundation.layout.Row
7+
import androidx.compose.foundation.layout.WindowInsets
8+
import androidx.compose.foundation.layout.fillMaxWidth
9+
import androidx.compose.foundation.layout.height
10+
import androidx.compose.foundation.layout.padding
11+
import androidx.compose.foundation.layout.statusBars
12+
import androidx.compose.foundation.layout.systemBars
13+
import androidx.compose.foundation.layout.width
614
import androidx.compose.foundation.lazy.LazyColumn
715
import androidx.compose.foundation.lazy.items
816
import androidx.compose.foundation.shape.CircleShape
917
import androidx.compose.material.icons.Icons
1018
import androidx.compose.material.icons.filled.ArrowBack
11-
import androidx.compose.material.icons.outlined.*
12-
import androidx.compose.material3.*
13-
import androidx.compose.runtime.*
19+
import androidx.compose.material.icons.outlined.Campaign
20+
import androidx.compose.material.icons.outlined.Code
21+
import androidx.compose.material.icons.outlined.Description
22+
import androidx.compose.material.icons.outlined.Info
23+
import androidx.compose.material.icons.outlined.Person
24+
import androidx.compose.material.icons.outlined.Policy
25+
import androidx.compose.material3.CardDefaults
26+
import androidx.compose.material3.ExperimentalMaterial3Api
27+
import androidx.compose.material3.Icon
28+
import androidx.compose.material3.IconButton
29+
import androidx.compose.material3.ListItem
30+
import androidx.compose.material3.LocalContentColor
31+
import androidx.compose.material3.LocalTextStyle
32+
import androidx.compose.material3.MaterialTheme
33+
import androidx.compose.material3.OutlinedCard
34+
import androidx.compose.material3.Scaffold
35+
import androidx.compose.material3.Surface
36+
import androidx.compose.material3.Text
37+
import androidx.compose.material3.TextButton
38+
import androidx.compose.material3.TopAppBar
39+
import androidx.compose.material3.contentColorFor
40+
import androidx.compose.runtime.Composable
41+
import androidx.compose.runtime.CompositionLocalProvider
42+
import androidx.compose.runtime.getValue
43+
import androidx.compose.runtime.mutableStateOf
1444
import androidx.compose.runtime.saveable.rememberSaveable
45+
import androidx.compose.runtime.setValue
1546
import androidx.compose.ui.Alignment
1647
import androidx.compose.ui.Modifier
1748
import androidx.compose.ui.draw.clip
@@ -312,37 +343,31 @@ val authors = mapOf(
312343
val licenses = listOf(
313344
LicenseNotice(
314345
name = "Kotlin Programming Language",
315-
copyright = "Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.",
346+
copyright = "Copyright © 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.",
316347
licenseName = "Apache License 2.0",
317348
licenseUrl = "https://github.com/JetBrains/kotlin/blob/master/license/LICENSE.txt"
318349
),
319350
LicenseNotice(
320351
name = "Android Jetpack",
321-
copyright = "Copyright 2020 Google LLC",
352+
copyright = "Copyright © 2023 The Android Open Source Project",
322353
licenseName = "Apache License 2.0",
323354
licenseUrl = "https://github.com/androidx/androidx/blob/androidx-main/LICENSE.txt"
324355
),
325-
LicenseNotice(
326-
name = "Accompanist",
327-
copyright = "Copyright 2020 The Android Open Source Project",
328-
licenseName = "Apache License 2.0",
329-
licenseUrl = "https://github.com/google/accompanist/blob/main/LICENSE"
330-
),
331356
LicenseNotice(
332357
name = "HtmlText",
333-
copyright = "Copyright 2021 Alexander Karkossa",
358+
copyright = "Copyright © 2021 Alexander Karkossa",
334359
licenseName = "Apache License 2.0",
335360
licenseUrl = "https://github.com/ch4rl3x/HtmlText/blob/main/LICENSE"
336361
),
337362
LicenseNotice(
338363
name = "OkHttp",
339-
copyright = "Copyright 2019 Square, Inc.",
364+
copyright = "Copyright © 2019 Square, Inc.",
340365
licenseName = "Apache License 2.0",
341366
licenseUrl = "https://github.com/square/okhttp/blob/master/LICENSE.txt"
342367
),
343368
LicenseNotice(
344369
name = "WeekSchedule",
345-
copyright = "Copyright 2021 Daniel Rampelt",
370+
copyright = "Copyright © 2021 Daniel Rampelt",
346371
licenseName = "MIT License",
347372
licenseUrl = "https://github.com/drampelt/WeekSchedule/blob/main/LICENSE"
348373
)

app/src/main/java/com/yara/raco/ui/components/RacoMainNavHost.kt

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ package com.yara.raco.ui.components
22

33
import android.widget.Toast
44
import androidx.compose.animation.Crossfade
5+
import androidx.compose.animation.core.tween
6+
import androidx.compose.animation.fadeIn
7+
import androidx.compose.animation.fadeOut
58
import androidx.compose.foundation.ExperimentalFoundationApi
69
import androidx.compose.foundation.layout.Box
710
import androidx.compose.foundation.layout.Column
@@ -12,7 +15,6 @@ import androidx.compose.foundation.pager.rememberPagerState
1215
import androidx.compose.material3.CircularProgressIndicator
1316
import androidx.compose.material3.MaterialTheme
1417
import androidx.compose.material3.Text
15-
import androidx.compose.material3.surfaceColorAtElevation
1618
import androidx.compose.runtime.Composable
1719
import androidx.compose.runtime.LaunchedEffect
1820
import androidx.compose.runtime.collectAsState
@@ -23,23 +25,23 @@ import androidx.compose.runtime.produceState
2325
import androidx.compose.runtime.remember
2426
import androidx.compose.runtime.rememberCoroutineScope
2527
import androidx.compose.runtime.setValue
28+
import androidx.compose.ui.Alignment
2629
import androidx.compose.ui.Modifier
2730
import androidx.compose.ui.platform.LocalContext
2831
import androidx.compose.ui.res.stringResource
2932
import androidx.compose.ui.text.style.TextAlign
30-
import androidx.compose.ui.unit.dp
3133
import androidx.navigation.NavHostController
3234
import androidx.navigation.NavType
3335
import androidx.navigation.compose.NavHost
3436
import androidx.navigation.compose.composable
3537
import androidx.navigation.navArgument
36-
import com.google.accompanist.swiperefresh.SwipeRefresh
37-
import com.google.accompanist.swiperefresh.SwipeRefreshIndicator
38-
import com.google.accompanist.swiperefresh.rememberSwipeRefreshState
3938
import com.yara.raco.R
4039
import com.yara.raco.model.evaluation.EvaluationWithGrades
4140
import com.yara.raco.model.notices.NoticeWithFiles
4241
import com.yara.raco.ui.RacoScreen
42+
import com.yara.raco.ui.components.pullrefresh.PullRefreshIndicator
43+
import com.yara.raco.ui.components.pullrefresh.pullRefresh
44+
import com.yara.raco.ui.components.pullrefresh.rememberPullRefreshState
4345
import com.yara.raco.ui.viewmodel.RacoViewModel
4446
import com.yara.raco.utils.Result
4547
import kotlinx.coroutines.launch
@@ -89,7 +91,9 @@ fun RacoMainNavHost(
8991
NavHost(
9092
navController = navHostController,
9193
startDestination = RacoScreen.Notes.name,
92-
modifier = modifier
94+
modifier = modifier,
95+
enterTransition = { fadeIn(animationSpec = tween(300)) },
96+
exitTransition = { fadeOut(animationSpec = tween(300)) },
9397
) {
9498
composable(RacoScreen.Notes.name) {
9599
Column {
@@ -333,28 +337,25 @@ fun RacoMainNavHost(
333337
}
334338
}
335339

336-
@Suppress("deprecation")
337340
@Composable
338341
fun RacoSwipeRefresh(
339342
isRefreshing: Boolean,
340343
onRefresh: () -> Unit,
341344
content: @Composable () -> Unit
342345
) {
343-
val refreshState = rememberSwipeRefreshState(isRefreshing = isRefreshing)
346+
val pullRefreshState = rememberPullRefreshState(
347+
refreshing = isRefreshing,
348+
onRefresh = onRefresh
349+
)
344350

345-
SwipeRefresh(
346-
state = refreshState,
347-
onRefresh = onRefresh,
348-
modifier = Modifier.fillMaxSize(),
349-
indicator = { rState, refreshTrigger ->
350-
SwipeRefreshIndicator(
351-
state = rState,
352-
refreshTriggerDistance = refreshTrigger,
353-
contentColor = MaterialTheme.colorScheme.primary,
354-
backgroundColor = MaterialTheme.colorScheme.surfaceColorAtElevation(4.dp)
355-
)
356-
}
357-
) {
351+
Box(modifier = Modifier.pullRefresh(pullRefreshState)) {
358352
content()
353+
354+
PullRefreshIndicator(
355+
refreshing = isRefreshing,
356+
state = pullRefreshState,
357+
contentColor = MaterialTheme.colorScheme.primary,
358+
modifier = Modifier.align(Alignment.TopCenter)
359+
)
359360
}
360361
}

app/src/main/java/com/yara/raco/ui/components/RacoMainScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ fun RacoMainScreen(
210210
},
211211
bottomBar = {
212212
RacoMainNavigationBar(
213-
allScreens = RacoScreen.values().asList(),
213+
allScreens = RacoScreen.entries,
214214
currentScreen = currentScreen,
215215
onScreenSelected = { racoScreen ->
216216
navController.navigate(racoScreen.name) {

0 commit comments

Comments
 (0)