Skip to content

Commit a05a5cc

Browse files
authored
Merge pull request #28 from hegocre/fix/first-run
Minor fixes for first beta
2 parents 6f62632 + 23075cd commit a05a5cc

4 files changed

Lines changed: 17 additions & 13 deletions

File tree

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ android {
1818
applicationId "com.yara.raco"
1919
minSdk 26
2020
targetSdk 33
21-
versionCode 1
22-
versionName "1.0"
21+
versionCode 4
22+
versionName "1.0.0-beta1"
2323

2424
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2525
vectorDrawables {

app/src/main/java/com/yara/raco/model/schedule/Schedule.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import androidx.compose.ui.graphics.Color
44
import androidx.room.Entity
55
import com.yara.raco.ui.components.Event
66
import kotlinx.serialization.SerialName
7-
import java.time.DayOfWeek
87
import java.time.LocalDateTime
98
import java.time.LocalTime
109
import java.time.temporal.TemporalAdjusters
10+
import java.time.temporal.WeekFields
11+
import java.util.*
1112

1213
/**
1314
* Class that represents a class in the schedule.
@@ -42,8 +43,11 @@ data class Schedule (
4243
val idioma: String
4344
) {
4445
fun toEvent(colorSubject: HashMap<String, Color>): Event {
46+
val firstDay = LocalDateTime.now().with(
47+
TemporalAdjusters.previousOrSame(WeekFields.of(Locale.getDefault()).firstDayOfWeek)
48+
)
4549
val dateWithoutTime =
46-
LocalDateTime.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.of(diaSetmana)))
50+
firstDay.plusDays((8L - firstDay.dayOfWeek.value) % 7 + diaSetmana - 1L)
4751
val dateStart = dateWithoutTime.with(
4852
LocalTime.of(
4953
inici.split(":")[0].toInt(),

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import androidx.compose.foundation.lazy.itemsIndexed
1111
import androidx.compose.foundation.text.KeyboardOptions
1212
import androidx.compose.material.icons.Icons
1313
import androidx.compose.material.icons.filled.ArrowDropDown
14+
import androidx.compose.material.icons.filled.Percent
1415
import androidx.compose.material.icons.outlined.*
1516
import androidx.compose.material3.*
1617
import androidx.compose.runtime.*
@@ -437,17 +438,14 @@ fun RacoGradeEditView(
437438
)
438439
)
439440
},
440-
placeholder = {
441-
Text(
442-
text = "0.0 %",
443-
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.5F)
444-
)
445-
},
446441
modifier = Modifier
447-
.width(80.dp),
442+
.width(120.dp),
448443
maxLines = 1,
449444
singleLine = true,
450-
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number)
445+
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number),
446+
trailingIcon = {
447+
Icon(imageVector = Icons.Default.Percent, contentDescription = "")
448+
}
451449
)
452450
IconButton(onClick = { onGradeDelete(grade) }) {
453451
Icon(Icons.Outlined.Delete, contentDescription = "Delete Weight")

app/src/main/java/com/yara/raco/workers/LogOutWorker.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ class LogOutWorker(context: Context, workerParams: WorkerParameters) :
2323
val workInfos =
2424
WorkManager.getInstance(context).getWorkInfosByTag("com.yara.raco.LOG_OUT_WORK")
2525
.get()
26-
val lastWork = workInfos.lastOrNull() ?: return ResultCode.SUCCESS
26+
val lastWork = workInfos.lastOrNull {
27+
it.state != WorkInfo.State.RUNNING && it.state != WorkInfo.State.ENQUEUED
28+
} ?: return ResultCode.SUCCESS
2729
return if (lastWork.state == WorkInfo.State.SUCCEEDED) {
2830
ResultCode.SUCCESS
2931
} else {

0 commit comments

Comments
 (0)