diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png new file mode 100644 index 0000000..f7a8b59 Binary files /dev/null and b/app/src/main/ic_launcher-playstore.png differ diff --git a/app/src/main/java/com/example/waterfiltercompanion/common/dependencyinjection/activity/ActivityModule.kt b/app/src/main/java/com/example/waterfiltercompanion/common/dependencyinjection/activity/ActivityModule.kt index 588891b..21313b2 100644 --- a/app/src/main/java/com/example/waterfiltercompanion/common/dependencyinjection/activity/ActivityModule.kt +++ b/app/src/main/java/com/example/waterfiltercompanion/common/dependencyinjection/activity/ActivityModule.kt @@ -8,7 +8,6 @@ import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.android.components.ActivityComponent -import dagger.hilt.android.scopes.ActivityScoped import javax.inject.Named @Module diff --git a/app/src/main/java/com/example/waterfiltercompanion/ui/components/capacityinputdialog/CapacityInputDialog.kt b/app/src/main/java/com/example/waterfiltercompanion/ui/components/capacityinputdialog/CapacityInputDialog.kt index 9c52193..a774c64 100644 --- a/app/src/main/java/com/example/waterfiltercompanion/ui/components/capacityinputdialog/CapacityInputDialog.kt +++ b/app/src/main/java/com/example/waterfiltercompanion/ui/components/capacityinputdialog/CapacityInputDialog.kt @@ -4,13 +4,8 @@ import androidx.compose.foundation.layout.* import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.* -import androidx.compose.runtime.Composable -import androidx.compose.runtime.CompositionLocalProvider -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.getValue +import androidx.compose.runtime.* import androidx.compose.runtime.saveable.rememberSaveable -import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource diff --git a/app/src/main/java/com/example/waterfiltercompanion/ui/components/detailscard/DetailsCard.kt b/app/src/main/java/com/example/waterfiltercompanion/ui/components/detailscard/DetailsCard.kt index a41552d..aaf4530 100644 --- a/app/src/main/java/com/example/waterfiltercompanion/ui/components/detailscard/DetailsCard.kt +++ b/app/src/main/java/com/example/waterfiltercompanion/ui/components/detailscard/DetailsCard.kt @@ -1,6 +1,5 @@ package com.example.waterfiltercompanion.ui.components.detailscard -import android.util.Log import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.animation.slideInHorizontally @@ -14,7 +13,6 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.example.waterfiltercompanion.R import com.example.waterfiltercompanion.ui.components.detailscard.content.DetailsContent -import com.example.waterfiltercompanion.ui.components.detailscard.content.item.DetailsContentItem @ExperimentalAnimationApi @Composable diff --git a/app/src/main/java/com/example/waterfiltercompanion/ui/components/ringindicator/Ring.kt b/app/src/main/java/com/example/waterfiltercompanion/ui/components/ringindicator/Ring.kt index d898d4e..3ac4012 100644 --- a/app/src/main/java/com/example/waterfiltercompanion/ui/components/ringindicator/Ring.kt +++ b/app/src/main/java/com/example/waterfiltercompanion/ui/components/ringindicator/Ring.kt @@ -5,9 +5,6 @@ import androidx.compose.animation.core.animateFloat import androidx.compose.animation.core.tween import androidx.compose.animation.core.updateTransition import androidx.compose.foundation.Canvas -import androidx.compose.foundation.border -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.size import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect diff --git a/app/src/main/java/com/example/waterfiltercompanion/ui/components/ringindicator/RingIndicator.kt b/app/src/main/java/com/example/waterfiltercompanion/ui/components/ringindicator/RingIndicator.kt index f19f619..a1f4752 100644 --- a/app/src/main/java/com/example/waterfiltercompanion/ui/components/ringindicator/RingIndicator.kt +++ b/app/src/main/java/com/example/waterfiltercompanion/ui/components/ringindicator/RingIndicator.kt @@ -3,11 +3,7 @@ package com.example.waterfiltercompanion.ui.components.ringindicator import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material.MaterialTheme import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.getValue -import androidx.compose.runtime.setValue +import androidx.compose.runtime.* import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight diff --git a/app/src/main/java/com/example/waterfiltercompanion/ui/screen/main/MainActivity.kt b/app/src/main/java/com/example/waterfiltercompanion/ui/screen/main/MainActivity.kt index a4f586f..dbe4ec2 100644 --- a/app/src/main/java/com/example/waterfiltercompanion/ui/screen/main/MainActivity.kt +++ b/app/src/main/java/com/example/waterfiltercompanion/ui/screen/main/MainActivity.kt @@ -1,19 +1,12 @@ package com.example.waterfiltercompanion.ui.screen.main import android.os.Bundle -import android.util.Log import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.viewModels import androidx.compose.animation.ExperimentalAnimationApi -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Surface -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.tooling.preview.Preview import androidx.lifecycle.lifecycleScope import com.example.waterfiltercompanion.common.dialog.MaterialDialogHelper -import com.example.waterfiltercompanion.ui.theme.WaterFilterCompanionTheme import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.Job import kotlinx.coroutines.flow.launchIn @@ -57,4 +50,12 @@ class MainActivity : ComponentActivity() { eventsJob?.cancel() eventsJob = null } + + override fun onBackPressed() { + if (viewModel.editMode) { + viewModel.leaveEditMode() + } else { + super.onBackPressed() + } + } } diff --git a/app/src/main/java/com/example/waterfiltercompanion/ui/screen/main/MainScreen.kt b/app/src/main/java/com/example/waterfiltercompanion/ui/screen/main/MainScreen.kt index 2a7b4c5..48e6e65 100644 --- a/app/src/main/java/com/example/waterfiltercompanion/ui/screen/main/MainScreen.kt +++ b/app/src/main/java/com/example/waterfiltercompanion/ui/screen/main/MainScreen.kt @@ -1,7 +1,6 @@ package com.example.waterfiltercompanion.ui.screen.main import android.content.res.Configuration -import android.util.Log import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.foundation.layout.* import androidx.compose.material.MaterialTheme diff --git a/app/src/main/java/com/example/waterfiltercompanion/ui/screen/main/MainViewModel.kt b/app/src/main/java/com/example/waterfiltercompanion/ui/screen/main/MainViewModel.kt index 99f20c2..42366f2 100644 --- a/app/src/main/java/com/example/waterfiltercompanion/ui/screen/main/MainViewModel.kt +++ b/app/src/main/java/com/example/waterfiltercompanion/ui/screen/main/MainViewModel.kt @@ -1,22 +1,25 @@ package com.example.waterfiltercompanion.ui.screen.main -import androidx.compose.runtime.* +import androidx.compose.runtime.derivedStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.setValue import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.example.waterfiltercompanion.common.date.DateHelper -import com.example.waterfiltercompanion.ui.components.capacityinputdialog.CapacityInputDialogConfig -import dagger.hilt.android.lifecycle.HiltViewModel -import javax.inject.Inject import com.example.waterfiltercompanion.R +import com.example.waterfiltercompanion.common.date.DateHelper import com.example.waterfiltercompanion.datapersistence.DataModel import com.example.waterfiltercompanion.datapersistence.LocalRepository +import com.example.waterfiltercompanion.ui.components.capacityinputdialog.CapacityInputDialogConfig import com.example.waterfiltercompanion.ui.components.confirmationdialog.ConfirmationDialogConfig import com.example.waterfiltercompanion.ui.components.infobar.InfoBarMessage import com.example.waterfiltercompanion.ui.components.infobar.InfoBarType import com.example.waterfiltercompanion.watercontrol.ConsumeWaterUseCase +import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.launch +import javax.inject.Inject @HiltViewModel class MainViewModel @Inject constructor( @@ -27,21 +30,31 @@ class MainViewModel @Inject constructor( // Global state var editMode by mutableStateOf(false) + private set var totalCapacity: Int? by mutableStateOf(null) + private set var remainingCapacity: Int? by mutableStateOf(null) + private set var installedOn: Long? by mutableStateOf(null) + private set // Candidate values var totalCapacityCandidate: String? by mutableStateOf(null) + private set var remainingCapacityCandidate: String? by mutableStateOf(null) + private set var installedOnCandidate: Long? by mutableStateOf(null) + private set // Dialogs var capacityInputDialogConfig: CapacityInputDialogConfig? by mutableStateOf(null) + private set var confirmationDialogConfig: ConfirmationDialogConfig? by mutableStateOf(null) + private set // Info Bar var infoBarMessage: InfoBarMessage? by mutableStateOf(null) + private set // Derived states val installedOnFormatted: String? by derivedStateOf { @@ -95,7 +108,7 @@ class MainViewModel @Inject constructor( leaveEditMode() } - private fun leaveEditMode() { + fun leaveEditMode() { editMode = false clearCandidateValues() } diff --git a/app/src/main/java/com/example/waterfiltercompanion/ui/theme/Type.kt b/app/src/main/java/com/example/waterfiltercompanion/ui/theme/Type.kt index 6119ef6..4da6845 100644 --- a/app/src/main/java/com/example/waterfiltercompanion/ui/theme/Type.kt +++ b/app/src/main/java/com/example/waterfiltercompanion/ui/theme/Type.kt @@ -1,7 +1,6 @@ package com.example.waterfiltercompanion.ui.theme import androidx.compose.material.Typography -import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d1..0000000 --- a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9..0000000 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..803f46d --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,21 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index eca70cf..7353dbd 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index eca70cf..7353dbd 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..c01f14b Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp deleted file mode 100644 index c209e78..0000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..7c5b39b Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp deleted file mode 100644 index b2dfe3d..0000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..7bdf758 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp deleted file mode 100644 index 4f0f1d6..0000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..0361c0e Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp deleted file mode 100644 index 62b611d..0000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..e1b3827 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp deleted file mode 100644 index 948a307..0000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..910ed65 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp deleted file mode 100644 index 1b9a695..0000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..3db9533 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp deleted file mode 100644 index 28d4b77..0000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..ab43115 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9287f50..0000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..bc0e286 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp deleted file mode 100644 index aa7d642..0000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..32fc3d9 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9126ae3..0000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml new file mode 100644 index 0000000..c5d5899 --- /dev/null +++ b/app/src/main/res/values/ic_launcher_background.xml @@ -0,0 +1,4 @@ + + + #FFFFFF + \ No newline at end of file