From 85c3f6abccb43a329e35ec22d9e30d30f3210d7b Mon Sep 17 00:00:00 2001 From: Sad Ellie Date: Sun, 7 May 2023 00:39:34 +0300 Subject: [PATCH] Added time zone module --- app/build.gradle.kts | 1 + .../com/sadellie/unitto/UnittoNavigation.kt | 6 +++ .../unitto/core/base/TopLevelDestinations.kt | 5 +++ core/base/src/main/res/values/strings.xml | 3 ++ feature/timezone/.gitignore | 1 + feature/timezone/build.gradle.kts | 38 +++++++++++++++++ feature/timezone/consumer-rules.pro | 0 feature/timezone/src/main/AndroidManifest.xml | 22 ++++++++++ .../unitto/timezone/TimeZoneScreen.kt | 27 ++++++++++++ .../timezone/navigation/TimeZoneNavigation.kt | 41 +++++++++++++++++++ settings.gradle.kts | 1 + 11 files changed, 145 insertions(+) create mode 100644 feature/timezone/.gitignore create mode 100644 feature/timezone/build.gradle.kts create mode 100644 feature/timezone/consumer-rules.pro create mode 100644 feature/timezone/src/main/AndroidManifest.xml create mode 100644 feature/timezone/src/main/java/com/sadellie/unitto/timezone/TimeZoneScreen.kt create mode 100644 feature/timezone/src/main/java/com/sadellie/unitto/timezone/navigation/TimeZoneNavigation.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 088727d6..a4eb1c44 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -113,6 +113,7 @@ dependencies { implementation(project(mapOf("path" to ":feature:settings"))) implementation(project(mapOf("path" to ":feature:unitslist"))) implementation(project(mapOf("path" to ":feature:epoch"))) + implementation(project(mapOf("path" to ":feature:timezone"))) implementation(project(mapOf("path" to ":data:units"))) implementation(project(mapOf("path" to ":data:model"))) implementation(project(mapOf("path" to ":data:userprefs"))) diff --git a/app/src/main/java/com/sadellie/unitto/UnittoNavigation.kt b/app/src/main/java/com/sadellie/unitto/UnittoNavigation.kt index ba195ac5..003cc061 100644 --- a/app/src/main/java/com/sadellie/unitto/UnittoNavigation.kt +++ b/app/src/main/java/com/sadellie/unitto/UnittoNavigation.kt @@ -39,6 +39,7 @@ import com.sadellie.unitto.feature.unitslist.navigation.leftScreen import com.sadellie.unitto.feature.unitslist.navigation.navigateToLeftSide import com.sadellie.unitto.feature.unitslist.navigation.navigateToRightSide import com.sadellie.unitto.feature.unitslist.navigation.rightScreen +import com.sadellie.unitto.timezone.navigation.timeZoneScreen import io.github.sadellie.themmo.ThemmoController @Composable @@ -102,5 +103,10 @@ internal fun UnittoNavigation( ) epochScreen(navigateToMenu = openDrawer) + + timeZoneScreen( + navigateToMenu = openDrawer, + navigateToSettings = ::navigateToSettings + ) } } diff --git a/core/base/src/main/java/com/sadellie/unitto/core/base/TopLevelDestinations.kt b/core/base/src/main/java/com/sadellie/unitto/core/base/TopLevelDestinations.kt index 5d4bff94..967a6d9f 100644 --- a/core/base/src/main/java/com/sadellie/unitto/core/base/TopLevelDestinations.kt +++ b/core/base/src/main/java/com/sadellie/unitto/core/base/TopLevelDestinations.kt @@ -39,6 +39,11 @@ sealed class TopLevelDestinations( name = R.string.epoch_converter ) + object TimeZone : TopLevelDestinations( + route = "time_zone_route", + name = R.string.time_zone + ) + object Settings : TopLevelDestinations( route = "settings_graph", name = R.string.settings_screen diff --git a/core/base/src/main/res/values/strings.xml b/core/base/src/main/res/values/strings.xml index b444c12a..d3e870e1 100644 --- a/core/base/src/main/res/values/strings.xml +++ b/core/base/src/main/res/values/strings.xml @@ -1271,6 +1271,9 @@ All expressions from history will be deleted forever. This action can\'t be undone! No history + + Time zone + Number of decimal places Converted values may have a precision higher than the preferred one. diff --git a/feature/timezone/.gitignore b/feature/timezone/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/feature/timezone/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/feature/timezone/build.gradle.kts b/feature/timezone/build.gradle.kts new file mode 100644 index 00000000..d8eeb87d --- /dev/null +++ b/feature/timezone/build.gradle.kts @@ -0,0 +1,38 @@ +/* + * Unitto is a unit converter for Android + * Copyright (c) 2023 Elshan Agaev + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +plugins { + id("unitto.library") + id("unitto.library.compose") + id("unitto.library.feature") + id("unitto.android.hilt") +} + +android { + namespace = "com.sadellie.unitto.feature.timezone" +} + +dependencies { + testImplementation(libs.junit) + implementation(libs.com.github.sadellie.themmo) + + implementation(project(mapOf("path" to ":data:common"))) + implementation(project(mapOf("path" to ":data:userprefs"))) + implementation(project(mapOf("path" to ":data:database"))) + implementation(project(mapOf("path" to ":data:model"))) +} diff --git a/feature/timezone/consumer-rules.pro b/feature/timezone/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/feature/timezone/src/main/AndroidManifest.xml b/feature/timezone/src/main/AndroidManifest.xml new file mode 100644 index 00000000..7bdbce91 --- /dev/null +++ b/feature/timezone/src/main/AndroidManifest.xml @@ -0,0 +1,22 @@ + + + + + + \ No newline at end of file diff --git a/feature/timezone/src/main/java/com/sadellie/unitto/timezone/TimeZoneScreen.kt b/feature/timezone/src/main/java/com/sadellie/unitto/timezone/TimeZoneScreen.kt new file mode 100644 index 00000000..89333315 --- /dev/null +++ b/feature/timezone/src/main/java/com/sadellie/unitto/timezone/TimeZoneScreen.kt @@ -0,0 +1,27 @@ +/* + * Unitto is a unit converter for Android + * Copyright (c) 2023 Elshan Agaev + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.sadellie.unitto.timezone + +import androidx.compose.runtime.Composable + +@Composable +internal fun TimeZoneRoute() {} + +@Composable +private fun TimeZoneScreen() {} diff --git a/feature/timezone/src/main/java/com/sadellie/unitto/timezone/navigation/TimeZoneNavigation.kt b/feature/timezone/src/main/java/com/sadellie/unitto/timezone/navigation/TimeZoneNavigation.kt new file mode 100644 index 00000000..d53efbb6 --- /dev/null +++ b/feature/timezone/src/main/java/com/sadellie/unitto/timezone/navigation/TimeZoneNavigation.kt @@ -0,0 +1,41 @@ +/* + * Unitto is a unit converter for Android + * Copyright (c) 2023 Elshan Agaev + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.sadellie.unitto.timezone.navigation + +import androidx.navigation.NavGraphBuilder +import androidx.navigation.compose.composable +import androidx.navigation.navDeepLink +import com.sadellie.unitto.core.base.TopLevelDestinations +import com.sadellie.unitto.timezone.TimeZoneRoute + +private val timeZoneRoute: String by lazy { TopLevelDestinations.TimeZone.route } + +fun NavGraphBuilder.timeZoneScreen( + navigateToMenu: () -> Unit, + navigateToSettings: () -> Unit +) { + composable( + route = timeZoneRoute, + deepLinks = listOf( + navDeepLink { uriPattern = "app://com.sadellie.unitto/$timeZoneRoute" } + ) + ) { + TimeZoneRoute() + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 320aa67e..ffb6a0a7 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -25,6 +25,7 @@ include(":feature:unitslist") include(":feature:calculator") include(":feature:settings") include(":feature:epoch") +include(":feature:timezone") include(":data:userprefs") include(":data:unitgroups") include(":data:licenses")