commit 67ce68bc36af27d64bf656c7ef05b4653372bb9c Author: Kuro Date: Sun Jun 29 02:30:16 2025 +0200 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b7b1d2d --- /dev/null +++ b/.gitignore @@ -0,0 +1,110 @@ +# ---> Java +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +replay_pid* + +# ---> Kotlin +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +replay_pid* + +# ---> Android +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Log/OS Files +*.log + +# Android Studio generated files and folders +captures/ +.externalNativeBuild/ +.cxx/ +*.apk +output.json + +# IntelliJ +*.iml +.idea/ +misc.xml +deploymentTargetDropDown.xml +render.experimental.xml + +# Keystore files +*.jks +*.keystore + +# Google Services (e.g. APIs or Firebase) +google-services.json + +# Android Profiling +*.hprof + +# ---> Gradle +.gradle +**/build/ +!src/**/build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Avoid ignore Gradle wrappper properties +!gradle-wrapper.properties + +# Cache of project +.gradletasknamecache + +# Eclipse Gradle plugin generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6c5a1fe --- /dev/null +++ b/LICENSE @@ -0,0 +1,392 @@ +Attribution-NoDerivatives 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + + +======================================================================= + +Creative Commons Attribution-NoDerivatives 4.0 International Public +License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-NoDerivatives 4.0 International Public License ("Public +License"). To the extent this Public License may be interpreted as a +contract, You are granted the Licensed Rights in consideration of Your +acceptance of these terms and conditions, and the Licensor grants You +such rights in consideration of benefits the Licensor receives from +making the Licensed Material available under these terms and +conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + c. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + d. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + e. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + f. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + g. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + h. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + i. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + j. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce and reproduce, but not Share, Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material, You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + For the avoidance of doubt, You do not have permission under + this Public License to Share Adapted Material. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database, provided You do not Share + Adapted Material; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material; and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.” The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..2a36e0a --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,67 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) + // The compose plugin is not strictly necessary for the provided View-based UI, + // but it causes no harm to leave it. + alias(libs.plugins.kotlin.compose) +} + +android { + namespace = "com.wiccafe.garminreconnector" + compileSdk = 35 + + defaultConfig { + applicationId = "com.wiccafe.garminreconnector" + minSdk = 24 + targetSdk = 35 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + kotlinOptions { + jvmTarget = "11" + } + buildFeatures { + compose = true + } +} + +dependencies { + + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.lifecycle.runtime.ktx) + implementation(libs.androidx.activity.compose) + implementation(platform(libs.androidx.compose.bom)) + implementation(libs.androidx.ui) + implementation(libs.androidx.ui.graphics) + implementation(libs.androidx.ui.tooling.preview) + implementation(libs.androidx.material3) + + // Dependency needed for the View-based UI from MainActivity + implementation(libs.androidx.appcompat) + + // The deprecated LocalBroadcastManager dependency has been removed. + + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) + androidTestImplementation(platform(libs.androidx.compose.bom)) + androidTestImplementation(libs.androidx.ui.test.junit4) + debugImplementation(libs.androidx.ui.tooling) + debugImplementation(libs.androidx.ui.test.manifest) +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/com/wiccafe/garminreconnector/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/wiccafe/garminreconnector/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..d997dd7 --- /dev/null +++ b/app/src/androidTest/java/com/wiccafe/garminreconnector/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.wiccafe.garminreconnector + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.wiccafe.garminreconnector", appContext.packageName) + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..c15ab8e --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/com/wiccafe/garminreconnector/GarminReconnectService.kt b/app/src/main/java/com/wiccafe/garminreconnector/GarminReconnectService.kt new file mode 100644 index 0000000..7beaf38 --- /dev/null +++ b/app/src/main/java/com/wiccafe/garminreconnector/GarminReconnectService.kt @@ -0,0 +1,352 @@ +package com.wiccafe.garminreconnector + +import android.Manifest +import android.app.Notification +import android.app.NotificationChannel +import android.app.NotificationManager +import android.app.PendingIntent +import android.app.Service +import android.bluetooth.* +import android.bluetooth.le.BluetoothLeScanner +import android.bluetooth.le.ScanCallback +import android.bluetooth.le.ScanFilter +import android.bluetooth.le.ScanResult +import android.bluetooth.le.ScanSettings +import android.content.Context +import android.content.Intent +import android.content.pm.PackageManager +import android.os.Binder +import android.os.Build +import android.os.Handler +import android.os.IBinder +import android.os.Looper +import android.os.ParcelUuid +import androidx.core.app.ActivityCompat +import androidx.core.app.NotificationCompat +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.asStateFlow +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +// Enum to represent the specific connection status +enum class ConnectionStatus { + DISCONNECTED, + SCANNING, + CONNECTING, + CONNECTED, + FAILED +} + +class GarminReconnectService : Service() { + + private val binder = LocalBinder() + + private val _isServiceRunning = MutableStateFlow(false) + val isServiceRunning = _isServiceRunning.asStateFlow() + + private val _connectionStatus = MutableStateFlow(ConnectionStatus.DISCONNECTED) + val connectionStatus = _connectionStatus.asStateFlow() + + private val _logs = MutableStateFlow>(emptyList()) + val logs = _logs.asStateFlow() + + private lateinit var bluetoothManager: BluetoothManager + private var bluetoothAdapter: BluetoothAdapter? = null + private var bluetoothLeScanner: BluetoothLeScanner? = null + private var bluetoothGatt: BluetoothGatt? = null + private val connectionHandler = Handler(Looper.getMainLooper()) + private val syncHandler = Handler(Looper.getMainLooper()) + private var retryCount = 0 + private var lastConnectedDeviceAddress: String? = null + private var connectedDeviceName: String? = null + + inner class LocalBinder : Binder() { + fun getService(): GarminReconnectService = this@GarminReconnectService + } + + override fun onCreate() { + super.onCreate() + bluetoothManager = getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager + bluetoothAdapter = bluetoothManager.adapter + createNotificationChannel() + log("Service created. Ready to scan for any Garmin device.") + } + + override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { + log("Service starting...") + startForeground(NOTIFICATION_ID, createNotification("Service is running. Looking for Garmin device...")) + _isServiceRunning.value = true + startConnectionAttempt() + syncHandler.post(syncRunnable) + return START_STICKY + } + + private val syncRunnable: Runnable = object : Runnable { + override fun run() { + if(_connectionStatus.value == ConnectionStatus.CONNECTED) { + triggerGarminSync() + } + syncHandler.postDelayed(this, SYNC_INTERVAL_MS) + } + } + + private fun triggerGarminSync() { + log("Attempting to trigger Garmin Connect sync...") + val garminPackage = "com.garmin.android.apps.connectmobile" + val launchIntent = packageManager.getLaunchIntentForPackage(garminPackage) + if (launchIntent != null) { + try { + launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + startActivity(launchIntent) + log("Sync successfully requested by launching Garmin Connect.") + } catch (e: Exception) { + log("Error launching Garmin Connect: ${e.message}") + } + } else { + log("Garmin Connect app not found. Cannot trigger sync.") + } + } + + private fun startConnectionAttempt() { + if (!checkPermissions("startConnectionAttempt")) { + _connectionStatus.value = ConnectionStatus.FAILED + stopSelf() + return + } + + lastConnectedDeviceAddress?.let { address -> + log("Attempting to reconnect to known device: $address") + val device = bluetoothAdapter?.getRemoteDevice(address) + if (device != null) { + connectToDevice(device) + return + } + } + + val bondedGarmin = findBondedGarminDevice() + if (bondedGarmin != null) { + log("Found bonded Garmin device: ${bondedGarmin.name}. Attempting connection.") + connectToDevice(bondedGarmin) + return + } + + log("No known or bonded device found. Starting a general scan.") + startGeneralScan() + } + + private fun findBondedGarminDevice(): BluetoothDevice? { + if (ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) { + return null + } + val bondedDevices = bluetoothAdapter?.bondedDevices + return bondedDevices?.firstOrNull { + it.name?.contains("Fenix", ignoreCase = true) == true || + it.name?.contains("Forerunner", ignoreCase = true) == true || + it.name?.contains("Venu", ignoreCase = true) == true || + it.name?.contains("Instinct", ignoreCase = true) == true + } + } + + private fun startGeneralScan() { + log("Permissions OK. Starting general scan for any Garmin device.") + _connectionStatus.value = ConnectionStatus.SCANNING + bluetoothLeScanner = bluetoothAdapter?.bluetoothLeScanner + + val garminServiceUuid = ParcelUuid.fromString(GARMIN_SERVICE_UUID) + val scanFilter = ScanFilter.Builder().setServiceUuid(garminServiceUuid).build() + val scanSettings = ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build() + + if (ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED) { + bluetoothLeScanner?.startScan(listOf(scanFilter), scanSettings, leScanCallback) + } + } + + private val leScanCallback = object : ScanCallback() { + override fun onScanResult(callbackType: Int, result: ScanResult) { + super.onScanResult(callbackType, result) + if (!checkPermissions("onScanResult")) return + + val deviceName = result.device?.name ?: "Unknown Device" + log("Garmin device found via scan: $deviceName") + + if (ActivityCompat.checkSelfPermission(this@GarminReconnectService, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED) { + bluetoothLeScanner?.stopScan(this) + } + + connectToDevice(result.device) + } + } + + private fun connectToDevice(device: BluetoothDevice) { + if (!checkPermissions("connectToDevice")) return + log("Connecting to GATT server on ${device.name ?: "device"}...") + _connectionStatus.value = ConnectionStatus.CONNECTING + if (ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) { + connectedDeviceName = device.name + lastConnectedDeviceAddress = device.address + bluetoothGatt = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + device.connectGatt(this, false, gattCallback, BluetoothDevice.TRANSPORT_LE) + } else { + device.connectGatt(this, false, gattCallback) + } + } + } + + private val reconnectionRunnable = Runnable { handleDisconnection() } + + private val gattCallback = object : BluetoothGattCallback() { + override fun onConnectionStateChange(gatt: BluetoothGatt, status: Int, newState: Int) { + if (!checkPermissions("onConnectionStateChange")) return + + val deviceName = gatt.device?.name ?: "Garmin Device" + if (newState == BluetoothProfile.STATE_CONNECTED) { + connectionHandler.removeCallbacks(reconnectionRunnable) + log("Successfully connected to $deviceName.") + _connectionStatus.value = ConnectionStatus.CONNECTED + updateNotification("Connected to $deviceName") + retryCount = 0 + } else if (newState == BluetoothProfile.STATE_DISCONNECTED) { + log("Transient disconnection from $deviceName. Status: $status. Starting grace period...") + if (ActivityCompat.checkSelfPermission(this@GarminReconnectService, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) { + gatt.close() + } + connectionHandler.postDelayed(reconnectionRunnable, GRACE_PERIOD_MS) + } + } + } + + private fun handleDisconnection() { + if (_connectionStatus.value == ConnectionStatus.CONNECTED) { + // We were connected, but the grace period expired. Now we are officially disconnected. + _connectionStatus.value = ConnectionStatus.DISCONNECTED + } + + if (retryCount < MAX_RETRIES) { + retryCount++ + log("Grace period over. Attempting to reconnect... (Attempt $retryCount/$MAX_RETRIES)") + updateNotification("Disconnected. Reconnecting... (Attempt $retryCount)") + startConnectionAttempt() + } else { + log("Max retries reached. Forcing general scan.") + _connectionStatus.value = ConnectionStatus.FAILED + lastConnectedDeviceAddress = null + retryCount = 0 + connectionHandler.postDelayed({ startConnectionAttempt() }, RETRY_DELAY_MS) + } + } + + override fun onDestroy() { + log("Service stopping...") + connectionHandler.removeCallbacksAndMessages(null) + syncHandler.removeCallbacksAndMessages(null) + + if (ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) { + bluetoothGatt?.close() + } + if (ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED) { + bluetoothLeScanner?.stopScan(leScanCallback) + } + bluetoothGatt = null + + // Broadcast the final "stopped" state + _isServiceRunning.value = false + _connectionStatus.value = ConnectionStatus.DISCONNECTED + + log("Service stopped and cleaned up.") + super.onDestroy() + } + + private fun log(message: String) { + val timestamp = SimpleDateFormat("HH:mm:ss", Locale.getDefault()).format(Date()) + val newLogs = _logs.value.toMutableList() + newLogs.add(0, "[$timestamp] $message") + _logs.value = newLogs + } + + private fun checkPermissions(caller: String): Boolean { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + if (ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED || + ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_SCAN) != PackageManager.PERMISSION_GRANTED) { + log("Permission check failed in '$caller': Bluetooth permissions not granted.") + return false + } + } + if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { + log("Permission check failed in '$caller': ACCESS_FINE_LOCATION not granted.") + return false + } + return true + } + + private fun createNotification(text: String): Notification { + val notificationIntent = Intent(this, MainActivity::class.java) + val pendingIntentFlag = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) PendingIntent.FLAG_IMMUTABLE else 0 + val pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, pendingIntentFlag) + + return NotificationCompat.Builder(this, CHANNEL_ID) + .setContentTitle("Garmin Reconnector") + .setContentText(text) + .setSmallIcon(R.drawable.ic_launcher_foreground) + .setContentIntent(pendingIntent) + .setOngoing(true) + .setPriority(NotificationCompat.PRIORITY_DEFAULT) + .build() + } + + private fun updateNotification(text: String) { + val manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + manager.notify(NOTIFICATION_ID, createNotification(text)) + } + + private fun sendFailureNotification() { + val manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + val deviceIdentifier = connectedDeviceName ?: "your Garmin device" + val channelId = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + val channel = NotificationChannel(FAILURE_CHANNEL_ID, "Failure Alerts", NotificationManager.IMPORTANCE_HIGH) + manager.createNotificationChannel(channel) + FAILURE_CHANNEL_ID + } else { "" } + + val pendingIntentFlag = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) PendingIntent.FLAG_IMMUTABLE else 0 + val notificationIntent = Intent(this, MainActivity::class.java) + val pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, pendingIntentFlag) + + val notification = NotificationCompat.Builder(this, channelId) + .setContentTitle("Garmin Reconnection Failed") + .setContentText("Could not reconnect to $deviceIdentifier after $MAX_RETRIES attempts.") + .setSmallIcon(R.drawable.ic_launcher_foreground) + .setContentIntent(pendingIntent) + .setAutoCancel(true) + .setPriority(NotificationCompat.PRIORITY_HIGH) + .build() + manager.notify(FAILURE_NOTIFICATION_ID, notification) + } + + private fun createNotificationChannel() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + val serviceChannel = NotificationChannel( + CHANNEL_ID, + "Garmin Reconnector Service Channel", + NotificationManager.IMPORTANCE_DEFAULT + ) + getSystemService(NotificationManager::class.java).createNotificationChannel(serviceChannel) + } + } + + override fun onBind(intent: Intent?): IBinder? { + return binder + } + + companion object { + const val GARMIN_SERVICE_UUID = "00001530-1212-efde-1523-785feabcd123" + const val MAX_RETRIES = 5 + const val RETRY_DELAY_MS = 5000L + const val GRACE_PERIOD_MS = 30000L // 30 seconds grace period + const val SYNC_INTERVAL_MS = 30 * 60 * 1000L // 30 minutes + const val CHANNEL_ID = "GarminReconnectServiceChannel" + const val FAILURE_CHANNEL_ID = "FailureChannel" + const val NOTIFICATION_ID = 1 + const val FAILURE_NOTIFICATION_ID = 2 + } +} diff --git a/app/src/main/java/com/wiccafe/garminreconnector/MainActivity.kt b/app/src/main/java/com/wiccafe/garminreconnector/MainActivity.kt new file mode 100644 index 0000000..d410272 --- /dev/null +++ b/app/src/main/java/com/wiccafe/garminreconnector/MainActivity.kt @@ -0,0 +1,233 @@ +package com.wiccafe.garminreconnector + +import android.Manifest +import android.content.ComponentName +import android.content.Context +import android.content.Intent +import android.content.ServiceConnection +import android.content.pm.PackageManager +import android.graphics.Color +import android.os.Build +import android.os.Bundle +import android.os.IBinder +import android.widget.Button +import android.widget.ScrollView +import android.widget.TextView +import androidx.activity.result.contract.ActivityResultContracts +import androidx.activity.viewModels +import androidx.appcompat.app.AlertDialog +import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.ContextCompat +import androidx.lifecycle.ViewModel +import androidx.lifecycle.lifecycleScope +import kotlinx.coroutines.Job +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +// A ViewModel to hold UI state across configuration changes (like screen rotation) +class MainViewModel : ViewModel() { + private val _logs = MutableStateFlow>(emptyList()) + val logs = _logs.asStateFlow() + + fun updateLogs(newLogs: List) { + _logs.value = newLogs + } +} + +class MainActivity : AppCompatActivity() { + + private lateinit var logTextView: TextView + private lateinit var logScrollView: ScrollView + private lateinit var controlButton: Button + private lateinit var statusTextView: TextView + + private var garminService: GarminReconnectService? = null + private var isBound = false + private var serviceCollectorJob: Job? = null + + // Get a reference to the ViewModel + private val viewModel: MainViewModel by viewModels() + + private val connection = object : ServiceConnection { + override fun onServiceConnected(className: ComponentName, service: IBinder) { + val binder = service as GarminReconnectService.LocalBinder + garminService = binder.getService() + isBound = true + observeServiceState() + } + + // This callback is now primarily for unexpected crashes or system kills. + override fun onServiceDisconnected(arg0: ComponentName) { + isBound = false + garminService = null + updateButtonState(false) + updateConnectionStatusUI(ConnectionStatus.DISCONNECTED) + } + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + logTextView = findViewById(R.id.logTextView) + logScrollView = findViewById(R.id.logScrollView) + controlButton = findViewById(R.id.controlButton) + statusTextView = findViewById(R.id.statusTextView) + + controlButton.setOnClickListener { toggleService() } + + // Observe the ViewModel's state to restore logs on rotation. + observeViewModel() + } + + private fun observeViewModel() { + lifecycleScope.launch { + viewModel.logs.collectLatest { logs -> + logTextView.text = logs.joinToString("\n") + logScrollView.post { logScrollView.fullScroll(ScrollView.FOCUS_DOWN) } + } + } + } + + override fun onStart() { + super.onStart() + // Always try to bind when the activity starts. This will also connect to a running service. + Intent(this, GarminReconnectService::class.java).also { intent -> + bindService(intent, connection, Context.BIND_AUTO_CREATE) + } + } + + override fun onResume() { + super.onResume() + if (!hasRequiredPermissions()) { + requestPermissions() + } + } + + override fun onStop() { + super.onStop() + if (isBound) { + unbindService(connection) + isBound = false + } + serviceCollectorJob?.cancel() + } + + private fun observeServiceState() { + serviceCollectorJob?.cancel() + serviceCollectorJob = lifecycleScope.launch { + // This collector is now the single source of truth for the service running state. + garminService?.isServiceRunning?.collect { isRunning -> + updateButtonState(isRunning) + } + } + lifecycleScope.launch { + garminService?.logs?.collectLatest { logs -> + // Push logs from the service into the ViewModel to persist them. + viewModel.updateLogs(logs) + } + } + lifecycleScope.launch { + garminService?.connectionStatus?.collectLatest { status -> + updateConnectionStatusUI(status) + } + } + } + + private fun updateConnectionStatusUI(status: ConnectionStatus) { + statusTextView.text = status.name + when (status) { + ConnectionStatus.DISCONNECTED -> statusTextView.setTextColor(Color.parseColor("#9CA3AF")) // Gray + ConnectionStatus.SCANNING -> statusTextView.setTextColor(Color.parseColor("#60A5FA")) // Blue + ConnectionStatus.CONNECTING -> statusTextView.setTextColor(Color.parseColor("#FBBF24")) // Amber + ConnectionStatus.CONNECTED -> statusTextView.setTextColor(Color.parseColor("#34D399")) // Emerald + ConnectionStatus.FAILED -> statusTextView.setTextColor(Color.parseColor("#F87171")) // Red + } + } + + private fun hasRequiredPermissions(): Boolean { + val requiredPermissions = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + listOf(Manifest.permission.BLUETOOTH_SCAN, Manifest.permission.BLUETOOTH_CONNECT, Manifest.permission.ACCESS_FINE_LOCATION) + } else { + listOf(Manifest.permission.ACCESS_FINE_LOCATION) + } + return requiredPermissions.all { + ContextCompat.checkSelfPermission(this, it) == PackageManager.PERMISSION_GRANTED + } + } + + private fun toggleService() { + if (!hasRequiredPermissions()) { + requestPermissions() + return + } + + val serviceIntent = Intent(this, GarminReconnectService::class.java) + val isRunning = garminService?.isServiceRunning?.value ?: false + + if (isRunning) { + // THE FIX: Unbind first, then stop the service, then manually update the UI. + // This prevents the "stuck button" race condition. + if (isBound) { + unbindService(connection) + isBound = false + } + stopService(serviceIntent) + updateButtonState(false) + updateConnectionStatusUI(ConnectionStatus.DISCONNECTED) + + } else { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + startForegroundService(serviceIntent) + } else { + startService(serviceIntent) + } + // After starting, re-bind to establish the communication channel + bindService(serviceIntent, connection, Context.BIND_AUTO_CREATE) + } + } + + private fun updateButtonState(running: Boolean) { + controlButton.isEnabled = true + controlButton.text = if (running) "Stop Monitoring Service" else "Start Monitoring Service" + controlButton.setBackgroundColor(if (running) Color.parseColor("#FF6347") else Color.parseColor("#32CD32")) + } + + private val requestPermissionLauncher = + registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { permissions -> + if (!hasRequiredPermissions()) { + showInsufficientPermissionsDialog() + } + } + + private fun showInsufficientPermissionsDialog() { + AlertDialog.Builder(this) + .setTitle("Insufficient Permissions") + .setMessage("This application requires Bluetooth and Location permissions to function. It will now close.") + .setPositiveButton("Exit") { _, _ -> + finish() + } + .setCancelable(false) + .show() + } + + private fun requestPermissions() { + val permissionsToRequest = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + arrayOf( + Manifest.permission.BLUETOOTH_SCAN, + Manifest.permission.BLUETOOTH_CONNECT, + Manifest.permission.POST_NOTIFICATIONS, + Manifest.permission.ACCESS_FINE_LOCATION + ) + } else { + arrayOf( + Manifest.permission.BLUETOOTH, + Manifest.permission.BLUETOOTH_ADMIN, + Manifest.permission.ACCESS_FINE_LOCATION + ) + } + requestPermissionLauncher.launch(permissionsToRequest) + } +} diff --git a/app/src/main/java/com/wiccafe/garminreconnector/ui/theme/Color.kt b/app/src/main/java/com/wiccafe/garminreconnector/ui/theme/Color.kt new file mode 100644 index 0000000..19e3ad2 --- /dev/null +++ b/app/src/main/java/com/wiccafe/garminreconnector/ui/theme/Color.kt @@ -0,0 +1,11 @@ +package com.wiccafe.garminreconnector.ui.theme + +import androidx.compose.ui.graphics.Color + +val Purple80 = Color(0xFFD0BCFF) +val PurpleGrey80 = Color(0xFFCCC2DC) +val Pink80 = Color(0xFFEFB8C8) + +val Purple40 = Color(0xFF6650a4) +val PurpleGrey40 = Color(0xFF625b71) +val Pink40 = Color(0xFF7D5260) \ No newline at end of file diff --git a/app/src/main/java/com/wiccafe/garminreconnector/ui/theme/Theme.kt b/app/src/main/java/com/wiccafe/garminreconnector/ui/theme/Theme.kt new file mode 100644 index 0000000..dc70baf --- /dev/null +++ b/app/src/main/java/com/wiccafe/garminreconnector/ui/theme/Theme.kt @@ -0,0 +1,58 @@ +package com.wiccafe.garminreconnector.ui.theme + +import android.app.Activity +import android.os.Build +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext + +private val DarkColorScheme = darkColorScheme( + primary = Purple80, + secondary = PurpleGrey80, + tertiary = Pink80 +) + +private val LightColorScheme = lightColorScheme( + primary = Purple40, + secondary = PurpleGrey40, + tertiary = Pink40 + + /* Other default colors to override + background = Color(0xFFFFFBFE), + surface = Color(0xFFFFFBFE), + onPrimary = Color.White, + onSecondary = Color.White, + onTertiary = Color.White, + onBackground = Color(0xFF1C1B1F), + onSurface = Color(0xFF1C1B1F), + */ +) + +@Composable +fun GarminreconnectorTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + // Dynamic color is available on Android 12+ + dynamicColor: Boolean = true, + content: @Composable () -> Unit +) { + val colorScheme = when { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) + } + + darkTheme -> DarkColorScheme + else -> LightColorScheme + } + + MaterialTheme( + colorScheme = colorScheme, + typography = Typography, + content = content + ) +} \ No newline at end of file diff --git a/app/src/main/java/com/wiccafe/garminreconnector/ui/theme/Type.kt b/app/src/main/java/com/wiccafe/garminreconnector/ui/theme/Type.kt new file mode 100644 index 0000000..06f3f00 --- /dev/null +++ b/app/src/main/java/com/wiccafe/garminreconnector/ui/theme/Type.kt @@ -0,0 +1,34 @@ +package com.wiccafe.garminreconnector.ui.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +// Set of Material typography styles to start with +val Typography = Typography( + bodyLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + lineHeight = 24.sp, + letterSpacing = 0.5.sp + ) + /* Other default text styles to override + titleLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 22.sp, + lineHeight = 28.sp, + letterSpacing = 0.sp + ), + labelSmall = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Medium, + fontSize = 11.sp, + lineHeight = 16.sp, + letterSpacing = 0.5.sp + ) + */ +) \ No newline at end of file diff --git a/app/src/main/res/drawable-nodpi/ic_launcher_monochrome.webp b/app/src/main/res/drawable-nodpi/ic_launcher_monochrome.webp new file mode 100644 index 0000000..ab564ac Binary files /dev/null and b/app/src/main/res/drawable-nodpi/ic_launcher_monochrome.webp differ diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..8607ce7 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/log_background.xml b/app/src/main/res/drawable/log_background.xml new file mode 100644 index 0000000..fbaa721 --- /dev/null +++ b/app/src/main/res/drawable/log_background.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/app/src/main/res/drawable/status_background.xml b/app/src/main/res/drawable/status_background.xml new file mode 100644 index 0000000..20ee812 --- /dev/null +++ b/app/src/main/res/drawable/status_background.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..8ee7792 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,67 @@ + + + + + + + +