Skip to content

Commit

Permalink
Merge branch 'gsoc2024-map-libre-migration' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
SebaDro committed Jan 3, 2025
2 parents b90b742 + 6fd6251 commit c351f29
Show file tree
Hide file tree
Showing 97 changed files with 3,896 additions and 1,882 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.idea/
**/.idea/**
!.idea/.name
!.idea/icon.svg
build/
*/build/
.gradle/
Expand All @@ -9,3 +11,4 @@ local.properties
gradle-release.properties
lcs-keystore
*/.settings/
**/.DS_Store
1 change: 1 addition & 0 deletions .idea/.name

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

10 changes: 10 additions & 0 deletions .idea/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 11 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ This is the app for the enviroCar platform. (www.envirocar.org)

enviroCar Mobile is an Android application for smartphones that can be used to collect Extended Floating Car Data (XFCD). The app communicates with an OBD2 Bluetooth adapter while the user drives. This enables read access to data from the vehicle’s engine control. The data is recorded along with the smartphone’s GPS position data.The driver can view statistics about his drives and publish his data as open data. The latter happens by uploading tracks to the enviroCar server, where the data is available under the ODbL license for further analysis and use. The data can also be viewed and analyzed via the enviroCar website. enviroCar Mobile is one of the enviroCar Citizen Science Platform’s components (www.envirocar.org).


**Key Technologies**

- Android
- Java
- Kotlin

**Benefits**

Expand All @@ -24,10 +24,8 @@ enviroCar Mobile is an Android application for smartphones that can be used to c
- Publishing anonymized track data as Open Data
- Map based visualization of track data and track statistics


## Quick Start


### Installation

