Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Belkaar committed May 27, 2024
0 parents commit 29c7fa4
Show file tree
Hide file tree
Showing 81 changed files with 3,999 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
.idea
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Belkaar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ZeroNavBridge
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
51 changes: 51 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsKotlinAndroid)
}

android {
namespace = "team.burkart.zero.navbridge"
compileSdk = 34

defaultConfig {
applicationId = "team.burkart.zero.navbridge"
minSdk = 26
targetSdk = 34
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.androidx.activity)
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -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
91 changes: 91 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-feature
android:name="android.hardware.bluetooth_le"
android:required="true" />

<uses-permission
android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
<uses-permission
android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission
android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.ZeroNavBridge"
tools:targetApi="34">
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:screenOrientation="nosensor"
android:theme="@style/Theme.ZeroNavBridge">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name=".HelpActivity"
android:exported="false"
android:theme="@style/Theme.ZeroNavBridge" />

<activity
android:name=".StartActivity"
android:exported="true"
android:label="@string/title_activity_start"
android:theme="@style/Theme.ZeroNavBridge.Translucent">
<intent-filter>
<action android:name="team.burkart.zero.navbridge.START" />
</intent-filter>
</activity>

<receiver
android:name=".NavReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="team.burkart.zero.navbridge.UPDATENAV" />
</intent-filter>
</receiver>

<service
android:name=".BridgeService"
android:exported="false"
android:foregroundServiceType="connectedDevice"
android:label="@string/service_name">
<intent-filter>
<action android:name="team.burkart.zero.navbridge.UPDATENAV" />
</intent-filter>
</service>

<service android:name=".MapsNotificationListener"
android:label="@string/mapslistener_service_name"
android:exported="false"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
<meta-data android:name="android.service.notification.default_filter_types" android:value="ongoing|alerting|silent" />
<meta-data android:name="android.service.notification.disabled_filter_types" android:value="conversations" />
</service>

</application>

</manifest>
46 changes: 46 additions & 0 deletions app/src/main/java/team/burkart/zero/LogUtil.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package team.burkart.zero

import android.annotation.SuppressLint
import android.os.Handler
import android.os.Looper
import android.util.Log
import android.widget.TextView

class LogUtil {
companion object {
@SuppressLint("SetTextI18n")
fun log(message: String) {
Log.i("zero", message)
Handler(Looper.getMainLooper()).post {
logView?.text = logView?.text.toString() + message + "\n"
}
}

fun clear() {
Handler(Looper.getMainLooper()).post {
logView?.text = ""
}
}

fun setLogView(view: TextView?) {
logView = view
}

fun setTimeStamp(name: String) {
timeStamps.put(name, System.currentTimeMillis())
}

fun getTimeStampString() : String {
var result = ""
val currentTime = System.currentTimeMillis()
timeStamps.forEach {
t, u -> result += t + ":"+ ((currentTime - u).toFloat() / 1000).toInt().toString() + "s; "
}
return result
}

private val timeStamps : MutableMap<String, Long> = HashMap()
@SuppressLint("StaticFieldLeak")
private var logView : TextView? = null
}
}
17 changes: 17 additions & 0 deletions app/src/main/java/team/burkart/zero/Observable.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package team.burkart.zero

class Observable<T>(private var value : T) {
private val observers : MutableList<(value: T, oldValue: T)->Unit> = ArrayList()

fun get() : T {return value;}

fun set(newValue: T) {
observers.forEach { observer -> observer.invoke(newValue, value); }
value = newValue
}

fun observe (callback: (value: T, oldValue: T)->Unit) {
observers.add(callback)
callback.invoke(value, value)
}
}
Loading

0 comments on commit 29c7fa4

Please sign in to comment.