Skip to content

Commit

Permalink
various changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sosauce committed Jan 14, 2024
1 parent a166325 commit 2a9547e
Show file tree
Hide file tree
Showing 30 changed files with 39 additions and 84 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified .gradle/8.0/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/8.0/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/8.0/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/8.0/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/8.0/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Binary file modified .gradle/file-system.probe
Binary file not shown.
7 changes: 7 additions & 0 deletions .idea/discord.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified app/.DS_Store
Binary file not shown.
8 changes: 2 additions & 6 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ android {
minSdk = 24
targetSdk = 34
versionCode = 11
versionName = "2.0.1"
versionName = "2.0.2"
}

buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
isCrunchPngs = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
Expand All @@ -39,11 +40,6 @@ android {
composeOptions {
kotlinCompilerExtensionVersion = "1.4.4"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"filters": [],
"attributes": [],
"versionCode": 11,
"versionName": "2.0.1",
"versionName": "2.0.2",
"outputFile": "app-release.apk"
}
],
Expand Down
Binary file modified app/src/.DS_Store
Binary file not shown.
Binary file modified app/src/main/.DS_Store
Binary file not shown.
2 changes: 0 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="CuteCalc"
android:roundIcon="@mipmap/ic_launcher_round"
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/java/com/sosauce/cutecalc/AboutScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.Card
import androidx.compose.material3.Divider
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import com.sosauce.cutecalc.ui.theme.GlobalFont
import androidx.compose.material3.Divider
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.remember
import androidx.compose.ui.res.painterResource


@SuppressLint("UnusedMaterialScaffoldPaddingParameter", "UnusedMaterial3ScaffoldPaddingParameter")
Expand Down Expand Up @@ -93,7 +93,7 @@ fun AboutScreen(navController: NavController) {
fontSize = 40.sp
)
Text(
text = "Version 2.0.1",
text = "Version 2.0.2",
fontFamily = GlobalFont,
fontSize = 20.sp,
modifier = Modifier.offset(y = (-8).dp),
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/java/com/sosauce/cutecalc/AppBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ package com.sosauce.cutecalc

import android.annotation.SuppressLint
import androidx.compose.foundation.background
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand All @@ -24,7 +23,6 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.icons.outlined.Info
import androidx.compose.material.icons.outlined.Settings
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.DropdownMenu
Expand All @@ -35,12 +33,8 @@ import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.RadioButton
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarColors
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand Down
14 changes: 9 additions & 5 deletions app/src/main/java/com/sosauce/cutecalc/Calculator.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@file:OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3Api::class,
@file:OptIn(
ExperimentalMaterial3Api::class, ExperimentalMaterial3Api::class,
ExperimentalMaterial3Api::class, ExperimentalMaterial3Api::class
)

Expand Down Expand Up @@ -41,13 +42,16 @@ import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavController
import com.sosauce.cutecalc.ui.theme.GlobalFont

@SuppressLint("UnusedMaterialScaffoldPaddingParameter", "UnusedMaterial3ScaffoldPaddingParameter",
@SuppressLint(
"UnusedMaterialScaffoldPaddingParameter", "UnusedMaterial3ScaffoldPaddingParameter",
"AutoboxingStateCreation"
)
@Composable
fun CalculatorUI (navController: NavController, state: CalcState, handleAction: (CalcAction) -> Unit) {
fun CalculatorUI(
navController: NavController,
state: CalcState
) {
val viewModel = viewModel<CalcViewModel>()
val appState = viewModel.state
val config = LocalConfiguration.current
val portraitMode = remember { mutableStateOf(config.orientation) }

Expand Down Expand Up @@ -395,6 +399,6 @@ fun CalculatorUI (navController: NavController, state: CalcState, handleAction:
}
}
} else {
LandscapeLayout(navController = navController, state = state)
LandscapeLayout(navController = navController, state = state)
}
}
6 changes: 3 additions & 3 deletions app/src/main/java/com/sosauce/cutecalc/CalculatorState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import com.notkamui.keval.keval
data class CalcState(val field: String)
sealed interface CalcAction {
object GetResult : CalcAction
object ResetField: CalcAction
object RemoveLast: CalcAction
object ResetField : CalcAction
object RemoveLast : CalcAction
data class AddToField(val value: String) : CalcAction
}

class GetFormulaResultUseCase {
operator fun invoke(formula: String) : String {
operator fun invoke(formula: String): String {
return formula.keval().toBigDecimal().stripTrailingZeros().toPlainString()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow

class CalcViewModel: ViewModel() {
class CalcViewModel : ViewModel() {

private val getFormulaResult: GetFormulaResultUseCase = GetFormulaResultUseCase()

Expand All @@ -22,9 +22,11 @@ class CalcViewModel: ViewModel() {
CalcAction.GetResult -> {
setState { copy(field = getFormulaResult(field)) }
}

CalcAction.ResetField -> {
setState { copy(field = "") }
}

CalcAction.RemoveLast -> {
setState { copy(field = field.dropLast(1)) }
}
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/com/sosauce/cutecalc/LandscapeLayout.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import com.sosauce.cutecalc.ui.theme.GlobalFont
fun LandscapeLayout(navController: NavController, state: CalcState) {

val viewModel = viewModel<CalcViewModel>()
val appState = viewModel.state


Scaffold(
Expand Down Expand Up @@ -149,7 +148,7 @@ fun LandscapeLayout(navController: NavController, state: CalcState) {
}

Button(
onClick = {viewModel.handleAction(CalcAction.AddToField("*")) },
onClick = { viewModel.handleAction(CalcAction.AddToField("*")) },
colors = ButtonDefaults.buttonColors(MaterialTheme.colorScheme.outlineVariant),
modifier = Modifier
.weight(0.15f)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/sosauce/cutecalc/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class MainActivity : ComponentActivity() {
.fillMaxSize()
.background(MaterialTheme.colorScheme.background),
contentColor = MaterialTheme.colorScheme.background
) { _ -> Nav()}
) { Nav() }
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/sosauce/cutecalc/NavigationGraph.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ fun Nav() {
composable(route = "CalculatorScreen") {
val viewModel = viewModel<CalcViewModel>()
val state by viewModel.state.collectAsStateWithLifecycle()
CalculatorUI(navController, state, viewModel::handleAction)
CalculatorUI(navController, state)
}
composable(route = "AboutScreen") {
AboutScreen(navController)
}
}

}
Binary file modified app/src/main/res/.DS_Store
Binary file not shown.
11 changes: 0 additions & 11 deletions app/src/main/res/values/colors.xml

This file was deleted.

3 changes: 0 additions & 3 deletions app/src/main/res/values/strings.xml

This file was deleted.

1 change: 1 addition & 0 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
</style>

<style name="Theme.CuteCalc" parent="android:Theme.Material.Light.NoActionBar" />
<color name="pink_tone">#201A1A</color>
</resources>
13 changes: 0 additions & 13 deletions app/src/main/res/xml/backup_rules.xml

This file was deleted.

19 changes: 0 additions & 19 deletions app/src/main/res/xml/data_extraction_rules.xml

This file was deleted.

0 comments on commit 2a9547e

Please sign in to comment.