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.

separate wear into own flavor

razeeman (Feb 27, 2024, 10:02 PM +0300) 6c4805e8 b55fdfb6

+78 -72
+20 -9
app/build.gradle.kts
··· 12 12 applyAndroidLibrary() 13 13 14 14 android { 15 + namespace = Base.namespace 16 + 15 17 defaultConfig { 16 18 applicationId = Base.applicationId 17 19 versionCode = Base.versionCode ··· 21 23 } 22 24 23 25 buildTypes { 24 - getByName("debug") { 26 + debug { 25 27 applicationIdSuffix = ".debug" 26 28 isMinifyEnabled = true 27 29 isCrunchPngs = false ··· 31 33 ) 32 34 testProguardFile("proguard-test-rules.pro") 33 35 } 34 - getByName("release") { 36 + release { 35 37 isMinifyEnabled = true 36 38 isCrunchPngs = false 37 39 proguardFiles( ··· 42 44 } 43 45 44 46 buildTypes { 45 - getByName("debug") { 47 + debug { 46 48 buildConfigField("String", "VERSION_NAME", "\"${defaultConfig.versionName}\"") 47 49 } 48 - getByName("release") { 50 + release { 49 51 buildConfigField("String", "VERSION_NAME", "\"${defaultConfig.versionName}\"") 50 52 } 51 53 } 52 54 55 + flavorDimensions += "version" 56 + 57 + productFlavors { 58 + // No google play services, no wear logic, for f-droid. 59 + create("base") { 60 + dimension = "version" 61 + } 62 + create("play") { 63 + dimension = "version" 64 + isDefault = true 65 + } 66 + } 67 + 53 68 compileOptions { 54 69 sourceCompatibility = JavaVersion.VERSION_1_8 55 70 targetCompatibility = JavaVersion.VERSION_1_8 ··· 67 82 // Adds exported schema location as test app assets. 68 83 getByName("androidTest").assets.srcDir("$projectDir/../data_local/schemas") 69 84 } 70 - 71 - namespace = Base.namespace 72 85 } 73 86 74 87 dependencies { ··· 97 110 implementation(project(":feature_data_edit")) 98 111 implementation(project(":feature_records_filter")) 99 112 implementation(project(":feature_goals")) 100 - implementation(project(":wearrpc")) 113 + "playImplementation"(project(":feature_wear")) 101 114 102 - implementation("com.google.android.gms:play-services-wearable:18.0.0") 103 - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1") 104 115 implementation(Deps.Androidx.room) 105 116 implementation(Deps.Ktx.navigationFragment) 106 117 implementation(Deps.Ktx.navigationUi)
+1 -9
app/src/main/AndroidManifest.xml
··· 45 45 android:value="true" /> 46 46 </service> 47 47 48 - <service 49 - android:name=".wear.WearService" 50 - android:exported="true"> 51 - <intent-filter> 52 - <action android:name="com.google.android.gms.wearable.REQUEST_RECEIVED" /> 53 - <data android:scheme="wear" android:host="*" 54 - android:pathPrefix="/stt" /> 55 - </intent-filter> 56 - </service> 57 48 </application> 58 49 59 50 <queries> ··· 66 57 <data android:mimeType="*/*" /> 67 58 </intent> 68 59 </queries> 60 + 69 61 </manifest>
+1 -1
app/src/main/java/com/example/util/simpletimetracker/wear/DomainAPI.kt features/feature_wear/src/main/java/com/example/util/simpletimetracker/feature_wear/DomainAPI.kt
··· 3 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 4 * file, You can obtain one at https://mozilla.org/MPL/2.0/. 5 5 */ 6 - package com.example.util.simpletimetracker.wear 6 + package com.example.util.simpletimetracker.feature_wear 7 7 8 8 import com.example.util.simpletimetracker.domain.interactor.PrefsInteractor 9 9 import com.example.util.simpletimetracker.domain.interactor.RecordTagInteractor
+1 -1
app/src/main/java/com/example/util/simpletimetracker/wear/WearService.kt features/feature_wear/src/main/java/com/example/util/simpletimetracker/feature_wear/WearService.kt
··· 3 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 4 * file, You can obtain one at https://mozilla.org/MPL/2.0/. 5 5 */ 6 - package com.example.util.simpletimetracker.wear 6 + package com.example.util.simpletimetracker.feature_wear 7 7 8 8 import com.example.util.simpletimetracker.domain.interactor.PrefsInteractor 9 9 import com.example.util.simpletimetracker.domain.interactor.RecordTagInteractor
+1 -1
buildSrc/src/main/kotlin/com/example/util/simpletimetracker/Base.kt
··· 6 6 7 7 const val versionCode = 38 8 8 const val versionName = "1.37" 9 - const val minSDK = 26 9 + const val minSDK = 21 10 10 const val currentSDK = 34 11 11 }
+2
buildSrc/src/main/kotlin/com/example/util/simpletimetracker/Deps.kt
··· 34 34 "com.google.dagger:hilt-android:${Versions.dagger}" 35 35 const val flexBox = 36 36 "com.google.android:flexbox:${Versions.flexBox}" 37 + const val services = 38 + "com.google.android.gms:play-services-wearable:${Versions.services}" 37 39 } 38 40 39 41 object Emoji {
+1
buildSrc/src/main/kotlin/com/example/util/simpletimetracker/Versions.kt
··· 17 17 const val dagger = "2.42" 18 18 const val viewpager2 = "1.0.0" 19 19 const val flexBox = "2.0.1" 20 + const val services = "18.0.0" 20 21 const val cardView = "1.0.0" 21 22 const val material = "1.2.0" 22 23 const val emoji = "1.4.0"
+1
features/feature_wear/.gitignore
··· 1 + /build
+24
features/feature_wear/build.gradle.kts
··· 1 + import com.example.util.simpletimetracker.Base 2 + import com.example.util.simpletimetracker.Deps 3 + import com.example.util.simpletimetracker.applyAndroidLibrary 4 + 5 + plugins { 6 + id("com.android.library") 7 + id("kotlin-android") 8 + id("kotlin-kapt") 9 + id("dagger.hilt.android.plugin") 10 + } 11 + 12 + applyAndroidLibrary() 13 + 14 + android { 15 + namespace = "${Base.namespace}.feature_wear" 16 + } 17 + 18 + dependencies { 19 + implementation(project(":core")) 20 + implementation(project(":wearrpc")) 21 + implementation(Deps.Google.services) 22 + implementation(Deps.Google.dagger) 23 + kapt(Deps.Kapt.dagger) 24 + }
+23
features/feature_wear/src/main/AndroidManifest.xml
··· 1 + <?xml version="1.0" encoding="utf-8"?> 2 + <manifest xmlns:android="http://schemas.android.com/apk/res/android" 3 + xmlns:tools="http://schemas.android.com/tools"> 4 + 5 + <!-- 6 + ExportedService suppressed because WearableListenerService has internal check 7 + that request came from google play service and not some other app 8 + --> 9 + <application> 10 + <service 11 + android:name=".WearService" 12 + android:exported="true" 13 + tools:ignore="ExportedService"> 14 + <intent-filter> 15 + <action android:name="com.google.android.gms.wearable.REQUEST_RECEIVED" /> 16 + <data 17 + android:host="*" 18 + android:pathPrefix="/stt" 19 + android:scheme="wear" /> 20 + </intent-filter> 21 + </service> 22 + </application> 23 + </manifest>
+3 -1
wearrpc/build.gradle.kts
··· 1 + import com.example.util.simpletimetracker.Base 2 + 1 3 /* 2 4 * This Source Code Form is subject to the terms of the Mozilla Public 3 5 * License, v. 2.0. If a copy of the MPL was not distributed with this ··· 13 15 compileSdk = 34 14 16 15 17 defaultConfig { 16 - minSdk = 26 18 + minSdk = Base.minSDK 17 19 18 20 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 19 21 consumerProguardFiles("consumer-rules.pro")
wearrpc/consumer-rules.pro

This is a binary file and will not be displayed.

-21
wearrpc/proguard-rules.pro
··· 1 - # Add project specific ProGuard rules here. 2 - # You can control the set of applied configuration files using the 3 - # proguardFiles setting in build.gradle. 4 - # 5 - # For more details, see 6 - # http://developer.android.com/guide/developing/tools/proguard.html 7 - 8 - # If your project uses WebView with JS, uncomment the following 9 - # and specify the fully qualified class name to the JavaScript interface 10 - # class: 11 - #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 - # public *; 13 - #} 14 - 15 - # Uncomment this to preserve the line number information for 16 - # debugging stack traces. 17 - #-keepattributes SourceFile,LineNumberTable 18 - 19 - # If you keep the line number information, uncomment this to 20 - # hide the original source file name. 21 - #-renamesourcefileattribute SourceFile
-29
wearrpc/src/androidTest/java/com/example/util/simpletimetracker/wearrpc/ExampleInstrumentedTest.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 - */ 6 - package com.example.util.simpletimetracker.wearrpc 7 - 8 - import androidx.test.platform.app.InstrumentationRegistry 9 - import androidx.test.ext.junit.runners.AndroidJUnit4 10 - 11 - import org.junit.Test 12 - import org.junit.runner.RunWith 13 - 14 - import org.junit.Assert.* 15 - 16 - /** 17 - * Instrumented test, which will execute on an Android device. 18 - * 19 - * See [testing documentation](http://d.android.com/tools/testing). 20 - */ 21 - @RunWith(AndroidJUnit4::class) 22 - class ExampleInstrumentedTest { 23 - @Test 24 - fun useAppContext() { 25 - // Context of the app under test. 26 - val appContext = InstrumentationRegistry.getInstrumentation().targetContext 27 - assertEquals("com.example.util.simpletimetracker.wearrpc.test", appContext.packageName) 28 - } 29 - }