This commit is contained in:
Sad Ellie 2023-09-14 09:58:03 +03:00
parent c81bcf1438
commit 031685ac7d
27 changed files with 112 additions and 61 deletions

View File

@ -23,19 +23,20 @@ plugins {
group = "com.sadellie.unitto.buildlogic"
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
jvmTarget = JavaVersion.VERSION_17.toString()
}
}
dependencies {
compileOnly(libs.android.gradlePlugin)
compileOnly(libs.kotlin.gradlePlugin)
compileOnly(libs.ksp.gradlePlugin)
}
gradlePlugin {
@ -59,5 +60,10 @@ gradlePlugin {
id = "unitto.library.compose"
implementationClass = "UnittoLibraryComposePlugin"
}
register("unittoRoomPlugin") {
id = "unitto.room"
implementationClass = "UnittoRoomPlugin"
}
}
}

View File

@ -0,0 +1,42 @@
/*
* 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/>.
*/
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType
@Suppress("UNUSED")
class UnittoRoomPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
with(pluginManager) {
apply("com.google.devtools.ksp")
apply("androidx.room")
}
dependencies {
"implementation"(libs.findLibrary("androidx.room.runtime").get())
"implementation"(libs.findLibrary("androidx.room.ktx").get())
"ksp"(libs.findLibrary("androidx.room.compiler").get())
}
}
}
}

View File

