Skip to content

Commit

Permalink
Merge pull request #20 from philippluxi/release/v0.4
Browse files Browse the repository at this point in the history
[Release] - v0.4 - Release to Master
  • Loading branch information
philippluxi authored Jan 3, 2021
2 parents 12d9bfe + 64e0830 commit b8a14ff
Show file tree
Hide file tree
Showing 24 changed files with 790 additions and 324 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,7 @@ dependencies {

// Json Support for JSONStore
implementation 'com.google.code.gson:gson:2.8.6'

// Get current location
implementation "com.google.android.gms:play-services-location:17.1.0"
}
11 changes: 5 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@

<application
android:name=".main.MainApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".activities.SpotMapsActivity"
android:label="@string/title_spot_maps_activity"></activity>
<activity android:name=".activities.SpotActivity" />
<activity android:name=".activities.SpotListActivity">
android:name=".views.map.SpotMapView"
android:label="@string/title_spot_maps_activity" />
<activity android:name=".views.spot.SpotView" />
<activity android:name=".views.spotList.SpotListView">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -29,7 +28,7 @@
android:value="@string/google_maps_key" />

<activity
android:name=".activities.MapActivity"
android:name=".views.location.EditLocationView"
android:label="@string/title_activity_map" />
</application>

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.archaeologicalfieldwork.helpers

import android.Manifest
import android.annotation.SuppressLint
import android.app.Activity
import android.content.pm.PackageManager
import android.util.Log
import androidx.core.app.ActivityCompat
import com.google.android.gms.location.LocationRequest

val REQUEST_PERMISSIONS_REQUEST_CODE = 34

fun checkLocationPermissions(activity: Activity): Boolean {
if (ActivityCompat.checkSelfPermission(
activity,
Manifest.permission.ACCESS_FINE_LOCATION
) == PackageManager.PERMISSION_GRANTED
) {
return true
} else {
ActivityCompat.requestPermissions(
activity,
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
REQUEST_PERMISSIONS_REQUEST_CODE
)
return false
}
}

fun isPermissionGranted(code: Int, grantResults: IntArray): Boolean {
var permissionGranted = false;
if (code == REQUEST_PERMISSIONS_REQUEST_CODE) {
when {
grantResults.isEmpty() -> Log.i("Location", "User interaction was cancelled.")
(grantResults[0] == PackageManager.PERMISSION_GRANTED) -> {
permissionGranted = true
Log.i("Location", "Permission Granted.")
}
else -> Log.i("Location", "Permission Denied.")
}
}
return permissionGranted
}

@SuppressLint("RestrictedApi")
fun createDefaultLocationRequest(): LocationRequest {
val locationRequest = LocationRequest().apply {
interval = 10000
fastestInterval = 5000
priority = LocationRequest.PRIORITY_HIGH_ACCURACY
}
return locationRequest
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class SpotJSONStore : SpotStore, AnkoLogger {
}

override fun delete(spot: SpotModel) {
spots.remove(spot)
val foundSpot: SpotModel? = spots.find { it.id == spot.id }
spots.remove(foundSpot)
serialize()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.archaeologicalfieldwork.views

import android.content.Intent
import com.archaeologicalfieldwork.main.MainApp

open class BasePresenter(var view: BaseView?) {

var app: MainApp = view?.application as MainApp

open fun doActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
}

open fun doRequestPermissionsResult(
requestCode: Int,
permissions: Array<String>,
grantResults: IntArray
) { }

open fun onDestroy() {
view = null
}
}
Loading

0 comments on commit b8a14ff

Please sign in to comment.