Skip to content

Commit

Permalink
Merge pull request #28 from hegocre/fix/first-run
Browse files Browse the repository at this point in the history
Minor fixes for first beta
  • Loading branch information
hegocre authored Dec 12, 2022
2 parents 6f62632 + 23075cd commit a05a5cc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ android {
applicationId "com.yara.raco"
minSdk 26
targetSdk 33
versionCode 1
versionName "1.0"
versionCode 4
versionName "1.0.0-beta1"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/java/com/yara/raco/model/schedule/Schedule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import androidx.compose.ui.graphics.Color
import androidx.room.Entity
import com.yara.raco.ui.components.Event
import kotlinx.serialization.SerialName
import java.time.DayOfWeek
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.temporal.TemporalAdjusters
import java.time.temporal.WeekFields
import java.util.*

/**
* Class that represents a class in the schedule.
Expand Down Expand Up @@ -42,8 +43,11 @@ data class Schedule (
val idioma: String
) {
fun toEvent(colorSubject: HashMap<String, Color>): Event {
val firstDay = LocalDateTime.now().with(
TemporalAdjusters.previousOrSame(WeekFields.of(Locale.getDefault()).firstDayOfWeek)
)
val dateWithoutTime =
LocalDateTime.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.of(diaSetmana)))
firstDay.plusDays((8L - firstDay.dayOfWeek.value) % 7 + diaSetmana - 1L)
val dateStart = dateWithoutTime.with(
LocalTime.of(
inici.split(":")[0].toInt(),
Expand Down
14 changes: 6 additions & 8 deletions app/src/main/java/com/yara/raco/ui/components/RacoGradesList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowDropDown
import androidx.compose.material.icons.filled.Percent
import androidx.compose.material.icons.outlined.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
Expand Down Expand Up @@ -437,17 +438,14 @@ fun RacoGradeEditView(
)
)
},
placeholder = {
Text(
text = "0.0 %",
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.5F)
)
},
modifier = Modifier
.width(80.dp),
.width(120.dp),
maxLines = 1,
singleLine = true,
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number)
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number),
trailingIcon = {
Icon(imageVector = Icons.Default.Percent, contentDescription = "")
}
)
IconButton(onClick = { onGradeDelete(grade) }) {
Icon(Icons.Outlined.Delete, contentDescription = "Delete Weight")
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/com/yara/raco/workers/LogOutWorker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class LogOutWorker(context: Context, workerParams: WorkerParameters) :
val workInfos =
WorkManager.getInstance(context).getWorkInfosByTag("com.yara.raco.LOG_OUT_WORK")
.get()
val lastWork = workInfos.lastOrNull() ?: return ResultCode.SUCCESS
val lastWork = workInfos.lastOrNull {
it.state != WorkInfo.State.RUNNING && it.state != WorkInfo.State.ENQUEUED
} ?: return ResultCode.SUCCESS
return if (lastWork.state == WorkInfo.State.SUCCEEDED) {
ResultCode.SUCCESS
} else {
Expand Down

0 comments on commit a05a5cc

Please sign in to comment.