A fork of Simple Time Tracker with WearOS support. (Now integrated upstream)
0

Configure Feed

Select the types of activity you want to include in your feed.

refactoring wear dependencies

razeeman (Mar 2, 2024, 6:58 PM +0300) 11dac9b6 b2885b1e

+97 -50
+4
buildSrc/src/main/kotlin/com/example/util/simpletimetracker/Base.kt
··· 8 8 const val versionName = "1.37" 9 9 const val minSDK = 21 10 10 const val currentSDK = 34 11 + 12 + const val versionCodeWear = 1 13 + const val versionNameWear = "1.0" 14 + const val minSDKWear = 26 11 15 }
+23
buildSrc/src/main/kotlin/com/example/util/simpletimetracker/Deps.kt
··· 64 64 "androidx.navigation:navigation-ui-ktx:${Versions.navigationKtx}" 65 65 } 66 66 67 + object Compose { 68 + const val activity = 69 + "androidx.activity:activity-compose:${Versions.compose_version}" 70 + const val ui = 71 + "androidx.compose.ui:ui:${Versions.compose_version}" 72 + const val uiToolingPreview = 73 + "androidx.compose.ui:ui-tooling-preview:${Versions.compose_version}" 74 + const val materialIcons = 75 + "androidx.compose.material:material-icons-core:${Versions.compose_icons}" 76 + const val wearNavigation = 77 + "androidx.wear.compose:compose-navigation:${Versions.wear_compose_version}" 78 + const val wearMaterial = 79 + "androidx.wear.compose:compose-material:${Versions.wear_compose_version}" 80 + const val wearFoundation = 81 + "androidx.wear.compose:compose-foundation:${Versions.wear_compose_version}" 82 + const val wearToolingPreview = 83 + "androidx.wear:wear-tooling-preview:${Versions.wear_compose_tooling_preview}" 84 + const val horologist = 85 + "com.google.android.horologist:horologist-compose-layout:${Versions.horologist}" 86 + const val uiTooling = 87 + "androidx.compose.ui:ui-tooling:${Versions.compose_version}" 88 + } 89 + 67 90 object Kapt { 68 91 const val room = 69 92 "androidx.room:room-compiler:${Versions.room}"
+1
buildSrc/src/main/kotlin/com/example/util/simpletimetracker/Extensions.kt
··· 4 4 import org.gradle.kotlin.dsl.apply 5 5 6 6 fun Project.applyAndroidLibrary() = apply(from = "$rootDir/gradle/android_library.gradle") 7 + fun Project.applyAndroidWearLibrary() = apply(from = "$rootDir/gradle/android_wear_library.gradle")
+7
buildSrc/src/main/kotlin/com/example/util/simpletimetracker/Versions.kt
··· 30 30 const val viewModelKtx = "2.2.0" 31 31 const val navigationKtx = "2.3.5" 32 32 33 + const val compose_version = "1.3.1" 34 + const val wear_compose_version = "1.1.0" 35 + const val compose_icons = "1.6.1" 36 + const val wear_compose_tooling_preview = "1.0.0" 37 + const val horologist = "0.2.7" 38 + const val compose_kotlin_compiler = "1.4.0-alpha02" 39 + 33 40 const val junit = "4.13" 34 41 const val junitUi = "1.1.4" 35 42 const val espresso = "3.5.0"
+5
features/feature_wear/build.gradle.kts
··· 1 + /* 2 + * This Source Code Form is subject to the terms of the Mozilla Public 3 + * License, v. 2.0. If a copy of the MPL was not distributed with this 4 + * file, You can obtain one at https://mozilla.org/MPL/2.0/. 5 + */ 1 6 import com.example.util.simpletimetracker.Base 2 7 import com.example.util.simpletimetracker.Deps 3 8 import com.example.util.simpletimetracker.applyAndroidLibrary
+5
features/feature_wear/src/main/java/com/example/util/simpletimetracker/feature_wear/WidgetModule.kt
··· 1 + /* 2 + * This Source Code Form is subject to the terms of the Mozilla Public 3 + * License, v. 2.0. If a copy of the MPL was not distributed with this 4 + * file, You can obtain one at https://mozilla.org/MPL/2.0/. 5 + */ 1 6 package com.example.util.simpletimetracker.feature_wear 2 7 3 8 import com.example.util.simpletimetracker.wear_api.WearCommunicationAPI
+20
gradle/android_wear_library.gradle
··· 1 + import com.example.util.simpletimetracker.Base 2 + 3 + android { 4 + compileSdk = Base.currentSDK 5 + 6 + defaultConfig { 7 + minSdk = Base.minSDKWear 8 + targetSdk = Base.currentSDK 9 + 10 + vectorDrawables.generatedDensities() 11 + } 12 + 13 + kotlinOptions { 14 + jvmTarget = JavaVersion.VERSION_1_8.toString() 15 + } 16 + 17 + buildFeatures { 18 + viewBinding = true 19 + } 20 + }
+27 -49
wear/build.gradle.kts
··· 1 - import com.example.util.simpletimetracker.Deps 2 - 3 1 /* 4 2 * This Source Code Form is subject to the terms of the Mozilla Public 5 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 6 4 * file, You can obtain one at https://mozilla.org/MPL/2.0/. 7 5 */ 6 + import com.example.util.simpletimetracker.Base 7 + import com.example.util.simpletimetracker.Deps 8 + import com.example.util.simpletimetracker.Versions 9 + import com.example.util.simpletimetracker.applyAndroidWearLibrary 8 10 9 11 plugins { 10 12 id("com.android.application") ··· 13 15 id("dagger.hilt.android.plugin") 14 16 } 15 17 18 + applyAndroidWearLibrary() 19 + 16 20 android { 17 - namespace = "com.example.util.simpletimetracker" 18 - compileSdk = 34 21 + namespace = Base.namespace 19 22 20 23 defaultConfig { 21 - applicationId = "com.razeeman.util.simpletimetracker" 22 - minSdk = 26 23 - targetSdk = 34 24 - versionCode = 1 25 - versionName = "1.0" 26 - vectorDrawables { 27 - useSupportLibrary = true 28 - } 29 - 24 + applicationId = Base.applicationId 25 + versionCode = Base.versionCodeWear 26 + versionName = Base.versionNameWear 30 27 } 31 28 32 29 buildTypes { ··· 41 38 ) 42 39 } 43 40 } 41 + 44 42 compileOptions { 45 43 sourceCompatibility = JavaVersion.VERSION_1_8 46 44 targetCompatibility = JavaVersion.VERSION_1_8 47 45 } 48 - kotlinOptions { 49 - jvmTarget = "1.8" 50 - } 46 + 51 47 buildFeatures { 52 48 compose = true 53 49 } 50 + 54 51 composeOptions { 55 - kotlinCompilerExtensionVersion = "1.4.0-alpha02" 56 - } 57 - packagingOptions { 58 - resources { 59 - excludes += "/META-INF/{AL2.0,LGPL2.1}" 60 - } 52 + kotlinCompilerExtensionVersion = Versions.compose_kotlin_compiler 61 53 } 62 54 } 63 55 64 56 dependencies { 65 - var compose_version = "1.3.1" 66 - var wear_compose_version = "1.1.0" 67 - // Runtime Dependencies 68 - implementation("androidx.wear.compose:compose-navigation:$wear_compose_version") 69 - implementation("com.google.android.horologist:horologist-compose-layout:0.2.7") 70 - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1") 71 - implementation("androidx.compose.material:material-icons-core:1.6.1") 72 57 implementation(project(":wear_api")) 73 58 implementation(project(":resources")) 74 59 75 - // Dev Dependencies 76 - implementation("androidx.wear:wear-tooling-preview:1.0.0") 77 - 78 - // Default Dependencies 79 - implementation("androidx.core:core-ktx:1.7.0") 80 - implementation("com.google.android.gms:play-services-wearable:17.1.0") 60 + implementation(Deps.Androidx.appcompat) 61 + implementation(Deps.Google.services) 81 62 implementation(Deps.Google.gson) 82 - implementation("androidx.percentlayout:percentlayout:1.0.0") 83 - implementation("androidx.legacy:legacy-support-v4:1.0.0") 84 - implementation("androidx.recyclerview:recyclerview:1.2.1") 85 - implementation("androidx.compose.ui:ui:$compose_version") 86 - implementation("androidx.wear.compose:compose-material:$wear_compose_version") 87 - implementation("androidx.wear.compose:compose-foundation:$wear_compose_version") 88 - implementation("androidx.compose.ui:ui-tooling-preview:$compose_version") 89 - implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.3.1") 90 - implementation("androidx.activity:activity-compose:1.3.1") 91 - implementation("androidx.appcompat:appcompat:1.6.0") 92 - 93 63 implementation(Deps.Google.dagger) 64 + implementation(Deps.Compose.activity) 65 + implementation(Deps.Compose.ui) 66 + implementation(Deps.Compose.uiToolingPreview) 67 + implementation(Deps.Compose.materialIcons) 68 + implementation(Deps.Compose.wearNavigation) 69 + implementation(Deps.Compose.wearMaterial) 70 + implementation(Deps.Compose.wearFoundation) 71 + implementation(Deps.Compose.wearToolingPreview) 72 + implementation(Deps.Compose.horologist) 73 + debugImplementation(Deps.Compose.uiTooling) 94 74 kapt(Deps.Kapt.dagger) 95 75 96 76 testImplementation(Deps.Test.junit) 97 77 testImplementation(Deps.Test.coroutines) 98 - androidTestImplementation("androidx.compose.ui:ui-test-junit4:$compose_version") 99 - debugImplementation("androidx.compose.ui:ui-tooling:$compose_version") 100 - debugImplementation("androidx.compose.ui:ui-test-manifest:$compose_version") 78 + 101 79 }
-1
wear_api/build.gradle.kts
··· 20 20 } 21 21 22 22 dependencies { 23 - implementation(Deps.Google.services) 24 23 implementation(Deps.Google.gson) 25 24 }
+5
wear_api/src/main/java/com/example/util/simpletimetracker/wear_api/MockWearCommunicationAPI.kt
··· 1 + /* 2 + * This Source Code Form is subject to the terms of the Mozilla Public 3 + * License, v. 2.0. If a copy of the MPL was not distributed with this 4 + * file, You can obtain one at https://mozilla.org/MPL/2.0/. 5 + */ 1 6 package com.example.util.simpletimetracker.wear_api 2 7 3 8 class MockWearCommunicationAPI : WearCommunicationAPI {