Skip to content

Commit

Permalink
fix: Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lastaapps committed Jan 22, 2024
1 parent 9888cf3 commit f676389
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 40 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ android {
// And some Apache shit
resources.excludes.add("org/apache/**")
resources.excludes.add("org/htmlunit/**")

// Taken from the AS template project, should be safe
resources.excludes.add("/META-INF/{AL2.0,LGPL2.1}")
}
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved
~ Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved
~
~ This file is part of Menza.
~
Expand Down Expand Up @@ -49,7 +49,7 @@
android:localeConfig="@xml/locales_config"
android:theme="@style/AppTheme.Starting"
android:enableOnBackInvokedCallback="true"
tools:targetApi="tiramisu">
tools:targetApi="34">
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/kotlin/cz/lastaapps/menza/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
package cz.lastaapps.menza

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
Expand All @@ -35,7 +35,7 @@ import cz.lastaapps.menza.ui.ApplyAppTheme
import cz.lastaapps.menza.ui.locals.WithFoldingFeature
import cz.lastaapps.menza.ui.locals.WithLocalWindowSizes

class MainActivity : AppCompatActivity() {
class MainActivity : ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fun OpeningHoursList(
) {
Text(
stringResource(R.string.info_opening_hours_title),
style = MaterialTheme.typography.titleLarge
style = MaterialTheme.typography.titleLarge,
)
data.forEach {
OpeningHoursLocationUI(
Expand Down Expand Up @@ -97,7 +97,10 @@ private fun OpeningHoursLocationUI(
) {
Column(
verticalArrangement = Arrangement.spacedBy(Padding.Small),
modifier = Modifier.padding(Padding.MidSmall),
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier
.padding(Padding.MidSmall)
.align(Alignment.CenterHorizontally),
) {
Text(
text = data.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import cz.lastaapps.menza.features.settings.data.datasource.OrderDataSourceImpl
import cz.lastaapps.menza.features.settings.data.datasource.OrderSettings
import cz.lastaapps.menza.features.settings.domain.MainSettingsRepo
import cz.lastaapps.menza.features.settings.domain.OrderRepo
import cz.lastaapps.menza.features.settings.domain.usecase.FullAppReloadUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetDishLanguageUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetDishListModeUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetImageScaleRangeUC
Expand Down Expand Up @@ -108,6 +109,7 @@ val settingsModule = module {
factoryOf(::SetLatestMenzaUC)
factoryOf(::SetPreferredMenzaUC)
factoryOf(::GetPreferredMenzaUC)
factoryOf(::FullAppReloadUC)

// Others
factoryOf(::GetImageScaleUC)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved
*
* This file is part of Menza.
*
* Menza is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Menza is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase

class FullAppReloadUC(
context: UCContext,
) : UseCase(context) {

suspend operator fun invoke(): Nothing = launch {
TODO("Implement me!!!")
// listOf(
// allergenRepo,
// locationRepo,
// messagesRepo,
// menzaRepo,
// contactsRepo,
// openingHoursRepo
// ).forEach {
// it.clearData()
// }
// app.imageLoader.diskCache?.clear()
//
// withContext(Dispatchers.Main) {
// exitProcess(0)
// }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ private fun LanguageButton(
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(Padding.Tiny),
modifier = Modifier.padding(Padding.MidSmall),
modifier = Modifier
.padding(Padding.MidSmall)
.fillMaxWidth(),
) {
Text(
title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,12 @@ private fun Buttons(
onCrashesDialog = onCrashesDialog,
)

FullDataReload(
onFullRefresh = onFullRefresh,
)
@Suppress("ConstantConditionIf")
if (false) {
FullDataReload(
onFullRefresh = onFullRefresh,
)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved
* Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved
*
* This file is part of Menza.
*
Expand Down Expand Up @@ -30,6 +30,7 @@ import cz.lastaapps.menza.features.settings.domain.model.DarkMode
import cz.lastaapps.menza.features.settings.domain.model.DarkMode.Dark
import cz.lastaapps.menza.features.settings.domain.model.InitialSelectionBehaviour
import cz.lastaapps.menza.features.settings.domain.model.PriceType
import cz.lastaapps.menza.features.settings.domain.usecase.FullAppReloadUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetImagesOnMeteredUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetPriceTypeUC
import cz.lastaapps.menza.features.settings.domain.usecase.OnSettingsOpenedUC
Expand Down Expand Up @@ -60,6 +61,7 @@ internal class SettingsViewModel(
val setInitialMenzaUC: SetInitialMenzaUC,
val getPreferredMenzaUC: GetPreferredMenzaUC,
val setPreferredMenzaUC: SetPreferredMenzaUC,
val fullAppReloadUC: FullAppReloadUC,
) : StateViewModel<SettingsState>(SettingsState(), vmContext), Appearing {
override var hasAppeared: Boolean = false

Expand Down Expand Up @@ -107,23 +109,8 @@ internal class SettingsViewModel(
setPreferredMenzaUC(menza.type)
}

fun fullAppReload() {
TODO("Implement me!!!")
// listOf(
// allergenRepo,
// locationRepo,
// messagesRepo,
// menzaRepo,
// contactsRepo,
// openingHoursRepo
// ).forEach {
// it.clearData()
// }
// app.imageLoader.diskCache?.clear()
//
// withContext(Dispatchers.Main) {
// exitProcess(0)
// }
fun fullAppReload() = launchVM {
fullAppReloadUC()
}
}

Expand Down
27 changes: 19 additions & 8 deletions app/src/main/kotlin/cz/lastaapps/menza/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,28 +65,32 @@ fun AppTheme(
}

Agata ->
if (isLightMode)
if (isLightMode) {
AgataLightColors
else
} else {
AgataDarkColors
}

CTU ->
if (isLightMode)
if (isLightMode) {
CtuLightColors
else
} else {
CtuDarkColors
}

Uwu ->
if (isLightMode)
if (isLightMode) {
UwuLightColors
else
} else {
UwuDarkColors
}

Kitty ->
if (isLightMode)
if (isLightMode) {
KittyLightColors
else
} else {
KittyDarkColors
}
}.animated()

MaterialTheme(
Expand Down Expand Up @@ -141,5 +145,12 @@ private fun ColorScheme.animated(): ColorScheme {
tertiaryContainer = animateColorAsState(tertiaryContainer).value,
outlineVariant = animateColorAsState(outlineVariant).value,
scrim = animateColorAsState(scrim).value,
surfaceBright = animateColorAsState(surfaceBright).value,
surfaceDim = animateColorAsState(surfaceDim).value,
surfaceContainer = animateColorAsState(surfaceContainer).value,
surfaceContainerHigh = animateColorAsState(surfaceContainerHigh).value,
surfaceContainerHighest = animateColorAsState(surfaceContainerHighest).value,
surfaceContainerLow = animateColorAsState(surfaceContainerLow).value,
surfaceContainerLowest = animateColorAsState(surfaceContainerLowest).value,
)
}
8 changes: 4 additions & 4 deletions app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<string name="language_choose_czech_description">Hezky podomácku</string>
<string name="language_choose_english_title">🇬🇧 Angliky</string>
<string name="language_choose_english_description">Se všemi veselými překlady</string>
<string name="language_choose_disclaimer">Přeloženy jsou pouye denní menu a pouze v některých menzách. Žádný text nebyl přeložen aplikací samotnou.</string>
<string name="language_choose_disclaimer">Přeloženy jsou pouze denní menu a pouze v některých menzách. Žádný text nebyl přeložen aplikací samotnou.</string>
<string name="privacy_title">Zásady ochrany osobních údajů</string>
<string name="privacy_text">
Tato aplikace neshromažďuje žádná (osobní) data.
Expand Down Expand Up @@ -194,7 +194,7 @@
<string name="today_list_mode_compact">Klasika</string>
<string name="today_list_mode_grid">Velké</string>
<string name="today_list_mode_horizontal">Řádky</string>
<string name="today_experimental_cafeteria">Experimentální menza - nemusí fungovat správně. Prosím hlašte chyby v nastavení.</string>
<string name="today_experimental_cafeteria">Experimentální menza - nemusí fungovat správně. Prosím, hlašte chyby v nastavení.</string>
<string name="week_list_none">Data nejsou dostupná</string>
<string name="week_list_web">Otevřít web</string>
<string name="error_button_report">Nahlásit</string>
Expand Down Expand Up @@ -262,9 +262,9 @@
<string name="wallet_login_tab_stravnik">Strávník</string>
<string name="wallet_login_tab_ctu">ČVUT</string>
<string name="wallet_login_tab_uct">VŠCHT</string>
<string name="wallet_login_subtitle_stravnik">Doporučená možnost. Použijte své udaje do portálu Strávník. Helso si můžete nastavit na webu Strávníka.</string>
<string name="wallet_login_subtitle_stravnik">Doporučená možnost. Použijte své údaje do portálu Strávník. Helso si můžete nastavit na webu Strávníka.</string>
<string name="wallet_login_subtitle_ctu">Pro zvýšenou bezpečnost použijte přihlášení přes Strávníka.\nPoužij svoje ČVUT údaje.</string>
<string name="wallet_login_subtitle_uct">Jsi z VŠCHT? Kontaktuj vývojáře v nastavení a pomož přidat tvvoji metodu přihlášení! Prozatím použij přihlášení přes Strávníka.</string>
<string name="wallet_login_subtitle_uct">Jsi z VŠCHT? Kontaktuj vývojáře v nastavení a pomož přidat tvoji metodu přihlášení! Prozatím použij přihlášení přes Strávníka.</string>
<string name="wallet_login_username">Uživatelské jmeno</string>
<string name="wallet_login_password">Velmi tajné heslo</string>
<string name="wallet_login_password_policy_hint">Uložení hesla</string>
Expand Down

0 comments on commit f676389

Please sign in to comment.