Skip to content

Commit

Permalink
v.0.14.0
Browse files Browse the repository at this point in the history
- replaces bottom-sheet with separate screen #60
- accessibility improvements
- fix minor annoyances
- adds and updates translations (thanks to all translators!)
  • Loading branch information
pabloscloud committed Jan 21, 2024
1 parent b802fbf commit 49dd1e3
Show file tree
Hide file tree
Showing 35 changed files with 1,507 additions and 814 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId = "cloud.pablos.overload"
minSdk = 26
targetSdk = 34
versionCode = 131
versionName = "0.13.1"
versionCode = 140
versionName = "0.14.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

Expand Down
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 131,
"versionName": "0.13.1",
"versionCode": 140,
"versionName": "0.14.0",
"outputFile": "app-release.apk"
}
],
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2022 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at
Expand All @@ -15,12 +14,13 @@
<application
android:name="Overload"
android:allowBackup="true"
android:enableOnBackInvokedCallback="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Overload"
tools:targetApi="31">
tools:targetApi="33">
<activity
android:name=".ui.MainActivity"
android:launchMode="singleInstance"
Expand All @@ -43,7 +43,7 @@
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"/>
android:resource="@xml/file_paths" />
</provider>
</application>

Expand Down
21 changes: 20 additions & 1 deletion app/src/main/java/cloud/pablos/overload/data/item/ItemEvent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,39 @@ package cloud.pablos.overload.data.item

sealed interface ItemEvent {
data object SaveItem : ItemEvent

data class SetId(val id: Int) : ItemEvent

data class SetStart(val start: String) : ItemEvent

data class SetEnd(val end: String) : ItemEvent

data class SetOngoing(val ongoing: Boolean) : ItemEvent

data class SetPause(val pause: Boolean) : ItemEvent

data class SetIsOngoing(val isOngoing: Boolean) : ItemEvent

data class DeleteItems(val items: List<Item>) : ItemEvent

data class SetSelectedDayCalendar(val day: String) : ItemEvent

data class SetSelectedYearCalendar(val year: Int) : ItemEvent

data class SetIsDeletingHome(val isDeleting: Boolean) : ItemEvent

data class SetIsSelectedHome(val isSelected: Boolean) : ItemEvent

data class SetSelectedItemsHome(val selectedItems: List<Item>) : ItemEvent

data class SetForgotToStopDialogShown(val isForgotToStopDialogShown: Boolean) : ItemEvent

data class SetAdjustEndDialogShown(val isAdjustEndDialogShown: Boolean) : ItemEvent
data class SetSpreadAcrossDaysDialogShown(val isSpreadAcrossDaysDialogShown: Boolean) : ItemEvent

data class SetSpreadAcrossDaysDialogShown(val isSpreadAcrossDaysDialogShown: Boolean) :
ItemEvent

data class SetIsFabOpen(val isFabOpen: Boolean) : ItemEvent

data class NavigateToScreen(val route: String, val popBackStack: Boolean = false) : ItemEvent
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ data class ItemState(
val isAdjustEndDialogShown: Boolean = false,
val isSpreadAcrossDaysDialogShown: Boolean = false,
val isFabOpen: Boolean = false,
val navigateToScreenRoute: String = "",
val navigateToScreenPopBackStack: Boolean = false,
)
46 changes: 32 additions & 14 deletions app/src/main/java/cloud/pablos/overload/data/item/ItemViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ import java.time.LocalDateTime
class ItemViewModel(
private val dao: ItemDao,
) : ViewModel() {

private val _items = dao.getAllItems().stateIn(viewModelScope, SharingStarted.WhileSubscribed(), emptyList())
private val _items =
dao.getAllItems().stateIn(viewModelScope, SharingStarted.WhileSubscribed(), emptyList())
private val _state = MutableStateFlow(ItemState())
val state = combine(_state, _items) { state, items ->
state.copy(
items = items,
)
}.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), ItemState())
val state =
combine(_state, _items) { state, items ->
state.copy(
items = items,
)
}.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), ItemState())

fun onEvent(event: ItemEvent) {
when (event) {
Expand All @@ -36,20 +37,22 @@ class ItemViewModel(
}
}
}

ItemEvent.SaveItem -> {
val id = _state.value.id
val start = _state.value.start
val end = _state.value.end
val ongoing = _state.value.ongoing
val pause = _state.value.pause

val item = Item(
id = id,
startTime = start,
endTime = end,
ongoing = ongoing,
pause = pause,
)
val item =
Item(
id = id,
startTime = start,
endTime = end,
ongoing = ongoing,
pause = pause,
)

viewModelScope.launch {
dao.upsertItem(item)
Expand All @@ -65,41 +68,47 @@ class ItemViewModel(
)
}
}

is ItemEvent.SetStart -> {
_state.update {
it.copy(
start = event.start,
)
}
}

is ItemEvent.SetEnd -> {
_state.update {
it.copy(
end = event.end,
)
}
}

is ItemEvent.SetOngoing -> {
_state.update {
it.copy(
ongoing = event.ongoing,
)
}
}

is ItemEvent.SetPause -> {
_state.update {
it.copy(
pause = event.pause,
)
}
}

is ItemEvent.SetIsOngoing -> {
_state.update {
it.copy(
isOngoing = event.isOngoing,
)
}
}

is ItemEvent.SetId -> {
_state.update {
it.copy(
Expand Down Expand Up @@ -168,6 +177,15 @@ class ItemViewModel(
)
}
}

is ItemEvent.NavigateToScreen -> {
_state.update {
it.copy(
navigateToScreenRoute = event.route,
navigateToScreenPopBackStack = event.popBackStack,
)
}
}
}
}
}
Loading

0 comments on commit 49dd1e3

Please sign in to comment.