-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0dce6d3
Showing
57 changed files
with
1,190 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Built application files | ||
*.apk | ||
*.aar | ||
*.ap_ | ||
*.aab | ||
|
||
# Files for the ART/Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
out/ | ||
# Uncomment the following line in case you need and you don't have the release build type files in your app | ||
# release/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log | ||
|
||
# Android Studio Navigation editor temp files | ||
.navigation/ | ||
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
# IntelliJ | ||
*.iml | ||
.idea/workspace.xml | ||
.idea/tasks.xml | ||
.idea/gradle.xml | ||
.idea/assetWizardSettings.xml | ||
.idea/dictionaries | ||
.idea/libraries | ||
# Android Studio 3 in .gitignore file. | ||
.idea/caches | ||
.idea/modules.xml | ||
# Comment next line if keeping position of elements in Navigation Editor is relevant for you | ||
.idea/navEditor.xml | ||
|
||
# Keystore files | ||
# Uncomment the following lines if you do not want to check your keystore files in. | ||
#*.jks | ||
#*.keystore | ||
|
||
# External native build folder generated in Android Studio 2.2 and later | ||
.externalNativeBuild | ||
.cxx/ | ||
|
||
# Google Services (e.g. APIs or Firebase) | ||
# google-services.json | ||
|
||
# Freeline | ||
freeline.py | ||
freeline/ | ||
freeline_project_description.json | ||
|
||
# fastlane | ||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots | ||
fastlane/test_output | ||
fastlane/readme.md | ||
|
||
# Version control | ||
vcs.xml | ||
|
||
# lint | ||
lint/intermediates/ | ||
lint/generated/ | ||
lint/outputs/ | ||
lint/tmp/ | ||
# lint/reports/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Robert | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'org.jetbrains.kotlin.android' | ||
} | ||
|
||
android { | ||
namespace 'de.r.gregat.graphhoppercoretest' | ||
compileSdk 33 | ||
|
||
defaultConfig { | ||
applicationId "de.r.gregat.graphhoppercoretest" | ||
minSdk 21 | ||
targetSdk 33 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
buildFeatures { | ||
viewBinding true | ||
} | ||
packagingOptions { | ||
resources.excludes.add("META-INF/*") | ||
} | ||
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 'com.graphhopper:graphhopper-core:6.2' | ||
implementation 'androidx.core:core-ktx:1.9.0' | ||
implementation 'androidx.appcompat:appcompat:1.5.1' | ||
implementation 'com.google.android.material:material:1.7.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' | ||
testImplementation 'junit:junit:4.13.2' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.4' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
24 changes: 24 additions & 0 deletions
24
app/src/androidTest/java/de/r/gregat/graphhoppercoretest/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package de.r.gregat.graphhoppercoretest | ||
|
||
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("de.r.gregat.graphhoppercoretest", appContext.packageName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<application | ||
android:name=".CustomApplication" | ||
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.GraphhopperCoreTest" | ||
tools:targetApi="31"> | ||
<activity | ||
android:name=".screens.main.MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
|
||
<meta-data | ||
android:name="android.app.lib_name" | ||
android:value="" /> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
20 changes: 20 additions & 0 deletions
20
app/src/main/java/de/r/gregat/graphhoppercoretest/CustomApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package de.r.gregat.graphhoppercoretest | ||
|
||
import android.app.Application | ||
import de.r.gregat.graphhoppercoretest.di.CompositionRoot | ||
|
||
|
||
|
||
|
||
class CustomApplication: Application() { | ||
private var compositionRoot: CompositionRoot? = null | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
compositionRoot = CompositionRoot() | ||
} | ||
|
||
fun getCompositionRoot(): CompositionRoot? { | ||
return compositionRoot | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/de/r/gregat/graphhoppercoretest/di/ActivityCompositionRoot.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package de.r.gregat.graphhoppercoretest.di | ||
|
||
import androidx.fragment.app.FragmentActivity | ||
|
||
class ActivityCompositionRoot( | ||
val compositionRoot: CompositionRoot, | ||
val fragmentActivity: FragmentActivity | ||
) { | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
app/src/main/java/de/r/gregat/graphhoppercoretest/di/CompositionRoot.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package de.r.gregat.graphhoppercoretest.di | ||
|
||
import de.r.gregat.graphhoppercoretest.utils.BackgroundThreadHelper | ||
import de.r.gregat.graphhoppercoretest.utils.UiThreadHelper | ||
|
||
class CompositionRoot { | ||
private var backgroundThreadHelper: BackgroundThreadHelper? = null | ||
private var uiThreadHelper: UiThreadHelper? = null | ||
|
||
fun getBackgroundThreadHelper(): BackgroundThreadHelper { | ||
if(backgroundThreadHelper == null) { | ||
backgroundThreadHelper = BackgroundThreadHelper() | ||
} | ||
return backgroundThreadHelper!! | ||
} | ||
|
||
fun getUiThreadHelper(): UiThreadHelper { | ||
if(uiThreadHelper == null) { | ||
uiThreadHelper = UiThreadHelper() | ||
} | ||
return uiThreadHelper!! | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
app/src/main/java/de/r/gregat/graphhoppercoretest/di/ControllerCompositionRoot.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package de.r.gregat.graphhoppercoretest.di | ||
|
||
import android.content.Context | ||
import android.view.LayoutInflater | ||
import androidx.fragment.app.FragmentActivity | ||
import de.r.gregat.graphhoppercoretest.screens.common.ViewMvcFactory | ||
|
||
|
||
|
||
|
||
|
||
class ControllerCompositionRoot(private val activityCompositionRoot: ActivityCompositionRoot) { | ||
|
||
fun getFragmentActivity(): FragmentActivity { | ||
return activityCompositionRoot.fragmentActivity | ||
} | ||
|
||
private fun getContext(): Context { | ||
return getFragmentActivity() | ||
} | ||
|
||
private fun getLayoutInflater(): LayoutInflater { | ||
return LayoutInflater.from(getContext()) | ||
} | ||
|
||
fun getViewMvcFactory(): ViewMvcFactory { | ||
return ViewMvcFactory(getLayoutInflater()) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
app/src/main/java/de/r/gregat/graphhoppercoretest/screens/common/BaseActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package de.r.gregat.graphhoppercoretest.screens.common | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import de.r.gregat.graphhoppercoretest.CustomApplication | ||
import de.r.gregat.graphhoppercoretest.di.ActivityCompositionRoot | ||
import de.r.gregat.graphhoppercoretest.di.ControllerCompositionRoot | ||
|
||
|
||
open class BaseActivity: AppCompatActivity() { | ||
private var activityCompositionRoot: ActivityCompositionRoot? = null | ||
private var controllerCompositionRoot: ControllerCompositionRoot? = null | ||
|
||
fun getActivityCompositionRoot(): ActivityCompositionRoot? { | ||
if (activityCompositionRoot == null) { | ||
activityCompositionRoot = ActivityCompositionRoot( | ||
(application as CustomApplication).getCompositionRoot()!!, | ||
this | ||
) | ||
} | ||
return activityCompositionRoot | ||
} | ||
|
||
protected fun getCompositionRoot(): ControllerCompositionRoot? { | ||
if (controllerCompositionRoot == null) { | ||
controllerCompositionRoot = ControllerCompositionRoot(getActivityCompositionRoot()!!) | ||
} | ||
return controllerCompositionRoot | ||
} | ||
} |
Oops, something went wrong.