master
yova 4 months ago
commit 64f14b6fd0

15
.gitignore vendored

@ -0,0 +1,15 @@
*.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

3
.idea/.gitignore vendored

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" />
</component>
</project>

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/Pixel_2_API_29_2.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-12-26T22:11:52.582376773Z" />
</component>
</project>

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$USER_HOME$/gradle" />
<option name="gradleJvm" value="Embedded JDK" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.9.20-Beta" />
</component>
</project>

@ -0,0 +1,17 @@
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="app/src/main/res/layout/activity_gather.xml" value="0.21846153846153846" />
<entry key="app/src/main/res/layout/activity_main.xml" value="0.221875" />
<entry key="app/src/main/res/layout/list_item.xml" value="0.20677083333333332" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

1
app/.gitignore vendored

@ -0,0 +1 @@
/build

@ -0,0 +1,70 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id("org.jetbrains.kotlin.plugin.parcelize")
}
android {
compileSdk 33
defaultConfig {
applicationId "and06.geonotes"
minSdk 23
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
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'
}
namespace 'and06.geonotes'
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KaptGenerateStubs).configureEach {
kotlinOptions {
jvmTarget = "1.8"
}
}
apply plugin: 'kotlin-kapt'
dependencies {
implementation("com.squareup.okhttp3:logging-interceptor:4.11.0")
implementation 'com.squareup.retrofit2:retrofit:<VERSION>'
implementation 'com.squareup.retrofit2:converter-jackson:2.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.webkit:webkit:1.4.0'
def room_version="2.5.2"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'org.osmdroid:osmdroid-android:6.1.13'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
kapt {
arguments {
arg("room.schemaLocation", "$projectDir/schemas".toString())
}
}

@ -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

@ -0,0 +1,174 @@
{
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "96281f21ed21dec24a5cb4d06c55ee94",
"entities": [
{
"tableName": "projekte",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `beschreibung` TEXT, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "beschreibung",
"columnName": "beschreibung",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "notizen",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `projektId` INTEGER NOT NULL, `latitude` REAL NOT NULL, `longitude` REAL NOT NULL, `thema` TEXT NOT NULL, `notiz` TEXT NOT NULL, FOREIGN KEY(`projektId`) REFERENCES `projekte`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`latitude`, `longitude`) REFERENCES `locations`(`latitude`, `longitude`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "projektId",
"columnName": "projektId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "latitude",
"columnName": "latitude",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "longitude",
"columnName": "longitude",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "thema",
"columnName": "thema",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notiz",
"columnName": "notiz",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"id"
]
},
"indices": [
{
"name": "index_notizen_projektId",
"unique": false,
"columnNames": [
"projektId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_notizen_projektId` ON `${TABLE_NAME}` (`projektId`)"
},
{
"name": "index_notizen_latitude_longitude",
"unique": false,
"columnNames": [
"latitude",
"longitude"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_notizen_latitude_longitude` ON `${TABLE_NAME}` (`latitude`, `longitude`)"
}
],
"foreignKeys": [
{
"table": "projekte",
"onDelete": "NO ACTION",
"onUpdate": "NO ACTION",
"columns": [
"projektId"
],
"referencedColumns": [
"id"
]
},
{
"table": "locations",
"onDelete": "NO ACTION",
"onUpdate": "NO ACTION",
"columns": [
"latitude",
"longitude"
],
"referencedColumns": [
"latitude",
"longitude"
]
}
]
},
{
"tableName": "locations",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`latitude` REAL NOT NULL, `longitude` REAL NOT NULL, `altitude` REAL NOT NULL, `provider` TEXT NOT NULL, PRIMARY KEY(`latitude`, `longitude`))",
"fields": [
{
"fieldPath": "latitude",
"columnName": "latitude",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "longitude",
"columnName": "longitude",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "altitude",
"columnName": "altitude",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "provider",
"columnName": "provider",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"latitude",
"longitude"
]
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '96281f21ed21dec24a5cb4d06c55ee94')"
]
}
}

@ -0,0 +1,24 @@
package and06.geonotes
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("and06.geonotes", appContext.packageName)
}
}

@ -0,0 +1,59 @@
<?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-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<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.Geonotes"
tools:targetApi="31">
<activity
android:name=".OsmWebViewActivity"
android:exported="false" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="geonotes.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"></meta-data>
</provider>
<activity
android:name=".GatherActivity"
android:configChanges="orientation|screenSize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".NoteMapActivity"
android:exported="false">
<!--
n
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
-->
</activity>
</application>
</manifest>

@ -0,0 +1,716 @@
package and06.geonotes
import android.content.Context
import android.content.Intent
import android.location.Location
import android.location.LocationListener
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.location.LocationManager
import android.util.Log
import android.view.View
import android.widget.*
import android.Manifest
import android.app.ProgressDialog.show
import android.content.ActivityNotFoundException
import android.content.DialogInterface
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.os.Environment
import java.text.DateFormat
import android.view.Menu
import android.view.MenuItem
import androidx.appcompat.app.AlertDialog
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.util.Date
class GatherActivity : AppCompatActivity() {
var minTime = 5000L // in Millisekunden
var minDistance = 5.0f // in Metern
var aktuellesProjekt = Projekt(Date().getTime(), "")
var aktuelleNotiz: Notiz? = null
val locationListener = NoteLocationListener()
companion object {
val NOTIZEN = "notizen"
val INDEX_AKTUELLE_NOTIZ = "index_aktuelle_notiz"
val PREFERENCES = "preferences"
val ID_ZULETZT_GEOEFFNETES_PROJEKT = "id_zuletzt_geoeffnetes_projekt"
val AKTUELLES_PROJEKT = "aktuelles_projekt"
val AKTUELLE_NOTIZ = "aktuelle_notiz"
}
inner class NoteLocationListener : LocationListener {
override fun onLocationChanged(location: Location) {
Log.d(javaClass.simpleName, "Empfangene Geodaten:\n$location")
/* val textview = findViewById<TextView>(R.id.textview_output)
textview.append("\nEmpfangene Geodaten:\n$location")*/
}
}
inner class SpinnerProviderItemSelectedListener : AdapterView.OnItemSelectedListener {
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
if (findViewById<ToggleButton>(R.id.togglebutton_lokalisierung).isChecked()) {
val locationManager = getSystemService(Context.LOCATION_SERVICE) as LocationManager
locationManager.removeUpdates(locationListener)
val provider = (view as TextView).text.toString()
try {
locationManager.requestLocationUpdates(
provider,
minTime,
minDistance,
locationListener
)
} catch (ex: SecurityException) {
Log.e(
javaClass.simpleName,
"Erforderliche Berechtigung $ex.toString() nicht erteilt"
)
}
}
}
override fun onNothingSelected(parent: AdapterView<*>?) {
}
}
fun initSpinnerProviders() {
val locationManager = getSystemService(Context.LOCATION_SERVICE) as LocationManager
val providers = locationManager.getProviders(true)
Log.d(javaClass.simpleName, "Verfügbare Provider:")
providers.forEach {
Log.d(javaClass.simpleName, "Provider: $it")
}
val spinner = findViewById<Spinner>(R.id.spinner_provider)
spinner.adapter = ArrayAdapter<String>(this, R.layout.list_item, providers)
spinner.onItemSelectedListener = SpinnerProviderItemSelectedListener()
if (providers.contains("gps"))
spinner.setSelection(providers.indexOf("gps"))
}
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
val locationIndex = permissions.indexOf(Manifest.permission.ACCESS_FINE_LOCATION)
if (grantResults[locationIndex] == PackageManager.PERMISSION_GRANTED) { //deprecated source
initSpinnerProviders()
} else {
Toast.makeText(
this,
"Standortbestimmung nicht erlaubt -- nur eingeschränkte Funktionalität verfügbar",
Toast.LENGTH_LONG
).show()
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_gather)
requestPermissions(
arrayOf<String>(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION
), 0
)
setSupportActionBar(findViewById(R.id.toolbar)) // deprecated source
val textview = findViewById<TextView>(R.id.textview_aktuelles_projekt)
textview.append(aktuellesProjekt.getDescription())
val notiz: Notiz?
if (savedInstanceState != null) {
if (Build.VERSION.SDK_INT >= 33) { // TIRAMISU
aktuellesProjekt =
savedInstanceState.getParcelable(AKTUELLES_PROJEKT, Projekt::class.java)!!
notiz =
savedInstanceState.getParcelable(AKTUELLE_NOTIZ, Notiz::class.java)
} else {
aktuellesProjekt =
savedInstanceState.getParcelable(AKTUELLES_PROJEKT)!!
notiz =
savedInstanceState.getParcelable(AKTUELLE_NOTIZ)
}
if (notiz != null) aktuelleNotiz = notiz!!
return
}
val projektId = getSharedPreferences(PREFERENCES, Context.MODE_PRIVATE).getLong(
ID_ZULETZT_GEOEFFNETES_PROJEKT,
0
)
if (projektId != 0L) {
val database = GeoNotesDatabase.getInstance(this)
CoroutineScope(Dispatchers.Main).launch {
var projekt: Projekt? = null
withContext(Dispatchers.IO) {
projekt = database.projekteDao().getProjekt(projektId)
}
if (projekt != null) {
with(AlertDialog.Builder(this@GatherActivity)) {
setMessage("Projekt \"${projekt?.getDescription()}\" weiter bearbeiten?")
setPositiveButton("Ja", DialogInterface.OnClickListener { dialog, id ->
aktuellesProjekt = projekt!!
val textview = findViewById<TextView>(R.id.textview_aktuelles_projekt)
textview.text =
getString(R.string.aktuelles_projekt_prefix) + aktuellesProjekt.getDescription()
})
setNegativeButton("Nein", DialogInterface.OnClickListener { dialog, id ->
})
show()
}
}
}
}
}
override fun onDestroy() {
super.onDestroy()
val locationManager = getSystemService(Context.LOCATION_SERVICE) as LocationManager
locationManager.removeUpdates(locationListener)
getSharedPreferences(PREFERENCES, Context.MODE_PRIVATE).edit()
.putLong(ID_ZULETZT_GEOEFFNETES_PROJEKT, aktuellesProjekt.id).apply()
Log.d(javaClass.simpleName, "ID_ZULETZT_GEOEFFNETES_PROJEKT: " + aktuellesProjekt.id)
}
override fun onPause() {
super.onPause()
val locationManager = getSystemService(Context.LOCATION_SERVICE) as LocationManager
locationManager.removeUpdates(locationListener)
}
override fun onResume() {
super.onResume()
if (findViewById<ToggleButton>(R.id.togglebutton_lokalisierung).isChecked()) {
val spinner = findViewById<Spinner>(R.id.spinner_provider)
val provider = spinner.selectedItem as String
val locationManager = getSystemService(Context.LOCATION_SERVICE) as LocationManager
try {
locationManager.requestLocationUpdates(
provider,
minTime,
minDistance,
locationListener
)
} catch (ex: SecurityException) {
Log.e(
javaClass.simpleName,
"Erforderliche Berechtigung ${ex.toString()} nicht erteilt"
)
}
}
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.putParcelable(AKTUELLES_PROJEKT, aktuellesProjekt)
if (aktuelleNotiz != null) outState.putParcelable(AKTUELLE_NOTIZ, aktuelleNotiz)
}
@Deprecated("Deprecated in Java")
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode != RESULT_OK) return
if (requestCode != 0) return
val extras = data?.getExtras() ?: return
val notizId = extras.getLong(NoteMapActivity.AKTUELLE_NOTIZ_ID)
val database = GeoNotesDatabase.getInstance(this)
Log.d(javaClass.simpleName, "Selected Notiz-ID: $notizId")
CoroutineScope(Dispatchers.Main).launch {
var notiz: Notiz? = null
withContext(Dispatchers.IO) {
notiz = database.notizenDao().getNotiz(notizId)
}
if (notiz != null) {
aktuelleNotiz = notiz
findViewById<TextView>(R.id.edittext_thema).text = aktuelleNotiz?.thema
findViewById<TextView>(R.id.edittext_notiz).text = aktuelleNotiz?.notiz
}
}
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.menu_gather_activity, menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
val id = item.itemId
when (id) {
R.id.item_foot, R.id.item_bicycle, R.id.item_car, R.id.item_car_fast, R.id.item_desktop -> {
item.setChecked(true)
val map = hashMapOf<Int, Pair<Long, Float>>(
R.id.item_desktop to (60000L to 10.0f),
R.id.item_foot to (9000L to 10.0f),
R.id.item_bicycle to (4000L to 25.0f),
R.id.item_car to (4000L to 50.0f),
R.id.item_car_fast to (4000L to 100.0f)
)
val pair = map.get(id) ?: return true
minTime = pair.first
minDistance = pair.second
Toast.makeText(
this,
"Neues GPS-Intervall \"$item\". Bitte Lokalisierung neu starten.",
Toast.LENGTH_LONG
).show()
return true
}
R.id.menu_projekt_bearbeiten -> {
openProjektBearbeitenDialog()
}
R.id.menu_projekt_auswaehlen -> {
openProjektAuswaehlenDialog()
}
R.id.menu_notiz_loeschen -> {
notizLoeschen()
}
R.id.menu_projekt_versenden -> {
projektVersenden()
}
R.id.menu_osm_oeffnen -> {
openNavigation()
}
R.id.menu_ghost -> {
callGhostApi()
}
}
return super.onOptionsItemSelected(item)
}
fun callGhostApi() {
CoroutineScope(Dispatchers.Main).launch {
withContext(Dispatchers.IO) {
ghostAPI.register()
ghostAPI.sendPosting(title=aktuelleNotiz!!.thema, html=aktuelleNotiz!!.notiz, author="yova@freedomhost.de")
/*createPost()*/
/*listPosts*/
/*createPost()*/
}
}
}
fun projektVersenden() {
if
(!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
Toast.makeText(this, "External Storage nicht verfügbar", Toast.LENGTH_LONG).show()
return
}
val database = GeoNotesDatabase.getInstance(this)
GlobalScope.launch {
val notizen = database.notizenDao().getNotizen(aktuellesProjekt.id)
if (notizen.isNullOrEmpty()) {
Toast.makeText(this@GatherActivity, "keine Notizen vorhanden", Toast.LENGTH_LONG).show()
return@launch
}
val generator = GpxGenerator()
val uri = generator.createGpxFile(this@GatherActivity, notizen, aktuellesProjekt.getDescription())
with(Intent(Intent.ACTION_SEND)) {
type = "text/xml"
putExtra(Intent.EXTRA_EMAIL, arrayOf("info@joefixit.eu"))
putExtra(Intent.EXTRA_SUBJECT, aktuellesProjekt.getDescription())
putExtra(Intent.EXTRA_STREAM, uri)
startActivity(Intent.createChooser(this, "Mail versenden"))
}
}
}
private fun notizLoeschen() {
if (aktuelleNotiz == null) {
Toast.makeText(this, "Notiz noch nicht gespeichert", Toast.LENGTH_LONG).show()
return
}
val id: Long = aktuelleNotiz!!.id as Long
val textViewThema = findViewById<TextView>(R.id.edittext_thema)
val textViewNotiz = findViewById<TextView>(R.id.edittext_notiz)
val database = GeoNotesDatabase.getInstance(this)
CoroutineScope(Dispatchers.Main).launch {
var notizen: List<Notiz>? = null
withContext(Dispatchers.IO) {
notizen = database.notizenDao().getNotizen(aktuellesProjekt.id)
}
if (!notizen.isNullOrEmpty() && notizen!!.size > 1) {
withContext(Dispatchers.IO) {
database.notizenDao().deleteNotiz(id)
notizen = database.notizenDao().getNotizen(aktuellesProjekt.id)
}
Toast.makeText(this@GatherActivity, "Notiz gelöscht.", Toast.LENGTH_LONG).show()
aktuelleNotiz = null
textViewThema.text = ""
textViewNotiz.text = ""
} else {
// Ganzes Projekt löschen
with(AlertDialog.Builder(this@GatherActivity)) {
setTitle("Löschen der letzten Notiz löscht das Projekt. Fortfahren?")
setNegativeButton("Abbrechen") { _, _ ->
Log.d(javaClass.simpleName, "Abbrechen")
return@setNegativeButton
}
setPositiveButton("OK") { _, _ ->
CoroutineScope(Dispatchers.Main).launch {
withContext(Dispatchers.IO) {
database.notizenDao().deleteNotiz(id)
database.projekteDao().deleteProjekt(aktuellesProjekt.id)
}
Toast.makeText(this@GatherActivity, "Projekt gelöscht.", Toast.LENGTH_LONG).show()
textViewThema.text = ""
textViewNotiz.text = ""
aktuellesProjekt = Projekt(Date().getTime(), "")
findViewById<TextView>(R.id.textview_aktuelles_projekt).text = getString(R.string.aktuelles_projekt_prefix) + aktuellesProjekt.getDescription()
}
}
show()
}
}
}
}
fun onToggleButtonLokalisierenClick(view: View?) {
val locationManager = getSystemService(Context.LOCATION_SERVICE) as LocationManager
if ((view as ToggleButton).isChecked()) {
val spinner = findViewById<Spinner>(R.id.spinner_provider)
val provider = spinner.selectedItem as String?
if (provider == null) {
Toast.makeText(
this,
"Erforderliche Berechtigungen wurden nicht erteilt",
Toast.LENGTH_LONG
).show()
(view as ToggleButton).setChecked(false)
return
}
try {
locationManager.requestLocationUpdates(
provider,
minTime,
minDistance,
locationListener
)
Log.d(javaClass.simpleName, "Lokalisierung gestartet")
} catch (ex: SecurityException) {
Log.e(
javaClass.simpleName,
"Erforderliche Berechtigung $ex.toString() nicht erteilt"
)
}
} else {
locationManager.removeUpdates(locationListener)
Log.d(javaClass.simpleName, "Lokalisierung beendet")
}
}
fun onButtonNotizSpeichernClick(view: View) {
val themaText = findViewById<TextView>(R.id.edittext_thema).text.toString().trim()
val notizText = findViewById<TextView>(R.id.edittext_notiz).text.toString().trim()
if (themaText.isEmpty() || notizText.isEmpty()) {
Toast.makeText(this, "Thema und Notiz dürfen nicht leer sein", Toast.LENGTH_LONG)
.show()
return
}
var lastLocation: Location? = null
var provider = ""
try {
val locationManager = getSystemService(LOCATION_SERVICE) as LocationManager
val spinner = findViewById<Spinner>(R.id.spinner_provider)
provider = spinner.selectedItem as String
lastLocation = locationManager.getLastKnownLocation(provider)
} catch (ex: SecurityException) {
Log.e(
javaClass.simpleName,
"Erforderliche Berechtigung $ex.toString() nicht erteilt"
)
}
if (lastLocation == null) {
Toast.makeText(
this,
"Noch keine Geoposition ermittelt. Bitte später nochmal versuchen",
Toast.LENGTH_LONG
).show()
return
}
// Projekt speichern
val database = GeoNotesDatabase.getInstance(this)
GlobalScope.launch {
val id = database.projekteDao().insertProjekt(aktuellesProjekt)
Log.d(
javaClass.simpleName,
"Projekt $aktuellesProjekt mit id=$id in Datenbank geschrieben"
)
if (aktuelleNotiz == null && lastLocation != null) {
// Location speichern:
database.locationsDao().insertLocation(
Location(
lastLocation.latitude,
lastLocation.longitude,
lastLocation.altitude,
provider
)
)
// Notiz speichern:
aktuelleNotiz = Notiz(
null,
aktuellesProjekt.id,
lastLocation.latitude,
lastLocation.longitude,
themaText,
notizText
)
aktuelleNotiz?.id = database.notizenDao().insertNotiz(aktuelleNotiz!!)
Log.d(javaClass.simpleName, "Notiz $aktuelleNotiz gespeichert")
} else {
// Notiz aktualisieren
aktuelleNotiz?.thema = themaText
aktuelleNotiz?.notiz = notizText
database.notizenDao().insertNotiz(aktuelleNotiz!!)
Log.d(javaClass.simpleName, "Notiz $aktuelleNotiz aktualisiert")
}
}
with(AlertDialog.Builder(this)) {
setTitle("Notiz weiter bearbeiten?")
setNegativeButton("Nein") { _, _ ->
aktuelleNotiz = null
findViewById<TextView>(R.id.edittext_thema).text = ""
findViewById<TextView>(R.id.edittext_notiz).text = ""
}
setPositiveButton("Ja") { _, _ -> }
show()
}
}
fun openProjektBearbeitenDialog() {
val dialogView = layoutInflater.inflate(R.layout.dialog_projekt_bearbeiten, null)
val textView =
dialogView.findViewById<TextView>(R.id.textview_dialog_projekt_bearbeiten)
val dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT)
textView.text = dateFormat.format(Date(aktuellesProjekt.id))
val editText =
dialogView.findViewById<TextView>(R.id.edittext_dialog_projekt_bearbeiten)
editText.text = aktuellesProjekt.beschreibung
val database = GeoNotesDatabase.getInstance(this)
with(AlertDialog.Builder(this)) {
setView(dialogView)
setTitle("Projektbeschreibung eingeben/ändern")
setPositiveButton("Übernehmen", DialogInterface.OnClickListener { dialog, id ->
// Projektbeschreibung ändern
aktuellesProjekt.beschreibung = editText.text.toString().trim()
findViewById<TextView>(R.id.textview_aktuelles_projekt).text =
getString(R.string.aktuelles_projekt_prefix) + aktuellesProjekt.getDescription()
// Projekt-Update in Datenbank
GlobalScope.launch {
database.projekteDao().updateProjekt(aktuellesProjekt)
Log.d(javaClass.simpleName, "Update Projekt $aktuellesProjekt")
val projekte = database.projekteDao().getProjekte()
projekte.forEach {
Log.d(javaClass.simpleName, "Projekt $it")
}
}
})
setNegativeButton("Abbrechen", DialogInterface.OnClickListener { dialog, id -> })
show()
}
}
fun openProjektAuswaehlenDialog() {
var notizen: List<Notiz>
val database = GeoNotesDatabase.getInstance(this)
CoroutineScope(Dispatchers.Main).launch() {
var projekte: List<Projekt>? = null
withContext(Dispatchers.IO) {
projekte = database.projekteDao().getProjekte()
}
if (projekte.isNullOrEmpty()) {
Toast.makeText(
this@GatherActivity,
"Noch keine Projekte vorhanden",
Toast.LENGTH_LONG
).show()
return@launch
}
val items = ArrayList<CharSequence>()
projekte?.forEach {
items.add(it.getDescription())
}
with(AlertDialog.Builder(this@GatherActivity)) {
setTitle("Projekt auswählen")
setItems(
items.toArray(emptyArray())
) { _, id ->
// aktuelles Projekt auf ausgewähltes Projekt setzen:
aktuellesProjekt = projekte?.get(id)!!
val textView = findViewById<TextView>(R.id.textview_aktuelles_projekt)
textView.text =
getString(R.string.aktuelles_projekt_prefix) + aktuellesProjekt.getDescription()
// Notiz zum Projekt anzeigen:
CoroutineScope(Dispatchers.Main).launch {
withContext(Dispatchers.IO) {
notizen = database.notizenDao().getNotizen(aktuellesProjekt.id)
}
if (!notizen.isNullOrEmpty()) aktuelleNotiz = notizen.last()
else {
Toast.makeText(this@GatherActivity, "Projekt ist leer. Wird gelöscht. Aufräum.", Toast.LENGTH_LONG).show()
withContext(Dispatchers.IO) {
database.projekteDao().deleteProjekt(aktuellesProjekt.id)
}
}
findViewById<TextView>(R.id.edittext_thema).text = aktuelleNotiz?.thema
findViewById<TextView>(R.id.edittext_notiz).text = aktuelleNotiz?.notiz
}
}
show()
}
}
}
fun onButtonVorherigeNotizClick(view: View) {
val textViewThema = findViewById<TextView>(R.id.edittext_thema)
val textViewNotiz = findViewById<TextView>(R.id.edittext_notiz)
val textViewProjekt = findViewById<TextView>(R.id.textview_aktuelles_projekt)
if (aktuelleNotiz == null || (!textViewThema.text.trim().toString()
.equals(aktuelleNotiz?.thema) || !textViewNotiz.text.trim().toString()
.equals(aktuelleNotiz?.notiz))
) {
if (textViewThema.text.isNotEmpty() || textViewNotiz.text.isNotEmpty()) {
Toast.makeText(this, "Notiz wurde noch nicht gespeichert", Toast.LENGTH_LONG)
.show() // Fall 1
return
}
}
val database = GeoNotesDatabase.getInstance(this)
CoroutineScope(Dispatchers.Main).launch {
var notizen: List<Notiz>? = null
withContext(Dispatchers.IO) {
if (aktuelleNotiz == null) { // Fall 2
notizen = database.notizenDao().getNotizen(aktuellesProjekt.id)
} else { // Fall 3
notizen = database.notizenDao()
.getPreviousNotizen(aktuelleNotiz?.id!!, aktuellesProjekt.id)
}
}
if (!notizen.isNullOrEmpty()) {
aktuelleNotiz = notizen?.last()
textViewThema.text = aktuelleNotiz?.thema
textViewNotiz.text = aktuelleNotiz?.notiz
}
}
}
fun onButtonNaechsteNotizClick(view: View) {
val textViewThema = findViewById<TextView>(R.id.edittext_thema)
val textViewNotiz = findViewById<TextView>(R.id.edittext_notiz)
if (aktuelleNotiz == null) {
if (textViewThema.text.isNotEmpty() || textViewNotiz.text.isNotEmpty()) {
Toast.makeText(this, "Notiz wurde noch nicht gespeichert", Toast.LENGTH_LONG)
.show() // Fall 1
}
return // Fall 1 und Fall 2
}
val database = GeoNotesDatabase.getInstance(this)
CoroutineScope(Dispatchers.Main).launch {
var notizen: List<Notiz>? = null
withContext(Dispatchers.IO) {
notizen =
database.notizenDao()
.getNextNotizen(aktuelleNotiz?.id!!, aktuellesProjekt.id)
}
if (!notizen.isNullOrEmpty()) { // Fall 3a)
aktuelleNotiz = notizen?.first()
textViewThema.text = aktuelleNotiz?.thema
textViewNotiz.text = aktuelleNotiz?.notiz
} else { // Fall 3b)
aktuelleNotiz = null
textViewThema.text = ""
textViewNotiz.text = ""
withContext(Dispatchers.IO) {
notizen = database.notizenDao().getNotizen(aktuellesProjekt.id)
}
}
}
}
fun onButtonStandortAnzeigenClick(view: View) {
if (aktuelleNotiz == null) {
Toast.makeText(this, "Bitte Notiz auswählen oder speichern", Toast.LENGTH_LONG)
.show()
return
}
val database = GeoNotesDatabase.getInstance(this)
CoroutineScope(Dispatchers.Main).launch {
var notizen: List<Notiz>? = null
withContext(Dispatchers.IO) {
notizen = database.notizenDao().getNotizen(aktuellesProjekt.id)
}
if (!notizen.isNullOrEmpty()) {
val intent = Intent(this@GatherActivity, NoteMapActivity::class.java)
intent.putParcelableArrayListExtra(NOTIZEN, ArrayList<Notiz>(notizen!!))
intent.putExtra(INDEX_AKTUELLE_NOTIZ, notizen?.indexOf(aktuelleNotiz!!))
with(AlertDialog.Builder(this@GatherActivity)) {
setSingleChoiceItems(R.array.map_types,-1, DialogInterface.OnClickListener { dialog, id ->
Log.i(javaClass.simpleName,"Ausgewählter map typ: " + id)
if (id==0) {
intent.setClass(this@GatherActivity, OsmWebViewActivity::class.java)
} else {
intent.setClass(this@GatherActivity, NoteMapActivity::class.java)
}
})
setPositiveButton("OK", DialogInterface.OnClickListener { dialog, id ->
startActivityForResult(intent, 0)
})
setNegativeButton("Abbrechen", DialogInterface.OnClickListener { dialog, id -> })
show()
}
}
}
}
fun openNavigation() {
if (aktuelleNotiz == null) {
Toast.makeText(this, "Bitte Notiz auswählen oder speichern", Toast.LENGTH_LONG)
.show()
return
}
val geouri = "geo:" + aktuelleNotiz!!.latitude.toString() +','+ aktuelleNotiz!!.longitude.toString()
Log.i(javaClass.simpleName, "geouri: ${geouri}")
val naviIntent = Intent(Intent.ACTION_VIEW).setData(Uri.parse(geouri))
try {
startActivity(naviIntent)
} catch (e: ActivityNotFoundException) {
Toast.makeText(this, "Keine geeignete Anwendung installiert", Toast.LENGTH_LONG).show()
Log.i(javaClass.simpleName, e.toString())
}
}
}

@ -0,0 +1,101 @@
package and06.geonotes
import android.content.Context
import androidx.room.*
import java.text.DateFormat
import android.os.Parcelable
import kotlinx.parcelize.Parcelize
@Parcelize
@Entity(tableName = "projekte")
data class Projekt(@PrimaryKey val id: Long, var beschreibung: String?): Parcelable {
fun getDescription(): String {
val dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT)
val dateString = dateFormat.format(id)
return if (beschreibung.isNullOrEmpty()) dateString else "$beschreibung ($dateString)"
}
}
@Entity(tableName = "locations", primaryKeys = ["latitude", "longitude"])
data class Location(val latitude: Double,
val longitude: Double,
val altitude: Double,
val provider: String)
@Parcelize
@Entity(tableName = "notizen",
indices = arrayOf(Index(value = ["projektId"]), Index(value = ["latitude", "longitude"])),
foreignKeys =
[ForeignKey(entity = Projekt::class, parentColumns = ["id"], childColumns = ["projektId"]),
ForeignKey(entity = Location::class, parentColumns = ["latitude", "longitude"],
childColumns = ["latitude", "longitude"])])
data class Notiz(@PrimaryKey(autoGenerate = true) var id: Long? = null,
val projektId: Long,
val latitude: Double,
val longitude: Double,
var thema: String,
var notiz: String): Parcelable
@Database(entities = [Projekt::class, Notiz::class, Location::class], version = 1)
abstract class GeoNotesDatabase : RoomDatabase() {
abstract fun projekteDao(): ProjekteDao
abstract fun locationsDao(): LocationsDao
abstract fun notizenDao(): NotizenDao
companion object {
private var INSTANCE: GeoNotesDatabase? = null
fun getInstance(context: Context): GeoNotesDatabase {
if (INSTANCE == null) {
INSTANCE =
Room.databaseBuilder(context, GeoNotesDatabase::class.java, "GeoNotesDatabase").build()
}
return INSTANCE as GeoNotesDatabase
}
}
}
@Dao interface ProjekteDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertProjekt(projekt: Projekt): Long
@Update
fun updateProjekt(projekt: Projekt)
@Query("SELECT * FROM projekte")
fun getProjekte(): List<Projekt>
@Query("SELECT * FROM projekte where id=:id")
fun getProjekt(id: Long): Projekt
@Query("DELETE FROM projekte WHERE id = :id")
fun deleteProjekt(id:Long): Void
}
@Dao interface LocationsDao {
@Insert(onConflict = OnConflictStrategy.IGNORE)
fun insertLocation(location: Location): Long
@Query("SELECT * FROM locations")
fun getLocations(): List<Location>
}
@Dao interface NotizenDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertNotiz(notiz: Notiz): Long
@Query("SELECT * from notizen")
fun getNotizen(): List<Notiz>
@Query("SELECT * from notizen where projektId = :projektId")
fun getNotizen(projektId: Long): List<Notiz>
@Query("SELECT * from notizen where projektId = :projektId AND id < :notizId ORDER BY id ASC")
fun getPreviousNotizen(notizId: Long, projektId: Long): List<Notiz>
@Query("SELECT * from notizen where projektId = :projektId AND id > :notizId ORDER BY id ASC")
fun getNextNotizen(notizId: Long, projektId: Long): List<Notiz>
@Query("SELECT * from notizen where id = :id")
fun getNotiz(id: Long): Notiz
@Query("DELETE FROM notizen WHERE id = :id")
fun deleteNotiz(id: Long): Int
}

@ -0,0 +1,98 @@
package and06.geonotes
import android.content.Context
import android.net.Uri
import android.os.Environment
import android.util.Log
import androidx.core.content.FileProvider
import org.w3c.dom.Document
import java.io.File
import javax.xml.parsers.DocumentBuilderFactory
import javax.xml.parsers.ParserConfigurationException
import javax.xml.transform.TransformerConfigurationException
import javax.xml.transform.TransformerException
import javax.xml.transform.TransformerFactory
import javax.xml.transform.dom.DOMSource
import javax.xml.transform.stream.StreamResult
class GpxGenerator {
fun createGpxFile(context: Context, notizen: List<Notiz>, projektName: String): Uri? {
val document = createGpxDocument()
return document?.let {
createRootElement(it)
createMetaData(it, projektName)
appendTrackPoints(it, notizen)
serialize(context, it)
}
}
private fun createMetaData(document: Document, projektName: String) {
val metadata = document.createElement("medatadata")
document.documentElement.appendChild(metadata)
val name = document.createElement("desc")
name.appendChild(document.createTextNode(projektName))
metadata.appendChild(name)
}
private fun createGpxDocument(): Document? {
val factory = DocumentBuilderFactory.newInstance()
val gpxDocument = try {
val builder = factory.newDocumentBuilder()
builder.newDocument()
} catch(ex: ParserConfigurationException) {
Log.e(javaClass.simpleName, ex.toString())
null
}
return gpxDocument
}
private fun createRootElement(document: Document) {
with(document.createElement("gpx")) {
setAttribute("xmlns", "https://www.topografix.com/GPX/1/1/")
setAttribute("xmlns:xsi", "https://www.w3.org/2001/XMLSchema-instance")
setAttribute("xsi:schemaLocation", "https://www.topografix.com/GPX/1/1/gpx.xsd https://www.topografix.com/GPX/1/1/gpx.xsd")
setAttribute("version", "1.1")
setAttribute("creator", "GeoNotes")
document.appendChild(this)
}
}
private fun appendTrackPoints(document: Document, notizen: List<Notiz>) {
val trk = document.createElement("trk")
document.documentElement.appendChild(trk)
val trkseg = document.createElement("trkseg")
trk.appendChild(trkseg)
notizen.forEach {
with(document.createElement("trkpt")) {
setAttribute("lat", it.latitude.toString())
setAttribute("lon", it.longitude.toString())
val name = document.createElement("name")
name.appendChild(document.createTextNode(it.thema))
appendChild(name)
val desc = document.createElement("desc")
desc.appendChild(document.createTextNode(it.notiz))
appendChild(desc)
trkseg.appendChild(this)
}
}
}
private fun serialize(context: Context, document: Document): Uri? {
val documentsDirectory = context.getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS)
val destFile = File(documentsDirectory, "geonotes.gpx")
val factory = TransformerFactory.newInstance()
val uri = try {
val transformer = factory.newTransformer()
transformer.transform(
DOMSource(document.documentElement),
StreamResult(destFile) )
FileProvider.getUriForFile(context, "geonotes.fileprovider", destFile)
} catch (ex: TransformerConfigurationException) {
Log.d(javaClass.simpleName, ex.toString())
null
} catch (ex: TransformerException) {
Log.d(javaClass.simpleName, ex.toString())
null
}
return uri
}
}

@ -0,0 +1,133 @@
package and06.geonotes
import android.location.Location
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.widget.ImageButton
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.app.AppCompatActivity
import org.osmdroid.config.Configuration
import org.osmdroid.tileprovider.tilesource.OnlineTileSourceBase
import org.osmdroid.tileprovider.tilesource.TileSourceFactory
import org.osmdroid.tileprovider.tilesource.XYTileSource
import org.osmdroid.util.GeoPoint
import org.osmdroid.util.MapTileIndex
import org.osmdroid.views.MapView
import org.osmdroid.views.overlay.Marker
import java.io.File
class NoteMapActivity : AppCompatActivity() {
companion object {
val AKTUELLE_NOTIZ_ID = "aktuelle_notiz_id"
}
override fun onCreate(savedInstanceState: Bundle?) {
val GoogleSat: OnlineTileSourceBase = object : XYTileSource(
"Google-Sat",
0, 19, 256, ".png", arrayOf(
"https://mt0.google.com",
"https://mt1.google.com",
"https://mt2.google.com",
"https://mt3.google.com"
)
) {
override fun getTileURLString(pTileIndex: Long): String {
return baseUrl + "/vt/lyrs=s&x=" + MapTileIndex.getX(pTileIndex) + "&y=" + MapTileIndex.getY(
pTileIndex
) + "&z=" + MapTileIndex.getZoom(pTileIndex)
}
}
TileSourceFactory.addTileSource(GoogleSat)
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_notemap)
val osmConfig = Configuration.getInstance()
osmConfig.userAgentValue = packageName
val basePath = File(cacheDir.absolutePath, "osmdroid")
osmConfig.osmdroidBasePath = basePath
val tileCache = File(osmConfig.osmdroidBasePath, "tile")
osmConfig.osmdroidTileCache = tileCache
val map = findViewById<MapView>(R.id.mapview)
/*map.setTileSource(GoogleSat)*/
map.setTileSource(TileSourceFactory.OpenTopo)
val extras = intent.extras ?: return
val notizen : ArrayList<Notiz>
if (Build.VERSION.SDK_INT >= 33) { // TIRAMISU
notizen = intent.getParcelableArrayListExtra(GatherActivity.NOTIZEN, Notiz::class.java) ?: return
} else {
notizen = intent.getParcelableArrayListExtra<Notiz>(GatherActivity.NOTIZEN) ?: return
}
notizen.forEach {
val marker = Marker(map)
marker.position = GeoPoint(it.latitude, it.longitude)
marker.title = it.thema
marker.snippet = it.notiz
map.overlays.add(marker)
}
val controller = map.controller
var indexAktuelleNotiz = extras.getInt(GatherActivity.INDEX_AKTUELLE_NOTIZ)
val aktuelleNotiz = notizen.get(indexAktuelleNotiz)
controller.setCenter(GeoPoint(aktuelleNotiz.latitude, aktuelleNotiz.longitude))
controller.setZoom(10.0)
val buttonPrevious = findViewById<ImageButton>(R.id.button_previous_notiz)
buttonPrevious.setOnClickListener{
indexAktuelleNotiz = if (indexAktuelleNotiz == 0) notizen.size-1 else indexAktuelleNotiz-1
val notiz = notizen.get(indexAktuelleNotiz)
controller.setCenter(GeoPoint(notiz.latitude, notiz.longitude))
}
val buttonNext = findViewById<ImageButton>(R.id.button_next_notiz)
buttonNext.setOnClickListener {
indexAktuelleNotiz = (indexAktuelleNotiz + 1) % notizen.size
val notiz = notizen.get(indexAktuelleNotiz)
controller.setCenter(GeoPoint(notiz.latitude, notiz.longitude))
}
onBackPressedDispatcher.addCallback(this /* lifecycle owner */, object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
// Back is pressed... Finishing the activity
val pushIntent = getIntent()
pushIntent.putExtra(AKTUELLE_NOTIZ_ID, notizen.get(indexAktuelleNotiz).id)
setResult(RESULT_OK, pushIntent)
finish()
}
})
}
fun decimalToSexagesimal(latitude: Double, longitude: Double): String {
val latDegrees = latitude.toInt()
val lonDegrees = longitude.toInt()
val latTempMinutes = Math.abs((latitude - latDegrees) * 60)
val lonTempMinutes = Math.abs((longitude - lonDegrees) * 60)
val latMinutes = latTempMinutes.toInt()
val lonMinutes = lonTempMinutes.toInt()
val latTempSeconds = (latTempMinutes - latMinutes) * 60
val lonTempSeconds = (lonTempMinutes - lonMinutes) * 60
// auf drei Stellen runden
val latSeconds = Math.round(latTempSeconds * 1000)/1000.0
val lonSeconds = Math.round(lonTempSeconds * 1000)/1000.0
val latDegreesString = Math.abs(latDegrees).toString() + if (latitude < 0) "°S " else "°N "
val lonDegreesString = Math.abs(lonDegrees).toString() + if (longitude < 0) "°W " else "°O "
return lonDegreesString + lonMinutes + "\' " + lonSeconds + "\'\' / " + latDegreesString + latMinutes + "\' " + latSeconds + "\'\'"
}
override fun onResume() {
super.onResume()
val map = findViewById<MapView>(R.id.mapview)
map.onResume()
}
override fun onPause() {
super.onPause()
val map = findViewById<MapView>(R.id.mapview)
map.onPause()
}
}

@ -0,0 +1,52 @@
package and06.geonotes
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.webkit.JavascriptInterface
import android.webkit.WebView
import androidx.webkit.WebViewCompat
class OsmWebViewActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
val webViewPackageInfo = WebViewCompat.getCurrentWebViewPackage(this)
Log.d(javaClass.simpleName, "WebView packageName: ${webViewPackageInfo!!.packageName}")
Log.d(javaClass.simpleName, "WebView Version: ${webViewPackageInfo!!.versionName}")
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_osm_web_view)
val webview = findViewById<WebView>(R.id.osm_webview)
webview.settings.javaScriptEnabled = true
webview.loadUrl("file:///android_res/raw/index.html")
val notizen = intent.getParcelableArrayListExtra<Notiz>(GatherActivity.NOTIZEN)
val indexAktuelleNotiz = intent.extras?.getInt(GatherActivity.INDEX_AKTUELLE_NOTIZ) ?: 0
val myinterface = object {
@JavascriptInterface
fun getIndexAktuelleNotiz(): Int {
return indexAktuelleNotiz
}
@JavascriptInterface
fun getLatitude(i: Int): Double {
return notizen!!.get(i).latitude
}
@JavascriptInterface
fun getLongitude(i: Int): Double {
return notizen!!.get(i).longitude
}
@JavascriptInterface
fun getThema(i: Int): String {
return notizen!!.get(i).thema
}
@JavascriptInterface
fun getNotiz(i: Int): String {
return notizen!!.get(i).notiz
}
@JavascriptInterface
fun getNotizenCount(): Int {
return notizen!!.count()
}
}
webview.addJavascriptInterface(myinterface, "Android")
}
}

@ -0,0 +1,123 @@
package and06.geonotes
import android.util.Log
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.Response
import okhttp3.ResponseBody
import okhttp3.logging.HttpLoggingInterceptor
import org.json.JSONException
import org.json.JSONObject
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.converter.jackson.JacksonConverterFactory
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import java.io.IOException
class ghostAPI () {
companion object {
private const val API_KEY = "eyJhbGciOiJIUzI1NiIsImtpZCI6IjY1MWUwMzNlOTJmZWQ5MzE5MDlmZWFjNSIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2OTY1NDU0MzAsImV4cCI6MTY5NjU0NTczMCwiYXVkIjoiL2FkbWluLyJ9.SpT8LifIy_ZEfH4SakqYz79r853L0JjN_ZDehFbUv2U"
private const val BASE_URL = "https://mary.joefix.it/ghost/api/admin"
private val retrofit = RetrofitClient.getClient()
private val postApi = retrofit.create(PostApi::class.java)
fun register() : Boolean {
return try {
postApi.getCookie(Credentials()).execute().isSuccessful
} catch (ex: Exception) {
Log.d(javaClass.simpleName, "Couldn't log in. Exception: ${ex}")
false
}
}
fun sendPosting(title:String, html:String, author: String) : Boolean{
val post = sendPost(title, authors= listOf(author), html)
val postings= sendPostList(listOf(post))
return try {
postApi.pushPost(postings).execute().isSuccessful
} catch (ex: Exception) {
Log.d(javaClass.simpleName, "Couldn't send posting in. Exception: ${ex}")
false
}
}
fun successfulUsersResponse() {
val postsResponse = postApi.getPosts().execute()
val successful = postsResponse.isSuccessful
val httpStatusCode = postsResponse.code()
val httpStatusMessage = postsResponse.message()
Log.i(javaClass.simpleName, postsResponse.body().toString())
val testpost = sendPost(title = "testpos564ting", authors = listOf("yova@freedomhost.de") , html="<p>this is blabla</p>")
val testPostings = sendPostList(posts = listOf(testpost))
val pushResponse = postApi.pushPost(testPostings).execute()
Log.i(javaClass.simpleName, postApi.pushPost(testPostings).toString())
Log.i(javaClass.simpleName, pushResponse.body()!!.string())
}
}
object RequestInterceptor : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request()
val newRequest = request.newBuilder()
/*.header("Authorization", "Ghost "+ API_KEY)*/
.header("Origin", "https://mary.joefix.it")
.build()
Log.i(javaClass.simpleName, "Outgoing request to ${newRequest.url}")
Log.i(javaClass.simpleName, newRequest.body.toString())
return chain.proceed(newRequest)
}
}
object RetrofitClient {
private const val BASE_URL = "https://mary.joefix.it/ghost/api/admin/"
fun getClient(): Retrofit {
val loggingInterceptor = HttpLoggingInterceptor().apply {
this.setLevel(HttpLoggingInterceptor.Level.BODY)
}
val okHttpClient = OkHttpClient()
.newBuilder()
/*
.addInterceptor(RequestInterceptor)
*/
.addInterceptor(loggingInterceptor)
.cookieJar(MyCookieJar())
.build()
return Retrofit.Builder()
.client(okHttpClient)
.baseUrl(BASE_URL)
.addConverterFactory(JacksonConverterFactory.create())
.build()
}
}
interface PostApi {
@GET("posts")
fun getPosts(): Call<posts>
/* fun getPosts(): Call<ResponseBody> <- for json string*/
@POST("session")
fun getCookie(@Body credentials: Credentials ): Call<ResponseBody>
@POST("posts/?source=html")
fun pushPost(@Body postings: sendPostList): Call<ResponseBody>
}
}

@ -0,0 +1,19 @@
package and06.geonotes
import android.util.Log
import okhttp3.Cookie
import okhttp3.CookieJar
import okhttp3.HttpUrl
class MyCookieJar : CookieJar {
private var cookies: List<Cookie>? = null
override fun saveFromResponse(url: HttpUrl, cookies: List<Cookie>) {
Log.i(javaClass.simpleName,"getting cookies: " +cookies.toString())
this.cookies = cookies
}
override fun loadForRequest(url: HttpUrl): List<Cookie> {
Log.i(javaClass.simpleName,"giving cookies: " +cookies.toString())
return cookies ?: ArrayList()
}
}

@ -0,0 +1,206 @@
package and06.geonotes
import com.fasterxml.jackson.annotation.JsonProperty
class Credentials {
@JsonProperty("username") val username = "yova@freedomhost.de"
@JsonProperty("password") val password = "Ym9DCYN3FTo5srcu"
}
data class sendPost (
@JsonProperty("title") val title: String,
@JsonProperty("authors") val authors: List<String>,
@JsonProperty("html") val html: String,
@JsonProperty("status") val status: String = "published"
)
data class sendPostList (
@JsonProperty("posts") val posts: List<sendPost>
)
data class posts(
@JsonProperty("meta") val meta: Meta,
@JsonProperty("posts") val posts: List<PostX>
)
data class Author(
@JsonProperty("accessibility") val accessibility: String?,
@JsonProperty("bio") val bio: String?,
@JsonProperty("comment_notifications") val comment_notifications: Boolean?,
@JsonProperty("cover_image") val cover_image: String?,
@JsonProperty("created_at") val created_at: String?,
@JsonProperty("donation_notifications") val donation_notifications: Boolean?,
@JsonProperty("email") val email: String?,
@JsonProperty("facebook") val facebook: String?,
@JsonProperty("free_member_signup_notification") val free_member_signup_notification: Boolean?,
@JsonProperty("id") val id: String,
@JsonProperty("last_seen") val last_seen: String?,
@JsonProperty("location") val location: String?,
@JsonProperty("mention_notifications") val mention_notifications: Boolean?,
@JsonProperty("meta_description") val meta_description: String?,
@JsonProperty("meta_title") val meta_title: String?,
@JsonProperty("milestone_notifications") val milestone_notifications: Boolean?,
@JsonProperty("name") val name: String?,
@JsonProperty("paid_subscription_canceled_notification") val paid_subscription_canceled_notification: Boolean?,
@JsonProperty("paid_subscription_started_notification") val paid_subscription_started_notification: Boolean?,
@JsonProperty("profile_image") val profile_image: String?,
@JsonProperty("recommendation_notifications") val recommendation_notifications: Boolean?,
@JsonProperty("roles") val roles: List<Role>?,
@JsonProperty("slug") val slug: String?,
@JsonProperty("status") val status: String?,
@JsonProperty("tour") val tour: String?,
@JsonProperty("twitter") val twitter: String?,
@JsonProperty("updated_at") val updated_at: String?,
@JsonProperty("url") val url: String?,
@JsonProperty("website") val website: String?
)
data class Count(
@JsonProperty("clicks") val clicks: Int,
@JsonProperty("negative_feedback") val negative_feedback: Int,
@JsonProperty("positive_feedback") val positive_feedback: Int
)
data class Meta(
@JsonProperty("pagination") val pagination: Pagination
)
data class Pagination(
@JsonProperty("limit") val limit: Int,
@JsonProperty("next") val next: String?,
@JsonProperty("page") val page: Int,
@JsonProperty("pages") val pages: Int,
@JsonProperty("prev") val prev: String?,
@JsonProperty("total") val total: Int
)
data class PostX(
@JsonProperty("authors") val authors: List<Author>,
@JsonProperty("canonical_url") val canonical_url: String?,
@JsonProperty("codeinjection_foot") val codeinjection_foot: String?,
@JsonProperty("codeinjection_head") val codeinjection_head: String?,
@JsonProperty("comment_id") val comment_id: String?,
@JsonProperty("count") val count: Count,
@JsonProperty("created_at") val created_at: String?,
@JsonProperty("custom_excerpt") val custom_excerpt: String?,
@JsonProperty("custom_template") val custom_template: String?,
@JsonProperty("email") val email: String?,
@JsonProperty("email_only") val email_only: Boolean,
@JsonProperty("email_segment") val email_segment: String?,
@JsonProperty("email_subject") val email_subject: String?,
@JsonProperty("excerpt") val excerpt: String?,
@JsonProperty("feature_image") val feature_image: String?,
@JsonProperty("feature_image_alt") val feature_image_alt: String?,
@JsonProperty("feature_image_caption") val feature_image_caption: String?,
@JsonProperty("featured") val featured: Boolean,
@JsonProperty("frontmatter") val frontmatter: String?,
@JsonProperty("id") val id: String,
@JsonProperty("meta_description") val meta_description: String?,
@JsonProperty("meta_title") val meta_title: String?,
@JsonProperty("mobiledoc") val mobiledoc: String?,
@JsonProperty("newsletter") val newsletter: String?,
@JsonProperty("og_description") val og_description: String?,
@JsonProperty("og_image") val og_image: String?,
@JsonProperty("og_title") val og_title: String?,
@JsonProperty("post_revisions") val post_revisions: List<Any>,
@JsonProperty("primary_author") val primary_author: PrimaryAuthor,
@JsonProperty("primary_tag") val primary_tag: Tag?,
@JsonProperty("published_at") val published_at: String?,
@JsonProperty("reading_time") val reading_time: Int,
@JsonProperty("slug") val slug: String?,
@JsonProperty("status") val status: String?,
@JsonProperty("tags") val tags: List<Tag>,
@JsonProperty("tiers") val tiers: List<Tier>,
@JsonProperty("title") val title: String?,
@JsonProperty("twitter_description") val twitter_description: String?,
@JsonProperty("twitter_image") val twitter_image: String?,
@JsonProperty("twitter_title") val twitter_title: String?,
@JsonProperty("updated_at") val updated_at: String?,
@JsonProperty("url") val url: String?,
@JsonProperty("uuid") val uuid: String?,
@JsonProperty("visibility") val visibility: String?
)
data class PrimaryAuthor(
@JsonProperty("accessibility") val accessibility: String?,
@JsonProperty("bio") val bio: String?,
@JsonProperty("comment_notifications") val comment_notifications: Boolean,
@JsonProperty("cover_image") val cover_image: String?,
@JsonProperty("created_at") val created_at: String?,
@JsonProperty("donation_notifications") val donation_notifications: Boolean,
@JsonProperty("email") val email: String?,
@JsonProperty("facebook") val facebook: String?,
@JsonProperty("free_member_signup_notification") val free_member_signup_notification: Boolean,
@JsonProperty("id") val id: String?,
@JsonProperty("last_seen") val last_seen: String?,
@JsonProperty("location") val location: String?,
@JsonProperty("mention_notifications") val mention_notifications: Boolean,
@JsonProperty("meta_description") val meta_description: String?,
@JsonProperty("meta_title") val meta_title: String?,
@JsonProperty("milestone_notifications") val milestone_notifications: Boolean,
@JsonProperty("name") val name: String?,
@JsonProperty("paid_subscription_canceled_notification") val paid_subscription_canceled_notification: Boolean,
@JsonProperty("paid_subscription_started_notification") val paid_subscription_started_notification: Boolean,
@JsonProperty("profile_image") val profile_image: String?,
@JsonProperty("recommendation_notifications") val recommendation_notifications: Boolean,
@JsonProperty("roles") val roles: List<Role>,
@JsonProperty("slug") val slug: String?,
@JsonProperty("status") val status: String?,
@JsonProperty("tour") val tour: String?,
@JsonProperty("twitter") val twitter: String?,
@JsonProperty("updated_at") val updated_at: String?,
@JsonProperty("url") val url: String?,
@JsonProperty("website") val website: String?
)
data class Role(
@JsonProperty("created_at") val created_at: String?,
@JsonProperty("description") val description: String?,
@JsonProperty("id") val id: String,
@JsonProperty("name") val name: String?,
@JsonProperty("updated_at") val updated_at: String?
)
data class Tag(
@JsonProperty("accent_color") val accent_color: String?,
@JsonProperty("canonical_url") val canonical_url: String?,
@JsonProperty("codeinjection_foot") val codeinjection_foot: String?,
@JsonProperty("codeinjection_head") val codeinjection_head: String?,
@JsonProperty("created_at") val created_at: String?,
@JsonProperty("description") val description: String?,
@JsonProperty("feature_image") val feature_image: String?,
@JsonProperty("id") val id: String,
@JsonProperty("meta_description") val meta_description: String?,
@JsonProperty("meta_title") val meta_title: String?,
@JsonProperty("name") val name: String?,
@JsonProperty("og_description") val og_description: String?,
@JsonProperty("og_image") val og_image: String?,
@JsonProperty("og_title") val og_title: String?,
@JsonProperty("slug") val slug: String?,
@JsonProperty("twitter_description") val twitter_description: String?,
@JsonProperty("twitter_image") val twitter_image: String?,
@JsonProperty("twitter_title") val twitter_title: String?,
@JsonProperty("updated_at") val updated_at: String?,
@JsonProperty("url") val url: String?,
@JsonProperty("visibility") val visibility: String?
)
data class Tier(
@JsonProperty("active") val active: Boolean,
@JsonProperty("created_at") val created_at: String?,
@JsonProperty("currency") val currency: String?,
@JsonProperty("description") val description: String?,
@JsonProperty("id") val id: String,
@JsonProperty("monthly_price") val monthly_price: Int,
@JsonProperty("monthly_price_id") val monthly_price_id: String?,
@JsonProperty("name") val name: String?,
@JsonProperty("slug") val slug: String?,
@JsonProperty("trial_days") val trial_days: Int,
@JsonProperty("type") val type: String?,
@JsonProperty("updated_at") val updated_at: String?,
@JsonProperty("visibility") val visibility: String?,
@JsonProperty("welcome_page_url") val welcome_page_url: String?,
@JsonProperty("yearly_price") val yearly_price: Int,
@JsonProperty("yearly_price_id") val yearly_price_id: String?
)

@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="and06.geonotes.GatherActivity"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/verfuegbare_provider"/>
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/spinner_provider"/>
<ToggleButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textOff="@string/lokalisierung_starten"
android:textOn="@string/lokalisierung_gestartet"
android:onClick="onToggleButtonLokalisierenClick"
android:id="@+id/togglebutton_lokalisierung"/>
<View
android:layout_width="match_parent"
android:layout_height="1.5dp"
android:background="#000"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/aktuelles_projekt_prefix"
android:id="@+id/textview_aktuelles_projekt"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/thema"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/edittext_thema"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/notiz"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/edittext_notiz"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button_previous"
android:src="@android:drawable/ic_media_previous"
android:onClick="onButtonVorherigeNotizClick"
app:layout_constraintLeft_toLeftOf="parent"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button_next"
android:src="@android:drawable/ic_media_next"
android:onClick="onButtonNaechsteNotizClick"
app:layout_constraintRight_toRightOf="parent"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Vorherige Notiz"
app:layout_constraintLeft_toRightOf= "@+id/button_previous"
app:layout_constraintTop_toTopOf= "@+id/button_previous"
app:layout_constraintBottom_toBottomOf= "@+id/button_previous"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Nächste Notiz"
app:layout_constraintRight_toLeftOf= "@+id/button_next"
app:layout_constraintTop_toTopOf= "@+id/button_next"
app:layout_constraintBottom_toBottomOf= "@+id/button_next"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/notiz_speichern"
android:onClick="onButtonNotizSpeichernClick"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Standort anzeigen"
android:onClick="onButtonStandortAnzeigenClick"/>
</LinearLayout>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".NoteMapActivity">
<org.osmdroid.views.MapView android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<ImageButton
android:alpha="0.75"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_media_previous"
android:id="@+id/button_previous_notiz"
android:layout_gravity="left|center"/>
>
<ImageButton
android:alpha="0.75"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_media_next"
android:layout_gravity="right|center"
android:id="@+id/button_next_notiz"/>
</FrameLayout>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/osm_webview"
tools:context=".OsmWebViewActivity">
</WebView>

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id= "@+id/textview_dialog_projekt_bearbeiten"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id= "@+id/edittext_dialog_projekt_bearbeiten"/>
</LinearLayout>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</TextView>

@ -0,0 +1,47 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/menu_ghost"
android:title="Push to ghost"
android:icon="@android:drawable/ic_menu_upload"
app:showAsAction="ifRoom" />
<item android:id="@+id/menu_osm_oeffnen"
android:title="In Webview anzeigen"
android:icon="@android:drawable/ic_menu_directions"
app:showAsAction="ifRoom" />
<item android:id="@+id/menu_projekt_versenden"
android:title="Projekt versenden"
android:icon="@android:drawable/ic_menu_send"
app:showAsAction="ifRoom"/>
<item android:id="@+id/menu_projekt_bearbeiten"
android:title="Projektname bearbeiten"
android:icon="@android:drawable/ic_menu_edit"
app:showAsAction="ifRoom"/>
<item android:id="@+id/menu_projekt_auswaehlen"
android:title="Projekt auswählen"
android:icon="@android:drawable/ic_menu_set_as"
app:showAsAction="ifRoom"/>
<item android:id="@+id/menu_notiz_loeschen"
android:title="Notiz löschen"
android:icon="@android:drawable/ic_menu_delete"
app:showAsAction="ifRoom"/>
<item android:id="@+id/action_settings"
android:title="@string/action_settings"
android:orderInCategory="100"
app:showAsAction="never">
<menu>
<group android:checkableBehavior="single">
<item android:title="@string/title_item_desktop"
android:id="@+id/item_desktop"/>
<item android:title="@string/title_item_foot"
android:id="@+id/item_foot"/>
<item android:title="@string/title_item_bicycle"
android:id="@+id/item_bicycle"
android:checked="true"/>
<item android:title="@string/title_item_car"
android:id="@+id/item_car"/>
<item android:title="@string/title_item_car_fast"
android:id="@+id/item_car_fast"/>
</group>
</menu>
</item>
</menu>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -0,0 +1,63 @@
var indexAktuelleNotiz = Android.getIndexAktuelleNotiz();
console.log("Index der aktuellen Notiz: " + indexAktuelleNotiz);
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
view: new ol.View({
center: ol.proj.fromLonLat([Android.getLongitude (indexAktuelleNotiz), Android.getLatitude (indexAktuelleNotiz)]),
zoom: 16
})
});
var iconStyle = new ol.style.Style({
image: new ol.style.Icon( ({
anchor: [0.5, 0.5],
anchorXUnits: 'fraction',
anchorYUnits: 'fraction',
opacity: 0.75,
src: 'crosshair.png'
}))
});
var iconFeatures=[];
for (var i = 0; i < Android.getNotizenCount(); i++) {
var iconFeature = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.transform([Android.getLongitude(i),
Android.getLatitude(i)], 'EPSG:4326','EPSG:3857')),
name: Android.getThema(i),
description: Android.getNotiz(i),
});
iconFeature.setStyle(iconStyle);
iconFeatures.push(iconFeature);
}
var layer = new ol.layer.Vector({
source: new ol.source.Vector({
features: iconFeatures
})
});
map.addLayer(layer);
var container = document.getElementById('popup');
var content = document.getElementById('popup-content');
var closer = document.getElementById('popup-closer');
var overlay = new ol.Overlay({
element: container,
autoPan: true,
autoPanAnimation: {
duration: 250
}
});
map.addOverlay(overlay);
map.on('singleclick', function (event) {
if (map.hasFeatureAtPixel(event.pixel) === true) {
var coordinate = event.coordinate;
var features = map.getFeaturesAtPixel(event.pixel);
content.innerHTML = '<b>' + features[0].get("name") + '</b><br />' + features[0].get("description");
overlay.setPosition(coordinate);
} else {
overlay.setPosition(undefined);
closer.blur();
}
});

@ -0,0 +1,28 @@
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.4.3/css/ol.css" type="text/css">
<style>
.map {
height: 100%;
width: 100%;
position: absolute;
}
</style>
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.4.3/build/ol.js"></script>
</head>
<body>
<style>
body {
margin:0;
padding:0;
}
</style>
<div id="map" class="map"></div>
<div id="popup" class="ol-popup">
<a href="#" id="popup-closer" class="ol-popup-closer"></a>
<div id="popup-content"></div>
</div>
<script src="geonotes_on_osm.js"></script>
</body>
</html>

@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Geonotes" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>

@ -0,0 +1,24 @@
<resources>
<string name="app_name">Geonotes</string>
<string name="verfuegbare_provider">Verfügbare Provider:</string>
<string name="lokalisierung_starten">Lokalisierung starten</string>
<string name="lokalisierung_gestartet">Lokalisierung stoppen</string>
<string name="provider">Verfügbare Provider:</string>
<string name="geodaten_empfangen">Geodaten empfangen</string>
<string name="standort_anzeigen">Standort anzeigen</string>
<string name="aktuelles_projekt_prefix">Aktuelles Projekt:\u0020</string>
<string name="thema">Thema</string>
<string name="notiz">Notiz</string>
<string name="notiz_speichern">Notiz speichern</string>
<string name="action_settings">Einstellungen</string>
<string name="title_item_foot">Zu Fuß ~4km/h</string>
<string name="title_item_bicycle">Rad ~25km/h</string>
<string name="title_item_car">Auto ~50km/h</string>
<string name="title_item_car_fast">Auto > 100km/h</string>
<string name="title_item_desktop">Am Rechner 0km/h</string>
<string-array name="map_types">
<item>WebViewActivity</item>
<item>NoteMapActivity</item>
</string-array>
</resources>

@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Geonotes" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="my_documents" path="Android/data/and06.geonotes/files/Documents" />
</paths>

@ -0,0 +1,17 @@
package and06.geonotes
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

@ -0,0 +1,10 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.0.2' apply false
id 'com.android.library' version '8.0.2' apply false
id 'org.jetbrains.kotlin.android' version '1.9.20-Beta' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}

@ -0,0 +1,25 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false

Binary file not shown.

@ -0,0 +1,6 @@
#Tue Sep 19 14:15:58 CEST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
gradlew vendored

@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

89
gradlew.bat vendored

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

@ -0,0 +1,16 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "Geonotes"
include ':app'
Loading…
Cancel
Save