Skip to content

Commit

Permalink
v2.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sosauce committed Feb 6, 2025
1 parent db2a2e4 commit 89b9e4a
Show file tree
Hide file tree
Showing 24 changed files with 623 additions and 441 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
applicationId = "com.sosauce.cutecalc"
minSdk = 21
targetSdk = 35
versionCode = 38
versionName = "3.3.2"
versionCode = 39
versionName = "3.4.0"
}

buildTypes {
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.MEDIA_CONTENT_CONTROL"
<uses-permission
android:name="android.permission.MEDIA_CONTENT_CONTROL"
tools:ignore="ProtectedPermissions" />

<application
Expand All @@ -19,6 +20,7 @@
android:theme="@style/Theme.CuteSplash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.APP_CALCULATOR" />
</intent-filter>
Expand Down
157 changes: 0 additions & 157 deletions app/src/main/java/com/sosauce/cutecalc/AppBar.kt

This file was deleted.

19 changes: 5 additions & 14 deletions app/src/main/java/com/sosauce/cutecalc/components/AboutCard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand All @@ -22,7 +22,6 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.sosauce.cutecalc.R
import com.sosauce.cutecalc.ui.theme.GlobalFont
import com.sosauce.cutecalc.utils.GITHUB_RELEASES

@Composable
Expand All @@ -35,6 +34,7 @@ fun AboutCard() {
Card(
colors = CardDefaults.cardColors(MaterialTheme.colorScheme.surfaceContainer),
modifier = Modifier
.statusBarsPadding()
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 2.dp),
shape = RoundedCornerShape(24.dp)
Expand All @@ -49,13 +49,9 @@ fun AboutCard() {
.clip(RoundedCornerShape(15))
)
Column {
Text(
text = stringResource(R.string.cc_by_sosauce),
fontFamily = GlobalFont
)
Text(
CuteText(stringResource(R.string.cc_by_sosauce))
CuteText(
text = "${stringResource(R.string.version)} $version",
fontFamily = GlobalFont,
color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.85f)
)
}
Expand All @@ -69,12 +65,7 @@ fun AboutCard() {
onClick = { uriHandler.openUri(GITHUB_RELEASES) },
shape = RoundedCornerShape(24.dp),
modifier = Modifier.fillMaxWidth()
) {
Text(
text = stringResource(R.string.update),
fontFamily = GlobalFont
)
}
) { CuteText(stringResource(R.string.update)) }
}
}
}
Expand Down
35 changes: 26 additions & 9 deletions app/src/main/java/com/sosauce/cutecalc/components/CuteButton.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
@file:OptIn(ExperimentalFoundationApi::class)

package com.sosauce.cutecalc.components

import androidx.compose.animation.core.animateIntAsState
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.foundation.layout.size
Expand All @@ -10,7 +13,6 @@ import androidx.compose.material3.ButtonColors
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
Expand All @@ -24,15 +26,16 @@ import androidx.compose.ui.unit.sp
import com.sosauce.cutecalc.R
import com.sosauce.cutecalc.logic.rememberUseButtonsAnimation
import com.sosauce.cutecalc.logic.rememberVibration
import com.sosauce.cutecalc.ui.theme.GlobalFont

@Composable
fun CuteButton(
modifier: Modifier = Modifier,
text: String,
color: ButtonColors = ButtonDefaults.buttonColors(MaterialTheme.colorScheme.surfaceContainer),

onClick: () -> Unit,
textColor: Color = MaterialTheme.colorScheme.onBackground
textColor: Color = MaterialTheme.colorScheme.onBackground,
enabled: Boolean = true
) {
val shouldVibrate by rememberVibration()
val useButtonsAnimation by rememberUseButtonsAnimation()
Expand All @@ -52,21 +55,23 @@ fun CuteButton(
colors = color,
modifier = modifier,
shape = RoundedCornerShape(cornerRadius),
interactionSource = interactionSource
interactionSource = interactionSource,
enabled = enabled
) {
Text(
CuteText(
text = text,
color = textColor,
fontSize = 35.sp,
fontFamily = GlobalFont
fontSize = 35.sp
)
}
}

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun CuteIconButton(
modifier: Modifier,
onClick: () -> Unit,
onLongClick: () -> Unit = {},
color: ButtonColors = ButtonDefaults.buttonColors(MaterialTheme.colorScheme.surfaceContainer)
) {
val shouldVibrate by rememberVibration()
Expand All @@ -79,11 +84,16 @@ fun CuteIconButton(
targetValue = if (isPressed && useButtonsAnimation) 24 else 50, label = ""
)

Button(

LongClickButton(
onClick = {
onClick()
if (shouldVibrate) haptic.performHapticFeedback(HapticFeedbackType.LongPress)
},
onLongClick = {
onLongClick()
if (shouldVibrate) haptic.performHapticFeedback(HapticFeedbackType.LongPress)
},
colors = color,
modifier = modifier,
shape = RoundedCornerShape(cornerRadius),
Expand All @@ -96,4 +106,11 @@ fun CuteIconButton(
modifier = Modifier.size(45.dp)
)
}
}


}





Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.sosauce.cutecalc.components

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.ArrowBack
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedIconButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.sosauce.cutecalc.logic.navigation.Screens

@Composable
fun BoxScope.CuteNavigationButton(
onNavigate: (Screens) -> Unit
) {
OutlinedIconButton(
onClick = { onNavigate(Screens.MAIN) },
modifier = Modifier
.padding(start = 15.dp)
.align(Alignment.BottomStart)
.navigationBarsPadding(),
colors = IconButtonDefaults.iconButtonColors(
containerColor = MaterialTheme.colorScheme.background,
),
border = BorderStroke(
width = 1.dp,
color = MaterialTheme.colorScheme.onBackground.copy(0.2f)
)
) {
Icon(
imageVector = Icons.AutoMirrored.Rounded.ArrowBack,
contentDescription = null
)
}
}
Loading

0 comments on commit 89b9e4a

Please sign in to comment.