Merge pull request #1 from Myzel394/first-improvements

First improvements
This commit is contained in:
Myzel394 2024-04-26 21:19:10 +02:00 committed by GitHub
commit f71f849837
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
450 changed files with 9158 additions and 10390 deletions

7
.editorconfig Normal file
View File

@ -0,0 +1,7 @@
# https://editorconfig.org/
# This configuration is used by ktlint when spotless invokes it
[*.{kt,kts}]
ij_kotlin_allow_trailing_comma=true
ij_kotlin_allow_trailing_comma_on_call_site=true
ktlint_function_naming_ignore_when_annotated_with=Composable, Test

View File

@ -0,0 +1,34 @@
name: Prepare KeyStore
description: Write the KeyStore file and properties to disk
inputs:
signingStorePassword:
description: 'The password for the KeyStore'
required: true
signingKeyPassword:
description: 'The password for the Key'
required: true
signingKeyAlias:
description: 'The alias for the Key'
required: true
keyStoreBase64:
description: 'The KeyStore file encoded as base64'
required: true
runs:
using: composite
steps:
- name: Write Keystore file 🗄️
id: android_keystore
uses: timheuer/base64-to-file@v1.0.3
with:
fileName: key.jks
encodedString: ${{ inputs.keyStoreBase64 }}
- name: Write Keystore properties 🗝️
shell: bash
run: |
echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > key.properties
echo "storePassword=${{ inputs.signingStorePassword }}" >> key.properties
echo "keyPassword=${{ inputs.signingKeyPassword }}" >> key.properties
echo "keyAlias=${{ inputs.signingKeyAlias }}" >> key.properties

31
.github/workflows/build-testing.yaml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Build and push debug app
on:
pull_request:
jobs:
debug-builds:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: "adopt"
java-version: 21
cache: "gradle"
- name: Run tests
run: ./gradlew test
- name: Compile
run: ./gradlew assembleDebug
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: numberhub-app-debug-apks
path: app/build/outputs/apk/fdroid/debug/app-*-debug.apk

View File

@ -0,0 +1,52 @@
name: Build and publish app
on:
release:
types: [ published ]
jobs:
release-app-github:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
- name: Write KeyStore 🗝️
uses: ./.github/actions/prepare-keystore
with:
signingStorePassword: ${{ secrets.SIGNING_STORE_PASSWORD }}
signingKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
signingKeyAlias: ${{ secrets.SIGNING_KEY_ALIAS }}
keyStoreBase64: ${{ secrets.KEYSTORE }}
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 21
cache: 'gradle'
- name: Build APKs 📱
run: ./gradlew assembleRelease
- name: Build AABs 📱
run: ./gradlew bundleRelease
- name: Upload APKs 🚀
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
files: app/build/outputs/apk/fdroid/release/*.apk
- name: Upload APKs bundles 🚀
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
files: app/build/outputs/bundle/fdroidRelease/*.aab

View File

@ -0,0 +1,42 @@
<!--
~ Unitto is a calculator for Android
~ Copyright (c) 2024 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/>.
-->
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="spotlessApply" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--init-script gradle/init.gradle.kts --no-configuration-cache" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="spotlessApply" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,42 @@
<!--
~ Unitto is a calculator for Android
~ Copyright (c) 2024 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/>.
-->
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="spotlessCheck" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--init-script gradle/init.gradle.kts --no-configuration-cache" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="spotlessCheck" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
</component>

View File

@ -7,63 +7,14 @@
<img src="./fastlane/metadata/android/en-US/images/phoneScreenshots/slide5.png" width="19%" />
</p>
# 📲 Download
## Notice
<p align="middle">
<a href="https://play.google.com/store/apps/details?id=com.sadellie.unitto"><img alt="Google Play" src="./content/gplay.svg" height="60"></a>
<a href="https://f-droid.org/packages/com.sadellie.unitto"><img alt="F-Droid" src="./content/fdroid.svg" height="60"/></a>
<a href="https://github.com/sadellie/unitto/releases/latest"><img alt="GitHub" src="./content/github.svg" height="60"/></a>
</p>
This app was originally created by [sadellie](https://github.com/sadellie).
Unfortunately, it has been archived on March 1st, 2024 (https://github.com/sadellie/unitto)
without any notice or explanation.
Since there has been no activity from sadellie on GitHub since then, I guess
they are not actively working on projects anymore.
Prefer _Google Play_
# 💁‍♀️ Contribute
<p align="middle">
<img src="./content/based.png" width="97%" />
</p>
<p align="middle">
<a href="https://poeditor.com/join/project/T4zjmoq8dx"><img alt="Translate" src="./content/translate.svg" height="60"/></a>
<a href="https://github.com/sadellie/unitto/issues/new"><img alt="Issues" src="./content/issue.svg" height="60"/></a>
<a href="https://github.com/sadellie/unitto/discussions/new/choose"><img alt="Discussions" src="./content/discussion.svg" height="60"/></a>
</p>
## 👩‍💻 Do NOT contribute code
1. I do **NOT** need any help in code.
2. Hard forks and alterations of Unitto are **NOT** welcomed. Use a _Fork_ button so that commits' author is not lost.
# ⚠ Security
Read [this](https://github.com/sadellie/unitto/wiki/Security).
<sup>TL;DR: the app is legit, no cap fr fr</sup>
## 🤖 Custom ROM developers
Leave.
## 🤓 Nerds
<details>
<summary>Benchmarks and Baseline profile</summary>
```
Pixel 8 - 14
StartupBenchmark_startupPrecompiledWithBaselineProfile
timeToInitialDisplayMs min 183.5, median 219.9, max 247.3
StartupBenchmark_startupWithoutPreCompilation
timeToInitialDisplayMs min 223.6, median 328.0, max 663.8
StartupBenchmark_startupWithPartialCompilationAndDisabledBaselineProfile
timeToInitialDisplayMs min 264.8, median 308.0, max 376.1
StartupBenchmark_startupFullyPrecompiled
timeToInitialDisplayMs min 314.4, median 336.9, max 388.3
```
</details>
## 🔎 Additional
Terms and Conditions: https://sadellie.github.io/unitto/terms
Privacy Policy: https://sadellie.github.io/unitto/privacy
FAQ: https://sadellie.github.io/unitto/faq
I will maintain this app, but I do not plan to add new features.
I don't have enough time to do that, but you are welcome to contribute.
I will review and merge your pull requests.

View File

@ -28,11 +28,11 @@ plugins {
}
android {
namespace = "com.sadellie.unitto"
namespace = "app.myzel394.numberhub"
compileSdk = 34
defaultConfig {
applicationId = "com.sadellie.unitto"
applicationId = "app.myzel394.numberhub"
minSdk = 21
targetSdk = 34
versionCode = libs.versions.versionCode.get().toInt()

View File

@ -50,7 +50,7 @@
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="com.sadellie.unitto"
android:host="app.myzel394.numberhub"
android:scheme="app" />
</intent-filter>
</activity>

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto
package app.myzel394.numberhub
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
@ -37,14 +37,14 @@ import androidx.compose.ui.platform.LocalContext
import androidx.navigation.NavGraph.Companion.findStartDestination
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import com.sadellie.unitto.core.ui.common.NavigationDrawer
import com.sadellie.unitto.core.ui.common.rememberDrawerState
import com.sadellie.unitto.core.ui.model.DrawerItem
import com.sadellie.unitto.core.ui.pushDynamicShortcut
import com.sadellie.unitto.core.ui.theme.DarkThemeColors
import com.sadellie.unitto.core.ui.theme.LightThemeColors
import com.sadellie.unitto.core.ui.theme.TypographySystem
import com.sadellie.unitto.data.model.userprefs.AppPreferences
import app.myzel394.numberhub.core.ui.common.NavigationDrawer
import app.myzel394.numberhub.core.ui.common.rememberDrawerState
import app.myzel394.numberhub.core.ui.model.DrawerItem
import app.myzel394.numberhub.core.ui.pushDynamicShortcut
import app.myzel394.numberhub.core.ui.theme.DarkThemeColors
import app.myzel394.numberhub.core.ui.theme.LightThemeColors
import app.myzel394.numberhub.core.ui.theme.TypographySystem
import app.myzel394.numberhub.data.model.userprefs.AppPreferences
import io.github.sadellie.themmo.Themmo
import io.github.sadellie.themmo.ThemmoController
import kotlinx.coroutines.launch
@ -76,14 +76,14 @@ internal fun ComponentActivity.App(prefs: AppPreferences?) {
dynamicThemeEnabled = prefs.enableDynamicTheme,
amoledThemeEnabled = prefs.enableAmoledTheme,
customColor = prefs.customColor.toColor(),
monetMode = prefs.monetMode
monetMode = prefs.monetMode,
)
}
Themmo(
themmoController = themmoController,
typography = TypographySystem,
animationSpec = tween(250)
animationSpec = tween(250),
) {
val backgroundColor = MaterialTheme.colorScheme.background
val isDarkThemeEnabled = remember(backgroundColor) { backgroundColor.luminance() < 0.5f }
@ -92,7 +92,8 @@ internal fun ComponentActivity.App(prefs: AppPreferences?) {
modifier = Modifier,
state = drawerState,
gesturesEnabled = gesturesEnabled,
tabs = DrawerItem.main,
mainTabs = DrawerItem.main,
additionalTabs = DrawerItem.additional,
currentDestination = navBackStackEntry?.destination?.route,
onItemClick = { destination ->
drawerScope.launch { drawerState.close() }
@ -112,10 +113,9 @@ internal fun ComponentActivity.App(prefs: AppPreferences?) {
navController = navController,
themmoController = it,
startDestination = prefs.startingScreen,
rpnMode = prefs.rpnMode,
openDrawer = { drawerScope.launch { drawerState.open() } }
openDrawer = { drawerScope.launch { drawerState.open() } },
)
}
},
)
DisposableEffect(isDarkThemeEnabled) {

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto
package app.myzel394.numberhub
import android.os.Bundle
import androidx.activity.compose.setContent
@ -28,14 +28,14 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalConfiguration
import androidx.core.os.ConfigurationCompat
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.sadellie.unitto.core.ui.LocalHapticPreference
import com.sadellie.unitto.core.ui.LocalLocale
import com.sadellie.unitto.core.ui.LocalWindowSize
import com.sadellie.unitto.core.ui.calculateWindowSizeClass
import com.sadellie.unitto.core.ui.theme.LocalNumberTypography
import com.sadellie.unitto.core.ui.theme.NumberTypographySystem
import com.sadellie.unitto.core.ui.theme.NumberTypographyUnitto
import com.sadellie.unitto.data.model.repository.UserPreferencesRepository
import app.myzel394.numberhub.core.ui.LocalHapticPreference
import app.myzel394.numberhub.core.ui.LocalLocale
import app.myzel394.numberhub.core.ui.LocalWindowSize
import app.myzel394.numberhub.core.ui.calculateWindowSizeClass
import app.myzel394.numberhub.core.ui.theme.LocalNumberTypography
import app.myzel394.numberhub.core.ui.theme.NumberTypographySystem
import app.myzel394.numberhub.core.ui.theme.NumberTypographyUnitto
import app.myzel394.numberhub.data.model.repository.UserPreferencesRepository
import dagger.hilt.android.AndroidEntryPoint
import java.util.Locale
import javax.inject.Inject
@ -68,7 +68,7 @@ internal class MainActivity : AppCompatActivity() {
LocalLocale provides locale,
LocalWindowSize provides calculateWindowSizeClass(this@MainActivity),
LocalNumberTypography provides numbersTypography,
LocalHapticPreference provides (prefs?.enableVibrations ?: true)
LocalHapticPreference provides (prefs?.enableVibrations ?: true),
) {
App(prefs)
}

View File

@ -16,10 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto
package app.myzel394.numberhub
import android.app.Application
import dagger.hilt.android.HiltAndroidApp
@HiltAndroidApp
internal class UnittoApplication: Application()
internal class UnittoApplication : Application()

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto
package app.myzel394.numberhub
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
@ -26,14 +26,13 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import com.sadellie.unitto.feature.bodymass.navigation.bodyMassGraph
import com.sadellie.unitto.feature.calculator.navigation.calculatorGraph
import com.sadellie.unitto.feature.converter.navigation.converterGraph
import com.sadellie.unitto.feature.datecalculator.navigation.dateCalculatorGraph
import com.sadellie.unitto.feature.settings.navigation.navigateToSettings
import com.sadellie.unitto.feature.settings.navigation.navigateToUnitGroups
import com.sadellie.unitto.feature.settings.navigation.settingGraph
import com.sadellie.unitto.feature.timezone.navigation.timeZoneGraph
import app.myzel394.numberhub.feature.bodymass.navigation.bodyMassGraph
import app.myzel394.numberhub.feature.calculator.navigation.calculatorGraph
import app.myzel394.numberhub.feature.converter.navigation.converterGraph
import app.myzel394.numberhub.feature.datecalculator.navigation.dateCalculatorGraph
import app.myzel394.numberhub.feature.settings.navigation.navigateToUnitGroups
import app.myzel394.numberhub.feature.settings.navigation.settingGraph
import app.myzel394.numberhub.feature.timezone.navigation.timeZoneGraph
import io.github.sadellie.themmo.ThemmoController
@Composable
@ -42,47 +41,41 @@ internal fun UnittoNavigation(
themmoController: ThemmoController,
startDestination: String,
openDrawer: () -> Unit,
rpnMode: Boolean,
) {
NavHost(
navController = navController,
startDestination = startDestination,
modifier = Modifier.background(MaterialTheme.colorScheme.background),
enterTransition = { fadeIn() },
exitTransition = { fadeOut() }
exitTransition = { fadeOut() },
) {
calculatorGraph(
openDrawer = openDrawer,
)
converterGraph(
openDrawer = openDrawer,
navController = navController,
navigateToSettings = navController::navigateToSettings,
navigateToUnitGroups = navController::navigateToUnitGroups
)
settingGraph(
themmoController = themmoController,
navController = navController
)
calculatorGraph(
openDrawer = openDrawer,
rpnMode = rpnMode,
navigateToSettings = navController::navigateToSettings
navigateToUnitGroups = navController::navigateToUnitGroups,
)
dateCalculatorGraph(
navigateToMenu = openDrawer,
navigateToSettings = navController::navigateToSettings
openDrawer = openDrawer,
)
timeZoneGraph(
navigateToMenu = openDrawer,
navigateToSettings = navController::navigateToSettings,
openDrawer = openDrawer,
navController = navController,
)
bodyMassGraph(
openDrawer = openDrawer,
navigateToSettings = navController::navigateToSettings,
)
settingGraph(
openDrawer = openDrawer,
navController = navController,
themmoController = themmoController,
)
}
}

View File

@ -16,8 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto
package app.myzel394.numberhub
import android.annotation.SuppressLint
import android.app.PendingIntent
import android.content.Intent
import android.os.Build
@ -26,6 +27,7 @@ import androidx.annotation.RequiresApi
@RequiresApi(Build.VERSION_CODES.N)
class UnittoTileService : TileService() {
@SuppressLint("StartActivityAndCollapseDeprecated")
override fun onClick() {
super.onClick()

View File

@ -23,7 +23,7 @@ plugins {
}
android {
namespace = "com.sadellie.unitto.benchmark"
namespace = "app.myzel394.numberhub.benchmark"
compileSdk = 34
defaultConfig {

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.benchmark
package app.myzel394.numberhub.benchmark
import android.os.Build
import androidx.annotation.RequiresApi
@ -30,8 +30,8 @@ class StartupBaselineProfile {
@Test
fun generate() = baselineProfileRule.collect(
packageName = "com.sadellie.unitto",
includeInStartupProfile = true
packageName = "app.myzel394.numberhub",
includeInStartupProfile = true,
) {
startActivityAndWait()
device.pressBack()

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.benchmark
package app.myzel394.numberhub.benchmark
import androidx.benchmark.macro.BaselineProfileMode
import androidx.benchmark.macro.CompilationMode
@ -61,16 +61,16 @@ class StartupBenchmark {
fun startupFullyPrecompiled() = startup(CompilationMode.Full())
private fun startup(
compilationMode: CompilationMode
compilationMode: CompilationMode,
) = benchmarkRule.measureRepeated(
packageName = "com.sadellie.unitto",
packageName = "app.myzel394.numberhub",
metrics = listOf(StartupTimingMetric()),
compilationMode = compilationMode,
iterations = 10,
startupMode = StartupMode.COLD,
setupBlock = {
pressHome()
}
},
) {
startActivityAndWait()
}

View File

@ -20,7 +20,7 @@ plugins {
`kotlin-dsl`
}
group = "com.sadellie.unitto.buildlogic"
group = "app.myzel394.numberhub.buildlogic"
java {
sourceCompatibility = JavaVersion.VERSION_17

View File

@ -17,7 +17,7 @@
*/
import com.android.build.api.variant.ApplicationAndroidComponentsExtension
import com.sadellie.unitto.configureJacoco
import app.myzel394.numberhub.configureJacoco
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType

View File

@ -17,7 +17,7 @@
*/
import com.android.build.api.variant.LibraryAndroidComponentsExtension
import com.sadellie.unitto.configureJacoco
import app.myzel394.numberhub.configureJacoco
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType

View File

@ -17,7 +17,7 @@
*/
import com.android.build.gradle.TestExtension
import com.sadellie.unitto.configureKotlinAndroid
import app.myzel394.numberhub.configureKotlinAndroid
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure

View File

@ -17,7 +17,7 @@
*/
import com.android.build.api.dsl.LibraryExtension
import com.sadellie.unitto.configureCompose
import app.myzel394.numberhub.configureCompose
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension

View File

@ -17,7 +17,7 @@
*/
import com.android.build.api.dsl.LibraryExtension
import com.sadellie.unitto.configureKotlinAndroid
import app.myzel394.numberhub.configureKotlinAndroid
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto
package app.myzel394.numberhub
import com.android.build.api.dsl.CommonExtension
import org.gradle.api.Project
@ -24,7 +24,7 @@ import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.kotlin.dsl.getByType
internal fun Project.configureCompose(
commonExtension: CommonExtension<*, *, *, *, *>,
commonExtension: CommonExtension<*, *, *, *, *, *>
) {
commonExtension.apply {
buildFeatures {

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto
package app.myzel394.numberhub
import com.android.build.api.dsl.CommonExtension
import org.gradle.api.JavaVersion
@ -30,7 +30,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
internal fun Project.configureKotlinAndroid(
commonExtension: CommonExtension<*, *, *, *, *>,
commonExtension: CommonExtension<*, *, *, *, *, *>,
) {
commonExtension.apply {
compileSdk = 34
@ -100,6 +100,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

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto
package app.myzel394.numberhub
import com.android.build.api.variant.AndroidComponentsExtension
import org.gradle.api.Project

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto
package app.myzel394.numberhub
import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalog

View File

@ -22,7 +22,7 @@ plugins {
}
android {
namespace = "com.sadellie.unitto.core.base"
namespace = "app.myzel394.numberhub.core.base"
defaultConfig {
stringConfigField("VERSION_NAME", libs.versions.versionName.get())
@ -33,13 +33,13 @@ android {
getByName("playStore") {
stringConfigField(
"STORE_LINK",
"http://play.google.com/store/apps/details?id=com.sadellie.unitto"
"http://play.google.com/store/apps/details?id=app.myzel394.numberhub"
)
}
getByName("fdroid") {
stringConfigField(
"STORE_LINK",
"https://github.com/sadellie/unitto"
"https://github.com/Myzel394/NumberHub"
)
}
}

View File

@ -16,3 +16,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package app.myzel394.numberhub.core.base
/**
* Formatter symbols. Always use [Token].
*
* @property grouping Symbol fpr thousands separator.
* @property fractional Symbol decimal separator.
*/
data class FormatterSymbols(
val grouping: String,
val fractional: String,
)

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.base
package app.myzel394.numberhub.core.base
/**
* Output format here means whether or not use engineering notation
@ -24,8 +24,10 @@ package com.sadellie.unitto.core.base
object OutputFormat {
// Never use engineering notation
const val PLAIN = 0
// Use format that a lower API returns
const val ALLOW_ENGINEERING = 1
// App will try it's best to use engineering notation
const val FORCE_ENGINEERING = 2
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.base
package app.myzel394.numberhub.core.base
/**
* Current maximum scale that will be used in app. Used in various places in code.

View File

@ -16,10 +16,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.base
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.base
@Suppress("ObjectPropertyName")
object Token {
const val SPACE = " "
const val PERIOD = "."
const val COMMA = ","
object Digit {
const val _1 = "1"
const val _2 = "2"
@ -96,14 +102,14 @@ object Token {
val all by lazy {
listOf(
arsin, arcos, actan, sin, cos, tan, log, exp, ln
arsin, arcos, actan, sin, cos, tan, log, exp, ln,
).sortedByDescending { it.length }
}
val allWithOpeningBracket by lazy {
listOf(
arsinBracket, arcosBracket, actanBracket, sinBracket, cosBracket, tanBracket,
logBracket, expBracket, lnBracket
logBracket, expBracket, lnBracket,
)
}
}
@ -140,7 +146,7 @@ object Token {
Operator.multiply to listOf("*", ""),
Func.arsin to listOf("arsin"),
Func.arcos to listOf("arcos"),
Func.actan to listOf("actan")
Func.actan to listOf("actan"),
)
}
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.base
package app.myzel394.numberhub.core.base
// Don't touch, users have "..._route" in their settings
object TopLevelDestinations {

View File

@ -1,28 +0,0 @@
/*
* Unitto is a calculator for Android
* Copyright (c) 2022-2024 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/>.
*/
package com.sadellie.unitto.core.base
/**
* Separators mean symbols that separate fractional part
*/
object Separator {
const val SPACE = 0
const val PERIOD = 1
const val COMMA = 2
}

View File

@ -21,7 +21,7 @@
<!-- https://s3.eu-west-1.amazonaws.com/po-pub/i/QNmUuI88wb1Fm5P8wRIZajZF.png -->
<string name="add_label">Add</string>
<string name="app_name" translatable="false">Unitto</string>
<string name="app_name" translatable="false">NumberHub</string>
<!-- Person's height -->
<string name="body_mass_height">Height</string>
@ -220,7 +220,7 @@ Used in this dialog window. Should be short -->
https://s3.eu-west-1.amazonaws.com/po-pub/i/1oIHPj16krI0jyLmg4JaP2mk.png -->
<!-- Screen readers (accessibility) -->
<string name="selected_item">Selected item</string>
<string name="settings_about_unitto">About Unitto</string>
<string name="settings_about_unitto">About NumberHub</string>
<string name="settings_about_unitto_support">Learn about the app</string>
<!-- https://s3.eu-west-1.amazonaws.com/po-pub/i/p3aY3IWUI5m9Vjs6vZP3EXAo.png -->
@ -245,6 +245,7 @@ Alternatively you can use "Export" -->
<string name="settings_currency_rates_note_text">Currency rates are updated daily. There\'s no real-time market monitoring in the app</string>
<string name="settings_currency_rates_note_title">Wrong currency rates?</string>
<string name="settings_dark_mode">Dark</string>
<string name="settings_decimal_separator">Decimal separator</string>
<string name="settings_disable_unit_group_description">Disable unit group</string>
<string name="settings_display">Display</string>
<string name="settings_display_support">App look and feel</string>
@ -301,6 +302,7 @@ Maybe this can be labeled better? Let me know. It should be something that can d
<string name="settings_system_font_support">Use system font for texts in app</string>
<string name="settings_terms_and_conditions">Terms and Conditions</string>
<string name="settings_third_party_licenses">Third party licenses</string>
<string name="settings_thousands_separator">Thousands separator</string>
<string name="settings_title">Settings</string>
<string name="settings_translate_app">Translate this app</string>
<string name="settings_translate_app_support">Join POEditor project to help</string>
@ -320,6 +322,10 @@ Maybe this can be labeled better? Let me know. It should be something that can d
<string name="settings_view_source_code">View source code</string>
<string name="time_zone_add_title">Add time zone</string>
<string name="settings_numberhub_newApp">Unitto is now NumberHub!</string>
<string name="settings_numberhub_newApp_message">Unitto has been discontinued. You\'re one of the first users to try NumberHub! Please spread the word and share the app with your friends. Thank you for your support!</string>
<string name="settings_numberhub_newApp_announcement">NumberHub serves as a drop-in replacement for Unitto. It has the same features and more. NumberHub is still in beta and changes may occur. Please report any issues you find. Thanks for being one of the first to try it out!</string>
<!-- https://s3.eu-west-1.amazonaws.com/po-pub/i/UCrz06kaEYxCGAE73ZLl9EtX.png -->
<string name="time_zone_no_results_button">Read the article</string>

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.base
package app.myzel394.numberhub.core.base
import org.junit.Assert
import org.junit.Test

View File

@ -16,12 +16,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.base
package app.myzel394.numberhub.core.base
import org.junit.Assert
import org.junit.Test
class TokenTest {
@Test
fun testFormatterSymbols() {
Assert.assertEquals(" ", Token.SPACE)
Assert.assertEquals(".", Token.PERIOD)
Assert.assertEquals(",", Token.COMMA)
}
@Test
fun testDigit() {
Assert.assertEquals("1234567890", Token.Digit.all.joinToString(""))
@ -126,7 +134,7 @@ class TokenTest {
"e",
).joinToString("")
Assert.assertEquals("1234567890.$operator$func$consts", Token.expressionTokens.joinToString(""))
Assert.assertEquals("1234567890.$operator$func${consts}E", Token.expressionTokens.joinToString(""))
}
@Test
@ -142,7 +150,12 @@ class TokenTest {
@Test
fun testSexyToUgly() {
listOf(
"", "÷", "×", "sin⁻¹", "cos⁻¹", "tan⁻¹"
"",
"÷",
"×",
"sin⁻¹",
"cos⁻¹",
"tan⁻¹",
).forEach {
assert(it in Token.sexyToUgly.keys)
}

View File

@ -1,45 +0,0 @@
/*
* Unitto is a calculator for Android
* Copyright (c) 2023-2024 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/>.
*/
package com.sadellie.unitto.core.base
import org.junit.Assert
import org.junit.Test
class SeparatorTest {
@Test
fun testExists() {
Assert.assertNotNull(Separator)
}
@Test
fun testSeparatorSpace() {
Assert.assertEquals(0, Separator.SPACE)
}
@Test
fun testSeparatorPeriod() {
Assert.assertEquals(1, Separator.PERIOD)
}
@Test
fun testSeparatorComma() {
Assert.assertEquals(2, Separator.COMMA)
}
}

View File

@ -23,7 +23,7 @@ plugins {
id("unitto.android.library.jacoco")
}
android.namespace = "com.sadellie.unitto.core.ui"
android.namespace = "app.myzel394.numberhub.core.ui"
// Workaround from https://github.com/robolectric/robolectric/pull/4736
android.testOptions.unitTests.isIncludeAndroidResources = true

View File

@ -16,11 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui
package app.myzel394.numberhub.core.ui
import androidx.activity.ComponentActivity
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import com.sadellie.unitto.core.ui.datetime.formatOffset
import app.myzel394.numberhub.core.ui.datetime.formatOffset
import org.junit.Assert.assertEquals
import org.junit.Rule
import org.junit.Test
@ -28,7 +28,7 @@ import java.time.ZonedDateTime
class ZonedDateTimeUtilsTest {
@get: Rule
@get:Rule
val composeTestRule = createAndroidComposeRule<ComponentActivity>()
@Test

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui
package app.myzel394.numberhub.core.ui
import androidx.compose.runtime.compositionLocalOf

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui
package app.myzel394.numberhub.core.ui
import androidx.compose.runtime.compositionLocalOf
import java.util.Locale

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui
package app.myzel394.numberhub.core.ui
import android.app.Activity
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
@ -36,9 +36,10 @@ import androidx.compose.ui.util.fastForEach
import androidx.window.layout.WindowMetricsCalculator
val LocalWindowSize: ProvidableCompositionLocal<WindowSizeClass> = compositionLocalOf {
WindowSizeClass.calculateFromSize(
size = Size.Zero,
density = defaultDensity
// Phone in portrait mode
WindowSizeClass(
heightSizeClass = WindowHeightSizeClass.Medium,
widthSizeClass = WindowWidthSizeClass.Compact,
)
}
@ -80,9 +81,9 @@ fun calculateWindowSizeClass(activity: Activity): WindowSizeClass {
* @property heightSizeClass height-based window size class ([WindowHeightSizeClass])
*/
@Immutable
class WindowSizeClass private constructor(
class WindowSizeClass(
val widthSizeClass: WindowWidthSizeClass,
val heightSizeClass: WindowHeightSizeClass
val heightSizeClass: WindowHeightSizeClass,
) {
companion object {
/**
@ -117,7 +118,7 @@ class WindowSizeClass private constructor(
supportedWidthSizeClasses: Set<WindowWidthSizeClass> =
WindowWidthSizeClass.DefaultSizeClasses,
supportedHeightSizeClasses: Set<WindowHeightSizeClass> =
WindowHeightSizeClass.DefaultSizeClasses
WindowHeightSizeClass.DefaultSizeClasses,
): WindowSizeClass {
val windowWidthSizeClass =
WindowWidthSizeClass.fromWidth(size.width, density, supportedWidthSizeClasses)
@ -224,7 +225,9 @@ value class WindowWidthSizeClass private constructor(private val value: Int) :
/** Calculates the [WindowWidthSizeClass] for a given [width] */
internal fun fromWidth(width: Dp): WindowWidthSizeClass {
return fromWidth(
with(defaultDensity) { width.toPx() }, defaultDensity, DefaultSizeClasses
with(defaultDensity) { width.toPx() },
defaultDensity,
DefaultSizeClasses,
)
}
@ -235,7 +238,7 @@ value class WindowWidthSizeClass private constructor(private val value: Int) :
internal fun fromWidth(
width: Float,
density: Density,
supportedSizeClasses: Set<WindowWidthSizeClass>
supportedSizeClasses: Set<WindowWidthSizeClass>,
): WindowWidthSizeClass {
require(width >= 0) { "Width must not be negative" }
require(supportedSizeClasses.isNotEmpty()) { "Must support at least one size class" }
@ -322,7 +325,9 @@ value class WindowHeightSizeClass private constructor(private val value: Int) :
/** Calculates the [WindowHeightSizeClass] for a given [height] */
internal fun fromHeight(height: Dp): WindowHeightSizeClass {
return fromHeight(
with(defaultDensity) { height.toPx() }, defaultDensity, DefaultSizeClasses
with(defaultDensity) { height.toPx() },
defaultDensity,
DefaultSizeClasses,
)
}
@ -333,7 +338,7 @@ value class WindowHeightSizeClass private constructor(private val value: Int) :
internal fun fromHeight(
height: Float,
density: Density,
supportedSizeClasses: Set<WindowHeightSizeClass>
supportedSizeClasses: Set<WindowHeightSizeClass>,
): WindowHeightSizeClass {
require(height >= 0) { "Width must not be negative" }
require(supportedSizeClasses.isNotEmpty()) { "Must support at least one size class" }

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui
package app.myzel394.numberhub.core.ui
import androidx.compose.animation.AnimatedContentScope
import androidx.compose.animation.AnimatedContentTransitionScope
@ -44,16 +44,22 @@ fun NavGraphBuilder.unittoComposable(
route: String,
arguments: List<NamedNavArgument> = emptyList(),
deepLinks: List<NavDeepLink> = emptyList(),
enterTransition: (@JvmSuppressWildcards
AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)? = { unittoFadeIn() },
exitTransition: (@JvmSuppressWildcards
AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)? = { unittoFadeOut() },
popEnterTransition: (@JvmSuppressWildcards
AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)? =
enterTransition,
popExitTransition: (@JvmSuppressWildcards
AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)? =
exitTransition,
enterTransition: (
@JvmSuppressWildcards
AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?
)? = { unittoFadeIn() },
exitTransition: (
@JvmSuppressWildcards
AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?
)? = { unittoFadeOut() },
popEnterTransition: (
@JvmSuppressWildcards
AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?
)? = enterTransition,
popExitTransition: (
@JvmSuppressWildcards
AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?
)? = exitTransition,
content: @Composable AnimatedContentScope.(NavBackStackEntry) -> Unit,
): Unit = composable(
route = route,
@ -79,22 +85,26 @@ fun NavGraphBuilder.unittoStackedComposable(
enterTransition = {
slideInHorizontally(
animationSpec = unittoEnterTween(),
initialOffsetX = { (it * 0.2f).toInt() }) + unittoFadeIn()
initialOffsetX = { (it * 0.2f).toInt() },
) + unittoFadeIn()
},
exitTransition = {
slideOutHorizontally(
animationSpec = unittoExitTween(),
targetOffsetX = { -(it * 0.2f).toInt() }) + unittoFadeOut()
targetOffsetX = { -(it * 0.2f).toInt() },
) + unittoFadeOut()
},
popEnterTransition = {
slideInHorizontally(
animationSpec = unittoEnterTween(),
initialOffsetX = { -(it * 0.2f).toInt() }) + unittoFadeIn()
initialOffsetX = { -(it * 0.2f).toInt() },
) + unittoFadeIn()
},
popExitTransition = {
slideOutHorizontally(
animationSpec = unittoExitTween(),
targetOffsetX = { (it * 0.2f).toInt() }) + unittoFadeOut()
targetOffsetX = { (it * 0.2f).toInt() },
) + unittoFadeOut()
},
content = content,
)
@ -128,7 +138,7 @@ fun NavGraphBuilder.unittoNavigation(
exitTransition = exitTransition,
popEnterTransition = popEnterTransition,
popExitTransition = popExitTransition,
builder = builder
builder = builder,
)
private const val ENTER_DURATION = 350

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui
package app.myzel394.numberhub.core.ui
import android.app.PendingIntent
import android.app.PendingIntent.FLAG_IMMUTABLE
@ -28,8 +28,8 @@ import androidx.annotation.RequiresApi
import androidx.core.content.pm.ShortcutInfoCompat
import androidx.core.content.pm.ShortcutManagerCompat
import androidx.core.graphics.drawable.IconCompat
import com.sadellie.unitto.core.ui.model.DrawerItem
import com.sadellie.unitto.core.ui.model.Shortcut
import app.myzel394.numberhub.core.ui.model.DrawerItem
import app.myzel394.numberhub.core.ui.model.Shortcut
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
@ -48,7 +48,7 @@ suspend fun Context.pushDynamicShortcut(
val shortcutCompat = shortcutInfoCompat(
context = context,
route = drawerItem.graph,
shortcut = shortcut
shortcut = shortcut,
)
kotlin.runCatching {
@ -71,7 +71,7 @@ fun Context.addShortcut(
val shortcutCompat = shortcutInfoCompat(
context = context,
route = drawerItem.graph,
shortcut = shortcut
shortcut = shortcut,
)
val shortCutIntent = ShortcutManagerCompat.createShortcutResultIntent(context, shortcutCompat)
@ -80,7 +80,7 @@ fun Context.addShortcut(
ShortcutManagerCompat.requestPinShortcut(
context,
shortcutCompat,
PendingIntent.getBroadcast(context, 0, shortCutIntent, FLAG_IMMUTABLE).intentSender
PendingIntent.getBroadcast(context, 0, shortCutIntent, FLAG_IMMUTABLE).intentSender,
)
} catch (e: Exception) {
showToast(context, e.message ?: "Error")
@ -99,10 +99,10 @@ private fun Context.shortcutInfoCompat(
.setIntent(
Intent(
Intent.ACTION_VIEW,
Uri.parse("app://com.sadellie.unitto/$route"),
Uri.parse("app://app.myzel394.numberhub/$route"),
context,
context.javaClass
)
context.javaClass,
),
)
.build()
}

View File

@ -16,14 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui
package app.myzel394.numberhub.core.ui
import android.content.ActivityNotFoundException
import android.content.Context
import android.net.Uri
import android.widget.Toast
import androidx.browser.customtabs.CustomTabsIntent
import com.sadellie.unitto.core.base.R
import app.myzel394.numberhub.core.base.R
/**
* Open given link in browser

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.interaction.MutableInteractionSource
@ -50,7 +50,7 @@ fun Button(
border: BorderStroke? = null,
contentPadding: PaddingValues = ButtonDefaults.ContentPadding,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
content: @Composable RowScope.() -> Unit
content: @Composable RowScope.() -> Unit,
) {
Surface(
modifier = modifier.squashable(
@ -58,7 +58,7 @@ fun Button(
onLongClick = onLongClick,
interactionSource = interactionSource,
cornerRadiusRange = 30..50,
enabled = enabled
enabled = enabled,
),
color = containerColor,
contentColor = contentColor,
@ -70,12 +70,12 @@ fun Button(
Modifier
.defaultMinSize(
minWidth = ButtonDefaults.MinWidth,
minHeight = ButtonDefaults.MinHeight
minHeight = ButtonDefaults.MinHeight,
)
.padding(contentPadding),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically,
content = content
content = content,
)
}
}

View File

@ -16,9 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.animateColor
import androidx.compose.animation.core.updateTransition
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
@ -26,7 +27,6 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material3.AssistChipDefaults
import androidx.compose.material3.FilterChipDefaults
@ -40,6 +40,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.tooling.preview.Preview
@ -48,41 +49,37 @@ import androidx.compose.ui.unit.dp
@Composable
fun FilterChip(
modifier: Modifier = Modifier,
selected: Boolean,
isSelected: Boolean,
onClick: () -> Unit,
label: String,
imageVector: ImageVector,
contentDescription: String,
) {
val transition = updateTransition(targetState = isSelected, label = "Selected transition")
val backgroundColor = transition.animateColor(label = "Background color") {
if (it) MaterialTheme.colorScheme.primaryContainer else MaterialTheme.colorScheme.surface
}
val borderColor = transition.animateColor(label = "Border color") {
if (it) Color.Transparent else MaterialTheme.colorScheme.outline
}
Row(
modifier = modifier
.background(
color = if (selected) MaterialTheme.colorScheme.primaryContainer else MaterialTheme.colorScheme.surface,
shape = FilterChipDefaults.shape
)
.padding(vertical = 8.dp)
.clip(FilterChipDefaults.shape)
.clickable { onClick() }
.background(backgroundColor.value)
.border(
width = 1.dp,
color = if (selected) Color.Transparent else MaterialTheme.colorScheme.outline,
shape = FilterChipDefaults.shape
color = borderColor.value,
shape = FilterChipDefaults.shape,
)
.height(FilterChipDefaults.Height)
.clickable { onClick() }
.padding(start = 8.dp, end = 16.dp),
verticalAlignment = Alignment.CenterVertically
.padding(horizontal = 16.dp),
verticalAlignment = Alignment.CenterVertically,
) {
AnimatedVisibility(visible = selected) {
Icon(
modifier = Modifier.height(FilterChipDefaults.IconSize),
imageVector = imageVector,
contentDescription = contentDescription,
tint = MaterialTheme.colorScheme.onPrimaryContainer
)
}
Text(
modifier = Modifier.padding(start = 8.dp),
text = label,
style = MaterialTheme.typography.labelLarge,
color = if (selected) MaterialTheme.colorScheme.onPrimaryContainer else MaterialTheme.colorScheme.onSurfaceVariant
color = if (isSelected) MaterialTheme.colorScheme.onPrimaryContainer else MaterialTheme.colorScheme.onSurfaceVariant,
)
}
}
@ -96,25 +93,24 @@ fun AssistChip(
) {
Row(
modifier = modifier
.background(
color = MaterialTheme.colorScheme.surface,
shape = AssistChipDefaults.shape
)
.padding(vertical = 8.dp)
.clip(FilterChipDefaults.shape)
.clickable { onClick() }
.background(MaterialTheme.colorScheme.surface)
.border(
width = 1.dp,
color = MaterialTheme.colorScheme.outline,
shape = AssistChipDefaults.shape
shape = AssistChipDefaults.shape,
)
.height(32.dp)
.clickable { onClick() }
.padding(horizontal = 8.dp),
verticalAlignment = Alignment.CenterVertically
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
modifier = Modifier.height(AssistChipDefaults.IconSize),
imageVector = imageVector,
contentDescription = contentDescription,
tint = MaterialTheme.colorScheme.onSurfaceVariant
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
}
@ -125,7 +121,7 @@ fun PreviewAssistChip() {
AssistChip(
onClick = {},
imageVector = Icons.Default.Settings,
contentDescription = ""
contentDescription = "",
)
}
@ -135,10 +131,8 @@ fun PreviewFilterChip() {
var isSelected by remember { mutableStateOf(true) }
FilterChip(
selected = isSelected,
isSelected = isSelected,
onClick = { isSelected = !isSelected },
label = "Label",
imageVector = Icons.Default.Check,
contentDescription = ""
)
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Menu
@ -24,19 +24,19 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import com.sadellie.unitto.core.base.R
import app.myzel394.numberhub.core.base.R
/**
* Button that is used in Top bars
* Button that is used in Top bars to open drawer.
*
* @param onClick Action to be called when button is clicked.
*/
@Composable
fun MenuButton(onClick: () -> Unit) {
fun DrawerButton(onClick: () -> Unit) {
IconButton(onClick = onClick) {
Icon(
Icons.Outlined.Menu,
contentDescription = stringResource(R.string.open_menu_description)
imageVector = Icons.Outlined.Menu,
contentDescription = stringResource(R.string.open_menu_description),
)
}
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.material3.Icon
import androidx.compose.material3.NavigationDrawerItem
@ -25,7 +25,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import com.sadellie.unitto.core.ui.model.DrawerItem
import app.myzel394.numberhub.core.ui.model.DrawerItem
@Composable
internal fun DrawerItem(
@ -33,13 +33,13 @@ internal fun DrawerItem(
destination: DrawerItem,
icon: ImageVector,
selected: Boolean,
onClick: (DrawerItem) -> Unit
onClick: (DrawerItem) -> Unit,
) {
NavigationDrawerItem(
modifier = modifier,
label = { Text(stringResource(destination.name)) },
icon = { Icon(icon, stringResource(destination.name)) },
selected = selected,
onClick = { onClick(destination) }
onClick = { onClick(destination) },
)
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.PaddingValues
@ -43,8 +43,8 @@ fun Header(
start = 56.dp,
end = 16.dp,
top = 24.dp,
bottom = 12.dp
)
bottom = 12.dp,
),
) {
Text(
modifier = modifier
@ -53,6 +53,6 @@ fun Header(
.fillMaxWidth(),
text = text,
style = MaterialTheme.typography.titleSmall,
color = MaterialTheme.colorScheme.primary
color = MaterialTheme.colorScheme.primary,
)
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import android.view.HapticFeedbackConstants
import androidx.compose.animation.core.tween
@ -36,7 +36,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalView
import com.sadellie.unitto.core.ui.LocalHapticPreference
import app.myzel394.numberhub.core.ui.LocalHapticPreference
import kotlinx.coroutines.launch
@Composable
@ -64,15 +64,24 @@ fun BasicKeyboardButton(
Box(
modifier = modifier
.squashable(
onClick = { onClick(); vibrate() },
onLongClick = if (onLongClick != null) { { onLongClick(); vibrate() } } else null,
onClick = {
onClick()
vibrate()
},
onLongClick = if (onLongClick != null) {
{
onLongClick()
vibrate()
}
} else {
null
},
interactionSource = remember { MutableInteractionSource() },
cornerRadiusRange = 30..50,
animationSpec = tween(200)
animationSpec = tween(200),
)
.background(containerColor)
,
contentAlignment = Alignment.Center
.background(containerColor),
contentAlignment = Alignment.Center,
) {
Icon(
imageVector = icon,
@ -84,7 +93,7 @@ fun BasicKeyboardButton(
scaleX = contentHeight
scaleY = contentHeight
},
tint = iconColor
tint = iconColor,
)
}
}
@ -173,22 +182,25 @@ fun KeyboardButtonTertiary(
)
}
/**
object KeyboardButtonToken {
/**
* Mostly for main button in portrait mode. Changes icon size inside.
*/
const val KeyboardButtonContentHeightTall = 1.1f
const val CONTENT_HEIGHT_TALL = 1.1f
/**
/**
* Mostly for additional button in portrait mode. Changes icon size inside.
*/
const val KeyboardButtonContentHeightTallAdditional = 1.6f
const val CONTENT_HEIGHT_TALL_ADDITIONAL = 1.6f
/**
/**
* Mostly for main button in landscape mode. Changes icon size inside.
*/
const val KeyboardButtonContentHeightShort = 1.3f
const val CONTENT_HEIGHT_SHORT = 1.3f
/**
/**
* Mostly for additional button in landscape mode. Changes icon size inside.
*/
const val KeyboardButtonContentHeightShortAdditional = 1.1f
const val CONTENT_HEIGHT_SHORT_ADDITIONAL = 1.1f
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.annotation.IntRange
import androidx.compose.foundation.layout.Arrangement
@ -49,7 +49,7 @@ fun KeypadFlow(
columns: Int,
@IntRange(0, 100) horizontalPadding: Int = 10,
@IntRange(0, 100) verticalPadding: Int = 10,
content: @Composable FlowRowScope.(width: Float, height: Float) -> Unit
content: @Composable FlowRowScope.(width: Float, height: Float) -> Unit,
) {
val height: Float = remember { (1f - verticalPadding / 100f) / rows }
val width: Float = remember { (1f - horizontalPadding / 100f) / columns }
@ -58,7 +58,7 @@ fun KeypadFlow(
modifier = modifier,
maxItemsInEachRow = columns,
horizontalArrangement = Arrangement.SpaceAround,
verticalArrangement = Arrangement.SpaceAround
verticalArrangement = Arrangement.SpaceAround,
) {
content(width, height)
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
@ -57,12 +57,12 @@ fun ListItem(
.padding(start = 16.dp, end = 24.dp)
.heightIn(min = if (supportingContent == null) 56.dp else 72.dp),
horizontalArrangement = Arrangement.spacedBy(16.dp),
verticalAlignment = Alignment.CenterVertically
verticalAlignment = Alignment.CenterVertically,
) {
leadingContent?.let {
ProvideColor(
color = MaterialTheme.colorScheme.onSurfaceVariant,
content = it
content = it,
)
}
@ -70,20 +70,20 @@ fun ListItem(
ProvideStyle(
color = MaterialTheme.colorScheme.onSurface,
textStyle = MaterialTheme.typography.bodyLarge,
content = headlineContent
content = headlineContent,
)
supportingContent?.let {
ProvideStyle(
color = MaterialTheme.colorScheme.onSurfaceVariant,
textStyle = MaterialTheme.typography.bodyMedium,
content = it
content = it,
)
}
}
trailingContent?.let {
ProvideColor(
color = MaterialTheme.colorScheme.onSurfaceVariant,
content = it
content = it,
)
}
}
@ -106,10 +106,10 @@ fun ListItem(
imageVector = icon,
contentDescription = iconDescription,
modifier = Modifier.size(24.dp),
tint = MaterialTheme.colorScheme.onSurfaceVariant
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)
},
trailingContent = trailing
trailingContent = trailing,
)
@Composable
@ -120,14 +120,14 @@ fun ListItem(
iconDescription: String = headlineText,
supportingText: String? = null,
switchState: Boolean,
onSwitchChange: (Boolean) -> Unit
onSwitchChange: (Boolean) -> Unit,
) = ListItem(
modifier = modifier
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(),
onClick = { onSwitchChange(!switchState) },
role = Role.Switch
role = Role.Switch,
),
headlineText = headlineText,
supportingText = supportingText,
@ -136,9 +136,9 @@ fun ListItem(
trailing = {
Switch(
checked = switchState,
onCheckedChange = { onSwitchChange(it) }
onCheckedChange = { onSwitchChange(it) },
)
}
},
)
@Preview
@ -152,7 +152,7 @@ fun PreviewListItem1() {
leadingContent = {
Icon(
imageVector = Icons.Default.Home,
contentDescription = null
contentDescription = null,
)
},
)
@ -171,7 +171,7 @@ fun PreviewListItem1() {
supportingText = "Support text support text support text support text",
modifier = Modifier,
trailing = {},
iconDescription = ""
iconDescription = "",
)
ListItem(

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.ProvideTextStyle

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.animation.core.AnimationSpec
import androidx.compose.animation.core.animateDpAsState
@ -47,7 +47,7 @@ fun Modifier.squashable(
val cornerRadius: Int by animateIntAsState(
targetValue = if (isPressed) cornerRadiusRange.first else cornerRadiusRange.last,
animationSpec = animationSpec,
label = "Squashed animation"
label = "Squashed animation",
)
this
@ -58,7 +58,7 @@ fun Modifier.squashable(
interactionSource = interactionSource,
indication = rememberRipple(),
role = role,
enabled = enabled
enabled = enabled,
)
}
@ -75,7 +75,7 @@ fun Modifier.squashable(
val cornerRadius: Dp by animateDpAsState(
targetValue = if (isPressed) cornerRadiusRange.start else cornerRadiusRange.endInclusive,
animationSpec = animationSpec,
label = "Squashed animation"
label = "Squashed animation",
)
this
@ -86,6 +86,6 @@ fun Modifier.squashable(
interactionSource = interactionSource,
indication = rememberRipple(),
role = role,
enabled = enabled
enabled = enabled,
)
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.ArrowBack
@ -24,7 +24,7 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import com.sadellie.unitto.core.base.R
import app.myzel394.numberhub.core.base.R
/**
* Button that is used in Top bars
@ -36,7 +36,7 @@ fun NavigateUpButton(onClick: () -> Unit) {
IconButton(onClick = onClick) {
Icon(
Icons.AutoMirrored.Outlined.ArrowBack,
contentDescription = stringResource(R.string.navigate_up_description)
contentDescription = stringResource(R.string.navigate_up_description),
)
}
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Canvas
@ -58,9 +58,9 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.LocalWindowSize
import com.sadellie.unitto.core.ui.WindowWidthSizeClass
import com.sadellie.unitto.core.ui.model.DrawerItem
import app.myzel394.numberhub.core.ui.LocalWindowSize
import app.myzel394.numberhub.core.ui.WindowWidthSizeClass
import app.myzel394.numberhub.core.ui.model.DrawerItem
import kotlinx.coroutines.launch
import kotlin.math.roundToInt
@ -73,7 +73,7 @@ class DrawerState(
initialValue = initialValue,
positionalThreshold = { distance -> distance * 0.5f },
velocityThreshold = { with(requireNotNull(density)) { 400.dp.toPx() } },
animationSpec = tween()
animationSpec = tween(),
)
val isOpen: Boolean
@ -89,10 +89,10 @@ class DrawerState(
suspend fun close() = anchoredDraggableState.animateTo(DrawerValue.Closed)
companion object {
internal fun Saver() =
internal fun saver() =
Saver<DrawerState, DrawerValue>(
save = { it.currentValue },
restore = { DrawerState(it) }
restore = { DrawerState(it) },
)
}
}
@ -101,7 +101,7 @@ class DrawerState(
fun rememberDrawerState(
initialValue: DrawerValue = DrawerValue.Closed,
): DrawerState {
return rememberSaveable(saver = DrawerState.Saver()) {
return rememberSaveable(saver = DrawerState.saver()) {
DrawerState(initialValue)
}
}
@ -111,7 +111,8 @@ fun NavigationDrawer(
modifier: Modifier,
gesturesEnabled: Boolean,
state: DrawerState = rememberDrawerState(),
tabs: List<DrawerItem>,
mainTabs: List<DrawerItem>,
additionalTabs: List<DrawerItem>,
currentDestination: String?,
onItemClick: (DrawerItem) -> Unit,
content: @Composable () -> Unit,
@ -123,16 +124,17 @@ fun NavigationDrawer(
PermanentDrawerSheet(
modifier = Modifier
.fillMaxHeight()
.verticalScroll(rememberScrollState())
.verticalScroll(rememberScrollState()),
) {
SheetContent(
tabs = tabs,
mainTabs = mainTabs,
additionalTabs = additionalTabs,
currentDestination = currentDestination,
onItemClick = onItemClick
onItemClick = onItemClick,
)
}
},
content = content
content = content,
)
} else {
UnittoModalNavigationDrawer(
@ -141,18 +143,19 @@ fun NavigationDrawer(
ModalDrawerSheet(
modifier = Modifier
.fillMaxHeight()
.verticalScroll(rememberScrollState())
.verticalScroll(rememberScrollState()),
) {
SheetContent(
tabs = tabs,
mainTabs = mainTabs,
additionalTabs = additionalTabs,
currentDestination = currentDestination,
onItemClick = onItemClick
onItemClick = onItemClick,
)
}
},
gesturesEnabled = gesturesEnabled,
state = state,
content = content
content = content,
)
}
}
@ -170,7 +173,7 @@ private fun UnittoModalNavigationDrawer(
val drawerScope = rememberCoroutineScope()
Box(
modifier = modifier.fillMaxSize()
modifier = modifier.fillMaxSize(),
) {
val drawerWidth = 360.dp
val drawerWidthPx = with(density) { drawerWidth.toPx() }
@ -183,7 +186,7 @@ private fun UnittoModalNavigationDrawer(
DraggableAnchors {
DrawerValue.Closed at minValue
DrawerValue.Open at maxValue
}
},
)
}
@ -199,7 +202,7 @@ private fun UnittoModalNavigationDrawer(
state = state.anchoredDraggableState,
orientation = Orientation.Horizontal,
enabled = gesturesEnabled or state.isOpen,
)
),
)
Scrim(
@ -207,7 +210,9 @@ private fun UnittoModalNavigationDrawer(
onClose = { if (gesturesEnabled) drawerScope.launch { state.close() } },
fraction = {
fraction(
minValue, maxValue, state.anchoredDraggableState.requireOffset()
minValue,
maxValue,
state.anchoredDraggableState.requireOffset(),
)
},
)
@ -221,14 +226,14 @@ private fun UnittoModalNavigationDrawer(
.anchoredDraggableState
.requireOffset()
.roundToInt(),
y = 0
y = 0,
)
}
.anchoredDraggable(
state = state.anchoredDraggableState,
orientation = Orientation.Horizontal,
enabled = gesturesEnabled or state.isOpen,
)
),
) {
drawerContent()
}
@ -251,7 +256,7 @@ private fun Scrim(
Canvas(
Modifier
.fillMaxSize()
.then(dismissDrawer)
.then(dismissDrawer),
) {
drawRect(color, alpha = fraction())
}
@ -263,12 +268,12 @@ private fun fraction(a: Float, b: Float, pos: Float) =
@Preview(
backgroundColor = 0xFFC8F7D4,
showBackground = true,
device = "spec:width=320dp,height=500dp,dpi=320"
device = "spec:width=320dp,height=500dp,dpi=320",
)
@Preview(
backgroundColor = 0xFFC8F7D4,
showBackground = true,
device = "spec:width=440dp,height=500dp,dpi=440"
device = "spec:width=440dp,height=500dp,dpi=440",
)
@Composable
private fun PreviewUnittoModalNavigationDrawerClose() {
@ -279,18 +284,19 @@ private fun PreviewUnittoModalNavigationDrawerClose() {
modifier = Modifier,
state = drawerState,
gesturesEnabled = true,
tabs = DrawerItem.main,
mainTabs = DrawerItem.main,
additionalTabs = DrawerItem.additional,
currentDestination = DrawerItem.Calculator.start,
onItemClick = {},
content = {
Column {
Text(text = "Content")
Button(
onClick = { corScope.launch { drawerState.open() } }
onClick = { corScope.launch { drawerState.open() } },
) {
Text(text = "BUTTON")
}
}
}
},
)
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.Canvas
@ -49,7 +49,7 @@ import kotlinx.coroutines.launch
* [HorizontalPager] with a background and a page indicator.
*
* @param modifier [Modifier] that will be applied to the surround [Column].
* @param pagerState [PagerState] that will passed [HorizontalPager].
* @param pageCount Page count for [PagerState] that will passed [HorizontalPager].
* @param backgroundColor [Color] for background.
* @param pageIndicatorAlignment [Alignment.Horizontal] for page indicator.
* @param onClick Called on all clicks, even if the page didn't change.
@ -58,7 +58,7 @@ import kotlinx.coroutines.launch
@Composable
fun PagedIsland(
modifier: Modifier = Modifier,
pagerState: PagerState,
pageCount: Int,
backgroundColor: Color = MaterialTheme.colorScheme.secondaryContainer,
pageIndicatorAlignment: Alignment.Horizontal = Alignment.End,
onClick: () -> Unit = {},
@ -67,6 +67,8 @@ fun PagedIsland(
val contentColor = MaterialTheme.colorScheme.contentColorFor(backgroundColor)
val disabledContentColor = contentColor.copy(alpha = 0.5f)
val corScope = rememberCoroutineScope()
// https://stackoverflow.com/a/75469260
val pagerState = rememberPagerState { pageCount * 1_000 }
ProvideColor(color = contentColor) {
Column(
@ -74,14 +76,17 @@ fun PagedIsland(
.clip(RoundedCornerShape(32.dp))
.clickable {
onClick()
if (pagerState.currentPage == (pagerState.pageCount - 1)) return@clickable
val targetPage = pagerState.currentPage + 1
corScope.launch {
pagerState.animateScrollToPage(pagerState.currentPage + 1)
pagerState.animateScrollToPage(
// Animate to first page if target page is out of bounds
if (targetPage >= pagerState.pageCount) 0 else targetPage,
)
}
}
.background(backgroundColor)
.padding(16.dp)
.padding(16.dp),
) {
Row(
modifier = Modifier
@ -89,8 +94,8 @@ fun PagedIsland(
.padding(vertical = 8.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp, pageIndicatorAlignment),
) {
repeat(pagerState.pageCount) {
PageDot(if (it == pagerState.currentPage) contentColor else disabledContentColor)
repeat(pageCount) {
PageDot(if (it == pagerState.currentPage % pageCount) contentColor else disabledContentColor)
}
}
@ -99,10 +104,9 @@ fun PagedIsland(
.animateContentSize()
.fillMaxWidth(),
verticalAlignment = Alignment.Top,
state = pagerState
) { page ->
pageContent(page)
}
state = pagerState,
pageContent = { page -> pageContent(page % pageCount) },
)
}
}
}
@ -121,7 +125,7 @@ private fun PageDot(
private fun PreviewPagedIsland() {
PagedIsland(
modifier = Modifier.size(400.dp, 250.dp),
pagerState = rememberPagerState { 5 }
pageCount = 5,
) { currentPage ->
Column {
Text("Current page: $currentPage")

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
@ -26,9 +26,9 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.LocalWindowSize
import com.sadellie.unitto.core.ui.WindowHeightSizeClass
import com.sadellie.unitto.core.ui.WindowWidthSizeClass
import app.myzel394.numberhub.core.ui.LocalWindowSize
import app.myzel394.numberhub.core.ui.WindowHeightSizeClass
import app.myzel394.numberhub.core.ui.WindowWidthSizeClass
/**
* When Portrait mode will place [content1] and [content2] in a [Column].
@ -52,8 +52,11 @@ fun PortraitLandscape(
.weight(1f)
.fillMaxSize()
.padding(
it.maxWidth * 0.015f, 0.dp,
it.maxHeight * 0.03f, it.maxHeight * 0.03f)
it.maxWidth * 0.015f,
0.dp,
it.maxHeight * 0.03f,
it.maxHeight * 0.03f,
)
content1(contentModifier)
content2(contentModifier)
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.RowScope
@ -41,10 +41,10 @@ fun ScaffoldWithLargeTopBar(
title: String,
navigationIcon: @Composable () -> Unit,
actions: @Composable RowScope.() -> Unit = {},
content: @Composable (PaddingValues) -> Unit
content: @Composable (PaddingValues) -> Unit,
) {
val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior(
rememberTopAppBarState()
rememberTopAppBarState(),
)
Scaffold(
modifier = Modifier
@ -56,9 +56,9 @@ fun ScaffoldWithLargeTopBar(
},
navigationIcon = navigationIcon,
scrollBehavior = scrollBehavior,
actions = actions
actions = actions,
)
},
content = content
content = content,
)
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeIn
@ -33,9 +33,9 @@ import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.TopAppBarScrollBehavior
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.sadellie.unitto.core.ui.LocalWindowSize
import com.sadellie.unitto.core.ui.WindowHeightSizeClass
import com.sadellie.unitto.core.ui.WindowWidthSizeClass
import app.myzel394.numberhub.core.ui.LocalWindowSize
import app.myzel394.numberhub.core.ui.WindowHeightSizeClass
import app.myzel394.numberhub.core.ui.WindowWidthSizeClass
/**
* Template screen. Uses [Scaffold] and [CenterAlignedTopAppBar]
@ -59,7 +59,7 @@ fun ScaffoldWithTopBar(
floatingActionButton: @Composable () -> Unit = {},
floatingActionButtonPosition: FabPosition = FabPosition.End,
scrollBehavior: TopAppBarScrollBehavior? = null,
content: @Composable (PaddingValues) -> Unit
content: @Composable (PaddingValues) -> Unit,
) {
Scaffold(
modifier = modifier,
@ -67,11 +67,15 @@ fun ScaffoldWithTopBar(
AnimatedVisibility(
visible = LocalWindowSize.current.heightSizeClass > WindowHeightSizeClass.Compact,
enter = slideInVertically() + fadeIn(),
exit = slideOutVertically() + fadeOut()
exit = slideOutVertically() + fadeOut(),
) {
CenterAlignedTopAppBar(
title = title,
navigationIcon = if (LocalWindowSize.current.widthSizeClass != WindowWidthSizeClass.Expanded) navigationIcon else { {} },
navigationIcon = {
if (LocalWindowSize.current.widthSizeClass != WindowWidthSizeClass.Expanded) {
navigationIcon()
}
},
actions = actions,
colors = colors,
scrollBehavior = scrollBehavior,
@ -80,6 +84,6 @@ fun ScaffoldWithTopBar(
},
floatingActionButton = floatingActionButton,
floatingActionButtonPosition = floatingActionButtonPosition,
content = content
content = content,
)
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.activity.compose.BackHandler
import androidx.compose.animation.AnimatedVisibility
@ -72,7 +72,7 @@ import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.base.R
import app.myzel394.numberhub.core.base.R
import kotlin.math.roundToInt
@Composable
@ -109,7 +109,7 @@ fun SearchBar(
modifier = modifier
.windowInsetsPadding(TopAppBarDefaults.windowInsets)
.height(height),
contentAlignment = Alignment.Center
contentAlignment = Alignment.Center,
) {
Row(
modifier = Modifier
@ -121,10 +121,9 @@ fun SearchBar(
.fillMaxWidth()
.padding(horizontal = 16.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(16.dp)
horizontalArrangement = Arrangement.spacedBy(16.dp),
) {
ProvideColor(MaterialTheme.colorScheme.onSurface) {
NavigateButton { if (notEmpty) clear() else navigateUp() }
SearchTextField(
@ -135,7 +134,7 @@ fun SearchBar(
value = query,
placeholder = stringResource(R.string.search_text_field_placeholder),
onValueChange = onQueryChange,
onSearch = onSearch
onSearch = onSearch,
)
ClearButton(notEmpty, ::clear)
@ -152,7 +151,7 @@ private fun SearchTextField(
value: TextFieldValue,
placeholder: String,
onValueChange: (TextFieldValue) -> Unit,
onSearch: KeyboardActionScope.() -> Unit
onSearch: KeyboardActionScope.() -> Unit,
) {
BasicTextField(
modifier = modifier,
@ -171,33 +170,33 @@ private fun SearchTextField(
modifier = Modifier.alpha(0.7f),
text = placeholder,
style = MaterialTheme.typography.bodyLarge,
color = MaterialTheme.colorScheme.onSurface
color = MaterialTheme.colorScheme.onSurface,
)
}
}
},
)
}
@Composable
private fun SearchButton(
onClick: () -> Unit
onClick: () -> Unit,
) {
SearchBarIconButton(onClick) {
Icon(
imageVector = Icons.Default.Search,
contentDescription = stringResource(R.string.search_button_description)
contentDescription = stringResource(R.string.search_button_description),
)
}
}
@Composable
private fun NavigateButton(
onClick: () -> Unit
onClick: () -> Unit,
) {
SearchBarIconButton(onClick) {
Icon(
imageVector = Icons.AutoMirrored.Outlined.ArrowBack,
contentDescription = stringResource(R.string.navigate_up_description)
contentDescription = stringResource(R.string.navigate_up_description),
)
}
}
@ -205,17 +204,17 @@ private fun NavigateButton(
@Composable
private fun ClearButton(
visible: Boolean,
onClick: () -> Unit
onClick: () -> Unit,
) {
AnimatedVisibility(
visible = visible,
enter = fadeIn(),
exit = fadeOut()
exit = fadeOut(),
) {
SearchBarIconButton(onClick) {
Icon(
imageVector = Icons.Outlined.Clear,
contentDescription = stringResource(R.string.clear_input_description)
contentDescription = stringResource(R.string.clear_input_description),
)
}
}
@ -224,7 +223,7 @@ private fun ClearButton(
@Composable
fun SearchBarIconButton(
onClick: () -> Unit,
content: @Composable () -> Unit
content: @Composable () -> Unit,
) {
Box(
modifier = Modifier
@ -236,10 +235,10 @@ fun SearchBarIconButton(
interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(
bounded = false,
radius = 20.dp
)
radius = 20.dp,
),
contentAlignment = Alignment.Center
),
contentAlignment = Alignment.Center,
) {
content()
}
@ -259,6 +258,6 @@ fun UnittoSearchBarPreview() {
query = TextFieldValue("test"),
onQueryChange = {},
navigateUp = {},
scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior()
scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(),
)
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
@ -35,35 +35,35 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.base.R
import app.myzel394.numberhub.core.base.R
@Composable
fun SearchPlaceholder(
onButtonClick: () -> Unit,
supportText: String,
buttonLabel: String
buttonLabel: String,
) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(16.dp)
verticalArrangement = Arrangement.spacedBy(16.dp),
) {
Icon(
imageVector = Icons.Default.SearchOff,
contentDescription = stringResource(R.string.no_results_description),
modifier = Modifier.size(48.dp)
modifier = Modifier.size(48.dp),
)
Text(
text = stringResource(R.string.no_results_label),
textAlign = TextAlign.Center,
style = MaterialTheme.typography.bodyLarge
style = MaterialTheme.typography.bodyLarge,
)
Text(
text = supportText,
textAlign = TextAlign.Center,
style = MaterialTheme.typography.bodySmall
style = MaterialTheme.typography.bodySmall,
)
ElevatedButton(onClick = onButtonClick) {
Text(text = buttonLabel)

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.animation.Crossfade
import androidx.compose.foundation.border
@ -47,14 +47,14 @@ import androidx.compose.ui.unit.dp
@Composable
fun SegmentedButtonsRow(
modifier: Modifier = Modifier,
content: @Composable RowScope.() -> Unit
content: @Composable RowScope.() -> Unit,
) {
Row(
modifier
.width(IntrinsicSize.Max)
.height(40.dp)
.clip(CircleShape)
.border(1.dp, MaterialTheme.colorScheme.outline, CircleShape)
.border(1.dp, MaterialTheme.colorScheme.outline, CircleShape),
) {
content()
}
@ -66,7 +66,7 @@ fun RowScope.SegmentedButton(
label: String,
onClick: () -> Unit,
selected: Boolean,
icon: ImageVector? = null
icon: ImageVector? = null,
) {
val containerColor =
if (selected) MaterialTheme.colorScheme.secondaryContainer else MaterialTheme.colorScheme.surface
@ -77,9 +77,9 @@ fun RowScope.SegmentedButton(
shape = RectangleShape,
colors = ButtonDefaults.outlinedButtonColors(
containerColor = containerColor,
contentColor = contentColorFor(containerColor)
contentColor = contentColorFor(containerColor),
),
contentPadding = PaddingValues(horizontal = 12.dp)
contentPadding = PaddingValues(horizontal = 12.dp),
) {
if (icon != null) {
Crossfade(selected, label = "Selected state") {

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.animation.AnimatedContent
import androidx.compose.foundation.clickable
@ -38,16 +38,15 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.base.R
import com.sadellie.unitto.core.ui.LocalWindowSize
import com.sadellie.unitto.core.ui.WindowHeightSizeClass
import com.sadellie.unitto.core.ui.model.DrawerItem
import app.myzel394.numberhub.core.base.R
import app.myzel394.numberhub.core.ui.model.DrawerItem
import kotlinx.coroutines.delay
@Suppress("UnusedReceiverParameter")
@Composable
internal fun ColumnScope.SheetContent(
tabs: List<DrawerItem>,
mainTabs: List<DrawerItem>,
additionalTabs: List<DrawerItem>,
currentDestination: String?,
onItemClick: (DrawerItem) -> Unit,
) {
@ -68,38 +67,38 @@ internal fun ColumnScope.SheetContent(
modifier = Modifier.clickable(
interactionSource = interactionSource,
indication = null,
onClick = { showHello = true }
)
onClick = { showHello = true },
),
) { hello ->
Text(
text = if (hello) stringResource(R.string.hello_label) else stringResource(R.string.app_name),
modifier = Modifier.padding(horizontal = 28.dp, vertical = 24.dp),
style = MaterialTheme.typography.titleLarge,
color = MaterialTheme.colorScheme.primary
color = MaterialTheme.colorScheme.primary,
)
}
tabs.forEach { drawerItem ->
mainTabs.forEach { drawerItem ->
val selected = drawerItem.start == currentDestination
DrawerItem(
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding),
destination = drawerItem,
icon = if (selected) drawerItem.selectedIcon else drawerItem.defaultIcon,
selected = selected,
onClick = onItemClick
onClick = onItemClick,
)
}
// Top bar (and settings button in it) is not visible for compact height
if (LocalWindowSize.current.heightSizeClass == WindowHeightSizeClass.Compact) {
HorizontalDivider(Modifier.padding(horizontal = 12.dp, vertical = 8.dp))
additionalTabs.forEach { drawerItem ->
val selected = drawerItem.start == currentDestination
DrawerItem(
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding),
destination = DrawerItem.Settings,
icon = DrawerItem.Settings.defaultIcon,
selected = false,
onClick = onItemClick
destination = drawerItem,
icon = if (selected) drawerItem.selectedIcon else drawerItem.defaultIcon,
selected = selected,
onClick = onItemClick,
)
}
}
@ -109,13 +108,18 @@ internal fun ColumnScope.SheetContent(
private fun PreviewDrawerSheet() {
Column {
SheetContent(
tabs = listOf(
mainTabs = listOf(
DrawerItem.Calculator,
DrawerItem.Calculator,
DrawerItem.Calculator,
),
additionalTabs = listOf(
DrawerItem.Calculator,
DrawerItem.Calculator,
DrawerItem.Calculator,
),
currentDestination = DrawerItem.Calculator.start,
onItemClick = {}
onItemClick = {},
)
}
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.annotation.FloatRange
import androidx.compose.animation.core.Spring
@ -56,12 +56,12 @@ fun Slider(
value: Float,
valueRange: ClosedFloatingPointRange<Float>,
onValueChange: (Float) -> Unit,
onValueChangeFinished: (Float) -> Unit = {}
onValueChangeFinished: (Float) -> Unit = {},
) {
val animated = animateFloatAsState(
targetValue = value.roundToInt().toFloat(),
animationSpec = spring(),
label = "Thumb animation"
label = "Thumb animation",
)
Slider(
@ -81,14 +81,14 @@ private fun SquigglyTrack(
@FloatRange(0.0, 1.0) waveHeight: Float = 0.7f,
strokeWidth: Float = 15f,
filledColor: Color = MaterialTheme.colorScheme.primary,
unfilledColor: Color = MaterialTheme.colorScheme.surfaceVariant
unfilledColor: Color = MaterialTheme.colorScheme.surfaceVariant,
) {
val coroutineScope = rememberCoroutineScope()
var direct by remember { mutableFloatStateOf(waveHeight * (100f - strokeWidth * 2f ) / 100f ) }
var direct by remember { mutableFloatStateOf(waveHeight * (100f - strokeWidth * 2f) / 100f) }
val animatedDirect = animateFloatAsState(
targetValue = direct,
animationSpec = spring(stiffness = Spring.StiffnessLow),
label = "Track animation"
label = "Track animation",
)
LaunchedEffect(sliderState.value) {
@ -101,7 +101,7 @@ private fun SquigglyTrack(
Canvas(
modifier = Modifier
.fillMaxWidth()
.height(20.dp)
.height(20.dp),
) {
val width = size.width
val height = size.height
@ -114,7 +114,7 @@ private fun SquigglyTrack(
val path = Path().apply {
moveTo(
x = initialOffset,
y = height.times(0.5f)
y = height.times(0.5f),
)
val amount = ceil(width.div(eachWaveWidth))
@ -125,7 +125,7 @@ private fun SquigglyTrack(
dx1 = eachWaveWidth * 0.5f,
dy1 = height.times(peek),
dx2 = eachWaveWidth,
dy2 = 0f
dy2 = 0f,
)
}
}
@ -135,12 +135,12 @@ private fun SquigglyTrack(
left = 0f,
right = thumbPosition,
bottom = height,
clipOp = ClipOp.Intersect
clipOp = ClipOp.Intersect,
) {
drawPath(
path = path,
color = filledColor,
style = Stroke(strokeWidth, cap = StrokeCap.Round)
style = Stroke(strokeWidth, cap = StrokeCap.Round),
)
}
@ -149,7 +149,7 @@ private fun SquigglyTrack(
start = Offset(thumbPosition, height.times(0.5f)),
end = Offset(width, height.times(0.5f)),
strokeWidth = strokeWidth,
cap = StrokeCap.Round
cap = StrokeCap.Round,
)
}
}
@ -162,9 +162,9 @@ private fun SquigglyTrack(
private fun PreviewNewSlider() {
var currentValue by remember { mutableFloatStateOf(9f) }
com.sadellie.unitto.core.ui.common.Slider(
app.myzel394.numberhub.core.ui.common.Slider(
value = currentValue,
valueRange = 0f..16f,
onValueChange = { currentValue = it }
onValueChange = { currentValue = it },
)
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.animateDpAsState
@ -70,7 +70,7 @@ fun Switch(
)
val thumbOffset = animateDpAsState(
targetValue = if (checked) ThumbPaddingEnd else ThumbPaddingStart,
label = "Thumb offset"
label = "Thumb offset",
)
Box(
@ -81,15 +81,15 @@ fun Switch(
enabled = true,
onClickLabel = null,
role = Role.Switch,
onClick = { onCheckedChange(!checked) }
onClick = { onCheckedChange(!checked) },
)
.background(trackColor.value, CircleShape)
.size(TrackWidth, TrackHeight)
.border(
TrackOutlineWidth,
borderColor(enabled, checked, colors),
CircleShape
)
CircleShape,
),
) {
Box(
modifier = Modifier
@ -100,7 +100,7 @@ fun Switch(
)
.align(Alignment.CenterStart)
.background(thumbColor.value, CircleShape)
.size(thumbSize.value)
.size(thumbSize.value),
)
}
}
@ -109,7 +109,7 @@ fun Switch(
private fun trackColor(
enabled: Boolean,
checked: Boolean,
colors: SwitchColors
colors: SwitchColors,
): Color =
if (enabled) {
if (checked) colors.checkedTrackColor else colors.uncheckedTrackColor
@ -121,7 +121,7 @@ private fun trackColor(
private fun thumbColor(
enabled: Boolean,
checked: Boolean,
colors: SwitchColors
colors: SwitchColors,
): Color =
if (enabled) {
if (checked) colors.checkedThumbColor else colors.uncheckedThumbColor
@ -133,7 +133,7 @@ private fun thumbColor(
private fun borderColor(
enabled: Boolean,
checked: Boolean,
colors: SwitchColors
colors: SwitchColors,
): Color =
if (enabled) {
if (checked) colors.checkedBorderColor else colors.uncheckedBorderColor
@ -156,6 +156,6 @@ fun PreviewPixelSwitch() {
var checked by remember { mutableStateOf(false) }
Switch(
checked = checked,
onCheckedChange = { checked = !checked }
onCheckedChange = { checked = !checked },
)
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common
package app.myzel394.numberhub.core.ui.common
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.BoxWithConstraints
@ -34,11 +34,11 @@ fun ColumnWithConstraints(
modifier: Modifier = Modifier,
verticalArrangement: Arrangement.Vertical = Arrangement.Top,
horizontalAlignment: Alignment.Horizontal = Alignment.Start,
content: @Composable (ColumnScope.(BoxWithConstraintsScope)-> Unit)
content: @Composable (ColumnScope.(BoxWithConstraintsScope) -> Unit),
) = BoxWithConstraints(modifier) {
Column(
verticalArrangement = verticalArrangement,
horizontalAlignment = horizontalAlignment
horizontalAlignment = horizontalAlignment,
) { content(this@BoxWithConstraints) }
}
@ -47,10 +47,10 @@ fun RowWithConstraints(
modifier: Modifier = Modifier,
horizontalArrangement: Arrangement.Horizontal = Arrangement.Start,
verticalAlignment: Alignment.Vertical = Alignment.Top,
content: @Composable (RowScope.(BoxWithConstraintsScope)-> Unit)
content: @Composable (RowScope.(BoxWithConstraintsScope) -> Unit),
) = BoxWithConstraints(modifier) {
Row(
horizontalArrangement = horizontalArrangement,
verticalAlignment = verticalAlignment
verticalAlignment = verticalAlignment,
) { content(this@BoxWithConstraints) }
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.autosize
package app.myzel394.numberhub.core.ui.common.autosize
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.BoxWithConstraintsScope
@ -43,54 +43,6 @@ import androidx.compose.ui.unit.TextUnit
import kotlin.math.min
import kotlin.math.roundToInt
// HUGE performance drop. Don't use for buttons
///**
// * Composable function that automatically adjusts the text size to fit within given constraints using AnnotatedString, considering the ratio of line spacing to text size.
// *
// * Features:
// * Similar to AutoSizeText(String), with support for AnnotatedString.
// *
// * @param inlineContent a map storing composables that replaces certain ranges of the text, used to
// * insert composables into text layout. See [InlineTextContent].
// * @see AutoSizeText
// */
//@Composable
//internal fun AutoSizeText(
// text: AnnotatedString,
// modifier: Modifier = Modifier,
// minRatio: Float = 1f,
// maxTextSize: TextUnit = TextUnit.Unspecified,
// alignment: Alignment = Alignment.TopStart,
// overflow: TextOverflow = TextOverflow.Clip,
// softWrap: Boolean = true,
// maxLines: Int = Int.MAX_VALUE,
// minLines: Int = 1,
// inlineContent: Map<String, InlineTextContent> = mapOf(),
// onTextLayout: (TextLayoutResult) -> Unit = {},
// style: TextStyle = LocalTextStyle.current,
//) = AutoSizeTextStyleBox(
// modifier = modifier,
// text = text,
// maxTextSize = maxTextSize,
// maxLines = maxLines,
// minLines = minLines,
// softWrap = softWrap,
// style = style,
// minRatio = minRatio,
// alignment = alignment
//) {
// Text(
// text = text,
// overflow = overflow,
// softWrap = softWrap,
// maxLines = maxLines,
// minLines = minLines,
// inlineContent = inlineContent,
// onTextLayout = onTextLayout,
// style = LocalTextStyle.current,
// )
//}
/**
* [BoxWithConstraints] with [autoTextStyle] passed via [LocalTextStyle].
*
@ -122,11 +74,11 @@ internal fun AutoSizeTextStyleBox(
style: TextStyle,
minRatio: Float,
alignment: Alignment,
content: @Composable () -> Unit
content: @Composable () -> Unit,
) {
val density = LocalDensity.current
CompositionLocalProvider(
LocalDensity provides Density(density = density.density, fontScale = 1F)
LocalDensity provides Density(density = density.density, fontScale = 1F),
) {
BoxWithConstraints(
modifier = modifier,
@ -141,12 +93,12 @@ internal fun AutoSizeTextStyleBox(
style = style,
alignment = alignment,
density = density,
minRatio = minRatio
minRatio = minRatio,
)
CompositionLocalProvider(
value = LocalTextStyle.provides(autoTextStyle),
content = content
content = content,
)
}
}
@ -290,10 +242,11 @@ private fun <E> IntProgression.findElectedValue(
var high = last
while (low <= high) {
val mid = low + (high - low) / 2
if (shouldMoveBackward(transform(mid)))
if (shouldMoveBackward(transform(mid))) {
high = mid - 1
else
} else {
low = mid + 1
}
}
transform(high.coerceAtLeast(minimumValue = first))
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.autosize
package app.myzel394.numberhub.core.ui.common.autosize
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.DpSize
@ -27,5 +27,8 @@ import androidx.compose.ui.unit.isSpecified
internal fun Density.roundToPx(sp: TextUnit): Int = sp.roundToPx()
internal fun Density.toSp(px: Int): TextUnit = px.toSp()
internal fun Density.toIntSize(dpSize: DpSize): IntSize =
if (dpSize.isSpecified) IntSize(dpSize.width.roundToPx(), dpSize.height.roundToPx())
else IntSize.Zero
if (dpSize.isSpecified) {
IntSize(dpSize.width.roundToPx(), dpSize.height.roundToPx())
} else {
IntSize.Zero
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.datetimepicker
package app.myzel394.numberhub.core.ui.common.datetimepicker
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
@ -43,7 +43,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.DialogProperties
import com.sadellie.unitto.core.base.R
import app.myzel394.numberhub.core.base.R
import java.time.Instant
import java.time.LocalDateTime
import java.time.ZoneId
@ -67,7 +67,7 @@ fun DatePickerDialog(
BasicAlertDialog(
onDismissRequest = onDismiss,
modifier = modifier.wrapContentHeight(),
properties = DialogProperties(usePlatformDefaultWidth = false)
properties = DialogProperties(usePlatformDefaultWidth = false),
) {
Surface(
modifier = modifier
@ -83,15 +83,14 @@ fun DatePickerDialog(
Box(
modifier = Modifier
.align(Alignment.End)
.padding(_dialogButtonsPadding)
.padding(_dialogButtonsPadding),
) {
AlertDialogFlowRow(
mainAxisSpacing = _dialogButtonsMainAxisSpacing,
crossAxisSpacing = _dialogButtonsCrossAxisSpacing
crossAxisSpacing = _dialogButtonsCrossAxisSpacing,
) {
TextButton(
onClick = onDismiss
onClick = onDismiss,
) {
Text(text = dismissLabel)
}
@ -100,16 +99,17 @@ fun DatePickerDialog(
val millis = pickerState.selectedDateMillis ?: return@TextButton
val date = LocalDateTime.ofInstant(
Instant.ofEpochMilli(millis), ZoneId.systemDefault()
Instant.ofEpochMilli(millis),
ZoneId.systemDefault(),
)
onConfirm(
localDateTime
.withYear(date.year)
.withMonth(date.monthValue)
.withDayOfMonth(date.dayOfMonth)
.withDayOfMonth(date.dayOfMonth),
)
}
},
) {
Text(text = confirmLabel)
}
@ -125,7 +125,7 @@ fun DatePickerDialog(
private fun AlertDialogFlowRow(
mainAxisSpacing: Dp,
crossAxisSpacing: Dp,
content: @Composable () -> Unit
content: @Composable () -> Unit,
) {
Layout(content) { measurables, constraints ->
val sequences = mutableListOf<List<Placeable>>()
@ -193,14 +193,16 @@ private fun AlertDialogFlowRow(
val mainAxisPositions = IntArray(childrenMainAxisSizes.size) { 0 }
with(arrangement) {
arrange(
mainAxisLayoutSize, childrenMainAxisSizes,
layoutDirection, mainAxisPositions
mainAxisLayoutSize,
childrenMainAxisSizes,
layoutDirection,
mainAxisPositions,
)
}
placeables.forEachIndexed { j, placeable ->
placeable.place(
x = mainAxisPositions[j],
y = crossAxisPositions[i]
y = crossAxisPositions[i],
)
}
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.datetimepicker
package app.myzel394.numberhub.core.ui.common.datetimepicker
import android.text.format.DateFormat
import androidx.compose.foundation.background
@ -59,7 +59,7 @@ import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.DialogProperties
import androidx.compose.ui.zIndex
import com.sadellie.unitto.core.base.R
import app.myzel394.numberhub.core.base.R
// https://cs.android.com/androidx/platform/tools/dokka-devsite-plugin/+/master:testData/compose/samples/material3/samples/TimePickerSamples.kt
@Composable
@ -73,7 +73,7 @@ fun TimePickerDialog(
val pickerState = rememberTimePickerState(
initialHour = hour,
initialMinute = minute,
is24Hour = DateFormat.is24HourFormat(LocalContext.current)
is24Hour = DateFormat.is24HourFormat(LocalContext.current),
)
val configuration = LocalConfiguration.current
var showingPicker by rememberSaveable { mutableStateOf(true) }
@ -81,8 +81,8 @@ fun TimePickerDialog(
BasicAlertDialog(
onDismissRequest = onCancel,
properties = DialogProperties(
usePlatformDefaultWidth = false
)
usePlatformDefaultWidth = false,
),
) {
Surface(
shape = MaterialTheme.shapes.extraLarge,
@ -92,7 +92,7 @@ fun TimePickerDialog(
.height(IntrinsicSize.Min)
.background(
shape = MaterialTheme.shapes.extraLarge,
color = MaterialTheme.colorScheme.surface
color = MaterialTheme.colorScheme.surface,
),
) {
if (configuration.screenHeightDp > 400) {
@ -103,7 +103,7 @@ fun TimePickerDialog(
.fillMaxSize()
.semantics {
isTraversalGroup = true
}
},
) {
IconButton(
modifier = Modifier
@ -114,7 +114,8 @@ fun TimePickerDialog(
.size(64.dp, 72.dp)
.align(Alignment.BottomStart)
.zIndex(5f),
onClick = { showingPicker = !showingPicker }) {
onClick = { showingPicker = !showingPicker },
) {
val icon = if (showingPicker) {
Icons.Outlined.Keyboard
} else {
@ -122,21 +123,21 @@ fun TimePickerDialog(
}
Icon(
imageVector = icon,
contentDescription = stringResource(R.string.select_time_label)
contentDescription = stringResource(R.string.select_time_label),
)
}
}
}
Column(
modifier = Modifier.padding(24.dp),
horizontalAlignment = Alignment.CenterHorizontally
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text(
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 20.dp),
text = stringResource(R.string.select_time_label),
style = MaterialTheme.typography.labelMedium
style = MaterialTheme.typography.labelMedium,
)
if (showingPicker && configuration.screenHeightDp > 400) {
TimePicker(state = pickerState)
@ -146,14 +147,14 @@ fun TimePickerDialog(
Row(
modifier = Modifier
.height(40.dp)
.fillMaxWidth()
.fillMaxWidth(),
) {
Spacer(modifier = Modifier.weight(1f))
TextButton(
onClick = onCancel
onClick = onCancel,
) { Text(stringResource(R.string.cancel_label)) }
TextButton(
onClick = { onConfirm(pickerState.hour, pickerState.minute) }
onClick = { onConfirm(pickerState.hour, pickerState.minute) },
) { Text(confirmLabel) }
}
}

View File

@ -16,6 +16,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons
package app.myzel394.numberhub.core.ui.common.icons
object IconPack

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.ArCos: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.ArSin: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.AcTan: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Backspace: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Brackets: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Clear: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Comma: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Cos: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Deg: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Divide: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Dot: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Equal: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Euler: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Ex: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Factorial: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Inv: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Key0: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Key1: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Key2: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Key3: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Key4: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Key5: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Key6: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Key7: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.core.ui.common.icons.iconpack
@file:Suppress("ktlint:standard:property-naming")
package app.myzel394.numberhub.core.ui.common.icons.iconpack
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
@ -27,7 +29,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.sadellie.unitto.core.ui.common.icons.IconPack
import app.myzel394.numberhub.core.ui.common.icons.IconPack
@Suppress("UnusedReceiverParameter")
val IconPack.Key8: ImageVector

Some files were not shown because too many files have changed in this diff Show More