@ -23,9 +23,8 @@ import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.kotlin.dsl.getByType
@Suppress("UnstableApiUsage")
internal fun Project.configureCompose(
commonExtension: CommonExtension<*, *, *, *>,
commonExtension: CommonExtension<*, *, *, *, *>,
) {
commonExtension.apply {
buildFeatures {

View File

@ -29,9 +29,8 @@ import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@Suppress("UnstableApiUsage")
internal fun Project.configureKotlinAndroid(
commonExtension: CommonExtension<*, *, *, *>,
commonExtension: CommonExtension<*, *, *, *, *>,
) {
commonExtension.apply {
compileSdk = 34
@ -95,6 +94,6 @@ internal fun Project.configureKotlinAndroid(
}
}
fun CommonExtension<*, *, *, *>.kotlinOptions(block: KotlinJvmOptions.() -> Unit) {
fun CommonExtension<*, *, *, *, *>.kotlinOptions(block: KotlinJvmOptions.() -> Unit) {
(this as ExtensionAware).extensions.configure("kotlinOptions", block)
}

View File

@ -3,6 +3,8 @@ plugins {
alias(libs.plugins.android.gradlePlugin) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.room) apply false
}
tasks.register("clean", Delete::class) {

View File

@ -19,7 +19,7 @@
package com.sadellie.unitto.core.ui.common
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.MenuOpen
import androidx.compose.material.icons.automirrored.outlined.MenuOpen
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.runtime.Composable
@ -35,7 +35,7 @@ import com.sadellie.unitto.core.base.R
fun MenuButton(onClick: () -> Unit) {
IconButton(onClick = onClick) {
Icon(
Icons.Outlined.MenuOpen,
Icons.AutoMirrored.Outlined.MenuOpen,
contentDescription = stringResource(R.string.open_menu_description)
)
}

View File

@ -19,7 +19,7 @@
package com.sadellie.unitto.core.ui.common
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.ArrowBack
import androidx.compose.material.icons.automirrored.outlined.ArrowBack
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.runtime.Composable
@ -35,7 +35,7 @@ import com.sadellie.unitto.core.base.R
fun NavigateUpButton(onClick: () -> Unit) {
IconButton(onClick = onClick) {
Icon(
Icons.Outlined.ArrowBack,
Icons.AutoMirrored.Outlined.ArrowBack,
contentDescription = stringResource(R.string.navigate_up_description)
)
}

View File

@ -82,7 +82,7 @@ fun RowScope.SegmentedButton(
contentPadding = PaddingValues(horizontal = 12.dp)
) {
if (icon != null) {
Crossfade(targetState = selected) {
Crossfade(selected, label = "Selected state") {
if (it) {
Icon(Icons.Default.Check, null, Modifier.size(18.dp))
} else {

View File

@ -89,7 +89,7 @@ fun UnittoSearchBar(
TopAppBar(
modifier = modifier,
title = {
Crossfade(showSearchInput) { showSearch ->
Crossfade(showSearchInput, label = "Search input") { showSearch ->
if (showSearch) {
LaunchedEffect(Unit) { focusRequester.requestFocus() }
@ -114,7 +114,7 @@ fun UnittoSearchBar(
NavigateUpButton { stagedNavigateUp() }
},
actions = {
Crossfade(showSearchInput) { showSearch ->
Crossfade(showSearchInput, label = "Search unit") { showSearch ->
Row(verticalAlignment = Alignment.CenterVertically) {
if (showSearch) {
ClearButton(visible = query.text.isNotEmpty()) { onQueryChange(TextFieldValue()) }

View File

@ -19,22 +19,15 @@
plugins {
id("unitto.library")
id("unitto.android.hilt")
id("unitto.room")
}
android {
namespace = "com.sadellie.unitto.data.database"
// Long thingy
room {
val schemaLocation = "$projectDir/schemas"
defaultConfig
.javaCompileOptions
.annotationProcessorOptions
.arguments["room.schemaLocation"] = schemaLocation
schemaDirectory(schemaLocation)
println("Exported Database schema to $schemaLocation")
}
dependencies {
implementation(libs.androidx.room.runtime)
implementation(libs.androidx.room.ktx)
kapt(libs.androidx.room.compiler)
}
}

View File

@ -18,7 +18,7 @@
package io.github.sadellie.evaluatto
import org.junit.jupiter.api.Test
import org.junit.Test
class ExpressionComplexTest {

View File

@ -18,7 +18,7 @@
package io.github.sadellie.evaluatto
import org.junit.jupiter.api.Test
import org.junit.Test
class ExpressionExceptionsTest {

View File

@ -18,7 +18,7 @@
package io.github.sadellie.evaluatto
import org.junit.jupiter.api.Test
import org.junit.Test
class ExpressionSimpleTest {

View File

@ -18,7 +18,7 @@
package io.github.sadellie.evaluatto
import org.junit.jupiter.api.Test
import org.junit.Test
class FixLexiconTest {

View File

@ -18,7 +18,7 @@
package io.github.sadellie.evaluatto
import org.junit.jupiter.api.Test
import org.junit.Test
class TokenizerTest {

View File

@ -19,20 +19,24 @@
plugins {
id("unitto.library")
id("unitto.android.hilt")
id("unitto.room")
}
android {
namespace = "com.sadellie.unitto.data.units"
testOptions.unitTests.isIncludeAndroidResources = true
room {
val schemaLocation = "$projectDir/schemas"
schemaDirectory(schemaLocation)
println("Exported Database schema to $schemaLocation")
}
}
dependencies {
testImplementation(libs.junit)
testImplementation(libs.org.robolectric)
implementation(libs.androidx.room.runtime)
implementation(libs.androidx.room.ktx)
kapt(libs.androidx.room.compiler)
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.androidx.datastore)

View File

@ -313,7 +313,7 @@ private fun PortraitKeyboard(
horizontalArrangement = Arrangement.spacedBy(additionalRowSpacedBy)
) {
// Additional buttons
Crossfade(invMode, weightModifier) {
Crossfade(invMode, weightModifier, label = "Additional button") {
if (it) {
AdditionalButtonsPortraitInverse(
modifier = additionalButtonModifier,
@ -487,7 +487,7 @@ private fun LandscapeKeyboard(
.weight(1f)
.padding(constraints.maxWidth * 0.005f, constraints.maxHeight * 0.02f)
Crossfade(invMode, Modifier.weight(3f)) {
Crossfade(invMode, Modifier.weight(3f), label = "Additional button") {
Row {
if (it) {
AdditionalButtonsLandscapeInverse(

View File

@ -16,8 +16,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
plugins {
id("unitto.library")
id("unitto.library.compose")

View File

@ -153,7 +153,8 @@ private fun LeftSideScreen(
) { paddingValues ->
Crossfade(
targetState = uiState.units?.isNotEmpty(),
modifier = Modifier.padding(paddingValues)
modifier = Modifier.padding(paddingValues),
label = "Units list"
) { hasUnits ->
when (hasUnits) {
true -> LazyColumn(Modifier.fillMaxSize()) {

View File

@ -98,7 +98,8 @@ private fun RightSideScreen(
) { paddingValues ->
Crossfade(
targetState = uiState.units?.isNotEmpty(),
modifier = Modifier.padding(paddingValues)
modifier = Modifier.padding(paddingValues),
label = "Units list"
) { hasUnits ->
when (hasUnits) {
true -> LazyColumn(Modifier.fillMaxSize()) {

View File

@ -112,7 +112,8 @@ internal fun BasicUnitListItem(
targetState = isFavorite,
transitionSpec = {
(scaleIn() togetherWith scaleOut()).using(SizeTransform(clip = false))
}
},
label = "Favorite unit"
) {
Icon(
if (it) Icons.Filled.Favorite else Icons.Filled.FavoriteBorder,

View File

@ -70,7 +70,8 @@ internal fun UnitSelectionButton(
}.using(
SizeTransform(clip = false)
)
}
},
label = "Unit change"
) {
Text(
text = it,

View File

@ -148,7 +148,7 @@ private fun AddSubtractView(
SegmentedButton(
selected = uiState.addition,
onClick = { updateAddition(true) },
shape = SegmentedButtonDefaults.shape(position = 0, count = 2),
shape = SegmentedButtonDefaults.itemShape(index = 0, count = 2),
icon = {}
) {
Icon(Icons.Outlined.Add, null)
@ -156,7 +156,7 @@ private fun AddSubtractView(
SegmentedButton(
selected = !uiState.addition,
onClick = { updateAddition(false) },
shape = SegmentedButtonDefaults.shape(position = 1, count = 2),
shape = SegmentedButtonDefaults.itemShape(index = 1, count = 2),
icon = {}
) {
Icon(Icons.Outlined.Remove, null)

View File

@ -23,9 +23,9 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.Help
import androidx.compose.material.icons.filled.Code
import androidx.compose.material.icons.filled.Copyright
import androidx.compose.material.icons.filled.Help
import androidx.compose.material.icons.filled.Info
import androidx.compose.material.icons.filled.Policy
import androidx.compose.material.icons.filled.PrivacyTip
@ -73,7 +73,7 @@ internal fun AboutScreen(
ListItem(
leadingContent = {
Icon(
Icons.Default.Help,
Icons.AutoMirrored.Filled.Help,
stringResource(R.string.currency_rates_note_setting)
)
},

View File

@ -21,8 +21,8 @@ package com.sadellie.unitto.feature.settings.converter
import androidx.compose.foundation.clickable
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Rule
import androidx.compose.material.icons.filled.Sort
import androidx.compose.material.icons.automirrored.filled.Rule
import androidx.compose.material.icons.automirrored.filled.Sort
import androidx.compose.material.icons.filled.Timer
import androidx.compose.material3.Icon
import androidx.compose.material3.ListItem
@ -62,7 +62,7 @@ internal fun ConverterSettingsScreen(
ListItem(
leadingContent = {
Icon(
Icons.Default.Rule,
Icons.AutoMirrored.Filled.Rule,
stringResource(R.string.disable_unit_group_description),
)
},
@ -77,7 +77,7 @@ internal fun ConverterSettingsScreen(
ListItem(
leadingContent = {
Icon(
Icons.Default.Sort,
Icons.AutoMirrored.Filled.Sort,
stringResource(R.string.units_sorting)
)
},

View File

@ -2,19 +2,20 @@
appCode = "23"
appName = "Mikado Yellow"
kotlin = "1.9.0"
androidxCore = "1.10.1"
androidGradlePlugin = "8.0.2"
ksp = "1.9.0-1.0.13"
androidxCore = "1.12.0"
androidGradlePlugin = "8.1.1"
orgJetbrainsKotlinxCoroutinesTest = "1.7.2"
androidxCompose = "1.6.0-alpha02"
androidxCompose = "1.6.0-alpha05"
androidxComposeCompiler = "1.5.0"
androidxComposeUi = "1.6.0-alpha02"
androidxComposeMaterial3 = "1.2.0-alpha04"
androidxNavigation = "2.6.0"
androidxLifecycleRuntimeCompose = "2.6.1"
androidxComposeUi = "1.6.0-alpha05"
androidxComposeMaterial3 = "1.2.0-alpha07"
androidxNavigation = "2.7.2"
androidxLifecycleRuntimeCompose = "2.6.2"
androidxHilt = "1.0.0"
androidxAppCompat = "1.6.1"
comGoogleDagger = "2.47"
androidxComposeMaterialIconsExtended = "1.6.0-alpha02"
androidxComposeMaterialIconsExtended = "1.6.0-alpha05"
androidxDatastore = "1.0.0"
comGoogleAccompanist = "0.30.1"
androidxRoom = "2.6.0-beta01"
@ -68,8 +69,11 @@ androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version
android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" }
kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
com-google-dagger = { group = "com.google.dagger", name = "hilt-android-gradle-plugin", version.ref = "comGoogleDagger" }
ksp-gradlePlugin = { group = "com.google.devtools.ksp", name = "com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" }
[plugins]
android-gradlePlugin = { id = "com.android.application", version.ref = "androidGradlePlugin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
hilt = { id = "com.google.dagger.hilt.android", version.ref = "comGoogleDagger" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
room = { id = "androidx.room", version.ref = "androidxRoom" }

View File

@ -1,6 +1,6 @@
#Thu Feb 02 22:43:30 AZT 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME