Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21fbca36fe | ||
|
|
cb507e9a8c | ||
|
|
e32460116f | ||
|
|
cfb2fcbe2f | ||
|
|
4ea3d60932 | ||
|
|
6c4ca9d622 | ||
|
|
62d0331a32 | ||
|
|
5553dd4757 | ||
|
|
3f89f50492 | ||
|
|
b96615419e | ||
|
|
e1b5c70fb7 | ||
|
|
11f5d372b6 | ||
|
|
bbe51ebbf4 | ||
|
|
8319f56304 | ||
|
|
e9704b46f6 | ||
|
|
34a98136be | ||
|
|
f8d1a96d0b | ||
|
|
c5b69a12e7 | ||
|
|
08db82b1f7 | ||
|
|
fcd899f25f | ||
|
|
85c026fa8f | ||
|
|
8f7aeec0ab | ||
|
|
d3ba3f570a | ||
|
|
3c63e9530f | ||
|
|
cc66a682f0 |
@@ -3,13 +3,6 @@
|
|||||||
// this groovy script is executed by jenkins
|
// this groovy script is executed by jenkins
|
||||||
node {
|
node {
|
||||||
|
|
||||||
|
|
||||||
def gradleInfo
|
|
||||||
def server = Artifactory.server 'project.nes.uni-due.de'
|
|
||||||
def gradleBuild = Artifactory.newGradleBuild()
|
|
||||||
gradleBuild.tool = 'gradle-5.5.1'
|
|
||||||
gradleBuild.usesPlugin = true
|
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
ANDROID_SDK_ROOT = '/var/lib/android-sdk'
|
ANDROID_SDK_ROOT = '/var/lib/android-sdk'
|
||||||
}
|
}
|
||||||
@@ -21,49 +14,44 @@ node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def version = ''
|
def version = ''
|
||||||
|
def release = false
|
||||||
|
|
||||||
// configure the deployer based on the version
|
// configure the deployer based on the version
|
||||||
stage('Configure') {
|
stage('Configure') {
|
||||||
version = sh(returnStdout: true, script: "./gradlew properties -q | grep \"version:\" | awk '{print \$2}'", label: "Detecting project version.").trim()
|
version = sh(returnStdout: true, script: "./gradlew properties -q | grep \"version:\" | awk '{print \$2}'", label: "Detecting project version.").trim()
|
||||||
println "Version is: '${version}'"
|
println "Version is: '${version}'"
|
||||||
if (version.endsWith("-SNAPSHOT")) {
|
release = (! version.endsWith("-SNAPSHOT"))
|
||||||
println "Using internal-snapshots for publication."
|
|
||||||
gradleBuild.deployer server: server, repo: 'internal-snapshots'
|
|
||||||
} else {
|
|
||||||
println "Using internal-releases for publication."
|
|
||||||
gradleBuild.deployer server: server, repo: 'internal-releases'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// build the source code with gradle
|
// build the source code with gradle
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
withCredentials([string(credentialsId: 'maptology-keystore-password', variable: 'PASSWD')]) {
|
withCredentials([string(credentialsId: 'maptology-keystore-password', variable: 'PASSWD')]) {
|
||||||
def switches = "-Djenkins.build.number=${env.BUILD_NUMBER} -Dandroid.keystore.password=${PASSWD}".toString()
|
sh(script: './gradlew -Djenkins.build.number=' + env.BUILD_NUMBER + ' -Dandroid.keystore.password=$PASSWD clean build', label: "Building project.")
|
||||||
gradleInfo = gradleBuild.run buildFile: 'build.gradle', tasks: 'clean build', switches: switches
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// deploy the maven publications to artifactory
|
// deploy the maven publications to nexus
|
||||||
stage ('Publish') {
|
stage ('Publish') {
|
||||||
if (env.BRANCH_NAME == "master") {
|
if (env.BRANCH_NAME == "master") {
|
||||||
withCredentials([string(credentialsId: 'maptology-keystore-password', variable: 'PASSWD')]) {
|
withCredentials([string(credentialsId: 'jenkins-nexus-password', variable: 'NEXUS')]) {
|
||||||
def switches = "-Djenkins.build.number=${env.BUILD_NUMBER} -Dandroid.keystore.password=${PASSWD}".toString()
|
withCredentials([string(credentialsId: 'maptology-keystore-password', variable: 'PASSWD')]) {
|
||||||
gradleInfo = gradleBuild.run buildFile: 'build.gradle', tasks: 'artifactoryPublish', switches: switches
|
sh(script: './gradlew -Djenkins.build.number=' + env.BUILD_NUMBER + ' -Dandroid.keystore.password=$PASSWD -Djenkins.nexus.password=$NEXUS publishAllPublicationsToMavenRepository', label: "Publishing project.")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "Skipping deployment for non-master branch."
|
echo "Skipping publication for non-master branch."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// deploy the build output on the server
|
// deploy the build output on the server
|
||||||
stage ('Deploy') {
|
stage ('Deploy') {
|
||||||
if (env.BRANCH_NAME == "master") {
|
if (env.BRANCH_NAME == "master" && release) {
|
||||||
withCredentials([sshUserPrivateKey(credentialsId: "maptology-server-key", keyFileVariable: "keyfile")]) {
|
withCredentials([sshUserPrivateKey(credentialsId: "maptology-server-key", keyFileVariable: "KEYFILE")]) {
|
||||||
sh "scp -i ${keyfile} site-ear/build/libs/site-ear-${version}.ear wildfly@srv.nes.uni-due.de:/opt/wildfly-17-maptology/standalone/deployments/maptology.ear"
|
sh 'scp -i $KEYFILE site-ear/build/libs/site-ear-' + version + '.ear wildfly@apps-pro.nes.uni-due.de:/opt/wildfly-21-maptology/standalone/deployments/maptology.ear'
|
||||||
sh "scp -i ${keyfile} android-app/build/outputs/apk/release/*.apk wildfly@srv.nes.uni-due.de:/opt/android/maptology/"
|
sh 'scp -i $KEYFILE android-app/build/outputs/apk/release/*.apk wildfly@apps-pro.nes.uni-due.de:/opt/android/maptology/'
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "Skipping deployment for non-master branch."
|
echo "Skipping deployment for non-master branch or non-release build."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ description = "Maptology Android App"
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
implementation project(":android-feign")
|
implementation project(":android-feign")
|
||||||
implementation "androidx.legacy:legacy-support-v4:${versionAndroidx}"
|
implementation "androidx.legacy:legacy-support-v4:${versionAndroidxLegacy}"
|
||||||
implementation "androidx.appcompat:appcompat:${versionAndroidx}"
|
implementation "androidx.appcompat:appcompat:${versionAndroidxCompat}"
|
||||||
implementation "androidx.preference:preference:${versionAndroidx}"
|
implementation "androidx.preference:preference:${versionAndroidxPreference}"
|
||||||
implementation "androidx.cardview:cardview:${versionAndroidx}"
|
implementation "androidx.cardview:cardview:${versionAndroidxCard}"
|
||||||
implementation "androidx.recyclerview:recyclerview:${versionAndroidx}"
|
implementation "androidx.recyclerview:recyclerview:${versionAndroidxRecycler}"
|
||||||
implementation "com.google.android.material:material:${versionAndroidx}"
|
implementation "com.google.android.material:material:${versionAndroidxMaterial}"
|
||||||
implementation "com.google.android.gms:play-services-oss-licenses:${versionPlay}"
|
implementation "com.google.android.gms:play-services-oss-licenses:${versionPlay}"
|
||||||
testImplementation "junit:junit:${versionJunit}"
|
testImplementation "junit:junit:${versionJunit}"
|
||||||
testImplementation "org.robolectric:robolectric:${versionRobolectric}"
|
testImplementation "org.robolectric:robolectric:${versionRobolectric}"
|
||||||
@@ -22,12 +22,12 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 30
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.maptology.android.app"
|
applicationId "com.maptology.android.app"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 28
|
targetSdkVersion 30
|
||||||
versionCode 10
|
versionCode 13
|
||||||
versionName "${version}"
|
versionName "${version}"
|
||||||
buildConfigField "long", "BUILD_TIME", System.currentTimeMillis() + "L"
|
buildConfigField "long", "BUILD_TIME", System.currentTimeMillis() + "L"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
@@ -75,13 +75,15 @@ android {
|
|||||||
dexOptions {
|
dexOptions {
|
||||||
javaMaxHeapSize "512m"
|
javaMaxHeapSize "512m"
|
||||||
}
|
}
|
||||||
|
defaultConfig {
|
||||||
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register('makeEclipseDir') {
|
tasks.register('makeEclipseDir') {
|
||||||
doLast {
|
doLast {
|
||||||
file('build/generated/source/aidl/debug').mkdirs();
|
file('build/generated/source/aidl/debug').mkdirs()
|
||||||
file('build/generated/source/r/debug').mkdirs();
|
file('build/generated/source/r/debug').mkdirs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
|||||||
@@ -293,9 +293,14 @@ public abstract class AbstractService extends Service {
|
|||||||
protected static boolean isPowerCordPlugged(Context context) {
|
protected static boolean isPowerCordPlugged(Context context) {
|
||||||
Intent intent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
Intent intent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
||||||
int p = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
|
int p = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
|
||||||
return p == BatteryManager.BATTERY_PLUGGED_AC ||
|
if (Build.VERSION.SDK_INT < 17) {
|
||||||
p == BatteryManager.BATTERY_PLUGGED_USB ||
|
return p == BatteryManager.BATTERY_PLUGGED_AC ||
|
||||||
p == BatteryManager.BATTERY_PLUGGED_WIRELESS;
|
p == BatteryManager.BATTERY_PLUGGED_USB;
|
||||||
|
} else {
|
||||||
|
return p == BatteryManager.BATTERY_PLUGGED_AC ||
|
||||||
|
p == BatteryManager.BATTERY_PLUGGED_USB ||
|
||||||
|
p == BatteryManager.BATTERY_PLUGGED_WIRELESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -458,8 +458,17 @@ public class LocationService extends AbstractService {
|
|||||||
* @return True if gps permissions are set.
|
* @return True if gps permissions are set.
|
||||||
*/
|
*/
|
||||||
private boolean hasGpsPermissions() {
|
private boolean hasGpsPermissions() {
|
||||||
return ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
List<String> permissions = new ArrayList<>();
|
||||||
&& ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED;
|
permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);
|
||||||
|
permissions.add(Manifest.permission.ACCESS_COARSE_LOCATION);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
permissions.add(Manifest.permission.ACCESS_BACKGROUND_LOCATION);
|
||||||
|
}
|
||||||
|
boolean granted = true;
|
||||||
|
for (String permission: permissions) {
|
||||||
|
granted &= ActivityCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_GRANTED;
|
||||||
|
}
|
||||||
|
return granted;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.maptology.android.app;
|
package com.maptology.android.app;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.hardware.Sensor;
|
import android.hardware.Sensor;
|
||||||
import android.hardware.SensorEvent;
|
import android.hardware.SensorEvent;
|
||||||
@@ -34,22 +35,22 @@ public class LoggerService extends AbstractService {
|
|||||||
/**
|
/**
|
||||||
* The key for the detailed gps data.
|
* The key for the detailed gps data.
|
||||||
*/
|
*/
|
||||||
private String METADATA_GPS = "gps";
|
private static final String METADATA_GPS = "gps";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The key for the acceleration sensor.
|
* The key for the acceleration sensor.
|
||||||
*/
|
*/
|
||||||
private String METADATA_ACCELEROMETER = "accel";
|
private static final String METADATA_ACCELEROMETER = "accel";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The key for the gyroscope.
|
* The key for the gyroscope.
|
||||||
*/
|
*/
|
||||||
private String METADATA_GYROSCOPE = "gyro";
|
private static final String METADATA_GYROSCOPE = "gyro";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The key for the magnetometer.
|
* The key for the magnetometer.
|
||||||
*/
|
*/
|
||||||
private String METADATA_MAGNETOMETER = "magnet";
|
private static final String METADATA_MAGNETOMETER = "magnet";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The notification id of the foreground service indicator.
|
* The notification id of the foreground service indicator.
|
||||||
@@ -151,6 +152,7 @@ public class LoggerService extends AbstractService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressLint("WakelockTimeout") // the device is plugged, so we can ignore safely the energy usage
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
gpsListener = new GpsListener(LocationManager.GPS_PROVIDER, UPDATE_DELAY * UPDATE_FACTOR / SAMPLING_DELAY_GPS);
|
gpsListener = new GpsListener(LocationManager.GPS_PROVIDER, UPDATE_DELAY * UPDATE_FACTOR / SAMPLING_DELAY_GPS);
|
||||||
@@ -547,7 +549,7 @@ public class LoggerService extends AbstractService {
|
|||||||
public void setRegistered(boolean registered) {
|
public void setRegistered(boolean registered) {
|
||||||
this.registered = registered;
|
this.registered = registered;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -613,9 +615,8 @@ public class LoggerService extends AbstractService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSensorChanged(SensorEvent event) {
|
public void onSensorChanged(SensorEvent event) {
|
||||||
long prev = 0;
|
|
||||||
if (data.size() > 0) {
|
if (data.size() > 0) {
|
||||||
prev = data.get(data.size() - 1)[0];
|
long prev = data.get(data.size() - 1)[0];
|
||||||
long diff = event.timestamp / 1000 - prev;
|
long diff = event.timestamp / 1000 - prev;
|
||||||
if (diff / 1000 < SAMPLING_DELAY_SENSOR) return;
|
if (diff / 1000 < SAMPLING_DELAY_SENSOR) return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.maptology.android.app;
|
package com.maptology.android.app;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
import com.maptology.android.app.fragment.GrantListFragment;
|
import com.maptology.android.app.fragment.GrantListFragment;
|
||||||
import com.maptology.android.app.fragment.ManageFragment;
|
import com.maptology.android.app.fragment.ManageFragment;
|
||||||
import com.maptology.android.app.fragment.MapFragment;
|
import com.maptology.android.app.fragment.MapFragment;
|
||||||
@@ -10,6 +12,7 @@ import com.maptology.android.app.fragment.ShareListFragment;
|
|||||||
import com.maptology.android.app.fragment.TermsFragment;
|
import com.maptology.android.app.fragment.TermsFragment;
|
||||||
import com.maptology.android.app.model.LocalShare;
|
import com.maptology.android.app.model.LocalShare;
|
||||||
import com.maptology.android.app.repository.IValueListener;
|
import com.maptology.android.app.repository.IValueListener;
|
||||||
|
import com.maptology.android.app.repository.Repository;
|
||||||
import com.maptology.android.app.repository.Value;
|
import com.maptology.android.app.repository.Value;
|
||||||
import com.maptology.android.app.task.UpdateUserTask;
|
import com.maptology.android.app.task.UpdateUserTask;
|
||||||
import com.maptology.android.app.util.TabletUtil;
|
import com.maptology.android.app.util.TabletUtil;
|
||||||
@@ -18,21 +21,28 @@ import com.maptology.android.feign.model.User;
|
|||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import com.google.android.material.navigation.NavigationView;
|
import com.google.android.material.navigation.NavigationView;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.fragment.app.DialogFragment;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import androidx.core.content.PermissionChecker;
|
|
||||||
import androidx.drawerlayout.widget.DrawerLayout;
|
import androidx.drawerlayout.widget.DrawerLayout;
|
||||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -96,13 +106,28 @@ public class MainActivity extends AppCompatActivity implements
|
|||||||
public void onValueChanged(Value<DeviceHandle> source, DeviceHandle oldValue, DeviceHandle newValue) {
|
public void onValueChanged(Value<DeviceHandle> source, DeviceHandle oldValue, DeviceHandle newValue) {
|
||||||
if (newValue != null) {
|
if (newValue != null) {
|
||||||
MenuItem webapp = navigationView.getMenu().findItem(R.id.menu_webapp);
|
MenuItem webapp = navigationView.getMenu().findItem(R.id.menu_webapp);
|
||||||
MenuItem connect =navigationView.getMenu().findItem(R.id.menu_connect);
|
MenuItem connect = navigationView.getMenu().findItem(R.id.menu_connect);
|
||||||
connect.setVisible(newValue.getUser() == null);
|
connect.setVisible(newValue.getUser() == null);
|
||||||
webapp.setVisible(newValue.getUser() != null);
|
webapp.setVisible(newValue.getUser() != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A listener that performs a permission check whenever the user enables localization.
|
||||||
|
*/
|
||||||
|
private SharedPreferences.OnSharedPreferenceChangeListener preferenceListener =new SharedPreferences.OnSharedPreferenceChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
|
if (Repository.KEY_PRIVACY_LOCALIZE.equals(key)) {
|
||||||
|
if (sharedPreferences.getBoolean(key, false)) {
|
||||||
|
checkPermissions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Navigation Drawer menu.
|
* Navigation Drawer menu.
|
||||||
*/
|
*/
|
||||||
@@ -122,10 +147,16 @@ public class MainActivity extends AppCompatActivity implements
|
|||||||
*/
|
*/
|
||||||
private MaptologyApp app;
|
private MaptologyApp app;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The preferences to keep on watching the localization state.
|
||||||
|
*/
|
||||||
|
private SharedPreferences prefs;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
app = (MaptologyApp) getApplicationContext();
|
app = (MaptologyApp) getApplicationContext();
|
||||||
|
prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
AbstractService.runService(this);
|
AbstractService.runService(this);
|
||||||
setTitle(R.string.application_short);
|
setTitle(R.string.application_short);
|
||||||
if (TabletUtil.isLandscapeTablet(this)) {
|
if (TabletUtil.isLandscapeTablet(this)) {
|
||||||
@@ -137,7 +168,6 @@ public class MainActivity extends AppCompatActivity implements
|
|||||||
setScreen(Screen.MAP);
|
setScreen(Screen.MAP);
|
||||||
}
|
}
|
||||||
createNavigationDrawer();
|
createNavigationDrawer();
|
||||||
checkPermissions();
|
|
||||||
new UpdateUserTask(app).execute();
|
new UpdateUserTask(app).execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,10 +176,12 @@ public class MainActivity extends AppCompatActivity implements
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
app.getRepository().user.addValueListener(userListener, true);
|
app.getRepository().user.addValueListener(userListener, true);
|
||||||
app.getRepository().deviceHandle.addValueListener(deviceListener, true);
|
app.getRepository().deviceHandle.addValueListener(deviceListener, true);
|
||||||
|
prefs.registerOnSharedPreferenceChangeListener(preferenceListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
|
prefs.unregisterOnSharedPreferenceChangeListener(preferenceListener);
|
||||||
app.getRepository().deviceHandle.removeValueListener(deviceListener);
|
app.getRepository().deviceHandle.removeValueListener(deviceListener);
|
||||||
app.getRepository().user.removeValueListener(userListener);
|
app.getRepository().user.removeValueListener(userListener);
|
||||||
super.onPause();
|
super.onPause();
|
||||||
@@ -170,28 +202,21 @@ public class MainActivity extends AppCompatActivity implements
|
|||||||
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
|
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
int itemId = item.getItemId();
|
||||||
case R.id.menu_notice:
|
if (itemId == R.id.menu_notice) {
|
||||||
setScreen(Screen.NOTICE);
|
setScreen(Screen.NOTICE);
|
||||||
break;
|
} else if (itemId == R.id.menu_map) {
|
||||||
case R.id.menu_map:
|
setScreen(Screen.MAP);
|
||||||
setScreen(Screen.MAP);
|
} else if (itemId == R.id.menu_share) {
|
||||||
break;
|
createShare();
|
||||||
case R.id.menu_share:
|
} else if (itemId == R.id.menu_manage) {
|
||||||
createShare();
|
setScreen(Screen.MANAGE);
|
||||||
break;
|
} else if (itemId == R.id.menu_settings) {
|
||||||
case R.id.menu_manage:
|
showSettings();
|
||||||
setScreen(Screen.MANAGE);
|
} else if (itemId == R.id.menu_connect) {
|
||||||
break;
|
showLogin();
|
||||||
case R.id.menu_settings:
|
} else if (itemId == R.id.menu_webapp) {
|
||||||
showSettings();
|
showPlaces();
|
||||||
break;
|
|
||||||
case R.id.menu_connect:
|
|
||||||
showLogin();
|
|
||||||
break;
|
|
||||||
case R.id.menu_webapp:
|
|
||||||
showPlaces();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
closeDrawerIfNeeded();
|
closeDrawerIfNeeded();
|
||||||
return false;
|
return false;
|
||||||
@@ -236,7 +261,6 @@ public class MainActivity extends AppCompatActivity implements
|
|||||||
super.onDrawerClosed(view);
|
super.onDrawerClosed(view);
|
||||||
setTitle(R.string.application_short);
|
setTitle(R.string.application_short);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDrawerOpened(View drawerView) {
|
public void onDrawerOpened(View drawerView) {
|
||||||
super.onDrawerOpened(drawerView);
|
super.onDrawerOpened(drawerView);
|
||||||
setTitle(R.string.drawer_title);
|
setTitle(R.string.drawer_title);
|
||||||
@@ -262,30 +286,91 @@ public class MainActivity extends AppCompatActivity implements
|
|||||||
* Method to request location permission for the app.
|
* Method to request location permission for the app.
|
||||||
*/
|
*/
|
||||||
private void checkPermissions() {
|
private void checkPermissions() {
|
||||||
boolean permissionGranted = PermissionChecker.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PermissionChecker.PERMISSION_GRANTED &&
|
if (! app.getRepository().isLocalizable()) return;
|
||||||
PermissionChecker.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PermissionChecker.PERMISSION_GRANTED;
|
boolean coarse = ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED;
|
||||||
if (!permissionGranted) {
|
boolean fine = ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;
|
||||||
Log.d(TAG, "Requesting permissions.");
|
if (!(coarse && fine)) {
|
||||||
ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, CODE_REQUEST_PERMISSIONS);
|
Log.d(TAG, "Requesting foreground localization.");
|
||||||
|
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION)) {
|
||||||
|
PermissionDialogFragment dialog = new PermissionDialogFragment();
|
||||||
|
dialog.setForeground(true);
|
||||||
|
getSupportFragmentManager().beginTransaction().add(dialog, "foreground").commit();
|
||||||
|
} else {
|
||||||
|
requestForegroundLocalization();
|
||||||
|
}
|
||||||
|
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q){
|
||||||
|
boolean background = ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_BACKGROUND_LOCATION) == PackageManager.PERMISSION_GRANTED;
|
||||||
|
if (!background){
|
||||||
|
Log.d(TAG, "Requesting background localization.");
|
||||||
|
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_BACKGROUND_LOCATION)) {
|
||||||
|
PermissionDialogFragment dialog = new PermissionDialogFragment();
|
||||||
|
dialog.setForeground(false);
|
||||||
|
getSupportFragmentManager().beginTransaction().add(dialog, "background").commit();
|
||||||
|
} else {
|
||||||
|
requestBackgroundLocalization();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request the foreground localization permission.
|
||||||
|
*/
|
||||||
|
private void requestForegroundLocalization() {
|
||||||
|
ActivityCompat.requestPermissions(this, new String[] {
|
||||||
|
Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION
|
||||||
|
}, CODE_REQUEST_PERMISSIONS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request background localization permission.
|
||||||
|
*/
|
||||||
|
private void requestBackgroundLocalization() {
|
||||||
|
ActivityCompat.requestPermissions(this, new String[] {
|
||||||
|
Manifest.permission.ACCESS_BACKGROUND_LOCATION
|
||||||
|
}, CODE_REQUEST_PERMISSIONS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancels the localization request.
|
||||||
|
*/
|
||||||
|
private void cancelLocalization() {
|
||||||
|
app.getRepository().setLocalizable(false);
|
||||||
|
AbstractService.stopServices(this);
|
||||||
|
Snackbar.make(findViewById(R.id.coordinator), R.string.permission_missing,
|
||||||
|
Snackbar.LENGTH_LONG).setAction(R.string.permission_configure, v -> {
|
||||||
|
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||||
|
Uri uri = Uri.fromParts("package", getPackageName(), null);
|
||||||
|
intent.setData(uri);
|
||||||
|
startActivity(intent);
|
||||||
|
}).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method handles the requested permission (whether it was given or not).
|
* Method handles the requested permission (whether it was given or not).
|
||||||
*
|
*
|
||||||
* @param requestCode requestCode identifies requested permission
|
* @param requestCode Identifies requested permission.
|
||||||
* @param permissions permissions The permissions.
|
* @param permissions The permissions.
|
||||||
* @param grantResults results The results for the permissions.
|
* @param grantResults The results for the permissions.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case CODE_REQUEST_PERMISSIONS: {
|
case CODE_REQUEST_PERMISSIONS: {
|
||||||
StringBuilder b = new StringBuilder();
|
boolean granted = true;
|
||||||
for (int i = 0, s = Math.min(permissions.length, grantResults.length); i < s; i++) {
|
for (int i = 0; i < grantResults.length; i++) {
|
||||||
b.append(permissions[i] + " " + (grantResults[i] == PackageManager.PERMISSION_GRANTED) + "\n");
|
boolean value = grantResults[i] == PackageManager.PERMISSION_GRANTED;
|
||||||
|
granted &= value;
|
||||||
|
Log.d(TAG, permissions[i] + ": " + value);
|
||||||
|
}
|
||||||
|
Log.d(TAG, "All permissions granted: " + granted);
|
||||||
|
if (!granted) {
|
||||||
|
cancelLocalization();
|
||||||
|
} else {
|
||||||
|
checkPermissions();
|
||||||
}
|
}
|
||||||
Log.d(TAG, "Permission result:\n" + b.toString());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -413,4 +498,46 @@ public class MainActivity extends AppCompatActivity implements
|
|||||||
MANAGE
|
MANAGE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A dialog to explain the permissions.
|
||||||
|
*/
|
||||||
|
public static class PermissionDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks the fragment either as foreground or background.
|
||||||
|
*
|
||||||
|
* @param foreground True for foreground, false for background.
|
||||||
|
*/
|
||||||
|
public void setForeground(boolean foreground) {
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
b.putBoolean("foreground", foreground);
|
||||||
|
setArguments(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||||
|
boolean foreground = getArguments().getBoolean("foreground");
|
||||||
|
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity());
|
||||||
|
builder.setTitle(R.string.permission_required);
|
||||||
|
builder.setMessage(foreground ? R.string.permission_foreground_explain : R.string.permission_background_explain);
|
||||||
|
builder.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||||
|
if (foreground) {
|
||||||
|
((MainActivity)getActivity()).requestForegroundLocalization();
|
||||||
|
} else {
|
||||||
|
((MainActivity)getActivity()).requestBackgroundLocalization();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> {
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
builder.setOnCancelListener(dialog -> ((MainActivity)getActivity()).cancelLocalization());
|
||||||
|
return builder.create();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.maptology.android.app.fragment;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
import com.locoslab.android.leafless.IMapStateListener;
|
import com.locoslab.android.leafless.IMapStateListener;
|
||||||
import com.locoslab.android.leafless.ITouchListener;
|
import com.locoslab.android.leafless.ITouchListener;
|
||||||
import com.locoslab.android.leafless.MapOptions;
|
import com.locoslab.android.leafless.MapOptions;
|
||||||
@@ -31,18 +33,16 @@ import com.maptology.android.feign.model.Coordinate;
|
|||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
|
||||||
import androidx.collection.LongSparseArray;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.collection.LongSparseArray;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A fragment that displays a map.
|
* A fragment that displays a map.
|
||||||
@@ -288,7 +288,7 @@ public class MapFragment extends AbstractFragment {
|
|||||||
// apply the state
|
// apply the state
|
||||||
getRepository().mapState.getValue().applyTo(map);
|
getRepository().mapState.getValue().applyTo(map);
|
||||||
// add a tile layer
|
// add a tile layer
|
||||||
map.addLayer(new TileLayer(new TileLayerOptions("https://cloud.locoslab.com/carta/restful-services/tile/{z}/{x}/{y}.png")));
|
map.addLayer(new TileLayer(new TileLayerOptions("https://www.maptology.com/carta/tile/{z}/{x}/{y}.png")));
|
||||||
// add map interaction
|
// add map interaction
|
||||||
map.addShortTapListener(new ITouchListener() {
|
map.addShortTapListener(new ITouchListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -461,7 +461,7 @@ public class MapFragment extends AbstractFragment {
|
|||||||
getRepository().mapMode.setValue(MapMode.values()[code]);
|
getRepository().mapMode.setValue(MapMode.values()[code]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies the current map mode.
|
* Applies the current map mode.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,16 +17,19 @@ import android.content.ActivityNotFoundException;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import androidx.core.content.pm.PackageInfoCompat;
|
import androidx.core.content.pm.PackageInfoCompat;
|
||||||
|
import androidx.preference.CheckBoxPreference;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceCategory;
|
import androidx.preference.PreferenceCategory;
|
||||||
import androidx.preference.PreferenceFragmentCompat;
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
import androidx.preference.PreferenceGroup;
|
import androidx.preference.PreferenceGroup;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -144,6 +147,18 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
|||||||
*/
|
*/
|
||||||
private PreferenceGroup developmentGroup;
|
private PreferenceGroup developmentGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A listener for shared preferences.
|
||||||
|
*/
|
||||||
|
private SharedPreferences.OnSharedPreferenceChangeListener preferenceListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
|
if (Repository.KEY_PRIVACY_LOCALIZE.equals(key)) {
|
||||||
|
updateLocalize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
@@ -179,6 +194,29 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(preferenceListener);
|
||||||
|
updateLocalize();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(getContext()).unregisterOnSharedPreferenceChangeListener(preferenceListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateLocalize() {
|
||||||
|
CheckBoxPreference p = findPreference(Repository.KEY_PRIVACY_LOCALIZE);
|
||||||
|
if (p != null) {
|
||||||
|
boolean state = getApp().getRepository().isLocalizable();
|
||||||
|
if (p.isChecked() != state) {
|
||||||
|
p.setChecked(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the logger switch is available.
|
* Determines whether the logger switch is available.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -83,12 +83,18 @@ public class TermsFragment extends AbstractFragment {
|
|||||||
View acceptView = view.findViewById(R.id.fragment_terms_accept);
|
View acceptView = view.findViewById(R.id.fragment_terms_accept);
|
||||||
acceptView.setVisibility(getRepository().isTermsAccepted()?View.GONE:View.VISIBLE);
|
acceptView.setVisibility(getRepository().isTermsAccepted()?View.GONE:View.VISIBLE);
|
||||||
final CheckBox permissionCheckbox = (CheckBox) view.findViewById(R.id.permission_checkbox_start);
|
final CheckBox permissionCheckbox = (CheckBox) view.findViewById(R.id.permission_checkbox_start);
|
||||||
Button continueButton = (Button) view.findViewById(R.id.start_button_continue);
|
final Button continueButton = (Button) view.findViewById(R.id.start_button_continue);
|
||||||
|
continueButton.setEnabled(permissionCheckbox.isChecked());
|
||||||
|
permissionCheckbox.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
continueButton.setEnabled(permissionCheckbox.isChecked());
|
||||||
|
}
|
||||||
|
});
|
||||||
continueButton.setOnClickListener(new View.OnClickListener() {
|
continueButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
getRepository().setTermsAccepted(true);
|
getRepository().setTermsAccepted(true);
|
||||||
getRepository().setShareable(permissionCheckbox.isChecked());
|
|
||||||
if (continueListener != null) continueListener.onClick(v);
|
if (continueListener != null) continueListener.onClick(v);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import com.maptology.android.feign.model.User;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -149,9 +149,9 @@ public class Repository {
|
|||||||
*/
|
*/
|
||||||
public Repository(Context context) {
|
public Repository(Context context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.deviceHandle = new PersistentValue<DeviceHandle>(this, new JacksonSerializer<DeviceHandle>(DeviceHandle.class), "device.json");
|
this.deviceHandle = new PersistentValue<>(this, new JacksonSerializer<>(DeviceHandle.class), "device.json");
|
||||||
this.user = new PersistentValue<User>(this, new JacksonSerializer<User>(User.class), "user.json");
|
this.user = new PersistentValue<>(this, new JacksonSerializer<>(User.class), "user.json");
|
||||||
this.lastUpdate = new PersistentValue<ReleasedLocation>(this, new JacksonSerializer<ReleasedLocation>(ReleasedLocation.class), "update.json");
|
this.lastUpdate = new PersistentValue<>(this, new JacksonSerializer<>(ReleasedLocation.class), "update.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -172,12 +172,24 @@ public class Repository {
|
|||||||
return getPreference(KEY_PRIVACY_LOCALIZE, R.bool.privacy_localize_default);
|
return getPreference(KEY_PRIVACY_LOCALIZE, R.bool.privacy_localize_default);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables or disables localization.
|
||||||
|
*
|
||||||
|
* @param value True to enable, false to disable.
|
||||||
|
*/
|
||||||
|
public void setLocalizable(boolean value) {
|
||||||
|
setPreference(KEY_PRIVACY_LOCALIZE, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether logging is enabled.
|
||||||
|
*
|
||||||
|
* @return True if logging is enabled, false otherwise.
|
||||||
|
*/
|
||||||
public boolean isLoggable() {
|
public boolean isLoggable() {
|
||||||
return getPreference(KEY_PRIVACY_LOGGABLE, R.bool.privacy_loggable_default);
|
return getPreference(KEY_PRIVACY_LOGGABLE, R.bool.privacy_loggable_default);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the user has allowed that his positions can be used for research.
|
* Sets whether the user has allowed that his positions can be used for research.
|
||||||
*
|
*
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 134 KiB |
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
@@ -1,4 +1,6 @@
|
|||||||
<vector android:height="48dp" android:viewportHeight="24.0"
|
<vector
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
|
android:height="48dp" android:viewportHeight="24.0"
|
||||||
android:viewportWidth="24.0" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:viewportWidth="24.0" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<path android:fillColor="#FF000000" android:pathData="M12,6c3.87,0 7,3.13 7,7 0,0.84 -0.16,1.65 -0.43,2.4l1.52,1.52c0.58,-1.19 0.91,-2.51 0.91,-3.92 0,-4.97 -4.03,-9 -9,-9 -1.41,0 -2.73,0.33 -3.92,0.91L9.6,6.43C10.35,6.16 11.16,6 12,6zM22,5.72l-4.6,-3.86 -1.29,1.53 4.6,3.86L22,5.72zM2.92,2.29L1.65,3.57 2.98,4.9l-1.11,0.93 1.42,1.42 1.11,-0.94 0.8,0.8C3.83,8.69 3,10.75 3,13c0,4.97 4.02,9 9,9 2.25,0 4.31,-0.83 5.89,-2.2l2.2,2.2 1.27,-1.27L3.89,3.27l-0.97,-0.98zM16.47,18.39C15.26,19.39 13.7,20 12,20c-3.87,0 -7,-3.13 -7,-7 0,-1.7 0.61,-3.26 1.61,-4.47l9.86,9.86zM8.02,3.28L6.6,1.86l-0.86,0.71 1.42,1.42 0.86,-0.71z"/>
|
<path android:fillColor="#FF000000" android:pathData="M12,6c3.87,0 7,3.13 7,7 0,0.84 -0.16,1.65 -0.43,2.4l1.52,1.52c0.58,-1.19 0.91,-2.51 0.91,-3.92 0,-4.97 -4.03,-9 -9,-9 -1.41,0 -2.73,0.33 -3.92,0.91L9.6,6.43C10.35,6.16 11.16,6 12,6zM22,5.72l-4.6,-3.86 -1.29,1.53 4.6,3.86L22,5.72zM2.92,2.29L1.65,3.57 2.98,4.9l-1.11,0.93 1.42,1.42 1.11,-0.94 0.8,0.8C3.83,8.69 3,10.75 3,13c0,4.97 4.02,9 9,9 2.25,0 4.31,-0.83 5.89,-2.2l2.2,2.2 1.27,-1.27L3.89,3.27l-0.97,-0.98zM16.47,18.39C15.26,19.39 13.7,20 12,20c-3.87,0 -7,-3.13 -7,-7 0,-1.7 0.61,-3.26 1.61,-4.47l9.86,9.86zM8.02,3.28L6.6,1.86l-0.86,0.71 1.42,1.42 0.86,-0.71z"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<vector android:height="48dp" android:viewportHeight="24.0"
|
<vector
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
|
android:height="48dp" android:viewportHeight="24.0"
|
||||||
android:viewportWidth="24.0" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:viewportWidth="24.0" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<path android:fillColor="#FF000000" android:pathData="M20.94,11c-0.46,-4.17 -3.77,-7.48 -7.94,-7.94V1h-2v2.06C6.83,3.52 3.52,6.83 3.06,11H1v2h2.06c0.46,4.17 3.77,7.48 7.94,7.94V23h2v-2.06c4.17,-0.46 7.48,-3.77 7.94,-7.94H23v-2h-2.06zM12,19c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7z"/>
|
<path android:fillColor="#FF000000" android:pathData="M20.94,11c-0.46,-4.17 -3.77,-7.48 -7.94,-7.94V1h-2v2.06C6.83,3.52 3.52,6.83 3.06,11H1v2h2.06c0.46,4.17 3.77,7.48 7.94,7.94V23h2v-2.06c4.17,-0.46 7.48,-3.77 7.94,-7.94H23v-2h-2.06zM12,19c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7z"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<vector android:height="48dp" android:viewportHeight="24.0"
|
<vector
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
|
android:height="48dp" android:viewportHeight="24.0"
|
||||||
android:viewportWidth="24.0" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:viewportWidth="24.0" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<path android:fillColor="#FF000000" android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"/>
|
<path android:fillColor="#FF000000" android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector android:height="48dp" android:viewportHeight="24.0"
|
<vector android:tint="?attr/colorControlNormal"
|
||||||
|
android:height="48dp" android:viewportHeight="24.0"
|
||||||
android:viewportWidth="24.0" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:viewportWidth="24.0" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<path android:fillColor="#FF000000" android:pathData="M6,19h4L10,5L6,5v14zM14,5v14h4L18,5h-4z"/>
|
<path android:fillColor="#FF000000" android:pathData="M6,19h4L10,5L6,5v14zM14,5v14h4L18,5h-4z"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24"
|
android:viewportWidth="24"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<vector android:height="48dp" android:viewportHeight="24.0"
|
<vector android:tint="?attr/colorControlNormal" android:height="48dp" android:viewportHeight="24.0"
|
||||||
android:viewportWidth="24.0" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:viewportWidth="24.0" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<path android:fillColor="#FF000000" android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
|
<path android:fillColor="#FF000000" android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="48dp"
|
android:width="48dp"
|
||||||
android:height="48dp"
|
android:height="48dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
app:itemIconTint="@color/white"
|
||||||
android:id="@+id/drawer_layout">
|
android:id="@+id/drawer_layout">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout 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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
@@ -14,7 +15,7 @@
|
|||||||
android:layout_margin="@dimen/space_large"
|
android:layout_margin="@dimen/space_large"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/login_title"
|
android:id="@+id/login_title"
|
||||||
tools:text="@string/login_title_create"
|
tools:text="@string/login_title_create"
|
||||||
android:layout_marginBottom="@dimen/space_medium"
|
android:layout_marginBottom="@dimen/space_medium"
|
||||||
@@ -23,7 +24,7 @@
|
|||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/login_explain"
|
android:id="@+id/login_explain"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -31,10 +32,11 @@
|
|||||||
tools:text="@string/login_explain_create"
|
tools:text="@string/login_explain_create"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatEditText
|
<EditText
|
||||||
android:id="@+id/input_username"
|
android:id="@+id/input_username"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:autofillHints="username"
|
||||||
android:drawableStart="@drawable/ic_perm_identity_black_24dp"
|
android:drawableStart="@drawable/ic_perm_identity_black_24dp"
|
||||||
android:drawableLeft="@drawable/ic_perm_identity_black_24dp"
|
android:drawableLeft="@drawable/ic_perm_identity_black_24dp"
|
||||||
android:drawablePadding="@dimen/space_medium"
|
android:drawablePadding="@dimen/space_medium"
|
||||||
@@ -48,8 +50,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="@dimen/space_large"
|
android:layout_marginBottom="@dimen/space_large"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<androidx.appcompat.widget.AppCompatEditText
|
<EditText
|
||||||
android:id="@+id/input_password"
|
android:id="@+id/input_password"
|
||||||
|
android:autofillHints="password"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -67,10 +70,10 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="@dimen/space_medium"
|
android:padding="@dimen/space_medium"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:src="@drawable/ic_visibility_black_24dp" />
|
app:srcCompat="@drawable/ic_visibility_black_24dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatButton
|
<Button
|
||||||
android:id="@+id/button_login"
|
android:id="@+id/button_login"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -78,7 +81,7 @@
|
|||||||
android:theme="@style/button_highlighted"
|
android:theme="@style/button_highlighted"
|
||||||
tools:text="@string/login_button_create"/>
|
tools:text="@string/login_button_create"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatButton
|
<Button
|
||||||
android:id="@+id/button_no_login"
|
android:id="@+id/button_no_login"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -88,7 +91,7 @@
|
|||||||
android:theme="@style/button"
|
android:theme="@style/button"
|
||||||
android:text="@string/login_button_continue"/>
|
android:text="@string/login_button_continue"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/text_register"
|
android:id="@+id/text_register"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="@drawable/bg_launch_gradient"
|
android:background="@drawable/bg_launch_gradient"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -8,7 +9,7 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/icon_launch_map"
|
android:id="@+id/icon_launch_map"
|
||||||
android:contentDescription="@string/application_long"
|
android:contentDescription="@string/application_long"
|
||||||
android:src="@drawable/icon_launch_map"
|
app:srcCompat="@drawable/icon_launch_map"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
@@ -24,14 +25,14 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:contentDescription="@null"
|
android:contentDescription="@null"
|
||||||
android:src="@drawable/icon_launch_text"
|
app:srcCompat="@drawable/icon_launch_text"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/icon_launch_person"
|
android:id="@+id/icon_launch_person"
|
||||||
android:src="@drawable/icon_launch_person"
|
app:srcCompat="@drawable/icon_launch_person"
|
||||||
android:contentDescription="@null"
|
android:contentDescription="@null"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
app:tabMode="fixed"
|
app:tabMode="fixed"
|
||||||
app:tabGravity="fill"
|
app:tabGravity="fill"
|
||||||
app:elevation="6dp"
|
app:elevation="6dp"
|
||||||
app:tabTextColor="?android:attr/textColorPrimaryInverse"
|
app:tabTextColor="@color/white"
|
||||||
app:tabSelectedTextColor="?android:attr/textColorPrimaryInverse"
|
app:tabSelectedTextColor="@color/colorAccent"
|
||||||
app:tabIndicatorColor="@color/colorAccent"
|
app:tabIndicatorColor="@color/colorAccent"
|
||||||
android:minHeight="?attr/actionBarSize"/>
|
android:minHeight="?attr/actionBarSize"/>
|
||||||
|
|
||||||
|
|||||||
@@ -53,9 +53,10 @@
|
|||||||
android:layout_marginEnd="@dimen/space_medium"
|
android:layout_marginEnd="@dimen/space_medium"
|
||||||
app:layout_dodgeInsetEdges="bottom"
|
app:layout_dodgeInsetEdges="bottom"
|
||||||
app:layout_insetEdge="bottom"
|
app:layout_insetEdge="bottom"
|
||||||
|
android:contentDescription="@string/map_share"
|
||||||
app:layout_anchorGravity="top|right"
|
app:layout_anchorGravity="top|right"
|
||||||
app:layout_anchor="@id/detail_sheet"
|
app:layout_anchor="@id/detail_sheet"
|
||||||
android:src="@drawable/ic_share_black_24dp"
|
app:srcCompat="@drawable/ic_share_black_24dp"
|
||||||
style="@style/button_fab_highlighted"/>
|
style="@style/button_fab_highlighted"/>
|
||||||
|
|
||||||
|
|
||||||
@@ -66,10 +67,10 @@
|
|||||||
android:layout_marginRight="@dimen/space_medium"
|
android:layout_marginRight="@dimen/space_medium"
|
||||||
android:layout_marginEnd="@dimen/space_medium"
|
android:layout_marginEnd="@dimen/space_medium"
|
||||||
android:layout_marginBottom="64dp"
|
android:layout_marginBottom="64dp"
|
||||||
android:contentDescription="@string/nav_share"
|
android:contentDescription="@string/map_mode"
|
||||||
app:layout_anchor="@id/buttonShare"
|
app:layout_anchor="@id/buttonShare"
|
||||||
app:layout_anchorGravity="top|right"
|
app:layout_anchorGravity="top|right"
|
||||||
android:src="@drawable/ic_gps_not_fixed_black_24dp"
|
app:srcCompat="@drawable/ic_gps_not_fixed_black_24dp"
|
||||||
style="@style/button_fab"/>
|
style="@style/button_fab"/>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/share_explain"
|
android:id="@+id/share_explain"
|
||||||
android:text="@string/share_explain_create"
|
android:text="@string/share_explain_create"
|
||||||
android:layout_marginBottom="@dimen/space_medium"
|
android:layout_marginBottom="@dimen/space_medium"
|
||||||
@@ -44,9 +44,10 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatEditText
|
<EditText
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:importantForAutofill="no"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:drawablePadding="@dimen/space_medium"
|
android:drawablePadding="@dimen/space_medium"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
@@ -58,9 +59,10 @@
|
|||||||
android:drawableStart="@drawable/ic_message_black_24dp"
|
android:drawableStart="@drawable/ic_message_black_24dp"
|
||||||
android:drawableLeft="@drawable/ic_message_black_24dp"/>
|
android:drawableLeft="@drawable/ic_message_black_24dp"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatEditText
|
<EditText
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:importantForAutofill="no"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:drawablePadding="@dimen/space_medium"
|
android:drawablePadding="@dimen/space_medium"
|
||||||
android:maxLength="140"
|
android:maxLength="140"
|
||||||
@@ -79,12 +81,12 @@
|
|||||||
android:layout_marginBottom="@dimen/space_medium"
|
android:layout_marginBottom="@dimen/space_medium"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:text="@string/share_creation_time"
|
android:text="@string/share_creation_time"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/share_creation_date"
|
android:id="@+id/share_creation_date"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
@@ -92,7 +94,7 @@
|
|||||||
tools:text="1.1.2003"
|
tools:text="1.1.2003"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/share_creation_time"
|
android:id="@+id/share_creation_time"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
@@ -109,12 +111,12 @@
|
|||||||
android:layout_marginBottom="@dimen/space_medium"
|
android:layout_marginBottom="@dimen/space_medium"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:text="@string/share_expiration_time"
|
android:text="@string/share_expiration_time"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/share_expiration_date"
|
android:id="@+id/share_expiration_date"
|
||||||
android:textAppearance="@style/text_medium_hyperlink"
|
android:textAppearance="@style/text_medium_hyperlink"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
@@ -122,7 +124,7 @@
|
|||||||
tools:text="1.1.2003"
|
tools:text="1.1.2003"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/share_expiration_time"
|
android:id="@+id/share_expiration_time"
|
||||||
style="@style/text_medium_hyperlink"
|
style="@style/text_medium_hyperlink"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
@@ -142,7 +144,7 @@
|
|||||||
android:layout_marginBottom="@dimen/space_medium"
|
android:layout_marginBottom="@dimen/space_medium"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatButton
|
<Button
|
||||||
android:id="@+id/share_button_link"
|
android:id="@+id/share_button_link"
|
||||||
android:text="@string/share_action_link"
|
android:text="@string/share_action_link"
|
||||||
android:drawableStart="@drawable/ic_link_black_24dp"
|
android:drawableStart="@drawable/ic_link_black_24dp"
|
||||||
@@ -162,7 +164,7 @@
|
|||||||
android:paddingTop="@dimen/space_medium"
|
android:paddingTop="@dimen/space_medium"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatCheckBox
|
<CheckBox
|
||||||
android:id="@+id/share_paused"
|
android:id="@+id/share_paused"
|
||||||
android:text="@string/share_paused"
|
android:text="@string/share_paused"
|
||||||
android:textAppearance="@style/text_small_hyperlink"
|
android:textAppearance="@style/text_small_hyperlink"
|
||||||
@@ -187,7 +189,7 @@
|
|||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:id="@+id/share_button_layout"
|
android:id="@+id/share_button_layout"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<androidx.appcompat.widget.AppCompatButton
|
<Button
|
||||||
android:id="@+id/share_button_delete"
|
android:id="@+id/share_button_delete"
|
||||||
android:text="@string/share_action_delete"
|
android:text="@string/share_action_delete"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
@@ -196,7 +198,7 @@
|
|||||||
android:theme="@style/button"
|
android:theme="@style/button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
<androidx.appcompat.widget.AppCompatButton
|
<Button
|
||||||
android:id="@+id/share_button_save"
|
android:id="@+id/share_button_save"
|
||||||
android:text="@string/share_action_save"
|
android:text="@string/share_action_save"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
@@ -205,7 +207,7 @@
|
|||||||
android:theme="@style/button_highlighted"
|
android:theme="@style/button_highlighted"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
<androidx.appcompat.widget.AppCompatButton
|
<Button
|
||||||
android:id="@+id/share_button_create"
|
android:id="@+id/share_button_create"
|
||||||
android:text="@string/share_action_create"
|
android:text="@string/share_action_create"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
tools:text="Pick an action"
|
tools:text="Pick an action"
|
||||||
android:id="@+id/dialog_text"
|
android:id="@+id/dialog_text"
|
||||||
android:drawableLeft="@drawable/ic_launch_black_24dp"
|
app:drawableStartCompat="@drawable/ic_launch_black_24dp"
|
||||||
android:drawableStart="@drawable/ic_launch_black_24dp"
|
|
||||||
android:drawablePadding="@dimen/space_large"
|
android:drawablePadding="@dimen/space_large"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/view_detail_plain"
|
android:id="@+id/view_detail_plain"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -10,7 +11,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView android:src="@drawable/ic_share_black_48dp"
|
<ImageView app:srcCompat="@drawable/ic_share_black_48dp"
|
||||||
|
android:contentDescription="@null"
|
||||||
android:id="@+id/view_detail_status"
|
android:id="@+id/view_detail_status"
|
||||||
android:paddingRight="4dp"
|
android:paddingRight="4dp"
|
||||||
android:paddingEnd="4dp"
|
android:paddingEnd="4dp"
|
||||||
@@ -27,12 +29,12 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:text="@string/share_name"
|
android:text="@string/share_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/view_detail_name"
|
android:id="@+id/view_detail_name"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
tools:text="Marcus Handte"
|
tools:text="Marcus Handte"
|
||||||
@@ -48,13 +50,13 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/view_detail_creation_label"
|
android:id="@+id/view_detail_creation_label"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:text="@string/share_creation_time"
|
android:text="@string/share_creation_time"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/view_detail_creation_time"
|
android:id="@+id/view_detail_creation_time"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
tools:text="12/12/12 10:30"
|
tools:text="12/12/12 10:30"
|
||||||
@@ -70,12 +72,12 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:text="@string/share_expiration_time"
|
android:text="@string/share_expiration_time"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/view_detail_expiration_time"
|
android:id="@+id/view_detail_expiration_time"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
tools:text="12/12/12 10:30"
|
tools:text="12/12/12 10:30"
|
||||||
@@ -98,15 +100,15 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:id="@+id/view_detail_message_line">
|
android:id="@+id/view_detail_message_line">
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<ImageView
|
||||||
android:src="@drawable/ic_message_black_24dp"
|
app:srcCompat="@drawable/ic_message_black_24dp"
|
||||||
android:paddingLeft="14dp"
|
android:paddingLeft="14dp"
|
||||||
android:paddingRight="14dp"
|
android:paddingRight="14dp"
|
||||||
android:alpha="0.75"
|
android:alpha="0.75"
|
||||||
android:contentDescription="@string/share_hint_message"
|
android:contentDescription="@string/share_hint_message"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/view_detail_message"
|
android:id="@+id/view_detail_message"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
tools:text="Message"
|
tools:text="Message"
|
||||||
@@ -121,16 +123,16 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:id="@+id/view_detail_destination_line">
|
android:id="@+id/view_detail_destination_line">
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<ImageView
|
||||||
android:contentDescription="@string/share_hint_message"
|
android:contentDescription="@string/share_hint_message"
|
||||||
android:src="@drawable/ic_card_travel_black_24dp"
|
app:srcCompat="@drawable/ic_card_travel_black_24dp"
|
||||||
android:paddingLeft="14dp"
|
android:paddingLeft="14dp"
|
||||||
android:paddingRight="14dp"
|
android:paddingRight="14dp"
|
||||||
android:alpha="0.75"
|
android:alpha="0.75"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/view_detail_destination"
|
android:id="@+id/view_detail_destination"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
tools:text="Destination"
|
tools:text="Destination"
|
||||||
@@ -145,16 +147,16 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:id="@+id/view_detail_position_line">
|
android:id="@+id/view_detail_position_line">
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<ImageView
|
||||||
android:contentDescription="@string/share_hint_position"
|
android:contentDescription="@string/share_hint_position"
|
||||||
android:src="@drawable/ic_gps_fixed_black_24dp"
|
app:srcCompat="@drawable/ic_gps_fixed_black_24dp"
|
||||||
android:paddingLeft="14dp"
|
android:paddingLeft="14dp"
|
||||||
android:paddingRight="14dp"
|
android:paddingRight="14dp"
|
||||||
android:alpha="0.75"
|
android:alpha="0.75"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/view_detail_position"
|
android:id="@+id/view_detail_position"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
tools:text="Available"
|
tools:text="Available"
|
||||||
@@ -169,16 +171,16 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:id="@+id/view_detail_updated_line">
|
android:id="@+id/view_detail_updated_line">
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<ImageView
|
||||||
android:contentDescription="@string/share_hint_updated"
|
android:contentDescription="@string/share_hint_updated"
|
||||||
android:src="@drawable/ic_update_black_24dp"
|
app:srcCompat="@drawable/ic_update_black_24dp"
|
||||||
android:paddingLeft="14dp"
|
android:paddingLeft="14dp"
|
||||||
android:paddingRight="14dp"
|
android:paddingRight="14dp"
|
||||||
android:alpha="0.75"
|
android:alpha="0.75"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/view_detail_updated"
|
android:id="@+id/view_detail_updated"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
tools:text="Last update ..."
|
tools:text="Last update ..."
|
||||||
@@ -192,16 +194,16 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<ImageView
|
||||||
android:contentDescription="@string/share_token"
|
android:contentDescription="@string/share_token"
|
||||||
android:src="@drawable/ic_vpn_key_black_24dp"
|
app:srcCompat="@drawable/ic_vpn_key_black_24dp"
|
||||||
android:paddingLeft="14dp"
|
android:paddingLeft="14dp"
|
||||||
android:paddingRight="14dp"
|
android:paddingRight="14dp"
|
||||||
android:alpha="0.75"
|
android:alpha="0.75"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:id="@+id/view_detail_token"
|
android:id="@+id/view_detail_token"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
tools:text="abcdefghijklmnopqrs"
|
tools:text="abcdefghijklmnopqrs"
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout 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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
<ImageView android:layout_width="match_parent"
|
<ImageView android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:src="@drawable/icon_header"
|
app:srcCompat="@drawable/icon_header"
|
||||||
android:contentDescription="@null"
|
android:contentDescription="@null"
|
||||||
android:scaleType="centerCrop" />
|
android:scaleType="centerCrop" />
|
||||||
|
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
tools:text="Sony Xperia Foo"
|
tools:text="Sony Xperia Foo"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
|
android:textColor="@color/white"
|
||||||
android:id="@+id/view_header_device"
|
android:id="@+id/view_header_device"
|
||||||
android:textAppearance="?android:attr/textAppearanceMediumInverse"
|
android:textAppearance="?android:attr/textAppearanceMediumInverse"
|
||||||
/>
|
/>
|
||||||
@@ -32,6 +34,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/view_header_username"
|
android:id="@+id/view_header_username"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
|
android:textColor="@color/white"
|
||||||
tools:text="John Doe"
|
tools:text="John Doe"
|
||||||
android:textAppearance="?android:attr/textAppearanceMediumInverse"
|
android:textAppearance="?android:attr/textAppearanceMediumInverse"
|
||||||
android:textStyle="bold"/>
|
android:textStyle="bold"/>
|
||||||
|
|||||||
@@ -19,8 +19,9 @@
|
|||||||
android:layout_toLeftOf="@android:id/text1"
|
android:layout_toLeftOf="@android:id/text1"
|
||||||
android:layout_toStartOf="@android:id/text1"
|
android:layout_toStartOf="@android:id/text1"
|
||||||
tools:src="@drawable/ic_call_received_white_24dp"
|
tools:src="@drawable/ic_call_received_white_24dp"
|
||||||
|
app:tint="@color/white"
|
||||||
android:id="@android:id/icon"/>
|
android:id="@android:id/icon"/>
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<TextView
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
|
|||||||
@@ -5,11 +5,20 @@
|
|||||||
<string name="terms_button_accept">Bedingungen annehmen</string>
|
<string name="terms_button_accept">Bedingungen annehmen</string>
|
||||||
<string name="terms_permisson_checkbox">Erlaubst Du uns die anonyme Nutzung Deiner Positionsdaten für Forschungszwecke? Du kannst Deine Wahl jederzeit in den Einstellungen der App ändern.</string>
|
<string name="terms_permisson_checkbox">Erlaubst Du uns die anonyme Nutzung Deiner Positionsdaten für Forschungszwecke? Du kannst Deine Wahl jederzeit in den Einstellungen der App ändern.</string>
|
||||||
|
|
||||||
|
<string name="permission_required">Berechtigung erforderlich</string>
|
||||||
|
<string name="permission_foreground_explain">Damit Du Deinen Standort in der Karte anzeigen und mit anderen teilen kannst, benötigt Maptology die Berechtigung zum Zugriff auf Deinen Standort.</string>
|
||||||
|
<string name="permission_background_explain">Damit Du Deinen Standort auch dann teilen kannst, wenn Du die App nicht geöffnet hast, benötigt Maptology die Berechtigung zur Standortbestimmung im Hintergrund.</string>
|
||||||
|
<string name="permission_missing">Für die Standortbestimmung fehlt eine wichtige Berechtigung.</string>
|
||||||
|
<string name="permission_configure">Ändern</string>
|
||||||
|
|
||||||
<!-- a language code that we will use to detect the translation currently active -->
|
<!-- a language code that we will use to detect the translation currently active -->
|
||||||
<string name="language_code">de</string>
|
<string name="language_code">de</string>
|
||||||
|
|
||||||
<!-- map constants -->
|
<!-- map constants -->
|
||||||
<string name="map_attribution">Kartendaten: © OpenStreetMap | Visualisierung: © Locoslab GmbH</string>
|
<string name="map_attribution">Kartendaten: © OpenStreetMap | Visualisierung: © Locoslab GmbH</string>
|
||||||
|
<string name="map_share">Freigabe erstellen</string>
|
||||||
|
<string name="map_mode">Ansicht ändern</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- constants used in the notice related views -->
|
<!-- constants used in the notice related views -->
|
||||||
<string name="menu_notice_update_title">Aktualisieren</string>
|
<string name="menu_notice_update_title">Aktualisieren</string>
|
||||||
|
|||||||
@@ -5,11 +5,19 @@
|
|||||||
<string name="terms_button_accept">Accept conditions</string>
|
<string name="terms_button_accept">Accept conditions</string>
|
||||||
<string name="terms_permisson_checkbox">Do you want to share your location anonymously for research? You can change your decision in the settings at any time.</string>
|
<string name="terms_permisson_checkbox">Do you want to share your location anonymously for research? You can change your decision in the settings at any time.</string>
|
||||||
|
|
||||||
|
<string name="permission_required">Permission required</string>
|
||||||
|
<string name="permission_foreground_explain">Maptology needs permission to access your location to be able to display it on a map and to share it with your friends.</string>
|
||||||
|
<string name="permission_background_explain">Maptology needs permission to access your location in the background, so you can share your location even when you are not using the app.</string>
|
||||||
|
<string name="permission_missing">Localization is missing an important permission.</string>
|
||||||
|
<string name="permission_configure">Setup</string>
|
||||||
|
|
||||||
<!-- a language code that we will use to detect the translation currently active -->
|
<!-- a language code that we will use to detect the translation currently active -->
|
||||||
<string name="language_code">en</string>
|
<string name="language_code">en</string>
|
||||||
|
|
||||||
<!-- map constants -->
|
<!-- map constants -->
|
||||||
<string name="map_attribution">Map data: © OpenStreetMap | Visualization: © Locoslab GmbH</string>
|
<string name="map_attribution">Map data: © OpenStreetMap | Visualization: © Locoslab GmbH</string>
|
||||||
|
<string name="map_share">Create share</string>
|
||||||
|
<string name="map_mode">Change view</string>
|
||||||
|
|
||||||
<!-- constants used in the notice related views -->
|
<!-- constants used in the notice related views -->
|
||||||
<string name="menu_notice_update_title">Update</string>
|
<string name="menu_notice_update_title">Update</string>
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<style name="Theme.MaptologyTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
<style name="Theme.MaptologyTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
|
<item name="actionBarStyle">@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse</item>
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
<item name="preferenceTheme">@style/settingsTheme</item>
|
<item name="preferenceTheme">@style/settingsTheme</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.MaptologyTheme.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
|
<style name="Theme.MaptologyTheme.NoActionBar" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
|||||||
@@ -1,19 +1,13 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.5.2'
|
classpath 'com.android.tools.build:gradle:4.2.1'
|
||||||
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.10.0'
|
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.4'
|
||||||
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.0.Fixed'
|
|
||||||
classpath 'org.handte.gradle:gradle-android-eclipse:1.0.0'
|
classpath 'org.handte.gradle:gradle-android-eclipse:1.0.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url = 'https://project.nes.uni-due.de/artifactory/releases';
|
url = 'https://project.nes.uni-due.de/nexus/repository/maven-public';
|
||||||
credentials { username = 'public'; password = 'public' }
|
|
||||||
authentication { basic(BasicAuthentication) }
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
url = 'https://project.nes.uni-due.de/artifactory/snapshots';
|
|
||||||
credentials { username = 'public'; password = 'public' }
|
credentials { username = 'public'; password = 'public' }
|
||||||
authentication { basic(BasicAuthentication) }
|
authentication { basic(BasicAuthentication) }
|
||||||
}
|
}
|
||||||
@@ -23,12 +17,10 @@ buildscript {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
apply plugin: 'com.jfrog.artifactory'
|
|
||||||
|
|
||||||
|
|
||||||
// set version for our project
|
// set version for our project
|
||||||
group = 'com.maptology'
|
group = 'com.maptology'
|
||||||
version = '1.0.5-SNAPSHOT'
|
version = '1.0.8-SNAPSHOT'
|
||||||
|
|
||||||
// set versions for our libraries
|
// set versions for our libraries
|
||||||
ext {
|
ext {
|
||||||
@@ -43,7 +35,7 @@ allprojects {
|
|||||||
versionWildfly = '17.0.1.Final'
|
versionWildfly = '17.0.1.Final'
|
||||||
versionPicketbox = '5.0.3.Final'
|
versionPicketbox = '5.0.3.Final'
|
||||||
// testing dependencies
|
// testing dependencies
|
||||||
versionJunit = '4.12'
|
versionJunit = '4.13.1'
|
||||||
versionArquillianContainer = '2.2.0.Final'
|
versionArquillianContainer = '2.2.0.Final'
|
||||||
versionArquillianJunit = '1.5.0.Final'
|
versionArquillianJunit = '1.5.0.Final'
|
||||||
// thorntail dependencies
|
// thorntail dependencies
|
||||||
@@ -51,10 +43,15 @@ allprojects {
|
|||||||
versionThorntail = '2.5.0.Final'
|
versionThorntail = '2.5.0.Final'
|
||||||
|
|
||||||
// android stuff
|
// android stuff
|
||||||
versionAndroidx = '1.0.0'
|
versionAndroidxCompat = '1.3.0'
|
||||||
|
versionAndroidxLegacy = '1.0.0'
|
||||||
|
versionAndroidxPreference = '1.1.1'
|
||||||
|
versionAndroidxCard = '1.0.0'
|
||||||
|
versionAndroidxRecycler = '1.2.1'
|
||||||
|
versionAndroidxMaterial = '1.3.0'
|
||||||
versionRobolectric = '4.3.1'
|
versionRobolectric = '4.3.1'
|
||||||
versionPlay = '17.0.0'
|
versionPlay = '17.0.0'
|
||||||
versionAndroidxTest = '1.2.0'
|
versionAndroidxTest = '1.4.0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,25 +113,57 @@ subprojects {
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url = 'https://project.nes.uni-due.de/artifactory/releases';
|
url = 'https://project.nes.uni-due.de/nexus/repository/maven-public';
|
||||||
credentials { username = 'public'; password = 'public' }
|
|
||||||
authentication { basic(BasicAuthentication) }
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
url = 'https://project.nes.uni-due.de/artifactory/snapshots';
|
|
||||||
credentials { username = 'public'; password = 'public' }
|
credentials { username = 'public'; password = 'public' }
|
||||||
authentication { basic(BasicAuthentication) }
|
authentication { basic(BasicAuthentication) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
artifactoryPublish.dependsOn('build')
|
repositories {
|
||||||
|
maven {
|
||||||
artifactoryPublish {
|
url = version.endsWith('SNAPSHOT') ?
|
||||||
publications(publishing.publications.maven);
|
"https://project.nes.uni-due.de/nexus/repository/maven-snapshots" :
|
||||||
|
"https://project.nes.uni-due.de/nexus/repository/maven-releases"
|
||||||
|
credentials { username = 'jenkins'; password = System.properties['jenkins.nexus.password'] }
|
||||||
|
authentication { basic(BasicAuthentication) }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rename subprojects in eclipse to avoid collisions with other projects
|
||||||
|
eclipse.project.name = 'maptology-' + project.name
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("generatePomFileForMavenPublication") { }
|
tasks.register("generatePomFileForMavenPublication") { }
|
||||||
tasks.register("build") { }
|
tasks.register("build") { }
|
||||||
|
|
||||||
|
// aquire locks to ensure that service-ejb and service-war are not running tests in parallel
|
||||||
|
def lock = new java.util.concurrent.locks.ReentrantLock()
|
||||||
|
def available = lock.newCondition()
|
||||||
|
def busy = new java.util.concurrent.atomic.AtomicBoolean()
|
||||||
|
def serializedTasks = []
|
||||||
|
def sequentialProjects = [ 'service-ejb', 'service-war' ]
|
||||||
|
|
||||||
|
gradle.taskGraph.beforeTask {
|
||||||
|
if (it.name == 'test' && it.project.name in sequentialProjects) {
|
||||||
|
serializedTasks << it
|
||||||
|
it.doFirst {
|
||||||
|
lock.lock()
|
||||||
|
while (busy.get()) {
|
||||||
|
available.await()
|
||||||
|
}
|
||||||
|
busy.set(true)
|
||||||
|
lock.unlock()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gradle.taskGraph.afterTask {
|
||||||
|
if (it in serializedTasks) {
|
||||||
|
lock.lock()
|
||||||
|
busy.set(false)
|
||||||
|
available.signal()
|
||||||
|
lock.unlock()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ description = 'Maptology Common Api'
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testCompile "junit:junit:${versionJunit}"
|
testCompile "junit:junit:${versionJunit}"
|
||||||
compileOnly "javax.xml.bind:jaxb-api:${versionJaxb}"
|
compile "javax.xml.bind:jaxb-api:${versionJaxb}"
|
||||||
compileOnly "jakarta.platform:jakarta.jakartaee-api:${versionJavaee}"
|
compileOnly "jakarta.platform:jakarta.jakartaee-api:${versionJavaee}"
|
||||||
compileOnly "io.swagger:swagger-annotations:${versionSwagger}"
|
compileOnly "io.swagger:swagger-annotations:${versionSwagger}"
|
||||||
compileOnly "com.fasterxml.jackson.core:jackson-annotations:${versionJackson}"
|
compileOnly "com.fasterxml.jackson.core:jackson-annotations:${versionJackson}"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableR8=true
|
org.gradle.jvmargs=-Xmx4g
|
||||||
|
org.gradle.parallel=true
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#Sun Jul 21 19:24:12 CEST 2019
|
#Mon Feb 15 21:00:24 CET 2021
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class LocationConverter extends AbstractConverter<LocationEntity, Locatio
|
|||||||
public Location convert(LocationEntity source) {
|
public Location convert(LocationEntity source) {
|
||||||
Location result = create();
|
Location result = create();
|
||||||
result.setAvailability(source.getAvailability());
|
result.setAvailability(source.getAvailability());
|
||||||
result.setTimestamp(source.getTimestamp());
|
result.setTimestamp(source.getMeasurementTime());
|
||||||
result.setCoordinate(convert(source.getCoordinate()));
|
result.setCoordinate(convert(source.getCoordinate()));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class PositionConverter extends AbstractConverter<PositionEntity, Positio
|
|||||||
p.setOs(source.getOs());
|
p.setOs(source.getOs());
|
||||||
p.setProvider(source.getProvider());
|
p.setProvider(source.getProvider());
|
||||||
p.setSpeed(source.getSpeed());
|
p.setSpeed(source.getSpeed());
|
||||||
p.setTimestamp(source.getTimestamp());
|
p.setTimestamp(source.getMeasurementTime());
|
||||||
p.setVersion(source.getVersion());
|
p.setVersion(source.getVersion());
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.maptology.service.entity;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.EnumType;
|
import javax.persistence.EnumType;
|
||||||
@@ -18,7 +19,7 @@ import javax.persistence.UniqueConstraint;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The entity that represents codes sent out to the user.
|
* The entity that represents codes sent out to the user.
|
||||||
*
|
*
|
||||||
* @author Marcus
|
* @author Marcus
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@@ -35,31 +36,32 @@ public class CodeEntity extends AbstractEntity {
|
|||||||
* Serialization version.
|
* Serialization version.
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 2477619107225809934L;
|
private static final long serialVersionUID = 2477619107225809934L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The email to which a code has been sent.
|
* The email to which a code has been sent.
|
||||||
*/
|
*/
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name="email_id")
|
@JoinColumn(name="email_id")
|
||||||
private EmailEntity email;
|
private EmailEntity email;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of code that has been sent out.
|
* The type of code that has been sent out.
|
||||||
*/
|
*/
|
||||||
@Enumerated(EnumType.ORDINAL)
|
@Enumerated(EnumType.ORDINAL)
|
||||||
private CodeType type;
|
private CodeType type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value of the code.
|
* The value of the code.
|
||||||
*/
|
*/
|
||||||
|
@Column(length = 100)
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The time when the code expires.
|
* The time when the code expires.
|
||||||
*/
|
*/
|
||||||
private long expirationTime;
|
private long expirationTime;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the email.
|
* Returns the email.
|
||||||
*
|
*
|
||||||
@@ -131,10 +133,10 @@ public class CodeEntity extends AbstractEntity {
|
|||||||
public void setExpirationTime(long expirationTime) {
|
public void setExpirationTime(long expirationTime) {
|
||||||
this.expirationTime = expirationTime;
|
this.expirationTime = expirationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds a code by value.
|
* Finds a code by value.
|
||||||
*
|
*
|
||||||
* @param em The entity manager.
|
* @param em The entity manager.
|
||||||
* @param value The value to search for.
|
* @param value The value to search for.
|
||||||
* @return The code entity.
|
* @return The code entity.
|
||||||
@@ -148,10 +150,10 @@ public class CodeEntity extends AbstractEntity {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the active codes of the specified type
|
* Returns the active codes of the specified type
|
||||||
*
|
*
|
||||||
* @param em The entity manager.
|
* @param em The entity manager.
|
||||||
* @param email The email to lookup.
|
* @param email The email to lookup.
|
||||||
* @param type The type.
|
* @param type The type.
|
||||||
@@ -163,5 +165,5 @@ public class CodeEntity extends AbstractEntity {
|
|||||||
q.setParameter("email", email);
|
q.setParameter("email", email);
|
||||||
return q.getResultList();
|
return q.getResultList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.maptology.service.entity;
|
package com.maptology.service.entity;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
@@ -10,7 +11,7 @@ import javax.validation.constraints.Pattern;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An entity to manage email addresses of users.
|
* An entity to manage email addresses of users.
|
||||||
*
|
*
|
||||||
* @author Marcus
|
* @author Marcus
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@@ -29,19 +30,20 @@ public class EmailEntity extends AbstractEntity {
|
|||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name="user_id")
|
@JoinColumn(name="user_id")
|
||||||
private UserEntity user;
|
private UserEntity user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The actual email address.
|
* The actual email address.
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
@Pattern(regexp=".+@.+\\..+", message="Invalid email address format.")
|
@Pattern(regexp=".+@.+\\..+", message="Invalid email address format.")
|
||||||
|
@Column(length = 100)
|
||||||
private String address;
|
private String address;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flag to determine whether this email is verified.
|
* A flag to determine whether this email is verified.
|
||||||
*/
|
*/
|
||||||
private boolean verified;
|
private boolean verified;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flag to determine whether this email is the primary email.
|
* A flag to determine whether this email is the primary email.
|
||||||
*/
|
*/
|
||||||
@@ -119,5 +121,5 @@ public class EmailEntity extends AbstractEntity {
|
|||||||
this.correspondence = correspondence;
|
this.correspondence = correspondence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ import com.maptology.api.location.Availability;
|
|||||||
@Entity
|
@Entity
|
||||||
@Table(name = "location",
|
@Table(name = "location",
|
||||||
indexes = {
|
indexes = {
|
||||||
@Index(columnList = "timestamp", unique = false)
|
@Index(columnList = "measurementTime", unique = false)
|
||||||
})
|
})
|
||||||
public class LocationEntity extends AbstractEntity {
|
public class LocationEntity extends AbstractEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The serialization version.
|
* The serialization version.
|
||||||
*/
|
*/
|
||||||
@@ -37,7 +37,7 @@ public class LocationEntity extends AbstractEntity {
|
|||||||
*/
|
*/
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
private DeviceEntity device;
|
private DeviceEntity device;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The (un-) availability information for the entity.
|
* The (un-) availability information for the entity.
|
||||||
*/
|
*/
|
||||||
@@ -47,8 +47,8 @@ public class LocationEntity extends AbstractEntity {
|
|||||||
/**
|
/**
|
||||||
* The measurement time of the location.
|
* The measurement time of the location.
|
||||||
*/
|
*/
|
||||||
private long timestamp;
|
private long measurementTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The (optional) coordinate of the location.
|
* The (optional) coordinate of the location.
|
||||||
*/
|
*/
|
||||||
@@ -96,21 +96,21 @@ public class LocationEntity extends AbstractEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the timestamp.
|
* Returns the measurementTime.
|
||||||
*
|
*
|
||||||
* @return The timestamp.
|
* @return The measurementTime.
|
||||||
*/
|
*/
|
||||||
public long getTimestamp() {
|
public long getMeasurementTime() {
|
||||||
return timestamp;
|
return measurementTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the timestamp.
|
* Sets the measurementTime.
|
||||||
*
|
*
|
||||||
* @param timestamp The timestamp to set.
|
* @param measurementTime The measurementTime to set.
|
||||||
*/
|
*/
|
||||||
public void setTimestamp(long timestamp) {
|
public void setMeasurementTime(long measurementTime) {
|
||||||
this.timestamp = timestamp;
|
this.measurementTime = measurementTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -130,5 +130,5 @@ public class LocationEntity extends AbstractEntity {
|
|||||||
public void setCoordinate(EmbeddedCoordinate coordinate) {
|
public void setCoordinate(EmbeddedCoordinate coordinate) {
|
||||||
this.coordinate = coordinate;
|
this.coordinate = coordinate;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ import javax.persistence.Table;
|
|||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents metadata attached to a position. The metadata consist of
|
* Represents metadata attached to a position. The metadata consist of
|
||||||
* a tag-value pair. The value is stored as a clob to allow large metadata
|
* a tag-value pair. The value is stored as a clob to allow large metadata
|
||||||
* items.
|
* items.
|
||||||
*
|
*
|
||||||
* @author Marcus
|
* @author Marcus
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "metadata",
|
@Table(name = "public_metadata",
|
||||||
indexes = {
|
indexes = {
|
||||||
@Index(columnList = "tag", unique = false)
|
@Index(columnList = "tag", unique = false)
|
||||||
})
|
})
|
||||||
@@ -31,7 +31,7 @@ import javax.validation.constraints.NotNull;
|
|||||||
@IdClass(MetadataId.class)
|
@IdClass(MetadataId.class)
|
||||||
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
||||||
public class MetadataEntity {
|
public class MetadataEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reference to the position.
|
* The reference to the position.
|
||||||
*/
|
*/
|
||||||
@@ -40,7 +40,7 @@ public class MetadataEntity {
|
|||||||
@JoinColumn(name = "position_id")
|
@JoinColumn(name = "position_id")
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
private PositionEntity position;
|
private PositionEntity position;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The tag to determine the metadata type.
|
* The tag to determine the metadata type.
|
||||||
*/
|
*/
|
||||||
@@ -48,12 +48,12 @@ public class MetadataEntity {
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Column(name="tag", length = 64)
|
@Column(name="tag", length = 64)
|
||||||
private String tag;
|
private String tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value with the actual metadata.
|
* The value with the actual metadata.
|
||||||
*/
|
*/
|
||||||
@Lob
|
@Lob
|
||||||
@Column(name="value")
|
@Column(name="value")
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,6 +108,6 @@ public class MetadataEntity {
|
|||||||
*/
|
*/
|
||||||
public void setValue(String value) {
|
public void setValue(String value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,20 +37,20 @@ import com.maptology.api.location.Availability;
|
|||||||
/**
|
/**
|
||||||
* Represents a stored location that has been made available
|
* Represents a stored location that has been made available
|
||||||
* for research purposes.
|
* for research purposes.
|
||||||
*
|
*
|
||||||
* @author Marcus
|
* @author Marcus
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "position",
|
@Table(name = "public_position",
|
||||||
indexes = {
|
indexes = {
|
||||||
@Index(columnList = "creationTime,timestamp", unique = false),
|
@Index(columnList = "creationTime,measurementTime", unique = false),
|
||||||
@Index(columnList = "device,timestamp", unique = false)
|
@Index(columnList = "device,measurementTime", unique = false)
|
||||||
})
|
})
|
||||||
@NamedQueries({
|
@NamedQueries({
|
||||||
@NamedQuery(name="findAllPositions", lockMode=LockModeType.NONE, query="select p from PositionEntity p order by p.id asc"),
|
@NamedQuery(name="findAllPositions", lockMode=LockModeType.NONE, query="select p from PositionEntity p order by p.id asc"),
|
||||||
@NamedQuery(name="getLastPosition", lockMode=LockModeType.NONE, query="select max(p.creationTime) from PositionEntity p"),
|
@NamedQuery(name="getLastPosition", lockMode=LockModeType.NONE, query="select max(p.creationTime) from PositionEntity p"),
|
||||||
@NamedQuery(name="countPositions", lockMode=LockModeType.NONE, query="select count(p) from PositionEntity p"),
|
@NamedQuery(name="countPositions", lockMode=LockModeType.NONE, query="select count(p) from PositionEntity p"),
|
||||||
@NamedQuery(name="findDeviceRangePositions", lockMode=LockModeType.NONE, query="select p from PositionEntity p where p.timestamp>=:minTime and p.timestamp<=:maxTime and p.device in :devices order by p.device, p.timestamp asc"),
|
@NamedQuery(name="findDeviceRangePositions", lockMode=LockModeType.NONE, query="select p from PositionEntity p where p.measurementTime>=:minTime and p.measurementTime<=:maxTime and p.device in :devices order by p.device, p.measurementTime asc"),
|
||||||
@NamedQuery(name="findDevicePositions", lockMode=LockModeType.NONE, query="select p from PositionEntity p where p.device=:device order by p.id asc"),
|
@NamedQuery(name="findDevicePositions", lockMode=LockModeType.NONE, query="select p from PositionEntity p where p.device=:device order by p.id asc"),
|
||||||
@NamedQuery(name="countDevicePositions", lockMode=LockModeType.NONE, query="select count(p) from PositionEntity p where p.device=:device"),
|
@NamedQuery(name="countDevicePositions", lockMode=LockModeType.NONE, query="select count(p) from PositionEntity p where p.device=:device"),
|
||||||
@NamedQuery(name="getLastDevicePosition", lockMode=LockModeType.NONE, query="select max(p.creationTime) from PositionEntity p where p.device=:device")
|
@NamedQuery(name="getLastDevicePosition", lockMode=LockModeType.NONE, query="select max(p.creationTime) from PositionEntity p where p.device=:device")
|
||||||
@@ -68,7 +68,7 @@ public class PositionEntity {
|
|||||||
* The id of the device.
|
* The id of the device.
|
||||||
*/
|
*/
|
||||||
private long device;
|
private long device;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The (un-) availability information for the entity.
|
* The (un-) availability information for the entity.
|
||||||
*/
|
*/
|
||||||
@@ -87,17 +87,17 @@ public class PositionEntity {
|
|||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "pid_generator")
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "pid_generator")
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The creation time of the position item.
|
* The creation time of the position item.
|
||||||
*/
|
*/
|
||||||
private long creationTime;
|
private long creationTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The measurement time of the location.
|
* The measurement time of the location.
|
||||||
*/
|
*/
|
||||||
private long timestamp;
|
private long measurementTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The (optional) coordinate of the location.
|
* The (optional) coordinate of the location.
|
||||||
*/
|
*/
|
||||||
@@ -107,43 +107,43 @@ public class PositionEntity {
|
|||||||
@AttributeOverride(name="longitude", column=@Column(nullable=true))
|
@AttributeOverride(name="longitude", column=@Column(nullable=true))
|
||||||
})
|
})
|
||||||
private EmbeddedCoordinate coordinate;
|
private EmbeddedCoordinate coordinate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The accuracy in meters.
|
* The accuracy in meters.
|
||||||
*/
|
*/
|
||||||
private Double accuracy;
|
private Double accuracy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The altitude in meters.
|
* The altitude in meters.
|
||||||
*/
|
*/
|
||||||
private Double altitude;
|
private Double altitude;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The speed in m/s.
|
* The speed in m/s.
|
||||||
*/
|
*/
|
||||||
private Double speed;
|
private Double speed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The bearing in degree.
|
* The bearing in degree.
|
||||||
*/
|
*/
|
||||||
private Double bearing;
|
private Double bearing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The location provider.
|
* The location provider.
|
||||||
*/
|
*/
|
||||||
private String provider;
|
private String provider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The app version.
|
* The app version.
|
||||||
*/
|
*/
|
||||||
private int version;
|
private int version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional meta data collected for the position.
|
* Additional meta data collected for the position.
|
||||||
*/
|
*/
|
||||||
@OneToMany(mappedBy = "position", fetch = FetchType.LAZY)
|
@OneToMany(mappedBy = "position", fetch = FetchType.LAZY)
|
||||||
private Set<MetadataEntity> metadata = new HashSet<>();
|
private Set<MetadataEntity> metadata = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Automatically sets the creation date.
|
* Automatically sets the creation date.
|
||||||
*/
|
*/
|
||||||
@@ -225,21 +225,21 @@ public class PositionEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the timestamp.
|
* Returns the measurementTime.
|
||||||
*
|
*
|
||||||
* @return The timestamp.
|
* @return The measurementTime.
|
||||||
*/
|
*/
|
||||||
public long getTimestamp() {
|
public long getMeasurementTime() {
|
||||||
return timestamp;
|
return measurementTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the timestamp.
|
* Sets the measurementTime.
|
||||||
*
|
*
|
||||||
* @param timestamp The timestamp to set.
|
* @param measurementTime The measurementTime to set.
|
||||||
*/
|
*/
|
||||||
public void setTimestamp(long timestamp) {
|
public void setMeasurementTime(long measurementTime) {
|
||||||
this.timestamp = timestamp;
|
this.measurementTime = measurementTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -367,7 +367,7 @@ public class PositionEntity {
|
|||||||
public void setVersion(int version) {
|
public void setVersion(int version) {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the metadata.
|
* Returns the metadata.
|
||||||
*
|
*
|
||||||
@@ -388,7 +388,7 @@ public class PositionEntity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last creation time of the position.
|
* Returns the last creation time of the position.
|
||||||
*
|
*
|
||||||
* @param em The entity manager.
|
* @param em The entity manager.
|
||||||
* @return The maximum time stamp of creation times.
|
* @return The maximum time stamp of creation times.
|
||||||
*/
|
*/
|
||||||
@@ -402,11 +402,11 @@ public class PositionEntity {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of positions stored.
|
* Returns the number of positions stored.
|
||||||
*
|
*
|
||||||
* @param em The entity manager.
|
* @param em The entity manager.
|
||||||
* @return The number of positions.
|
* @return The number of positions.
|
||||||
*/
|
*/
|
||||||
@@ -420,10 +420,10 @@ public class PositionEntity {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds all positions for the page.
|
* Finds all positions for the page.
|
||||||
*
|
*
|
||||||
* @param em The entity manager.
|
* @param em The entity manager.
|
||||||
* @param page The page config.
|
* @param page The page config.
|
||||||
* @return The positions for the page.
|
* @return The positions for the page.
|
||||||
@@ -434,11 +434,11 @@ public class PositionEntity {
|
|||||||
q.setMaxResults(page.getSize());
|
q.setMaxResults(page.getSize());
|
||||||
return q.getResultList();
|
return q.getResultList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last creation date of a position for the device.
|
* Returns the last creation date of a position for the device.
|
||||||
*
|
*
|
||||||
* @param em The entity manager.
|
* @param em The entity manager.
|
||||||
* @param device The device to search.
|
* @param device The device to search.
|
||||||
* @return The creation time stamp of the last position for the device.
|
* @return The creation time stamp of the last position for the device.
|
||||||
@@ -454,11 +454,11 @@ public class PositionEntity {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of positions for a device.
|
* Returns the number of positions for a device.
|
||||||
*
|
*
|
||||||
* @param em The entity manager.
|
* @param em The entity manager.
|
||||||
* @param device The device to search.
|
* @param device The device to search.
|
||||||
* @return The number of positions.
|
* @return The number of positions.
|
||||||
@@ -474,10 +474,10 @@ public class PositionEntity {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a page of positions for the device.
|
* Returns a page of positions for the device.
|
||||||
*
|
*
|
||||||
* @param em The entity manager.
|
* @param em The entity manager.
|
||||||
* @param device The device.
|
* @param device The device.
|
||||||
* @param page The page.
|
* @param page The page.
|
||||||
@@ -490,10 +490,10 @@ public class PositionEntity {
|
|||||||
q.setMaxResults(page.getSize());
|
q.setMaxResults(page.getSize());
|
||||||
return q.getResultList();
|
return q.getResultList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the positions for a certain set of devices in the specified time range.
|
* Find the positions for a certain set of devices in the specified time range.
|
||||||
*
|
*
|
||||||
* @param em The entity manager.
|
* @param em The entity manager.
|
||||||
* @param devices The devices to search.
|
* @param devices The devices to search.
|
||||||
* @param start The minimum time to return (inclusive) in epoch milliseconds.
|
* @param start The minimum time to return (inclusive) in epoch milliseconds.
|
||||||
@@ -507,5 +507,5 @@ public class PositionEntity {
|
|||||||
q.setParameter("maxTime", start + duration);
|
q.setParameter("maxTime", start + duration);
|
||||||
return q.getResultList();
|
return q.getResultList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.maptology.service.entity;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
@@ -16,7 +17,7 @@ import javax.validation.constraints.NotNull;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An entity to define user roles.
|
* An entity to define user roles.
|
||||||
*
|
*
|
||||||
* @author Marcus
|
* @author Marcus
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@@ -36,12 +37,14 @@ public class RoleEntity extends AbstractEntity {
|
|||||||
* The name of the role.
|
* The name of the role.
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
|
@Column(length = 100)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A human readable description of the role.
|
* A human readable description of the role.
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
|
@Column(length = 100)
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,10 +97,10 @@ public class RoleEntity extends AbstractEntity {
|
|||||||
public Set<UserEntity> getUsers() {
|
public Set<UserEntity> getUsers() {
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds a role with a given name.
|
* Finds a role with a given name.
|
||||||
*
|
*
|
||||||
* @param name The name.
|
* @param name The name.
|
||||||
* @param em The entity manager.
|
* @param em The entity manager.
|
||||||
* @return The role or null, if it does not exist.
|
* @return The role or null, if it does not exist.
|
||||||
|
|||||||
@@ -82,14 +82,14 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
|
|||||||
Collections.sort(unprocessed, new Comparator<LocationEntity>() {
|
Collections.sort(unprocessed, new Comparator<LocationEntity>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(LocationEntity o1, LocationEntity o2) {
|
public int compare(LocationEntity o1, LocationEntity o2) {
|
||||||
return Long.compare(o1.getTimestamp(), o2.getTimestamp());
|
return Long.compare(o1.getMeasurementTime(), o2.getMeasurementTime());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
VisitEntity lastVisit = device.getVisit();
|
VisitEntity lastVisit = device.getVisit();
|
||||||
LocationEntity lastLocation = device.getLocation();
|
LocationEntity lastLocation = device.getLocation();
|
||||||
for (ReleasedLocation location: update.getLocations()) {
|
for (ReleasedLocation location: update.getLocations()) {
|
||||||
// check for too old updates (should not happen for a working client)
|
// check for too old updates (should not happen for a working client)
|
||||||
if (lastLocation != null && location.getTimestamp() < lastLocation.getTimestamp()) {
|
if (lastLocation != null && location.getTimestamp() < lastLocation.getMeasurementTime()) {
|
||||||
log.log(Level.SEVERE, "Received an out-of-order location update from device " + device.getId() + ", ignoring it.");
|
log.log(Level.SEVERE, "Received an out-of-order location update from device " + device.getId() + ", ignoring it.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
|
|||||||
lastLocation = new LocationEntity();
|
lastLocation = new LocationEntity();
|
||||||
lastLocation.setAvailability(location.getAvailability());
|
lastLocation.setAvailability(location.getAvailability());
|
||||||
lastLocation.setDevice(device);
|
lastLocation.setDevice(device);
|
||||||
lastLocation.setTimestamp(location.getTimestamp());
|
lastLocation.setMeasurementTime(location.getTimestamp());
|
||||||
Coordinate c = location.getCoordinate();
|
Coordinate c = location.getCoordinate();
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
lastLocation.setCoordinate(new EmbeddedCoordinate(c.getLongitude(), c.getLatitude()));
|
lastLocation.setCoordinate(new EmbeddedCoordinate(c.getLongitude(), c.getLatitude()));
|
||||||
@@ -440,7 +440,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
|
|||||||
last = in.get(i);
|
last = in.get(i);
|
||||||
} else if (last != null) {
|
} else if (last != null) {
|
||||||
// if we have a reference and current does not have coordinate
|
// if we have a reference and current does not have coordinate
|
||||||
if (last.getTimestamp() - next.getTimestamp() > maxTime) {
|
if (last.getMeasurementTime() - next.getMeasurementTime() > maxTime) {
|
||||||
// ... remove everything that is too old
|
// ... remove everything that is too old
|
||||||
for (int j = i; j >= 0; j--) {
|
for (int j = i; j >= 0; j--) {
|
||||||
out.add(0, in.remove(j));
|
out.add(0, in.remove(j));
|
||||||
@@ -461,7 +461,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
|
|||||||
private static Long getFirst(List<LocationEntity> in) {
|
private static Long getFirst(List<LocationEntity> in) {
|
||||||
for (int i = 0, s = in.size(); i < s; i++) {
|
for (int i = 0, s = in.size(); i < s; i++) {
|
||||||
if (in.get(i).getCoordinate() != null) {
|
if (in.get(i).getCoordinate() != null) {
|
||||||
return in.get(i).getTimestamp();
|
return in.get(i).getMeasurementTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -476,7 +476,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
|
|||||||
private static Long getLast(List<LocationEntity> in) {
|
private static Long getLast(List<LocationEntity> in) {
|
||||||
for (int i = in.size() - 1; i >= 0; i--) {
|
for (int i = in.size() - 1; i >= 0; i--) {
|
||||||
if (in.get(i).getCoordinate() != null) {
|
if (in.get(i).getCoordinate() != null) {
|
||||||
return in.get(i).getTimestamp();
|
return in.get(i).getMeasurementTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -535,7 +535,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
|
|||||||
*/
|
*/
|
||||||
private static boolean isTooOld(LocationEntity current, Location next, long maxDuration) {
|
private static boolean isTooOld(LocationEntity current, Location next, long maxDuration) {
|
||||||
if (current == null || current.getAvailability() == Availability.IDLE) return false;
|
if (current == null || current.getAvailability() == Availability.IDLE) return false;
|
||||||
return (next.getTimestamp() - current.getTimestamp() > maxDuration);
|
return (next.getTimestamp() - current.getMeasurementTime() > maxDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class PositionSessionBean implements IPositionSessionBean {
|
|||||||
p.setOs(device.getOs());
|
p.setOs(device.getOs());
|
||||||
p.setProvider(location.getProvider());
|
p.setProvider(location.getProvider());
|
||||||
p.setSpeed(location.getSpeed());
|
p.setSpeed(location.getSpeed());
|
||||||
p.setTimestamp(location.getTimestamp());
|
p.setMeasurementTime(location.getTimestamp());
|
||||||
p.setVersion(location.getVersion());
|
p.setVersion(location.getVersion());
|
||||||
HashSet<MetadataEntity> metadata = new HashSet<>();
|
HashSet<MetadataEntity> metadata = new HashSet<>();
|
||||||
if (location.getMetadata() != null) {
|
if (location.getMetadata() != null) {
|
||||||
@@ -257,7 +257,7 @@ public class PositionSessionBean implements IPositionSessionBean {
|
|||||||
p.setOs(location.getOs());
|
p.setOs(location.getOs());
|
||||||
p.setProvider(location.getProvider());
|
p.setProvider(location.getProvider());
|
||||||
p.setSpeed(location.getSpeed());
|
p.setSpeed(location.getSpeed());
|
||||||
p.setTimestamp(location.getTimestamp());
|
p.setMeasurementTime(location.getTimestamp());
|
||||||
p.setVersion(location.getVersion());
|
p.setVersion(location.getVersion());
|
||||||
em.persist(p);
|
em.persist(p);
|
||||||
if (p.getMetadata() != null) {
|
if (p.getMetadata() != null) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ we have received a request for a new email address association.
|
|||||||
|
|
||||||
If you have added this email address to your maptology account,
|
If you have added this email address to your maptology account,
|
||||||
please confirm the email address association by visiting
|
please confirm the email address association by visiting
|
||||||
https://www.maptology.com/app/activate/${token}.
|
https://www.maptology.com/app/activate/${token}
|
||||||
|
|
||||||
If you did not request the association, simply delete this email
|
If you did not request the association, simply delete this email
|
||||||
or contact us.
|
or contact us.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Dear ${name},
|
|||||||
we have received an account request for a new Maptology account.
|
we have received an account request for a new Maptology account.
|
||||||
|
|
||||||
If you have requested the account, please confirm your email by
|
If you have requested the account, please confirm your email by
|
||||||
visiting https://www.maptology.com/app/activate/${token}.
|
visiting https://www.maptology.com/app/activate/${token}
|
||||||
|
|
||||||
If you did not request the account, simply delete this email or
|
If you did not request the account, simply delete this email or
|
||||||
contact us.
|
contact us.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Dear ${name},
|
|||||||
we have received a request for a Maptology account reset.
|
we have received a request for a Maptology account reset.
|
||||||
|
|
||||||
If you have requested the reset, please assign a new password
|
If you have requested the reset, please assign a new password
|
||||||
by visiting https://www.maptology.com/app/reset/${token}.
|
by visiting https://www.maptology.com/app/reset/${token}
|
||||||
|
|
||||||
If you did not request the reset, simply delete this email or
|
If you did not request the reset, simply delete this email or
|
||||||
contact us.
|
contact us.
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.maptology.service.test.login;
|
package com.maptology.service.test.login;
|
||||||
|
|
||||||
import java.security.Principal;
|
import java.security.Principal;
|
||||||
import java.security.acl.Group;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -11,11 +11,15 @@ import javax.naming.Context;
|
|||||||
import javax.naming.InitialContext;
|
import javax.naming.InitialContext;
|
||||||
import javax.naming.NamingException;
|
import javax.naming.NamingException;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.security.auth.Subject;
|
||||||
|
import javax.security.auth.callback.Callback;
|
||||||
|
import javax.security.auth.callback.CallbackHandler;
|
||||||
|
import javax.security.auth.callback.NameCallback;
|
||||||
|
import javax.security.auth.callback.PasswordCallback;
|
||||||
import javax.security.auth.login.LoginException;
|
import javax.security.auth.login.LoginException;
|
||||||
|
|
||||||
import org.jboss.security.SecurityContextAssociation;
|
import org.jboss.security.SecurityContextAssociation;
|
||||||
import org.jboss.security.SimpleGroup;
|
import org.jboss.security.SimpleGroup;
|
||||||
import org.jboss.security.auth.spi.UsernamePasswordLoginModule;
|
|
||||||
|
|
||||||
import com.maptology.api.access.Roles;
|
import com.maptology.api.access.Roles;
|
||||||
import com.maptology.service.entity.DeviceEntity;
|
import com.maptology.service.entity.DeviceEntity;
|
||||||
@@ -24,148 +28,211 @@ import com.maptology.service.entity.UserEntity;
|
|||||||
import com.maptology.service.principal.MaptologyPrincipal;
|
import com.maptology.service.principal.MaptologyPrincipal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple login module that is used for testing. It assigns the
|
* A simple login module that is used for testing. It assigns the password
|
||||||
* password "password" for all users, so this can be used consistently.
|
* "password" for all users, so this can be used consistently. In addition, it
|
||||||
* In addition, it allows encoding users and devices into a single
|
* allows encoding users and devices into a single login name by combining the
|
||||||
* login name by combining the username with the device secret in
|
* username with the device secret in the following form: (login):(device).
|
||||||
* the following form: (login):(device).
|
*
|
||||||
*
|
|
||||||
* @author Marcus
|
* @author Marcus
|
||||||
*/
|
*/
|
||||||
public class LoginModule extends UsernamePasswordLoginModule {
|
public class LoginModule implements javax.security.auth.spi.LoginModule {
|
||||||
|
|
||||||
/**
|
|
||||||
* The roles that we will assign to the user.
|
|
||||||
*/
|
|
||||||
private List<String> roles = new ArrayList<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The logger.
|
|
||||||
*/
|
|
||||||
private Logger log = Logger.getLogger(getClass().getName());
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean login() throws LoginException {
|
|
||||||
if (super.login()) {
|
|
||||||
Principal p = getIdentity();
|
|
||||||
if (p instanceof MaptologyPrincipal) {
|
|
||||||
MaptologyPrincipal mp = (MaptologyPrincipal)p;
|
|
||||||
// abort the login if device and user are not set (!)
|
|
||||||
return mp.getUser() != null || mp.getUser() != null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean logout() throws LoginException {
|
|
||||||
boolean result = super.logout();
|
|
||||||
for (Group g: getRoleSets()) {
|
|
||||||
subject.getPrincipals().remove(g);
|
|
||||||
}
|
|
||||||
// this is probably hacky: clear the security context
|
|
||||||
SecurityContextAssociation.clearSecurityContext();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Principal createIdentity(String username) throws Exception {
|
|
||||||
String[] loginDevice = getLoginDevice(username);
|
|
||||||
Long user = null;
|
|
||||||
Long device = null;
|
|
||||||
String name1 = "";
|
|
||||||
String name2 = "";
|
|
||||||
// this will be running inside the application's current
|
|
||||||
// transaction which could potentially be problematic
|
|
||||||
EntityManager em = getEntityManager();
|
|
||||||
UserEntity ue = UserEntity.findByLogin(em, loginDevice[0]);
|
|
||||||
if (ue != null) {
|
|
||||||
user = ue.getId();
|
|
||||||
name1 = ue.getLogin();
|
|
||||||
for (RoleEntity re : ue.getRoles()) {
|
|
||||||
roles.add(re.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DeviceEntity de = DeviceEntity.findByToken(em, loginDevice[1]);
|
|
||||||
if (de != null) {
|
|
||||||
name2 = de.getToken();
|
|
||||||
device = de.getId();
|
|
||||||
roles.add(Roles.DEVICE);
|
|
||||||
}
|
|
||||||
return new MaptologyPrincipal(name1 + ":" + name2, user, device);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses the login name and the device token from the
|
|
||||||
* username string provided to the auth module.
|
|
||||||
*
|
|
||||||
* @param username The username (consisting of login:token).
|
|
||||||
* @return An array with the login and the token.
|
|
||||||
*/
|
|
||||||
private String[] getLoginDevice(String username) {
|
|
||||||
String[] loginAndDevice = new String[] { "", "" };
|
|
||||||
if (username != null) {
|
|
||||||
int idx = username.indexOf(':');
|
|
||||||
if (idx != -1) {
|
|
||||||
loginAndDevice[0] = username.substring(0, idx);
|
|
||||||
loginAndDevice[1] = username.substring(idx + 1, username.length());
|
|
||||||
} else {
|
|
||||||
loginAndDevice[0] = username;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return loginAndDevice;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean commit() throws LoginException {
|
|
||||||
System.out.println("Login ok is: " + loginOk);
|
|
||||||
if (loginOk) {
|
|
||||||
subject.getPrincipals().clear();
|
|
||||||
}
|
|
||||||
return super.commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
protected Group[] getRoleSets() throws LoginException {
|
* The group name that wildfly uses to identify the caller principal.
|
||||||
SimpleGroup group = new SimpleGroup("Roles");
|
*/
|
||||||
for (final String r: roles) {
|
private static final String GROUP_NAME_CALLER = "CallerPrincipal";
|
||||||
group.addMember(new Principal() {
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return new Group[] { group };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
protected String getUsersPassword() throws LoginException {
|
* The group name that wildfly uses to identify the roles of the caller.
|
||||||
return "password";
|
*/
|
||||||
}
|
private static final String GROUP_NAME_ROLES = "Roles";
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the entity manager for the maptology datastore.
|
|
||||||
*
|
|
||||||
* @return The entity manager or null, if the entity manager cannot be found.
|
|
||||||
*/
|
|
||||||
private EntityManager getEntityManager() {
|
|
||||||
try {
|
|
||||||
Context context = new InitialContext();
|
|
||||||
return (EntityManager)context.lookup("java:app/maptology/datastore");
|
|
||||||
} catch (NamingException e) {
|
|
||||||
log.log(Level.SEVERE, "Failed to resolve entity manager.", e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* The logger.
|
||||||
|
*/
|
||||||
|
private Logger log = Logger.getLogger(getClass().getName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The callback handler to fetch the username and password during login.
|
||||||
|
*/
|
||||||
|
private CallbackHandler callbackHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The subject to update with the caller and roles.
|
||||||
|
*/
|
||||||
|
private Subject subject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user name that we fetched or were initialized with.
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
/**
|
||||||
|
* The password that we fetched or where initialized with.
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of roles to assign.
|
||||||
|
*/
|
||||||
|
private List<String> roles = new ArrayList<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState,
|
||||||
|
Map<String, ?> options) {
|
||||||
|
this.subject = subject;
|
||||||
|
this.callbackHandler = callbackHandler;
|
||||||
|
Object username = sharedState.get("javax.security.auth.login.name");
|
||||||
|
this.username = asString(username);
|
||||||
|
Object password = sharedState.get("javax.security.auth.login.password");
|
||||||
|
this.password = asString(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to convert a parameter into a string.
|
||||||
|
*
|
||||||
|
* @param object
|
||||||
|
* The object.
|
||||||
|
* @return The string.
|
||||||
|
*/
|
||||||
|
private String asString(Object object) {
|
||||||
|
if (object == null) {
|
||||||
|
return null;
|
||||||
|
} else if (object instanceof char[]) {
|
||||||
|
return new String((char[]) object);
|
||||||
|
} else if (object instanceof String) {
|
||||||
|
return (String) object;
|
||||||
|
} else if (object instanceof Principal) {
|
||||||
|
return ((Principal) object).getName();
|
||||||
|
} else {
|
||||||
|
log.log(Level.SEVERE, "Unknown data type during login: " + object.getClass());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the entity manager for the maptology datastore.
|
||||||
|
*
|
||||||
|
* @return The entity manager or null, if the entity manager cannot be found.
|
||||||
|
*/
|
||||||
|
private EntityManager getEntityManager() {
|
||||||
|
try {
|
||||||
|
Context context = new InitialContext();
|
||||||
|
return (EntityManager) context.lookup("java:app/maptology/datastore");
|
||||||
|
} catch (NamingException e) {
|
||||||
|
log.log(Level.SEVERE, "Failed to resolve entity manager.", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses the login name and the device token from the username string provided
|
||||||
|
* to the auth module.
|
||||||
|
*
|
||||||
|
* @return An array with the login and the token.
|
||||||
|
*/
|
||||||
|
private String[] getLoginDevice() {
|
||||||
|
String[] loginAndDevice = new String[] { "", "" };
|
||||||
|
if (username != null) {
|
||||||
|
int idx = username.indexOf(':');
|
||||||
|
if (idx != -1) {
|
||||||
|
loginAndDevice[0] = username.substring(0, idx);
|
||||||
|
loginAndDevice[1] = username.substring(idx + 1, username.length());
|
||||||
|
} else {
|
||||||
|
loginAndDevice[0] = username;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return loginAndDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected MaptologyPrincipal createPrincipal() {
|
||||||
|
String[] loginDevice = getLoginDevice();
|
||||||
|
Long user = null;
|
||||||
|
Long device = null;
|
||||||
|
String name1 = "";
|
||||||
|
String name2 = "";
|
||||||
|
// this will be running inside the application's current
|
||||||
|
// transaction which could potentially be problematic
|
||||||
|
EntityManager em = getEntityManager();
|
||||||
|
UserEntity ue = UserEntity.findByLogin(em, loginDevice[0]);
|
||||||
|
if (ue != null) {
|
||||||
|
user = ue.getId();
|
||||||
|
name1 = ue.getLogin();
|
||||||
|
for (RoleEntity re : ue.getRoles()) {
|
||||||
|
roles.add(re.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DeviceEntity de = DeviceEntity.findByToken(em, loginDevice[1]);
|
||||||
|
if (de != null) {
|
||||||
|
name2 = de.getToken();
|
||||||
|
device = de.getId();
|
||||||
|
roles.add(Roles.DEVICE);
|
||||||
|
}
|
||||||
|
return new MaptologyPrincipal(name1 + ":" + name2, user, device);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean login() throws LoginException {
|
||||||
|
requestCredentials();
|
||||||
|
return username != null && password != null && password.equals("password");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to request the login credentials using the callback handler.
|
||||||
|
*/
|
||||||
|
private void requestCredentials() {
|
||||||
|
if (callbackHandler == null) {
|
||||||
|
log.log(Level.SEVERE, "No callback handler request credentials.");
|
||||||
|
} else {
|
||||||
|
NameCallback nc = new NameCallback("Login: ", "-");
|
||||||
|
PasswordCallback pc = new PasswordCallback("Password: ", false);
|
||||||
|
try {
|
||||||
|
callbackHandler.handle(new Callback[] { nc, pc });
|
||||||
|
String name = nc.getName();
|
||||||
|
if (name != null)
|
||||||
|
username = name;
|
||||||
|
char[] pass = pc.getPassword();
|
||||||
|
if (pass != null)
|
||||||
|
password = new String(pass);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.log(Level.SEVERE, "Failed to request credentials via callbacks.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean commit() throws LoginException {
|
||||||
|
// throw away all state held for the principal
|
||||||
|
subject.getPrincipals().clear();
|
||||||
|
// get the principal form the result and create the groups
|
||||||
|
MaptologyPrincipal principal = createPrincipal();
|
||||||
|
subject.getPrincipals().add(principal);
|
||||||
|
// add the caller principal group
|
||||||
|
SimpleGroup principalGroup = new SimpleGroup(GROUP_NAME_CALLER);
|
||||||
|
principalGroup.addMember(principal);
|
||||||
|
subject.getPrincipals().add(principalGroup);
|
||||||
|
SimpleGroup rolesGroup = new SimpleGroup(GROUP_NAME_ROLES);
|
||||||
|
subject.getPrincipals().add(rolesGroup);
|
||||||
|
// add the caller groups
|
||||||
|
for (String role : roles) {
|
||||||
|
SimpleGroup group = new SimpleGroup(role);
|
||||||
|
group.addMember(principal);
|
||||||
|
rolesGroup.addMember(group);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean abort() throws LoginException {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean logout() throws LoginException {
|
||||||
|
// throw away all state held for the principal
|
||||||
|
subject.getPrincipals().clear();
|
||||||
|
// this is probably hacky: clear the security context
|
||||||
|
SecurityContextAssociation.clearSecurityContext();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ import org.jboss.resteasy.client.jaxrs.engines.URLConnectionEngine;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple builder for the geocoder service.
|
* A simple builder for the geocoder service.
|
||||||
*
|
*
|
||||||
* @author Marcus
|
* @author Marcus
|
||||||
*/
|
*/
|
||||||
public class GeocoderBuilder {
|
public class GeocoderBuilder {
|
||||||
@@ -16,26 +16,26 @@ public class GeocoderBuilder {
|
|||||||
/**
|
/**
|
||||||
* The default url.
|
* The default url.
|
||||||
*/
|
*/
|
||||||
public static final String GEOCODER_URL = "https://cloud.locoslab.com/carta/restful-services";
|
public static final String GEOCODER_URL = "https://www.maptology.com/carta";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The url of the service.
|
* The url of the service.
|
||||||
*/
|
*/
|
||||||
public String url = GEOCODER_URL;
|
public String url = GEOCODER_URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The socket timeout in seconds.
|
* The socket timeout in seconds.
|
||||||
*/
|
*/
|
||||||
public Long socketTimeout = null;
|
public Long socketTimeout = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The connection timeout in seconds.
|
* The connection timeout in seconds.
|
||||||
*/
|
*/
|
||||||
public Long connectionTimeout = null;
|
public Long connectionTimeout = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the url.
|
* Sets the url.
|
||||||
*
|
*
|
||||||
* @param url The url to set.
|
* @param url The url to set.
|
||||||
* @return The builder.
|
* @return The builder.
|
||||||
*/
|
*/
|
||||||
@@ -43,10 +43,10 @@ public class GeocoderBuilder {
|
|||||||
this.url = url;
|
this.url = url;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the connection timeout in seconds.
|
* Sets the connection timeout in seconds.
|
||||||
*
|
*
|
||||||
* @param seconds The connection timeout in seconds.
|
* @param seconds The connection timeout in seconds.
|
||||||
* @return The builder.
|
* @return The builder.
|
||||||
*/
|
*/
|
||||||
@@ -54,10 +54,10 @@ public class GeocoderBuilder {
|
|||||||
this.connectionTimeout = seconds;
|
this.connectionTimeout = seconds;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the socket timeout in seconds.
|
* Sets the socket timeout in seconds.
|
||||||
*
|
*
|
||||||
* @param seconds The socket timeout in seconds.
|
* @param seconds The socket timeout in seconds.
|
||||||
* @return The builder.
|
* @return The builder.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,131 @@
|
|||||||
|
package com.maptology.tool;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A delta compression codec based on Google's WGS84 encoder that
|
||||||
|
* supports multiple data streams to encode other data than latitude
|
||||||
|
* and longitude values. Callers must supply the number of streams
|
||||||
|
* encoded in the data and the streams must exhibit the same number
|
||||||
|
* of data items.
|
||||||
|
*
|
||||||
|
* @author Marcus
|
||||||
|
*/
|
||||||
|
public class DeltaCodec {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of streams to encode or decode.
|
||||||
|
*/
|
||||||
|
private int streams;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a delta compressor for the specified number of streams.
|
||||||
|
*
|
||||||
|
* @param streams The number of streams to encode in the string.
|
||||||
|
*/
|
||||||
|
public DeltaCodec(int streams) {
|
||||||
|
this.streams = streams;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of streams expected by this codec.
|
||||||
|
*
|
||||||
|
* @return The number of streams.
|
||||||
|
*/
|
||||||
|
public int getStreams() {
|
||||||
|
return streams;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encodes a list of values into a string.
|
||||||
|
*
|
||||||
|
* @param values The values consisting of arrays that represent
|
||||||
|
* the individual streams.
|
||||||
|
* @return The string.
|
||||||
|
*/
|
||||||
|
public String encode(List<long[]> values) {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
long[] previous = new long[streams];
|
||||||
|
for (int i = 0, s = values.size(); i < s; i++) {
|
||||||
|
long[] current = values.get(i);
|
||||||
|
for (int j = 0; j < streams; j++) {
|
||||||
|
long delta = current[j] - previous[j];
|
||||||
|
builder.append(encodeSignedNumber(delta));
|
||||||
|
previous[j] = current[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts the list of data from an encoded string.
|
||||||
|
*
|
||||||
|
* @param encoded The encoded string.
|
||||||
|
* @param data An optional list of data items to be reused
|
||||||
|
* to avoid object allocations. Can be null.
|
||||||
|
* @return The list of data items representing the streams.
|
||||||
|
*/
|
||||||
|
public List<long[]> decode(String encoded, List<long[]> data) {
|
||||||
|
List<long[]> list = new ArrayList<>();
|
||||||
|
int index = 0;
|
||||||
|
int length = encoded.length();
|
||||||
|
long[] current = new long[streams];
|
||||||
|
while (index < length) {
|
||||||
|
long[] next;
|
||||||
|
if (data != null && data.size() > 0) {
|
||||||
|
next = data.remove(0);
|
||||||
|
} else {
|
||||||
|
next = new long[streams];
|
||||||
|
}
|
||||||
|
long c;
|
||||||
|
for (int i = 0; i < streams; i++) {
|
||||||
|
long shift = 0;
|
||||||
|
long result = 0;
|
||||||
|
do {
|
||||||
|
c = encoded.charAt(index++) - 63;
|
||||||
|
result |= (c & 0x1f) << shift;
|
||||||
|
shift += 5;
|
||||||
|
} while (c >= 0x20);
|
||||||
|
long delta = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
|
||||||
|
current[i] += delta;
|
||||||
|
next[i] = current[i];
|
||||||
|
}
|
||||||
|
list.add(next);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encodes a signed number as string.
|
||||||
|
*
|
||||||
|
* @param num The number.
|
||||||
|
* @return The string.
|
||||||
|
*/
|
||||||
|
private static String encodeSignedNumber(long num) {
|
||||||
|
long sgn_num = num << 1;
|
||||||
|
if (num < 0) {
|
||||||
|
sgn_num = ~(sgn_num);
|
||||||
|
}
|
||||||
|
return (encodeNumber(sgn_num));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encodes an unsigned number as string.
|
||||||
|
*
|
||||||
|
* @param num The number.
|
||||||
|
* @return The string.
|
||||||
|
*/
|
||||||
|
private static String encodeNumber(long num) {
|
||||||
|
StringBuilder encodeString = new StringBuilder();
|
||||||
|
while (num >= 0x20) {
|
||||||
|
int nextValue = (int)(0x20 | (num & 0x1f)) + 63;
|
||||||
|
encodeString.append((char) (nextValue));
|
||||||
|
num >>= 5;
|
||||||
|
}
|
||||||
|
num += 63;
|
||||||
|
encodeString.append((char) (num));
|
||||||
|
return encodeString.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.maptology.tool;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.maptology.api.position.Position;
|
||||||
|
|
||||||
|
public class GenerateGPSTrace {
|
||||||
|
|
||||||
|
public static final long start = new Date(120, 0, 28, 0, 0, 0).getTime();
|
||||||
|
public static final long end = new Date(120, 2, 3, 23, 59, 59).getTime();
|
||||||
|
|
||||||
|
public static void main(String[] args) throws IOException {
|
||||||
|
System.out.println("EID,Time,Longitude,Latitude");
|
||||||
|
File folder = new File(ToolUtilities.OUTPUT_FOLDER);
|
||||||
|
File[] files = folder.listFiles();
|
||||||
|
|
||||||
|
for (File input: files) {
|
||||||
|
if (input.getName().startsWith("device-") && input.getName().endsWith(".json")) {
|
||||||
|
String deviceId = input.getName().substring(7, input.getName().length() - 5);
|
||||||
|
//System.out.println("Processing: " + deviceId);
|
||||||
|
List<Position> positions = ToolUtilities.readPositions(input);
|
||||||
|
for (Position p: positions) {
|
||||||
|
if (p.getTimestamp() < start || p.getTimestamp() > end) continue;
|
||||||
|
if (p.getCoordinate() != null) {
|
||||||
|
if (p.getMetadata().containsKey("gps")) {
|
||||||
|
DeltaCodec c = new DeltaCodec(11);
|
||||||
|
List<long[]> result = c.decode(p.getMetadata().get("gps"), new ArrayList<>());
|
||||||
|
for (long[] pos: result) {
|
||||||
|
System.out.println(deviceId + "," + pos[0] + "," + (pos[2] / 10E6) + "," + (pos[3] / 10E6));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.out.println(deviceId + "," + p.getTimestamp()+ "," + p.getCoordinate().getLongitude()+ "," + p.getCoordinate().getLatitude());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.out.println("Skipping: " + input.getName());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,10 +1,20 @@
|
|||||||
package com.maptology.tool;
|
package com.maptology.tool;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.jboss.resteasy.client.jaxrs.BasicAuthentication;
|
import org.jboss.resteasy.client.jaxrs.BasicAuthentication;
|
||||||
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
|
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
|
||||||
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
|
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
|
||||||
import org.jboss.resteasy.client.jaxrs.engines.URLConnectionEngine;
|
import org.jboss.resteasy.client.jaxrs.engines.URLConnectionEngine;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.maptology.api.position.Position;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The tool configuration and utilities.
|
* The tool configuration and utilities.
|
||||||
*
|
*
|
||||||
@@ -20,7 +30,7 @@ public class ToolUtilities {
|
|||||||
/**
|
/**
|
||||||
* The devices
|
* The devices
|
||||||
*/
|
*/
|
||||||
public static long[] DEVICES = new long[] { 361281 };
|
public static long[] DEVICES = new long[] { 403330, 403336, 403340, 403345, 403349 };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The output folder to write data.
|
* The output folder to write data.
|
||||||
@@ -68,5 +78,28 @@ public class ToolUtilities {
|
|||||||
double c = 2 * Math.atan2(Math.sqrt(ax), Math.sqrt(1 - ax));
|
double c = 2 * Math.atan2(Math.sqrt(ax), Math.sqrt(1 - ax));
|
||||||
return EARTH_RADIUS * c;
|
return EARTH_RADIUS * c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads all positions from a file.
|
||||||
|
*
|
||||||
|
* @param file The file to read.
|
||||||
|
* @return The positions.
|
||||||
|
* @throws IOException Thrown if something fails.
|
||||||
|
*/
|
||||||
|
public static List<Position> readPositions(File file) throws IOException {
|
||||||
|
List<Position> result = new ArrayList<Position>();
|
||||||
|
BufferedReader r = new BufferedReader(new FileReader(file));
|
||||||
|
try {
|
||||||
|
ObjectMapper m = new ObjectMapper();
|
||||||
|
String line;
|
||||||
|
while ((line = r.readLine()) != null) {
|
||||||
|
result.add(m.readValue(line, Position.class));
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
r.close();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,12 +32,11 @@ html, body {
|
|||||||
// create a map, add polyline set view
|
// create a map, add polyline set view
|
||||||
var mymap = L.map('mapid').setView(polylinePoints[0], 13);
|
var mymap = L.map('mapid').setView(polylinePoints[0], 13);
|
||||||
|
|
||||||
L.tileLayer('https://cloud.locoslab.com/carta/restful-services/tile/{z}/{x}/{y}.png', {
|
L.tileLayer('https://www.maptology.com/carta/tile/{z}/{x}/{y}.png', {
|
||||||
maxZoom: 20,
|
maxZoom: 20,
|
||||||
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
|
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
|
||||||
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
|
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
|
||||||
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
|
'Visuals © <a href="https://www.locoslab.com/">LocosLab GmbH</a>'
|
||||||
id: 'mapbox/streets-v11'
|
|
||||||
}).addTo(mymap);
|
}).addTo(mymap);
|
||||||
|
|
||||||
var polylineOptions = {
|
var polylineOptions = {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ dependencies {
|
|||||||
task resolveWildfly(type: Copy) {
|
task resolveWildfly(type: Copy) {
|
||||||
destinationDir = file("${project.projectDir}")
|
destinationDir = file("${project.projectDir}")
|
||||||
from { zipTree(configurations.wildfly.singleFile) }
|
from { zipTree(configurations.wildfly.singleFile) }
|
||||||
|
onlyIf { !file("${project.projectDir}/wildfly-${versionWildfly}/").exists() }
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure wildfly is resolved as part of build
|
// make sure wildfly is resolved as part of build
|
||||||
@@ -21,4 +22,4 @@ tasks.register("cleanWildfly") {
|
|||||||
doLast {
|
doLast {
|
||||||
delete "${project.projectDir}/wildfly-${versionWildfly}/"
|
delete "${project.projectDir}/wildfly-${versionWildfly}/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
rootProject.name = 'project'
|
rootProject.name = 'maptology'
|
||||||
include(':common-api')
|
include(':common-api')
|
||||||
include(':android-app')
|
include(':android-app')
|
||||||
include(':android-feign')
|
include(':android-feign')
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
],
|
],
|
||||||
"optimization": true,
|
"optimization": true,
|
||||||
"outputHashing": "all",
|
"outputHashing": "all",
|
||||||
"sourceMap": false,
|
|
||||||
"extractCss": true,
|
"extractCss": true,
|
||||||
"namedChunks": false,
|
"namedChunks": false,
|
||||||
"aot": true,
|
"aot": true,
|
||||||
@@ -55,7 +54,9 @@
|
|||||||
"serve": {
|
"serve": {
|
||||||
"builder": "@angular-devkit/build-angular:dev-server",
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
"options": {
|
"options": {
|
||||||
"browserTarget": "webapp-ng:build"
|
"baseHref": "/app",
|
||||||
|
"browserTarget": "webapp-ng:build",
|
||||||
|
"proxyConfig": "proxy.conf.json"
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"ngVersion": "9.0.0"
|
||||||
|
}
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "com.moowork.node" version "1.3.1"
|
id 'com.github.node-gradle.node' version '2.2.4'
|
||||||
|
id 'org.hidetake.swagger.generator' version '2.18.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
description = 'Maptology Web Angular'
|
description = 'Maptology Web Angular'
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
swaggerCodegen 'io.swagger:swagger-codegen-cli:2.4.12'
|
||||||
|
}
|
||||||
|
|
||||||
node {
|
node {
|
||||||
version = '10.16.0'
|
version = '10.16.0'
|
||||||
npmVersion = '6.9.0'
|
npmVersion = '6.9.0'
|
||||||
@@ -17,13 +22,6 @@ class IoNodeTask extends com.moowork.gradle.node.task.NodeTask {
|
|||||||
File outputDir;
|
File outputDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
task genApi(type: IoNodeTask) {
|
|
||||||
script = file('node_modules/angular4-swagger-client-generator/bin/a4apigen.js')
|
|
||||||
args = ['-s', '../common-api/build/swagger/maptology.json', '-o', './src/api']
|
|
||||||
inputFile = project.file('../common-api/build/swagger/maptology.json')
|
|
||||||
outputDir = project.file('./src/api/')
|
|
||||||
}
|
|
||||||
|
|
||||||
task cleanApi(type: Delete) {
|
task cleanApi(type: Delete) {
|
||||||
delete './src/api', './dist'
|
delete './src/api', './dist'
|
||||||
}
|
}
|
||||||
@@ -35,11 +33,27 @@ task ngBuild(type: IoNodeTask) {
|
|||||||
outputDir = project.file('./dist/')
|
outputDir = project.file('./dist/')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
swaggerSources {
|
||||||
|
maptology {
|
||||||
|
inputFile = file(project(':common-api:').buildDir.path + '/swagger/maptology.json')
|
||||||
|
code {
|
||||||
|
outputDir = file("./src/api/")
|
||||||
|
language = 'typescript-angular'
|
||||||
|
configFile = file('apiconfig.json')
|
||||||
|
components = [models: true, apis: 'Default', supportingFiles: 'configuration.ts,encoder.ts,api.ts,models.ts,variables.ts']
|
||||||
|
wipeOutputDir = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// require api build to access swagger definition
|
||||||
|
tasks['resolveSwaggerTemplate'].dependsOn(project(':common-api').tasks['build'])
|
||||||
// make sure that common api is built before generating the api
|
// make sure that common api is built before generating the api
|
||||||
genApi.dependsOn(npmInstall)
|
ngBuild.dependsOn(npmInstall)
|
||||||
genApi.dependsOn(project(":common-api").tasks['build'])
|
|
||||||
// generate the api before running ng build
|
// generate the api before running ng build
|
||||||
ngBuild.dependsOn("genApi")
|
ngBuild.dependsOn("generateSwaggerCode")
|
||||||
// run ng build whenever the project is built
|
// run ng build whenever the project is built
|
||||||
build.dependsOn("ngBuild")
|
build.dependsOn("ngBuild")
|
||||||
|
|
||||||
|
|||||||