Less trash in code

This commit is contained in:
Sad Ellie 2023-05-15 16:48:05 +03:00
parent fe81601fa8
commit f25af1caad
12 changed files with 27 additions and 42 deletions

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
@Suppress("UnstableApiUsage")
dependencyResolutionManagement {
repositories {
google()

View File

@ -34,10 +34,10 @@ sealed class TopLevelDestinations(
name = R.string.calculator
)
object Epoch : TopLevelDestinations(
route = "epoch_route",
name = R.string.epoch_converter
)
// object Epoch : TopLevelDestinations(
// route = "epoch_route",
// name = R.string.epoch_converter
// )
object Settings : TopLevelDestinations(
route = "settings_graph",

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Unitto is a unit converter for Android
~ Copyright (c) 2023 Elshan Agaev
~
~ This program 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.
~
~ This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
-->
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_icon_background"/>
<foreground android:drawable="@drawable/ic_launcher_icon_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_icon_monochrome"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -27,7 +27,7 @@ sealed class FormatterSymbols(val grouping: String, val fractional: String) {
}
object AllFormatterSymbols {
private val allFormatterSymbs by lazy {
private val allFormatterSymbols by lazy {
hashMapOf(
Separator.SPACES to FormatterSymbols.Spaces,
Separator.PERIOD to FormatterSymbols.Period,
@ -41,6 +41,6 @@ object AllFormatterSymbols {
* @see Separator
*/
fun getById(separator: Int): FormatterSymbols {
return allFormatterSymbs.getOrElse(separator) { FormatterSymbols.Spaces }
return allFormatterSymbols.getOrElse(separator) { FormatterSymbols.Spaces }
}
}

View File

@ -30,7 +30,7 @@ import androidx.compose.animation.expandVertically
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.shrinkVertically
import androidx.compose.animation.with
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
@ -147,7 +147,9 @@ internal fun TopScreenPart(
ExpressionTextField(
modifier = Modifier,
value = calculatedTextFieldValue,
onCursorChange = { calculatedTextFieldValue = calculatedTextFieldValue.copy(selection = it) },
onCursorChange = { newSelection ->
calculatedTextFieldValue = calculatedTextFieldValue.copy(selection = newSelection)
},
formatterSymbols = formatterSymbols,
textColor = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.6f),
minRatio = 0.7f
@ -159,8 +161,7 @@ internal fun TopScreenPart(
transitionSpec = {
// Enter animation
(expandHorizontally(clip = false, expandFrom = Alignment.Start) + fadeIn()
// Exit animation
with fadeOut())
togetherWith fadeOut())
.using(SizeTransform(clip = false))
}
) { value ->
@ -178,7 +179,9 @@ internal fun TopScreenPart(
ExpressionTextField(
modifier = Modifier.weight(2f),
value = outputTextFieldValue,
onCursorChange = { outputTextFieldValue = outputTextFieldValue.copy(selection = it) },
onCursorChange = { newSelection ->
outputTextFieldValue = outputTextFieldValue.copy(selection = newSelection)
},
formatterSymbols = formatterSymbols,
readOnly = true,
minRatio = 0.7f
@ -197,7 +200,9 @@ internal fun TopScreenPart(
UnformattedTextField(
modifier = Modifier.weight(2f),
value = outputTextFieldValue,
onCursorChange = { outputTextFieldValue = outputTextFieldValue.copy(selection = it) },
onCursorChange = { newSelection ->
outputTextFieldValue = outputTextFieldValue.copy(selection = newSelection)
},
minRatio = 0.7f,
readOnly = true
)
@ -210,7 +215,9 @@ internal fun TopScreenPart(
UnformattedTextField(
modifier = Modifier.weight(2f),
value = outputTextFieldValue,
onCursorChange = { outputTextFieldValue = outputTextFieldValue.copy(selection = it) },
onCursorChange = { newSelection ->
outputTextFieldValue = outputTextFieldValue.copy(selection = newSelection)
},
minRatio = 0.7f,
readOnly = true
)
@ -245,7 +252,7 @@ internal fun TopScreenPart(
// Enter animation
(expandHorizontally(clip = false, expandFrom = Alignment.Start) + fadeIn()
// Exit animation
with fadeOut())
togetherWith fadeOut())
.using(SizeTransform(clip = false))
}
) { value ->

View File

@ -82,11 +82,11 @@ internal fun UnitSelectionButton(
targetState = label ?: 0,
transitionSpec = {
if (targetState > initialState) {
(slideInVertically { height -> height } + fadeIn()).togetherWith(
slideOutVertically { height -> -height } + fadeOut())
(slideInVertically { height -> height } + fadeIn()) togetherWith
slideOutVertically { height -> -height } + fadeOut()
} else {
(slideInVertically { height -> -height } + fadeIn()).togetherWith(
slideOutVertically { height -> height } + fadeOut())
(slideInVertically { height -> -height } + fadeIn()) togetherWith
slideOutVertically { height -> height } + fadeOut()
}.using(
SizeTransform(clip = false)
)

View File

@ -7,6 +7,7 @@ pluginManagement {
}
}
@Suppress("UnstableApiUsage")
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {