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%" /> <img src="./fastlane/metadata/android/en-US/images/phoneScreenshots/slide5.png" width="19%" />
</p> </p>
# 📲 Download ## Notice
<p align="middle"> This app was originally created by [sadellie](https://github.com/sadellie).
<a href="https://play.google.com/store/apps/details?id=com.sadellie.unitto"><img alt="Google Play" src="./content/gplay.svg" height="60"></a> Unfortunately, it has been archived on March 1st, 2024 (https://github.com/sadellie/unitto)
<a href="https://f-droid.org/packages/com.sadellie.unitto"><img alt="F-Droid" src="./content/fdroid.svg" height="60"/></a> without any notice or explanation.
<a href="https://github.com/sadellie/unitto/releases/latest"><img alt="GitHub" src="./content/github.svg" height="60"/></a> Since there has been no activity from sadellie on GitHub since then, I guess
</p> they are not actively working on projects anymore.
Prefer _Google Play_ 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.
# 💁‍♀️ Contribute I will review and merge your pull requests.
<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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,10 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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 android.app.Application
import dagger.hilt.android.HiltAndroidApp import dagger.hilt.android.HiltAndroidApp
@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/>. * 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.fadeIn
import androidx.compose.animation.fadeOut import androidx.compose.animation.fadeOut
@ -26,14 +26,13 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost import androidx.navigation.compose.NavHost
import com.sadellie.unitto.feature.bodymass.navigation.bodyMassGraph import app.myzel394.numberhub.feature.bodymass.navigation.bodyMassGraph
import com.sadellie.unitto.feature.calculator.navigation.calculatorGraph import app.myzel394.numberhub.feature.calculator.navigation.calculatorGraph
import com.sadellie.unitto.feature.converter.navigation.converterGraph import app.myzel394.numberhub.feature.converter.navigation.converterGraph
import com.sadellie.unitto.feature.datecalculator.navigation.dateCalculatorGraph import app.myzel394.numberhub.feature.datecalculator.navigation.dateCalculatorGraph
import com.sadellie.unitto.feature.settings.navigation.navigateToSettings import app.myzel394.numberhub.feature.settings.navigation.navigateToUnitGroups
import com.sadellie.unitto.feature.settings.navigation.navigateToUnitGroups import app.myzel394.numberhub.feature.settings.navigation.settingGraph
import com.sadellie.unitto.feature.settings.navigation.settingGraph import app.myzel394.numberhub.feature.timezone.navigation.timeZoneGraph
import com.sadellie.unitto.feature.timezone.navigation.timeZoneGraph
import io.github.sadellie.themmo.ThemmoController import io.github.sadellie.themmo.ThemmoController
@Composable @Composable
@ -42,47 +41,41 @@ internal fun UnittoNavigation(
themmoController: ThemmoController, themmoController: ThemmoController,
startDestination: String, startDestination: String,
openDrawer: () -> Unit, openDrawer: () -> Unit,
rpnMode: Boolean,
) { ) {
NavHost( NavHost(
navController = navController, navController = navController,
startDestination = startDestination, startDestination = startDestination,
modifier = Modifier.background(MaterialTheme.colorScheme.background), modifier = Modifier.background(MaterialTheme.colorScheme.background),
enterTransition = { fadeIn() }, enterTransition = { fadeIn() },
exitTransition = { fadeOut() } exitTransition = { fadeOut() },
) { ) {
calculatorGraph(
openDrawer = openDrawer,
)
converterGraph( converterGraph(
openDrawer = openDrawer, openDrawer = openDrawer,
navController = navController, navController = navController,
navigateToSettings = navController::navigateToSettings, navigateToUnitGroups = navController::navigateToUnitGroups,
navigateToUnitGroups = navController::navigateToUnitGroups
)
settingGraph(
themmoController = themmoController,
navController = navController
)
calculatorGraph(
openDrawer = openDrawer,
rpnMode = rpnMode,
navigateToSettings = navController::navigateToSettings
) )
dateCalculatorGraph( dateCalculatorGraph(
navigateToMenu = openDrawer, openDrawer = openDrawer,
navigateToSettings = navController::navigateToSettings
) )
timeZoneGraph( timeZoneGraph(
navigateToMenu = openDrawer, openDrawer = openDrawer,
navigateToSettings = navController::navigateToSettings,
navController = navController, navController = navController,
) )
bodyMassGraph( bodyMassGraph(
openDrawer = openDrawer, 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/>. * 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.app.PendingIntent
import android.content.Intent import android.content.Intent
import android.os.Build import android.os.Build
@ -26,6 +27,7 @@ import androidx.annotation.RequiresApi
@RequiresApi(Build.VERSION_CODES.N) @RequiresApi(Build.VERSION_CODES.N)
class UnittoTileService : TileService() { class UnittoTileService : TileService() {
@SuppressLint("StartActivityAndCollapseDeprecated")
override fun onClick() { override fun onClick() {
super.onClick() super.onClick()
@ -33,7 +35,7 @@ class UnittoTileService : TileService() {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startActivityAndCollapse(PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE)) startActivityAndCollapse(PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE))
} else { } else {
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
startActivityAndCollapse(intent) startActivityAndCollapse(intent)

View File

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

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@
*/ */
import com.android.build.api.variant.ApplicationAndroidComponentsExtension 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.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType import org.gradle.kotlin.dsl.getByType

View File

@ -17,7 +17,7 @@
*/ */
import com.android.build.api.variant.LibraryAndroidComponentsExtension 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.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType import org.gradle.kotlin.dsl.getByType

View File

@ -17,7 +17,7 @@
*/ */
import com.android.build.gradle.TestExtension 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.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.configure

View File

@ -17,7 +17,7 @@
*/ */
import com.android.build.api.dsl.LibraryExtension 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.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension import org.gradle.api.artifacts.VersionCatalogsExtension

View File

@ -17,7 +17,7 @@
*/ */
import com.android.build.api.dsl.LibraryExtension 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.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension import org.gradle.api.artifacts.VersionCatalogsExtension

View File

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

View File

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

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Project
import org.gradle.api.artifacts.VersionCatalog import org.gradle.api.artifacts.VersionCatalog

View File

@ -22,7 +22,7 @@ plugins {
} }
android { android {
namespace = "com.sadellie.unitto.core.base" namespace = "app.myzel394.numberhub.core.base"
defaultConfig { defaultConfig {
stringConfigField("VERSION_NAME", libs.versions.versionName.get()) stringConfigField("VERSION_NAME", libs.versions.versionName.get())
@ -33,13 +33,13 @@ android {
getByName("playStore") { getByName("playStore") {
stringConfigField( stringConfigField(
"STORE_LINK", "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") { getByName("fdroid") {
stringConfigField( stringConfigField(
"STORE_LINK", "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/>. * 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/>. * 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 * Output format here means whether or not use engineering notation
@ -24,8 +24,10 @@ package com.sadellie.unitto.core.base
object OutputFormat { object OutputFormat {
// Never use engineering notation // Never use engineering notation
const val PLAIN = 0 const val PLAIN = 0
// Use format that a lower API returns // Use format that a lower API returns
const val ALLOW_ENGINEERING = 1 const val ALLOW_ENGINEERING = 1
// App will try it's best to use engineering notation // App will try it's best to use engineering notation
const val FORCE_ENGINEERING = 2 const val FORCE_ENGINEERING = 2
} }

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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. * 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/>. * 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") @Suppress("ObjectPropertyName")
object Token { object Token {
const val SPACE = " "
const val PERIOD = "."
const val COMMA = ","
object Digit { object Digit {
const val _1 = "1" const val _1 = "1"
const val _2 = "2" const val _2 = "2"
@ -96,14 +102,14 @@ object Token {
val all by lazy { val all by lazy {
listOf( listOf(
arsin, arcos, actan, sin, cos, tan, log, exp, ln arsin, arcos, actan, sin, cos, tan, log, exp, ln,
).sortedByDescending { it.length } ).sortedByDescending { it.length }
} }
val allWithOpeningBracket by lazy { val allWithOpeningBracket by lazy {
listOf( listOf(
arsinBracket, arcosBracket, actanBracket, sinBracket, cosBracket, tanBracket, arsinBracket, arcosBracket, actanBracket, sinBracket, cosBracket, tanBracket,
logBracket, expBracket, lnBracket logBracket, expBracket, lnBracket,
) )
} }
} }
@ -140,7 +146,7 @@ object Token {
Operator.multiply to listOf("*", ""), Operator.multiply to listOf("*", ""),
Func.arsin to listOf("arsin"), Func.arsin to listOf("arsin"),
Func.arcos to listOf("arcos"), 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/>. * 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 // Don't touch, users have "..._route" in their settings
object TopLevelDestinations { 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 --> <!-- https://s3.eu-west-1.amazonaws.com/po-pub/i/QNmUuI88wb1Fm5P8wRIZajZF.png -->
<string name="add_label">Add</string> <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 --> <!-- Person's height -->
<string name="body_mass_height">Height</string> <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 --> https://s3.eu-west-1.amazonaws.com/po-pub/i/1oIHPj16krI0jyLmg4JaP2mk.png -->
<!-- Screen readers (accessibility) --> <!-- Screen readers (accessibility) -->
<string name="selected_item">Selected item</string> <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> <string name="settings_about_unitto_support">Learn about the app</string>
<!-- https://s3.eu-west-1.amazonaws.com/po-pub/i/p3aY3IWUI5m9Vjs6vZP3EXAo.png --> <!-- 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_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_currency_rates_note_title">Wrong currency rates?</string>
<string name="settings_dark_mode">Dark</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_disable_unit_group_description">Disable unit group</string>
<string name="settings_display">Display</string> <string name="settings_display">Display</string>
<string name="settings_display_support">App look and feel</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_system_font_support">Use system font for texts in app</string>
<string name="settings_terms_and_conditions">Terms and Conditions</string> <string name="settings_terms_and_conditions">Terms and Conditions</string>
<string name="settings_third_party_licenses">Third party licenses</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_title">Settings</string>
<string name="settings_translate_app">Translate this app</string> <string name="settings_translate_app">Translate this app</string>
<string name="settings_translate_app_support">Join POEditor project to help</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="settings_view_source_code">View source code</string>
<string name="time_zone_add_title">Add time zone</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 --> <!-- https://s3.eu-west-1.amazonaws.com/po-pub/i/UCrz06kaEYxCGAE73ZLl9EtX.png -->
<string name="time_zone_no_results_button">Read the article</string> <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/>. * 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.Assert
import org.junit.Test import org.junit.Test
@ -42,4 +42,4 @@ class OutputFormatTest {
fun testOutputFormatForceEngineering() { fun testOutputFormatForceEngineering() {
Assert.assertEquals(2, OutputFormat.FORCE_ENGINEERING) Assert.assertEquals(2, OutputFormat.FORCE_ENGINEERING)
} }
} }

View File

@ -16,12 +16,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Assert
import org.junit.Test import org.junit.Test
class TokenTest { class TokenTest {
@Test
fun testFormatterSymbols() {
Assert.assertEquals(" ", Token.SPACE)
Assert.assertEquals(".", Token.PERIOD)
Assert.assertEquals(",", Token.COMMA)
}
@Test @Test
fun testDigit() { fun testDigit() {
Assert.assertEquals("1234567890", Token.Digit.all.joinToString("")) Assert.assertEquals("1234567890", Token.Digit.all.joinToString(""))
@ -126,7 +134,7 @@ class TokenTest {
"e", "e",
).joinToString("") ).joinToString("")
Assert.assertEquals("1234567890.$operator$func$consts", Token.expressionTokens.joinToString("")) Assert.assertEquals("1234567890.$operator$func${consts}E", Token.expressionTokens.joinToString(""))
} }
@Test @Test
@ -142,9 +150,14 @@ class TokenTest {
@Test @Test
fun testSexyToUgly() { fun testSexyToUgly() {
listOf( listOf(
"", "÷", "×", "sin⁻¹", "cos⁻¹", "tan⁻¹" "",
"÷",
"×",
"sin⁻¹",
"cos⁻¹",
"tan⁻¹",
).forEach { ).forEach {
assert(it in Token.sexyToUgly.keys) 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") 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 // Workaround from https://github.com/robolectric/robolectric/pull/4736
android.testOptions.unitTests.isIncludeAndroidResources = true android.testOptions.unitTests.isIncludeAndroidResources = true

View File

@ -16,11 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.activity.ComponentActivity
import androidx.compose.ui.test.junit4.createAndroidComposeRule 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.Assert.assertEquals
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
@ -28,7 +28,7 @@ import java.time.ZonedDateTime
class ZonedDateTimeUtilsTest { class ZonedDateTimeUtilsTest {
@get: Rule @get:Rule
val composeTestRule = createAndroidComposeRule<ComponentActivity>() val composeTestRule = createAndroidComposeRule<ComponentActivity>()
@Test @Test

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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 androidx.compose.runtime.compositionLocalOf

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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 androidx.compose.runtime.compositionLocalOf
import java.util.Locale import java.util.Locale

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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 android.app.Activity
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
@ -36,9 +36,10 @@ import androidx.compose.ui.util.fastForEach
import androidx.window.layout.WindowMetricsCalculator import androidx.window.layout.WindowMetricsCalculator
val LocalWindowSize: ProvidableCompositionLocal<WindowSizeClass> = compositionLocalOf { val LocalWindowSize: ProvidableCompositionLocal<WindowSizeClass> = compositionLocalOf {
WindowSizeClass.calculateFromSize( // Phone in portrait mode
size = Size.Zero, WindowSizeClass(
density = defaultDensity heightSizeClass = WindowHeightSizeClass.Medium,
widthSizeClass = WindowWidthSizeClass.Compact,
) )
} }
@ -80,9 +81,9 @@ fun calculateWindowSizeClass(activity: Activity): WindowSizeClass {
* @property heightSizeClass height-based window size class ([WindowHeightSizeClass]) * @property heightSizeClass height-based window size class ([WindowHeightSizeClass])
*/ */
@Immutable @Immutable
class WindowSizeClass private constructor( class WindowSizeClass(
val widthSizeClass: WindowWidthSizeClass, val widthSizeClass: WindowWidthSizeClass,
val heightSizeClass: WindowHeightSizeClass val heightSizeClass: WindowHeightSizeClass,
) { ) {
companion object { companion object {
/** /**
@ -117,7 +118,7 @@ class WindowSizeClass private constructor(
supportedWidthSizeClasses: Set<WindowWidthSizeClass> = supportedWidthSizeClasses: Set<WindowWidthSizeClass> =
WindowWidthSizeClass.DefaultSizeClasses, WindowWidthSizeClass.DefaultSizeClasses,
supportedHeightSizeClasses: Set<WindowHeightSizeClass> = supportedHeightSizeClasses: Set<WindowHeightSizeClass> =
WindowHeightSizeClass.DefaultSizeClasses WindowHeightSizeClass.DefaultSizeClasses,
): WindowSizeClass { ): WindowSizeClass {
val windowWidthSizeClass = val windowWidthSizeClass =
WindowWidthSizeClass.fromWidth(size.width, density, supportedWidthSizeClasses) 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] */ /** Calculates the [WindowWidthSizeClass] for a given [width] */
internal fun fromWidth(width: Dp): WindowWidthSizeClass { internal fun fromWidth(width: Dp): WindowWidthSizeClass {
return fromWidth( 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( internal fun fromWidth(
width: Float, width: Float,
density: Density, density: Density,
supportedSizeClasses: Set<WindowWidthSizeClass> supportedSizeClasses: Set<WindowWidthSizeClass>,
): WindowWidthSizeClass { ): WindowWidthSizeClass {
require(width >= 0) { "Width must not be negative" } require(width >= 0) { "Width must not be negative" }
require(supportedSizeClasses.isNotEmpty()) { "Must support at least one size class" } 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] */ /** Calculates the [WindowHeightSizeClass] for a given [height] */
internal fun fromHeight(height: Dp): WindowHeightSizeClass { internal fun fromHeight(height: Dp): WindowHeightSizeClass {
return fromHeight( 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( internal fun fromHeight(
height: Float, height: Float,
density: Density, density: Density,
supportedSizeClasses: Set<WindowHeightSizeClass> supportedSizeClasses: Set<WindowHeightSizeClass>,
): WindowHeightSizeClass { ): WindowHeightSizeClass {
require(height >= 0) { "Width must not be negative" } require(height >= 0) { "Width must not be negative" }
require(supportedSizeClasses.isNotEmpty()) { "Must support at least one size class" } 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/>. * 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.AnimatedContentScope
import androidx.compose.animation.AnimatedContentTransitionScope import androidx.compose.animation.AnimatedContentTransitionScope
@ -44,16 +44,22 @@ fun NavGraphBuilder.unittoComposable(
route: String, route: String,
arguments: List<NamedNavArgument> = emptyList(), arguments: List<NamedNavArgument> = emptyList(),
deepLinks: List<NavDeepLink> = emptyList(), deepLinks: List<NavDeepLink> = emptyList(),
enterTransition: (@JvmSuppressWildcards enterTransition: (
AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)? = { unittoFadeIn() }, @JvmSuppressWildcards
exitTransition: (@JvmSuppressWildcards AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?
AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)? = { unittoFadeOut() }, )? = { unittoFadeIn() },
popEnterTransition: (@JvmSuppressWildcards exitTransition: (
AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)? = @JvmSuppressWildcards
enterTransition, AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?
popExitTransition: (@JvmSuppressWildcards )? = { unittoFadeOut() },
AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)? = popEnterTransition: (
exitTransition, @JvmSuppressWildcards
AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?
)? = enterTransition,
popExitTransition: (
@JvmSuppressWildcards
AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?
)? = exitTransition,
content: @Composable AnimatedContentScope.(NavBackStackEntry) -> Unit, content: @Composable AnimatedContentScope.(NavBackStackEntry) -> Unit,
): Unit = composable( ): Unit = composable(
route = route, route = route,
@ -79,22 +85,26 @@ fun NavGraphBuilder.unittoStackedComposable(
enterTransition = { enterTransition = {
slideInHorizontally( slideInHorizontally(
animationSpec = unittoEnterTween(), animationSpec = unittoEnterTween(),
initialOffsetX = { (it * 0.2f).toInt() }) + unittoFadeIn() initialOffsetX = { (it * 0.2f).toInt() },
) + unittoFadeIn()
}, },
exitTransition = { exitTransition = {
slideOutHorizontally( slideOutHorizontally(
animationSpec = unittoExitTween(), animationSpec = unittoExitTween(),
targetOffsetX = { -(it * 0.2f).toInt() }) + unittoFadeOut() targetOffsetX = { -(it * 0.2f).toInt() },
) + unittoFadeOut()
}, },
popEnterTransition = { popEnterTransition = {
slideInHorizontally( slideInHorizontally(
animationSpec = unittoEnterTween(), animationSpec = unittoEnterTween(),
initialOffsetX = { -(it * 0.2f).toInt() }) + unittoFadeIn() initialOffsetX = { -(it * 0.2f).toInt() },
) + unittoFadeIn()
}, },
popExitTransition = { popExitTransition = {
slideOutHorizontally( slideOutHorizontally(
animationSpec = unittoExitTween(), animationSpec = unittoExitTween(),
targetOffsetX = { (it * 0.2f).toInt() }) + unittoFadeOut() targetOffsetX = { (it * 0.2f).toInt() },
) + unittoFadeOut()
}, },
content = content, content = content,
) )
@ -113,10 +123,10 @@ fun NavGraphBuilder.unittoNavigation(
exitTransition: (AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)? = exitTransition: (AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)? =
null, null,
popEnterTransition: ( popEnterTransition: (
AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition? AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?
)? = enterTransition, )? = enterTransition,
popExitTransition: ( popExitTransition: (
AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition? AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?
)? = exitTransition, )? = exitTransition,
builder: NavGraphBuilder.() -> Unit, builder: NavGraphBuilder.() -> Unit,
): Unit = navigation( ): Unit = navigation(
@ -128,7 +138,7 @@ fun NavGraphBuilder.unittoNavigation(
exitTransition = exitTransition, exitTransition = exitTransition,
popEnterTransition = popEnterTransition, popEnterTransition = popEnterTransition,
popExitTransition = popExitTransition, popExitTransition = popExitTransition,
builder = builder builder = builder,
) )
private const val ENTER_DURATION = 350 private const val ENTER_DURATION = 350

View File

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

View File

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

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.BorderStroke
import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.interaction.MutableInteractionSource
@ -50,7 +50,7 @@ fun Button(
border: BorderStroke? = null, border: BorderStroke? = null,
contentPadding: PaddingValues = ButtonDefaults.ContentPadding, contentPadding: PaddingValues = ButtonDefaults.ContentPadding,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
content: @Composable RowScope.() -> Unit content: @Composable RowScope.() -> Unit,
) { ) {
Surface( Surface(
modifier = modifier.squashable( modifier = modifier.squashable(
@ -58,7 +58,7 @@ fun Button(
onLongClick = onLongClick, onLongClick = onLongClick,
interactionSource = interactionSource, interactionSource = interactionSource,
cornerRadiusRange = 30..50, cornerRadiusRange = 30..50,
enabled = enabled enabled = enabled,
), ),
color = containerColor, color = containerColor,
contentColor = contentColor, contentColor = contentColor,
@ -70,12 +70,12 @@ fun Button(
Modifier Modifier
.defaultMinSize( .defaultMinSize(
minWidth = ButtonDefaults.MinWidth, minWidth = ButtonDefaults.MinWidth,
minHeight = ButtonDefaults.MinHeight minHeight = ButtonDefaults.MinHeight,
) )
.padding(contentPadding), .padding(contentPadding),
horizontalArrangement = Arrangement.Center, horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically, 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/>. * 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.background
import androidx.compose.foundation.border import androidx.compose.foundation.border
import androidx.compose.foundation.clickable 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.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.Settings import androidx.compose.material.icons.filled.Settings
import androidx.compose.material3.AssistChipDefaults import androidx.compose.material3.AssistChipDefaults
import androidx.compose.material3.FilterChipDefaults import androidx.compose.material3.FilterChipDefaults
@ -40,6 +40,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
@ -48,41 +49,37 @@ import androidx.compose.ui.unit.dp
@Composable @Composable
fun FilterChip( fun FilterChip(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
selected: Boolean, isSelected: Boolean,
onClick: () -> Unit, onClick: () -> Unit,
label: String, 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( Row(
modifier = modifier modifier = modifier
.background( .padding(vertical = 8.dp)
color = if (selected) MaterialTheme.colorScheme.primaryContainer else MaterialTheme.colorScheme.surface, .clip(FilterChipDefaults.shape)
shape = FilterChipDefaults.shape .clickable { onClick() }
) .background(backgroundColor.value)
.border( .border(
width = 1.dp, width = 1.dp,
color = if (selected) Color.Transparent else MaterialTheme.colorScheme.outline, color = borderColor.value,
shape = FilterChipDefaults.shape shape = FilterChipDefaults.shape,
) )
.height(FilterChipDefaults.Height) .height(FilterChipDefaults.Height)
.clickable { onClick() } .padding(horizontal = 16.dp),
.padding(start = 8.dp, end = 16.dp), verticalAlignment = Alignment.CenterVertically,
verticalAlignment = Alignment.CenterVertically
) { ) {
AnimatedVisibility(visible = selected) {
Icon(
modifier = Modifier.height(FilterChipDefaults.IconSize),
imageVector = imageVector,
contentDescription = contentDescription,
tint = MaterialTheme.colorScheme.onPrimaryContainer
)
}
Text( Text(
modifier = Modifier.padding(start = 8.dp),
text = label, text = label,
style = MaterialTheme.typography.labelLarge, 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( Row(
modifier = modifier modifier = modifier
.background( .padding(vertical = 8.dp)
color = MaterialTheme.colorScheme.surface, .clip(FilterChipDefaults.shape)
shape = AssistChipDefaults.shape .clickable { onClick() }
) .background(MaterialTheme.colorScheme.surface)
.border( .border(
width = 1.dp, width = 1.dp,
color = MaterialTheme.colorScheme.outline, color = MaterialTheme.colorScheme.outline,
shape = AssistChipDefaults.shape shape = AssistChipDefaults.shape,
) )
.height(32.dp) .height(32.dp)
.clickable { onClick() }
.padding(horizontal = 8.dp), .padding(horizontal = 8.dp),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically,
) { ) {
Icon( Icon(
modifier = Modifier.height(AssistChipDefaults.IconSize), modifier = Modifier.height(AssistChipDefaults.IconSize),
imageVector = imageVector, imageVector = imageVector,
contentDescription = contentDescription, contentDescription = contentDescription,
tint = MaterialTheme.colorScheme.onSurfaceVariant tint = MaterialTheme.colorScheme.onSurfaceVariant,
) )
} }
} }
@ -125,7 +121,7 @@ fun PreviewAssistChip() {
AssistChip( AssistChip(
onClick = {}, onClick = {},
imageVector = Icons.Default.Settings, imageVector = Icons.Default.Settings,
contentDescription = "" contentDescription = "",
) )
} }
@ -135,10 +131,8 @@ fun PreviewFilterChip() {
var isSelected by remember { mutableStateOf(true) } var isSelected by remember { mutableStateOf(true) }
FilterChip( FilterChip(
selected = isSelected, isSelected = isSelected,
onClick = { isSelected = !isSelected }, onClick = { isSelected = !isSelected },
label = "Label", 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/>. * 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.Icons
import androidx.compose.material.icons.outlined.Menu import androidx.compose.material.icons.outlined.Menu
@ -24,19 +24,19 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton import androidx.compose.material3.IconButton
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource 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. * @param onClick Action to be called when button is clicked.
*/ */
@Composable @Composable
fun MenuButton(onClick: () -> Unit) { fun DrawerButton(onClick: () -> Unit) {
IconButton(onClick = onClick) { IconButton(onClick = onClick) {
Icon( Icon(
Icons.Outlined.Menu, imageVector = Icons.Outlined.Menu,
contentDescription = stringResource(R.string.open_menu_description) 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/>. * 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.Icon
import androidx.compose.material3.NavigationDrawerItem import androidx.compose.material3.NavigationDrawerItem
@ -25,7 +25,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import com.sadellie.unitto.core.ui.model.DrawerItem import app.myzel394.numberhub.core.ui.model.DrawerItem
@Composable @Composable
internal fun DrawerItem( internal fun DrawerItem(
@ -33,13 +33,13 @@ internal fun DrawerItem(
destination: DrawerItem, destination: DrawerItem,
icon: ImageVector, icon: ImageVector,
selected: Boolean, selected: Boolean,
onClick: (DrawerItem) -> Unit onClick: (DrawerItem) -> Unit,
) { ) {
NavigationDrawerItem( NavigationDrawerItem(
modifier = modifier, modifier = modifier,
label = { Text(stringResource(destination.name)) }, label = { Text(stringResource(destination.name)) },
icon = { Icon(icon, stringResource(destination.name)) }, icon = { Icon(icon, stringResource(destination.name)) },
selected = selected, 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/>. * 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.Spacer
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.background
import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.PaddingValues
@ -43,8 +43,8 @@ fun Header(
start = 56.dp, start = 56.dp,
end = 16.dp, end = 16.dp,
top = 24.dp, top = 24.dp,
bottom = 12.dp bottom = 12.dp,
) ),
) { ) {
Text( Text(
modifier = modifier modifier = modifier
@ -53,6 +53,6 @@ fun Header(
.fillMaxWidth(), .fillMaxWidth(),
text = text, text = text,
style = MaterialTheme.typography.titleSmall, 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/>. * 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 android.view.HapticFeedbackConstants
import androidx.compose.animation.core.tween 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.graphicsLayer
import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalView import androidx.compose.ui.platform.LocalView
import com.sadellie.unitto.core.ui.LocalHapticPreference import app.myzel394.numberhub.core.ui.LocalHapticPreference
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@Composable @Composable
@ -64,15 +64,24 @@ fun BasicKeyboardButton(
Box( Box(
modifier = modifier modifier = modifier
.squashable( .squashable(
onClick = { onClick(); vibrate() }, onClick = {
onLongClick = if (onLongClick != null) { { onLongClick(); vibrate() } } else null, onClick()
vibrate()
},
onLongClick = if (onLongClick != null) {
{
onLongClick()
vibrate()
}
} else {
null
},
interactionSource = remember { MutableInteractionSource() }, interactionSource = remember { MutableInteractionSource() },
cornerRadiusRange = 30..50, cornerRadiusRange = 30..50,
animationSpec = tween(200) animationSpec = tween(200),
) )
.background(containerColor) .background(containerColor),
, contentAlignment = Alignment.Center,
contentAlignment = Alignment.Center
) { ) {
Icon( Icon(
imageVector = icon, imageVector = icon,
@ -84,7 +93,7 @@ fun BasicKeyboardButton(
scaleX = contentHeight scaleX = contentHeight
scaleY = 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
/** /**
* Mostly for additional button in portrait mode. Changes icon size inside. * Mostly for main button in portrait mode. Changes icon size inside.
*/ */
const val KeyboardButtonContentHeightTallAdditional = 1.6f const val CONTENT_HEIGHT_TALL = 1.1f
/** /**
* Mostly for main button in landscape mode. Changes icon size inside. * Mostly for additional button in portrait mode. Changes icon size inside.
*/ */
const val KeyboardButtonContentHeightShort = 1.3f const val CONTENT_HEIGHT_TALL_ADDITIONAL = 1.6f
/** /**
* Mostly for additional button in landscape mode. Changes icon size inside. * Mostly for main button in landscape mode. Changes icon size inside.
*/ */
const val KeyboardButtonContentHeightShortAdditional = 1.1f const val CONTENT_HEIGHT_SHORT = 1.3f
/**
* Mostly for additional button in landscape mode. Changes icon size inside.
*/
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/>. * 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.annotation.IntRange
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
@ -49,7 +49,7 @@ fun KeypadFlow(
columns: Int, columns: Int,
@IntRange(0, 100) horizontalPadding: Int = 10, @IntRange(0, 100) horizontalPadding: Int = 10,
@IntRange(0, 100) verticalPadding: 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 height: Float = remember { (1f - verticalPadding / 100f) / rows }
val width: Float = remember { (1f - horizontalPadding / 100f) / columns } val width: Float = remember { (1f - horizontalPadding / 100f) / columns }
@ -58,7 +58,7 @@ fun KeypadFlow(
modifier = modifier, modifier = modifier,
maxItemsInEachRow = columns, maxItemsInEachRow = columns,
horizontalArrangement = Arrangement.SpaceAround, horizontalArrangement = Arrangement.SpaceAround,
verticalArrangement = Arrangement.SpaceAround verticalArrangement = Arrangement.SpaceAround,
) { ) {
content(width, height) content(width, height)
} }

View File

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

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.LocalContentColor
import androidx.compose.material3.ProvideTextStyle import androidx.compose.material3.ProvideTextStyle

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.annotation.FloatRange
import androidx.compose.animation.core.Spring import androidx.compose.animation.core.Spring
@ -56,12 +56,12 @@ fun Slider(
value: Float, value: Float,
valueRange: ClosedFloatingPointRange<Float>, valueRange: ClosedFloatingPointRange<Float>,
onValueChange: (Float) -> Unit, onValueChange: (Float) -> Unit,
onValueChangeFinished: (Float) -> Unit = {} onValueChangeFinished: (Float) -> Unit = {},
) { ) {
val animated = animateFloatAsState( val animated = animateFloatAsState(
targetValue = value.roundToInt().toFloat(), targetValue = value.roundToInt().toFloat(),
animationSpec = spring(), animationSpec = spring(),
label = "Thumb animation" label = "Thumb animation",
) )
Slider( Slider(
@ -81,14 +81,14 @@ private fun SquigglyTrack(
@FloatRange(0.0, 1.0) waveHeight: Float = 0.7f, @FloatRange(0.0, 1.0) waveHeight: Float = 0.7f,
strokeWidth: Float = 15f, strokeWidth: Float = 15f,
filledColor: Color = MaterialTheme.colorScheme.primary, filledColor: Color = MaterialTheme.colorScheme.primary,
unfilledColor: Color = MaterialTheme.colorScheme.surfaceVariant unfilledColor: Color = MaterialTheme.colorScheme.surfaceVariant,
) { ) {
val coroutineScope = rememberCoroutineScope() 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( val animatedDirect = animateFloatAsState(
targetValue = direct, targetValue = direct,
animationSpec = spring(stiffness = Spring.StiffnessLow), animationSpec = spring(stiffness = Spring.StiffnessLow),
label = "Track animation" label = "Track animation",
) )
LaunchedEffect(sliderState.value) { LaunchedEffect(sliderState.value) {
@ -101,7 +101,7 @@ private fun SquigglyTrack(
Canvas( Canvas(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.height(20.dp) .height(20.dp),
) { ) {
val width = size.width val width = size.width
val height = size.height val height = size.height
@ -114,7 +114,7 @@ private fun SquigglyTrack(
val path = Path().apply { val path = Path().apply {
moveTo( moveTo(
x = initialOffset, x = initialOffset,
y = height.times(0.5f) y = height.times(0.5f),
) )
val amount = ceil(width.div(eachWaveWidth)) val amount = ceil(width.div(eachWaveWidth))
@ -125,7 +125,7 @@ private fun SquigglyTrack(
dx1 = eachWaveWidth * 0.5f, dx1 = eachWaveWidth * 0.5f,
dy1 = height.times(peek), dy1 = height.times(peek),
dx2 = eachWaveWidth, dx2 = eachWaveWidth,
dy2 = 0f dy2 = 0f,
) )
} }
} }
@ -135,12 +135,12 @@ private fun SquigglyTrack(
left = 0f, left = 0f,
right = thumbPosition, right = thumbPosition,
bottom = height, bottom = height,
clipOp = ClipOp.Intersect clipOp = ClipOp.Intersect,
) { ) {
drawPath( drawPath(
path = path, path = path,
color = filledColor, 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)), start = Offset(thumbPosition, height.times(0.5f)),
end = Offset(width, height.times(0.5f)), end = Offset(width, height.times(0.5f)),
strokeWidth = strokeWidth, strokeWidth = strokeWidth,
cap = StrokeCap.Round cap = StrokeCap.Round,
) )
} }
} }
@ -162,9 +162,9 @@ private fun SquigglyTrack(
private fun PreviewNewSlider() { private fun PreviewNewSlider() {
var currentValue by remember { mutableFloatStateOf(9f) } var currentValue by remember { mutableFloatStateOf(9f) }
com.sadellie.unitto.core.ui.common.Slider( app.myzel394.numberhub.core.ui.common.Slider(
value = currentValue, value = currentValue,
valueRange = 0f..16f, 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/>. * 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.animateColorAsState
import androidx.compose.animation.core.animateDpAsState import androidx.compose.animation.core.animateDpAsState
@ -70,7 +70,7 @@ fun Switch(
) )
val thumbOffset = animateDpAsState( val thumbOffset = animateDpAsState(
targetValue = if (checked) ThumbPaddingEnd else ThumbPaddingStart, targetValue = if (checked) ThumbPaddingEnd else ThumbPaddingStart,
label = "Thumb offset" label = "Thumb offset",
) )
Box( Box(
@ -81,15 +81,15 @@ fun Switch(
enabled = true, enabled = true,
onClickLabel = null, onClickLabel = null,
role = Role.Switch, role = Role.Switch,
onClick = { onCheckedChange(!checked) } onClick = { onCheckedChange(!checked) },
) )
.background(trackColor.value, CircleShape) .background(trackColor.value, CircleShape)
.size(TrackWidth, TrackHeight) .size(TrackWidth, TrackHeight)
.border( .border(
TrackOutlineWidth, TrackOutlineWidth,
borderColor(enabled, checked, colors), borderColor(enabled, checked, colors),
CircleShape CircleShape,
) ),
) { ) {
Box( Box(
modifier = Modifier modifier = Modifier
@ -100,7 +100,7 @@ fun Switch(
) )
.align(Alignment.CenterStart) .align(Alignment.CenterStart)
.background(thumbColor.value, CircleShape) .background(thumbColor.value, CircleShape)
.size(thumbSize.value) .size(thumbSize.value),
) )
} }
} }
@ -109,7 +109,7 @@ fun Switch(
private fun trackColor( private fun trackColor(
enabled: Boolean, enabled: Boolean,
checked: Boolean, checked: Boolean,
colors: SwitchColors colors: SwitchColors,
): Color = ): Color =
if (enabled) { if (enabled) {
if (checked) colors.checkedTrackColor else colors.uncheckedTrackColor if (checked) colors.checkedTrackColor else colors.uncheckedTrackColor
@ -121,7 +121,7 @@ private fun trackColor(
private fun thumbColor( private fun thumbColor(
enabled: Boolean, enabled: Boolean,
checked: Boolean, checked: Boolean,
colors: SwitchColors colors: SwitchColors,
): Color = ): Color =
if (enabled) { if (enabled) {
if (checked) colors.checkedThumbColor else colors.uncheckedThumbColor if (checked) colors.checkedThumbColor else colors.uncheckedThumbColor
@ -133,7 +133,7 @@ private fun thumbColor(
private fun borderColor( private fun borderColor(
enabled: Boolean, enabled: Boolean,
checked: Boolean, checked: Boolean,
colors: SwitchColors colors: SwitchColors,
): Color = ): Color =
if (enabled) { if (enabled) {
if (checked) colors.checkedBorderColor else colors.uncheckedBorderColor if (checked) colors.checkedBorderColor else colors.uncheckedBorderColor
@ -147,7 +147,7 @@ val TrackOutlineWidth = 1.8.dp
val SelectedHandleSize = 20.0.dp val SelectedHandleSize = 20.0.dp
val UnselectedHandleSize = 20.0.dp val UnselectedHandleSize = 20.0.dp
val ThumbPaddingStart = (TrackHeight - UnselectedHandleSize) / 2 val ThumbPaddingStart = (TrackHeight - UnselectedHandleSize) / 2
val ThumbPaddingEnd = TrackWidth - SelectedHandleSize / 2 - TrackHeight / 2 val ThumbPaddingEnd = TrackWidth - SelectedHandleSize / 2 - TrackHeight / 2
@Preview @Preview
@ -156,6 +156,6 @@ fun PreviewPixelSwitch() {
var checked by remember { mutableStateOf(false) } var checked by remember { mutableStateOf(false) }
Switch( Switch(
checked = checked, 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/>. * 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.Arrangement
import androidx.compose.foundation.layout.BoxWithConstraints import androidx.compose.foundation.layout.BoxWithConstraints
@ -34,11 +34,11 @@ fun ColumnWithConstraints(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
verticalArrangement: Arrangement.Vertical = Arrangement.Top, verticalArrangement: Arrangement.Vertical = Arrangement.Top,
horizontalAlignment: Alignment.Horizontal = Alignment.Start, horizontalAlignment: Alignment.Horizontal = Alignment.Start,
content: @Composable (ColumnScope.(BoxWithConstraintsScope)-> Unit) content: @Composable (ColumnScope.(BoxWithConstraintsScope) -> Unit),
) = BoxWithConstraints(modifier) { ) = BoxWithConstraints(modifier) {
Column( Column(
verticalArrangement = verticalArrangement, verticalArrangement = verticalArrangement,
horizontalAlignment = horizontalAlignment horizontalAlignment = horizontalAlignment,
) { content(this@BoxWithConstraints) } ) { content(this@BoxWithConstraints) }
} }
@ -47,10 +47,10 @@ fun RowWithConstraints(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
horizontalArrangement: Arrangement.Horizontal = Arrangement.Start, horizontalArrangement: Arrangement.Horizontal = Arrangement.Start,
verticalAlignment: Alignment.Vertical = Alignment.Top, verticalAlignment: Alignment.Vertical = Alignment.Top,
content: @Composable (RowScope.(BoxWithConstraintsScope)-> Unit) content: @Composable (RowScope.(BoxWithConstraintsScope) -> Unit),
) = BoxWithConstraints(modifier) { ) = BoxWithConstraints(modifier) {
Row( Row(
horizontalArrangement = horizontalArrangement, horizontalArrangement = horizontalArrangement,
verticalAlignment = verticalAlignment verticalAlignment = verticalAlignment,
) { content(this@BoxWithConstraints) } ) { content(this@BoxWithConstraints) }
} }

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.BoxWithConstraints
import androidx.compose.foundation.layout.BoxWithConstraintsScope import androidx.compose.foundation.layout.BoxWithConstraintsScope
@ -43,54 +43,6 @@ import androidx.compose.ui.unit.TextUnit
import kotlin.math.min import kotlin.math.min
import kotlin.math.roundToInt 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]. * [BoxWithConstraints] with [autoTextStyle] passed via [LocalTextStyle].
* *
@ -122,11 +74,11 @@ internal fun AutoSizeTextStyleBox(
style: TextStyle, style: TextStyle,
minRatio: Float, minRatio: Float,
alignment: Alignment, alignment: Alignment,
content: @Composable () -> Unit content: @Composable () -> Unit,
) { ) {
val density = LocalDensity.current val density = LocalDensity.current
CompositionLocalProvider( CompositionLocalProvider(
LocalDensity provides Density(density = density.density, fontScale = 1F) LocalDensity provides Density(density = density.density, fontScale = 1F),
) { ) {
BoxWithConstraints( BoxWithConstraints(
modifier = modifier, modifier = modifier,
@ -141,12 +93,12 @@ internal fun AutoSizeTextStyleBox(
style = style, style = style,
alignment = alignment, alignment = alignment,
density = density, density = density,
minRatio = minRatio minRatio = minRatio,
) )
CompositionLocalProvider( CompositionLocalProvider(
value = LocalTextStyle.provides(autoTextStyle), value = LocalTextStyle.provides(autoTextStyle),
content = content content = content,
) )
} }
} }
@ -290,10 +242,11 @@ private fun <E> IntProgression.findElectedValue(
var high = last var high = last
while (low <= high) { while (low <= high) {
val mid = low + (high - low) / 2 val mid = low + (high - low) / 2
if (shouldMoveBackward(transform(mid))) if (shouldMoveBackward(transform(mid))) {
high = mid - 1 high = mid - 1
else } else {
low = mid + 1 low = mid + 1
}
} }
transform(high.coerceAtLeast(minimumValue = first)) transform(high.coerceAtLeast(minimumValue = first))
} }

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Density
import androidx.compose.ui.unit.DpSize 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.roundToPx(sp: TextUnit): Int = sp.roundToPx()
internal fun Density.toSp(px: Int): TextUnit = px.toSp() internal fun Density.toSp(px: Int): TextUnit = px.toSp()
internal fun Density.toIntSize(dpSize: DpSize): IntSize = internal fun Density.toIntSize(dpSize: DpSize): IntSize =
if (dpSize.isSpecified) IntSize(dpSize.width.roundToPx(), dpSize.height.roundToPx()) if (dpSize.isSpecified) {
else IntSize.Zero 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/>. * 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.Arrangement
import androidx.compose.foundation.layout.Box 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.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.DialogProperties 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.Instant
import java.time.LocalDateTime import java.time.LocalDateTime
import java.time.ZoneId import java.time.ZoneId
@ -67,7 +67,7 @@ fun DatePickerDialog(
BasicAlertDialog( BasicAlertDialog(
onDismissRequest = onDismiss, onDismissRequest = onDismiss,
modifier = modifier.wrapContentHeight(), modifier = modifier.wrapContentHeight(),
properties = DialogProperties(usePlatformDefaultWidth = false) properties = DialogProperties(usePlatformDefaultWidth = false),
) { ) {
Surface( Surface(
modifier = modifier modifier = modifier
@ -83,15 +83,14 @@ fun DatePickerDialog(
Box( Box(
modifier = Modifier modifier = Modifier
.align(Alignment.End) .align(Alignment.End)
.padding(_dialogButtonsPadding) .padding(_dialogButtonsPadding),
) { ) {
AlertDialogFlowRow( AlertDialogFlowRow(
mainAxisSpacing = _dialogButtonsMainAxisSpacing, mainAxisSpacing = _dialogButtonsMainAxisSpacing,
crossAxisSpacing = _dialogButtonsCrossAxisSpacing crossAxisSpacing = _dialogButtonsCrossAxisSpacing,
) { ) {
TextButton( TextButton(
onClick = onDismiss onClick = onDismiss,
) { ) {
Text(text = dismissLabel) Text(text = dismissLabel)
} }
@ -100,16 +99,17 @@ fun DatePickerDialog(
val millis = pickerState.selectedDateMillis ?: return@TextButton val millis = pickerState.selectedDateMillis ?: return@TextButton
val date = LocalDateTime.ofInstant( val date = LocalDateTime.ofInstant(
Instant.ofEpochMilli(millis), ZoneId.systemDefault() Instant.ofEpochMilli(millis),
ZoneId.systemDefault(),
) )
onConfirm( onConfirm(
localDateTime localDateTime
.withYear(date.year) .withYear(date.year)
.withMonth(date.monthValue) .withMonth(date.monthValue)
.withDayOfMonth(date.dayOfMonth) .withDayOfMonth(date.dayOfMonth),
) )
} },
) { ) {
Text(text = confirmLabel) Text(text = confirmLabel)
} }
@ -125,7 +125,7 @@ fun DatePickerDialog(
private fun AlertDialogFlowRow( private fun AlertDialogFlowRow(
mainAxisSpacing: Dp, mainAxisSpacing: Dp,
crossAxisSpacing: Dp, crossAxisSpacing: Dp,
content: @Composable () -> Unit content: @Composable () -> Unit,
) { ) {
Layout(content) { measurables, constraints -> Layout(content) { measurables, constraints ->
val sequences = mutableListOf<List<Placeable>>() val sequences = mutableListOf<List<Placeable>>()
@ -142,7 +142,7 @@ private fun AlertDialogFlowRow(
// Return whether the placeable can be added to the current sequence. // Return whether the placeable can be added to the current sequence.
fun canAddToCurrentSequence(placeable: Placeable) = fun canAddToCurrentSequence(placeable: Placeable) =
currentSequence.isEmpty() || currentMainAxisSize + mainAxisSpacing.roundToPx() + currentSequence.isEmpty() || currentMainAxisSize + mainAxisSpacing.roundToPx() +
placeable.width <= constraints.maxWidth placeable.width <= constraints.maxWidth
// Store current sequence information and start a new sequence. // Store current sequence information and start a new sequence.
fun startNewSequence() { fun startNewSequence() {
@ -187,20 +187,22 @@ private fun AlertDialogFlowRow(
sequences.forEachIndexed { i, placeables -> sequences.forEachIndexed { i, placeables ->
val childrenMainAxisSizes = IntArray(placeables.size) { j -> val childrenMainAxisSizes = IntArray(placeables.size) { j ->
placeables[j].width + placeables[j].width +
if (j < placeables.lastIndex) mainAxisSpacing.roundToPx() else 0 if (j < placeables.lastIndex) mainAxisSpacing.roundToPx() else 0
} }
val arrangement = Arrangement.End val arrangement = Arrangement.End
val mainAxisPositions = IntArray(childrenMainAxisSizes.size) { 0 } val mainAxisPositions = IntArray(childrenMainAxisSizes.size) { 0 }
with(arrangement) { with(arrangement) {
arrange( arrange(
mainAxisLayoutSize, childrenMainAxisSizes, mainAxisLayoutSize,
layoutDirection, mainAxisPositions childrenMainAxisSizes,
layoutDirection,
mainAxisPositions,
) )
} }
placeables.forEachIndexed { j, placeable -> placeables.forEachIndexed { j, placeable ->
placeable.place( placeable.place(
x = mainAxisPositions[j], x = mainAxisPositions[j],
y = crossAxisPositions[i] y = crossAxisPositions[i],
) )
} }
} }
@ -210,4 +212,4 @@ private fun AlertDialogFlowRow(
private val _dialogButtonsPadding by lazy { PaddingValues(bottom = 8.dp, end = 6.dp) } private val _dialogButtonsPadding by lazy { PaddingValues(bottom = 8.dp, end = 6.dp) }
private val _dialogButtonsMainAxisSpacing by lazy { 8.dp } private val _dialogButtonsMainAxisSpacing by lazy { 8.dp }
private val _dialogButtonsCrossAxisSpacing by lazy { 12.dp } private val _dialogButtonsCrossAxisSpacing by lazy { 12.dp }

View File

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

View File

@ -16,6 +16,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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 object IconPack

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.ArCos: ImageVector val IconPack.ArCos: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.ArSin: ImageVector val IconPack.ArSin: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.AcTan: ImageVector val IconPack.AcTan: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Backspace: ImageVector val IconPack.Backspace: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Brackets: ImageVector val IconPack.Brackets: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Clear: ImageVector val IconPack.Clear: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Comma: ImageVector val IconPack.Comma: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Cos: ImageVector val IconPack.Cos: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Deg: ImageVector val IconPack.Deg: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Divide: ImageVector val IconPack.Divide: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Dot: ImageVector val IconPack.Dot: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Equal: ImageVector val IconPack.Equal: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Euler: ImageVector val IconPack.Euler: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Ex: ImageVector val IconPack.Ex: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Factorial: ImageVector val IconPack.Factorial: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Inv: ImageVector val IconPack.Inv: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Key0: ImageVector val IconPack.Key0: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Key1: ImageVector val IconPack.Key1: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Key2: ImageVector val IconPack.Key2: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Key3: ImageVector val IconPack.Key3: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Key4: ImageVector val IconPack.Key4: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Key5: ImageVector val IconPack.Key5: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Key6: ImageVector val IconPack.Key6: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Key7: ImageVector val IconPack.Key7: ImageVector

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp 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") @Suppress("UnusedReceiverParameter")
val IconPack.Key8: ImageVector val IconPack.Key8: ImageVector

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