Use the [Google Play Store](https://play.google.com/store/apps/details?id=org.envirocar.app) to install the app on your device.
Expand All @@ -40,23 +38,16 @@ This software uses the gradle build system and is optimized to work within Andro
The setup of the source code should be straightforward. Just follow the Android Studio guidelines
for existing projects.

### Setting up the mapbox SDK
The enviroCar App project uses the ``Mapbox Maven repository``. **Mapbox is a mapping and location cloud platform for developers.**
To build the project you need the mapbox account, you can create an account for free from [here](https://account.mapbox.com/auth/signup/).
Once you have created an account, you will need to configure credentials
### Setting up the map module

The software includes a [map module](./org.envirocar.map), which is used to visualize the track data & statistics on a map. It may require additional configuration as part of the development process. Please refer to the [respective documentation](./org.envirocar.map/README.md) for more information.

### Configure credentials
1. From your account's [tokens page](https://account.mapbox.com/access-tokens/), click the **Create a token** button.
2. Give your token a name and do check that you have checked ``Downloads:Read`` scope.
3. Make sure you copy your token and save it somehwere as you will not be able to see the token again.
The map module provides support for multiple map providers & libraries. These may be enabled or disabled during compilation.

### Configure your secret token
1. This is a secret token, and we will use it in ``gradle.properties`` file. You should not expose the token in public, that's why add ``gradle.properties`` in ``.gitignore`` . It's also possible to store the sercret token in your local user's _gradle.properties_ file, usually stored at _«USER_HOME»/.gradle/gradle.properties_.
2. Now open the ``gradle.properties`` file and add this line ``MAPBOX_DOWNLOADS_TOKEN = <your-secret-token> ``. The secret token has to be pasted without any quote marks.
``MAPBOX_DOWNLOADS_TOKEN=sk.dutaksgjdvlsayVDSADUTLASDs@!ahsvdaslud*JVAS@%DLUTSVgdJLA&&>Hdval.sujdvadvasuydgalisy``(this is just a random string, not a real token)
3. That't it. You are good to go!

If you are still facing any problem, checkout the [Mapbox guide](https://docs.mapbox.com/android/maps/guides/install/) or feel free to [create an issue](https://github.com/enviroCar/enviroCar-app/issues/new)
The application also allows to switch between the map providers & styles during runtime as well.

[MapTiler](https://www.maptiler.com/) API key needs to be specified as `MAPTILER_API_KEY` in the [`gradle.properties` file](./gradle.properties) before compilation. MapTiler (a tile provider) is configured to work with Mapbox map provider & MapLibre map provider.

## License

Expand Down Expand Up @@ -100,17 +91,16 @@ Check out the [Changelog](https://github.com/enviroCar/enviroCar-app/blob/master

## OBD simulator

The repository also contains a simple OBD simulator (dumb, nothing fancy) that can
be used on another Android device and mock the actual car adapter.
The repository also contains a simple OBD simulator (dumb, nothing fancy) that can be used on another Android device and mock the actual car adapter.

## References

This app is in operational use in the [CITRAM - Citizen Science for Traffic Management](https://www.citram.de/) project. Check out the [enviroCar website](https://envirocar.org/) for more information about the enviroCar project.

## How to Contribute
For contributing to the enviroCar Android App, please, have a look at our [Contributor Guidelines](https://github.com/enviroCar/enviroCar-app/blob/master/CONTRIBUTING.md).

For contributing to the enviroCar Android App, please, have a look at our [Contributor Guidelines](https://github.com/enviroCar/enviroCar-app/blob/master/CONTRIBUTING.md).

## Contributors

Here is the list of [contributors to this project](https://github.com/enviroCar/enviroCar-app/blob/master/CONTRIBUTORS.md)
Here is the list of [contributors to this project](https://github.com/enviroCar/enviroCar-app/blob/master/CONTRIBUTORS.md).
2 changes: 1 addition & 1 deletion android-obd-simulator/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
alias libs.plugins.android.application
alias(libs.plugins.android.application)
}

android {
Expand Down
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
plugins {
alias libs.plugins.android.application apply false
alias libs.plugins.android.library apply false
alias libs.plugins.license.plugin
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.jetbrains.kotlin.android) apply false
alias(libs.plugins.license.plugin)
}

allprojects {
Expand Down
14 changes: 12 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,22 @@ coreTesting = "1.1.1"
dagger = "2.51.1"
easypermissions = "3.0.0"
envirocarAidl = "d67cfa49f3"
espressoCore = "3.5.1"
fabprogresscircle = "1.01"
gson = "2.10.1"
hellochartsLibrary = "1.5.8"
jsr305 = "3.0.2"
junit = "4.13.2"
junitVersion = "1.1.5"
kotlin = "1.9.0"
legacySupportV4 = "1.0.0"
licensePlugin = "0.16.1"
lifecycleCompiler = "2.7.0"
lifecycleExtensions = "2.2.0"
lifecycleRuntime = "2.7.0"
mapboxAndroidSdk = "9.2.1"
mapboxMapsAndroid = "11.4.0"
maplibreGlAndroidPluginAnnotationV9 = "3.0.0"
maplibreGlAndroidSdk = "11.0.1"
material = "1.12.0"
mockitoCore = "5.7.0"
opencsv = "4.6"
Expand Down Expand Up @@ -58,6 +63,8 @@ androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "a
androidx-cardview = { module = "androidx.cardview:cardview", version.ref = "cardview" }
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
androidx-core = { module = "androidx.core:core", version.ref = "androidxCore" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-legacy-support-v4 = { module = "androidx.legacy:legacy-support-v4", version.ref = "legacySupportV4" }
androidx-lifecycle-compiler = { module = "androidx.lifecycle:lifecycle-runtime", version.ref = "lifecycleCompiler" }
androidx-lifecycle-extensions = { module = "androidx.lifecycle:lifecycle-extensions", version.ref = "lifecycleExtensions" }
Expand All @@ -83,7 +90,9 @@ gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
hellocharts-library = { module = "com.github.lecho:hellocharts-library", version.ref = "hellochartsLibrary" }
jsr305 = { module = "com.google.code.findbugs:jsr305", version.ref = "jsr305" }
junit = { module = "junit:junit", version.ref = "junit" }
mapbox-android-sdk = { module = "com.mapbox.mapboxsdk:mapbox-android-sdk", version.ref = "mapboxAndroidSdk" }
mapbox-maps-android = { module = "com.mapbox.maps:android", version.ref = "mapboxMapsAndroid" }
maplibre-gl-android-plugin-annotation-v9 = { module = "org.maplibre.gl:android-plugin-annotation-v9", version.ref = "maplibreGlAndroidPluginAnnotationV9" }
maplibre-gl-android-sdk = { module = "org.maplibre.gl:android-sdk", version.ref = "maplibreGlAndroidSdk" }
material = { module = "com.google.android.material:material", version.ref = "material" }
material-dialogs-core = { module = "com.afollestad.material-dialogs:core", version.ref = "afollestadCore" }
mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockitoCore" }
Expand All @@ -107,4 +116,5 @@ transitionseverywhere = { module = "com.andkulikov:transitionseverywhere", versi
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
license-plugin = { id = "com.github.hierynomus.license", version.ref = "licensePlugin" }
6 changes: 3 additions & 3 deletions org.envirocar.algorithm/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
alias libs.plugins.android.library
alias(libs.plugins.android.library)
}

android {
Expand All @@ -19,8 +19,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}

Expand Down
20 changes: 11 additions & 9 deletions org.envirocar.app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
alias libs.plugins.android.application
alias(libs.plugins.android.application)
alias(libs.plugins.jetbrains.kotlin.android)
}

android {
Expand All @@ -15,6 +16,8 @@ android {

multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

buildConfigField "String", "MAPTILER_API_KEY", "\"${project.properties["MAPTILER_API_KEY"]}\""
}

buildFeatures {
Expand All @@ -41,12 +44,14 @@ android {
minifyEnabled false
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.debug

applicationIdSuffix ".debug"
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

sourceSets {
Expand Down Expand Up @@ -142,10 +147,6 @@ dependencies {
implementation libs.circleimageview
implementation libs.easypermissions

// MapBox SDK.

implementation libs.mapbox.android.sdk

// Testing.

testImplementation libs.junit
Expand All @@ -170,11 +171,12 @@ dependencies {

// Modules.

api project(path: ":org.envirocar.algorithm")
api project(path: ":org.envirocar.core")
api project(path: ":org.envirocar.remote")
api project(path: ":org.envirocar.map")
api project(path: ":org.envirocar.obd")
api project(path: ":org.envirocar.remote")
api project(path: ":org.envirocar.storage")
api project(path: ":org.envirocar.algorithm")
implementation libs.envirocar.aidl
}

Expand Down
5 changes: 5 additions & 0 deletions org.envirocar.app/res/drawable/baseline_expand_less_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="@android:color/white" android:pathData="M12,8l-6,6 1.41,1.41L12,10.83l4.59,4.58L18,14z"/>

</vector>
5 changes: 5 additions & 0 deletions org.envirocar.app/res/drawable/baseline_expand_more_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="@android:color/white" android:pathData="M16.59,8.59L12,13.17 7.41,8.59 6,10l6,6 6,-6z"/>

</vector>
4 changes: 2 additions & 2 deletions org.envirocar.app/res/layout/activity_map_expanded.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
app:layout_constraintRight_toRightOf="parent"
app:pressedTranslationZ="12dp" />

<com.mapbox.mapboxsdk.maps.MapView
<org.envirocar.map.MapView
android:id="@+id/activity_track_details_expanded_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand All @@ -86,7 +86,7 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0">

</com.mapbox.mapboxsdk.maps.MapView>
</org.envirocar.map.MapView>

<androidx.cardview.widget.CardView
android:id="@+id/legendCard"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
android:background="@android:color/transparent"
android:elevation="1dp" />

<com.mapbox.mapboxsdk.maps.MapView
<org.envirocar.map.MapView
android:id="@+id/activity_track_details_header_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion org.envirocar.app/res/layout/fragment_track_map.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.mapbox.mapboxsdk.maps.MapView
<org.envirocar.map.MapView
android:id="@+id/fragment_dashboard_frag_map_mapview"
android:layout_height="match_parent"
android:layout_width="match_parent" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
Copyright (C) 2013 - 2021 the enviroCar community
Expand All @@ -19,33 +18,30 @@
with the enviroCar app. If not, see http://www.gnu.org/licenses/.
-->
<LinearLayout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_tracklist_cardlayout_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
xmlns:mapbox="http://schemas.android.com/apk/res-auto">
android:orientation="vertical">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="150dp">

<com.mapbox.mapboxsdk.maps.MapView
<org.envirocar.map.MapView
android:id="@+id/fragment_tracklist_cardlayout_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
mapbox:mapbox_renderTextureMode="true"
android:background="@android:color/background_light"
android:transitionName="transition_track_details"/>
android:clickable="false"
android:transitionName="transition_track_details" />

<ImageButton
android:id="@+id/fragment_tracklist_cardlayout_invis_mapbutton"
android:id="@+id/fragment_tracklist_cardlayout_invisible_mapbutton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:elevation="4dp"/>
android:elevation="4dp" />

</RelativeLayout>

Expand All @@ -70,14 +66,14 @@
android:gravity="center"
android:text="0:00"
android:textColor="@color/blue_light_cario"
android:textSize="24sp"/>
android:textSize="24sp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/track_list_details_duration"
android:textSize="10sp"/>
android:textSize="10sp" />
</LinearLayout>

<LinearLayout
Expand All @@ -95,14 +91,14 @@
android:gravity="center"
android:text="0:00"
android:textColor="@color/blue_light_cario"
android:textSize="24sp"/>
android:textSize="24sp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/track_list_details_distance"
android:textSize="10sp"/>
android:textSize="10sp" />
</LinearLayout>

</LinearLayout>
Expand Down
Loading

0 comments on commit c351f29

Please sign in to comment.