Skip to content

Commit

Permalink
Add a Map app, which doesn't seem to work in my Mini
Browse files Browse the repository at this point in the history
  • Loading branch information
hufman committed Aug 6, 2024
1 parent 4b6d5fa commit 114a2b7
Show file tree
Hide file tree
Showing 38 changed files with 962 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions map/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
61 changes: 61 additions & 0 deletions map/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}

apply from: 'buildtools/external.gradle'

repositories {
maven { url 'https://jitpack.io' }
}

android {
namespace 'io.bimmergestalt.idriveexperiments.map'
compileSdk 34

defaultConfig {
applicationId "io.bimmergestalt.idriveexperiments.map"
minSdk 26
targetSdk 34
versionCode 1
versionName "1.0"

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

buildFeatures {
dataBinding true
}
buildTypes {
release {
minifyEnabled 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'
}
}

dependencies {

implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.4'
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'

implementation 'io.bimmergestalt:IDriveConnectKit:0.4'
implementation 'io.bimmergestalt:IDriveConnectKitAndroid:0.7'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}
66 changes: 66 additions & 0 deletions map/buildtools/external.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

def RHMISources = [
"BMW": [
// bmwone for mapState
"bmwone/bmwone.p7b": "bmwone/rhmi/bmw/bmwone.p7b",
"bmwone/rhmi/ui_description_ID5.xml": "bmwone/rhmi/ui_description.xml",
"bmwone/rhmi/common/texts.zip": "bmwone/rhmi/common/texts.zip",

],
]

// extract RHMI resources from official apps
task confirmRHMIResources() {
doLast {
def bmwFound = new FileNameByRegexFinder().getFileNames(file("../external").toString(), /(?i)bmw.*connected.*\.apk/)
if (bmwFound.isEmpty()) throw new MissingResourceException("Could not locate BMW Connected APK in external directory")
}
}

task extractRHMIResources(type: Copy, dependsOn: confirmRHMIResources) {
description "Extracts necessary RHMI resources for compilation"

def destRoot = "src/main/assets/carapplications"

def sources = [
"BMW": new FileNameByRegexFinder().getFileNames(file("../external").toString(), /(?i)bmw.*connected.*\.apk/),
]

// actually do the copy
sources.each { sourceZip ->
// only prepare the CopySpec if a destination file from this zip is missing
def missing = RHMISources[sourceZip.key].values().findAll {
!file("$destRoot/$it").exists()
}
if (!missing.isEmpty() && !sourceZip.value.isEmpty()) {
RHMISources[sourceZip.key].each { sourceFile ->
from({ zipTree(sourceZip.value[0]) }) {
include "assets/carapplications/${sourceFile.key}"
eachFile { it.relativePath = new RelativePath(true, sourceFile.value) }
}
}
if (inputs.sourceFiles.empty) throw new MissingResourceException("Could not locate RHMI Resources in provided APK: ${sourceZip.value}")
}
}
into destRoot

// declare the list of expected files, to inform Gradle Caching
def outputFiles = RHMISources.values().collect({ sourceZip ->
sourceZip.values()
}).flatten().collect({
"$destRoot/$it"
})
outputs.files outputFiles

// make extra sure that the correct files were extracted from the APKs
doLast {
def missing = outputFiles.findAll {
!file(it).exists()
}
if (!missing.isEmpty()) {
throw new MissingResourceException("Missing required RHMI files:\n${missing.join("\n")}")
}
}
}

preBuild.dependsOn extractRHMIResources
21 changes: 21 additions & 0 deletions map/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
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.bimmergestalt.idriveexperiments.map

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("io.bimmergestalt.idriveexperiments.map", appContext.packageName)
}
}
32 changes: 32 additions & 0 deletions map/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.IDriveExperiments">
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.IDriveExperiments">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".CarAppService" android:exported="true">
<intent-filter>
<action android:name="io.bimmergestalt.carconnection.service" />
</intent-filter>
<intent-filter>
<action android:name="io.bimmergestalt.idriveexperiments.map.uiConnected" />
</intent-filter>
</service>
</application>

</manifest>
Binary file added map/src/main/assets/kml.kmz
Binary file not shown.
17 changes: 17 additions & 0 deletions map/src/main/assets/kml/doc.kml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Folder>
<open>1</open>
<Style id="kmz_poi_normal.png"><IconStyle><Icon><href>kmz_poi_normal.png</href></Icon></IconStyle></Style>
<Style id="kmz_poi_highlight.png"><IconStyle><Icon><href>kmz_poi_highlight.png</href></Icon></IconStyle></Style>
<StyleMap id="f8cd938bc6f6fa2f39172a8f46c03cfbf26b6a07">
<Pair><key>normal</key><styleUrl>#kmz_poi_normal.png</styleUrl></Pair>
<Pair><key>highlight</key><styleUrl>#kmz_poi_highlight.png</styleUrl></Pair>
</StyleMap>
<Placemark id="1">
<name></name>
<styleUrl>#f8cd938bc6f6fa2f39172a8f46c03cfbf26b6a07</styleUrl>
<Point><coordinates>-121.8959279,37.3105937</coordinates></Point>
</Placemark>
</Folder>
</kml>
Binary file added map/src/main/assets/kml/kmz_poi_highlight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added map/src/main/assets/kml/kmz_poi_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 114a2b7

Please sign in to comment.