Author SHA1 Message Date
handte cb507e9a8c Release 1.0.7
LocationBasedServices/maptology/pipeline/head This commit looks good
2021-06-30 21:43:22 +02:00
handte e32460116f Fix linting issues, add dark theme.
LocationBasedServices/maptology/pipeline/head This commit looks good
2021-06-30 21:35:58 +02:00
handte cfb2fcbe2f Update app permissions to support Android 10 and 11.
LocationBasedServices/maptology/pipeline/head This commit looks good
2021-06-30 20:20:06 +02:00
handte 4ea3d60932 Adjust deployment paths to new servers.
LocationBasedServices/maptology/pipeline/head This commit looks good
2021-05-17 13:35:02 +02:00
handte 6c4ca9d622 Add background localization permission.
LocationBasedServices/maptology/pipeline/head This commit looks good
2021-02-15 21:13:34 +01:00
handte 62d0331a32 Fix comment.
LocationBasedServices/maptology/pipeline/head This commit looks good
2021-01-26 00:15:12 +01:00
handte 5553dd4757 Remove artifactory plugin from gradle build.
LocationBasedServices/maptology/pipeline/head This commit looks good
2021-01-25 23:14:00 +01:00
handte 3f89f50492 Remove string interpolation in jenkinsfile.
LocationBasedServices/maptology/pipeline/head This commit looks good
2021-01-25 22:55:04 +01:00
handte b96615419e Replace artifactory deployment with nexus.
LocationBasedServices/maptology/pipeline/head This commit looks good
2021-01-25 22:44:44 +01:00
handte e1b5c70fb7 Switch to maven repo to nexus.
LocationBasedServices/maptology/pipeline/head This commit looks good
2021-01-25 22:15:03 +01:00
handte 11f5d372b6 Upgrade to Angular 11.
LocationBasedServices/maptology/pipeline/head This commit looks good
Upgrade dependencies to Angular 11.
Replace saturn date range picker with new material component.
2020-12-17 23:44:03 +01:00
handte bbe51ebbf4 Update Android app, fix linting issues, reduce build time.
LocationBasedServices/maptology/pipeline/head This commit looks good
2020-12-17 22:20:19 +01:00
handte 8319f56304 Rename projects in Eclipse.
LocationBasedServices/maptology/pipeline/head This commit looks good
2020-12-11 19:15:07 +01:00
Marcus Handte e9704b46f6 Update Android plugin, fix deprecation warnings in login module.
LocationBasedServices/maptology/pipeline/head This commit looks good
2020-08-16 12:30:14 +02:00
handte 34a98136be Update to 1.0.7-SNAPSHOT.
LocationBasedServices/maptology/pipeline/head This commit looks good
2020-08-13 12:03:14 +02:00
handte f8d1a96d0b Release 1.0.6
LocationBasedServices/maptology/pipeline/head This commit looks good
2020-08-13 12:01:57 +02:00
handte c5b69a12e7 Update to 1.0.6-SNAPSHOT.
LocationBasedServices/maptology/pipeline/head This commit looks good
2020-08-13 11:02:33 +02:00
handte 08db82b1f7 Release 1.0.5
LocationBasedServices/maptology/pipeline/head This commit looks good
2020-08-13 11:01:02 +02:00
handte fcd899f25f Change carta urls to point to local installation.
LocationBasedServices/maptology/pipeline/head This commit looks good
2020-08-13 10:21:52 +02:00
Marcus Handte 85c026fa8f Upgrade gradle, plugins, android dependencies and angular code generator.
LocationBasedServices/maptology/pipeline/head This commit looks good
Upgrade gralde to latest version recommended by android studio.
Remove outdated android options in gradle properties.
Upgrade outdated gradle plugins to support npm downloads.
Upgrade android app dependencies to latest versions.
Make logger service constants static final.
Replace angular client generator with swagger codegen.
Adapt angular code to new client.
Integrate proxy config and basehref into angular cli configuration.
Change jenkinsfile to only deploy releases.
Change jenkinsfile to use gradle wrapper instead of fixed version.
Remove dots from user emails to not confuse simple email clients.
2020-06-20 10:28:43 +02:00
handte 8f7aeec0ab Update deployment location, add tools.
LocationBasedServices/maptology/pipeline/head This commit looks good
2020-05-01 00:10:59 +02:00
handte d3ba3f570a Rename public tables.
LocationBasedServices/maptology/master This commit looks good
2020-04-23 23:24:44 +02:00
handte 3c63e9530f Rename timestamp columns.
LocationBasedServices/maptology/master This commit looks good
2020-04-23 22:23:56 +02:00
handte cc66a682f0 Added column length definitions.
LocationBasedServices/maptology/master This commit looks good
2020-04-23 21:27:06 +02:00
Adriano Markovic f5691ef3a3 [66] #REFACTOR 'layout: user'
LocationBasedServices/maptology/angular-layout-refactoring This commit looks good
LocationBasedServices/maptology/master This commit looks good
{Added css flex classes.}
2020-03-18 13:04:09 +01:00
Adriano Markovic 8e3dc80fb8 [66] #REFACTOR 'layout: tables'
LocationBasedServices/maptology/angular-layout-refactoring This commit looks good
{Revised layouts and solved linter issues with time-sheet.service.ts.}
2020-02-26 16:24:27 +01:00
Adriano Markovic 20108b282d [66] #REFACTOR 'layout: user'
LocationBasedServices/maptology/angular-layout-refactoring This commit looks good
{Layout revised.}
2020-02-26 13:24:50 +01:00
Adriano Markovic aac6c5f5f3 [66] #REFACTOR 'layout: export'
{Revised the layout of the exort component.}
2020-02-26 12:05:52 +01:00
Adriano Markovic 3b644cece3 [66] #REFACTOR 'Layout: tables'
{Table view layout revised.}
2020-02-26 11:36:05 +01:00
Adriano Markovic 6b5f01a573 [66] #REFACTOR 'layout: privileges'
{Layout revised. Added content-layout.}
2020-02-26 11:13:07 +01:00
Adriano Markovic 98212476f4 Removed old templates. 2020-02-26 10:36:08 +01:00
Adriano Markovic eac84438f1 [66] #REFACTOR 'Component Renamed' 2020-02-26 10:34:01 +01:00
Adriano Markovic dfacfd4ff4 [66] #REFACTOR 'layout: notices'
LocationBasedServices/maptology/angular-layout-refactoring This commit looks good
{Revised layout.}
2020-02-25 21:06:56 +01:00
Adriano Markovic 301578f241 [66] #REFACTOR 'layout: timesheet'
{Revised layout.}
2020-02-25 21:05:59 +01:00
Adriano Markovic 41dc0030c3 [misc] #REFACTOR 'layout: drawer'
{Moved the timesheet nav button up.}
2020-02-25 21:04:46 +01:00
Adriano Markovic 73ea8185a4 [66] #IMPLEMENT 'layout: header'
{Implemented the layout header layout and revised the basic layout.}
2020-02-25 21:03:52 +01:00
Adriano Markovic ff89c9a7cc [66] #REFACTOR 'component:time-sheet'
LocationBasedServices/maptology/angular-layout-refactoring This commit looks good
{Layout revised.}
2020-02-19 22:08:28 +01:00
Adriano Markovic 7451e492c6 [66] #IMPLEMENT 'component:basic-layout'
{Basic layout component added and global stylesheet revised. }
2020-02-19 22:07:04 +01:00
178 changed files with 8246 additions and 8648 deletions
Vendored
+16 -28
View File
@@ -3,13 +3,6 @@
// this groovy script is executed by jenkins
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 {
ANDROID_SDK_ROOT = '/var/lib/android-sdk'
}
@@ -21,49 +14,44 @@ node {
}
def version = ''
def release = false
// configure the deployer based on the version
stage('Configure') {
version = sh(returnStdout: true, script: "./gradlew properties -q | grep \"version:\" | awk '{print \$2}'", label: "Detecting project version.").trim()
println "Version is: '${version}'"
if (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'
}
println "Version is: '${version}'"
release = (! version.endsWith("-SNAPSHOT"))
}
// build the source code with gradle
stage('Build') {
withCredentials([string(credentialsId: 'maptology-keystore-password', variable: 'PASSWD')]) {
def switches = "-Djenkins.build.number=${env.BUILD_NUMBER} -Dandroid.keystore.password=${PASSWD}".toString()
gradleInfo = gradleBuild.run buildFile: 'build.gradle', tasks: 'clean build', switches: switches
sh(script: './gradlew -Djenkins.build.number=' + env.BUILD_NUMBER + ' -Dandroid.keystore.password=$PASSWD clean build', label: "Building project.")
}
}
// deploy the maven publications to artifactory
// deploy the maven publications to nexus
stage ('Publish') {
if (env.BRANCH_NAME == "master") {
withCredentials([string(credentialsId: 'maptology-keystore-password', variable: 'PASSWD')]) {
def switches = "-Djenkins.build.number=${env.BUILD_NUMBER} -Dandroid.keystore.password=${PASSWD}".toString()
gradleInfo = gradleBuild.run buildFile: 'build.gradle', tasks: 'artifactoryPublish', switches: switches
}
withCredentials([string(credentialsId: 'jenkins-nexus-password', variable: 'NEXUS')]) {
withCredentials([string(credentialsId: 'maptology-keystore-password', variable: 'PASSWD')]) {
sh(script: './gradlew -Djenkins.build.number=' + env.BUILD_NUMBER + ' -Dandroid.keystore.password=$PASSWD -Djenkins.nexus.password=$NEXUS publishAllPublicationsToMavenRepository', label: "Publishing project.")
}
}
} else {
echo "Skipping deployment for non-master branch."
echo "Skipping publication for non-master branch."
}
}
// deploy the build output on the server
stage ('Deploy') {
if (env.BRANCH_NAME == "master") {
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} android-app/build/outputs/apk/release/*.apk wildfly@srv.nes.uni-due.de:/opt/android/maptology/"
if (env.BRANCH_NAME == "master" && release) {
withCredentials([sshUserPrivateKey(credentialsId: "maptology-server-key", keyFileVariable: "KEYFILE")]) {
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@apps-pro.nes.uni-due.de:/opt/android/maptology/'
}
} else {
echo "Skipping deployment for non-master branch."
echo "Skipping deployment for non-master branch or non-release build."
}
}
+14 -12
View File
@@ -3,12 +3,12 @@ description = "Maptology Android App"
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation project(":android-feign")
implementation "androidx.legacy:legacy-support-v4:${versionAndroidx}"
implementation "androidx.appcompat:appcompat:${versionAndroidx}"
implementation "androidx.preference:preference:${versionAndroidx}"
implementation "androidx.cardview:cardview:${versionAndroidx}"
implementation "androidx.recyclerview:recyclerview:${versionAndroidx}"
implementation "com.google.android.material:material:${versionAndroidx}"
implementation "androidx.legacy:legacy-support-v4:${versionAndroidxLegacy}"
implementation "androidx.appcompat:appcompat:${versionAndroidxCompat}"
implementation "androidx.preference:preference:${versionAndroidxPreference}"
implementation "androidx.cardview:cardview:${versionAndroidxCard}"
implementation "androidx.recyclerview:recyclerview:${versionAndroidxRecycler}"
implementation "com.google.android.material:material:${versionAndroidxMaterial}"
implementation "com.google.android.gms:play-services-oss-licenses:${versionPlay}"
testImplementation "junit:junit:${versionJunit}"
testImplementation "org.robolectric:robolectric:${versionRobolectric}"
@@ -22,12 +22,12 @@ configurations {
}
android {
compileSdkVersion 28
compileSdkVersion 30
defaultConfig {
applicationId "com.maptology.android.app"
minSdkVersion 14
targetSdkVersion 28
versionCode 10
targetSdkVersion 30
versionCode 12
versionName "${version}"
buildConfigField "long", "BUILD_TIME", System.currentTimeMillis() + "L"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -75,13 +75,15 @@ android {
dexOptions {
javaMaxHeapSize "512m"
}
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
tasks.register('makeEclipseDir') {
doLast {
file('build/generated/source/aidl/debug').mkdirs();
file('build/generated/source/r/debug').mkdirs();
file('build/generated/source/aidl/debug').mkdirs()
file('build/generated/source/r/debug').mkdirs()
}
}
+1
View File
@@ -7,6 +7,7 @@
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<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_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
@@ -293,9 +293,14 @@ public abstract class AbstractService extends Service {
protected static boolean isPowerCordPlugged(Context context) {
Intent intent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
int p = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
return p == BatteryManager.BATTERY_PLUGGED_AC ||
p == BatteryManager.BATTERY_PLUGGED_USB ||
p == BatteryManager.BATTERY_PLUGGED_WIRELESS;
if (Build.VERSION.SDK_INT < 17) {
return p == BatteryManager.BATTERY_PLUGGED_AC ||
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.
*/
private boolean hasGpsPermissions() {
return ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
&& ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED;
List<String> permissions = new ArrayList<>();
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;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
@@ -34,22 +35,22 @@ public class LoggerService extends AbstractService {
/**
* 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.
*/
private String METADATA_ACCELEROMETER = "accel";
private static final String METADATA_ACCELEROMETER = "accel";
/**
* The key for the gyroscope.
*/
private String METADATA_GYROSCOPE = "gyro";
private static final String METADATA_GYROSCOPE = "gyro";
/**
* 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.
@@ -151,6 +152,7 @@ public class LoggerService extends AbstractService {
@Override
@SuppressLint("WakelockTimeout") // the device is plugged, so we can ignore safely the energy usage
public void onCreate() {
super.onCreate();
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) {
this.registered = registered;
}
};
}
/**
@@ -613,9 +615,8 @@ public class LoggerService extends AbstractService {
@Override
public void onSensorChanged(SensorEvent event) {
long prev = 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;
if (diff / 1000 < SAMPLING_DELAY_SENSOR) return;
}
@@ -1,5 +1,7 @@
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.ManageFragment;
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.model.LocalShare;
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.task.UpdateUserTask;
import com.maptology.android.app.util.TabletUtil;
@@ -18,21 +21,28 @@ import com.maptology.android.feign.model.User;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.NonNull;
import com.google.android.material.navigation.NavigationView;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.core.content.PermissionChecker;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceManager;
import android.provider.Settings;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
@@ -96,13 +106,28 @@ public class MainActivity extends AppCompatActivity implements
public void onValueChanged(Value<DeviceHandle> source, DeviceHandle oldValue, DeviceHandle newValue) {
if (newValue != null) {
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);
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.
*/
@@ -122,10 +147,16 @@ public class MainActivity extends AppCompatActivity implements
*/
private MaptologyApp app;
/**
* The preferences to keep on watching the localization state.
*/
private SharedPreferences prefs;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
app = (MaptologyApp) getApplicationContext();
prefs = PreferenceManager.getDefaultSharedPreferences(this);
AbstractService.runService(this);
setTitle(R.string.application_short);
if (TabletUtil.isLandscapeTablet(this)) {
@@ -137,7 +168,6 @@ public class MainActivity extends AppCompatActivity implements
setScreen(Screen.MAP);
}
createNavigationDrawer();
checkPermissions();
new UpdateUserTask(app).execute();
}
@@ -146,10 +176,12 @@ public class MainActivity extends AppCompatActivity implements
super.onResume();
app.getRepository().user.addValueListener(userListener, true);
app.getRepository().deviceHandle.addValueListener(deviceListener, true);
prefs.registerOnSharedPreferenceChangeListener(preferenceListener);
}
@Override
protected void onPause() {
prefs.unregisterOnSharedPreferenceChangeListener(preferenceListener);
app.getRepository().deviceHandle.removeValueListener(deviceListener);
app.getRepository().user.removeValueListener(userListener);
super.onPause();
@@ -170,28 +202,21 @@ public class MainActivity extends AppCompatActivity implements
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_notice:
setScreen(Screen.NOTICE);
break;
case R.id.menu_map:
setScreen(Screen.MAP);
break;
case R.id.menu_share:
createShare();
break;
case R.id.menu_manage:
setScreen(Screen.MANAGE);
break;
case R.id.menu_settings:
showSettings();
break;
case R.id.menu_connect:
showLogin();
break;
case R.id.menu_webapp:
showPlaces();
break;
int itemId = item.getItemId();
if (itemId == R.id.menu_notice) {
setScreen(Screen.NOTICE);
} else if (itemId == R.id.menu_map) {
setScreen(Screen.MAP);
} else if (itemId == R.id.menu_share) {
createShare();
} else if (itemId == R.id.menu_manage) {
setScreen(Screen.MANAGE);
} else if (itemId == R.id.menu_settings) {
showSettings();
} else if (itemId == R.id.menu_connect) {
showLogin();
} else if (itemId == R.id.menu_webapp) {
showPlaces();
}
closeDrawerIfNeeded();
return false;
@@ -236,7 +261,6 @@ public class MainActivity extends AppCompatActivity implements
super.onDrawerClosed(view);
setTitle(R.string.application_short);
}
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
setTitle(R.string.drawer_title);
@@ -262,30 +286,91 @@ public class MainActivity extends AppCompatActivity implements
* Method to request location permission for the app.
*/
private void checkPermissions() {
boolean permissionGranted = PermissionChecker.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PermissionChecker.PERMISSION_GRANTED &&
PermissionChecker.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PermissionChecker.PERMISSION_GRANTED;
if (!permissionGranted) {
Log.d(TAG, "Requesting permissions.");
ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, CODE_REQUEST_PERMISSIONS);
if (! app.getRepository().isLocalizable()) return;
boolean coarse = ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED;
boolean fine = ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;
if (!(coarse && fine)) {
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).
*
* @param requestCode requestCode identifies requested permission
* @param permissions permissions The permissions.
* @param grantResults results The results for the permissions.
* @param requestCode Identifies requested permission.
* @param permissions The permissions.
* @param grantResults The results for the permissions.
*/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case CODE_REQUEST_PERMISSIONS: {
StringBuilder b = new StringBuilder();
for (int i = 0, s = Math.min(permissions.length, grantResults.length); i < s; i++) {
b.append(permissions[i] + " " + (grantResults[i] == PackageManager.PERMISSION_GRANTED) + "\n");
boolean granted = true;
for (int i = 0; i < grantResults.length; i++) {
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;
}
default:
@@ -413,4 +498,46 @@ public class MainActivity extends AppCompatActivity implements
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.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.ITouchListener;
import com.locoslab.android.leafless.MapOptions;
@@ -31,18 +33,16 @@ import com.maptology.android.feign.model.Coordinate;
import android.database.Cursor;
import android.os.Bundle;
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.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
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.
@@ -288,7 +288,7 @@ public class MapFragment extends AbstractFragment {
// apply the state
getRepository().mapState.getValue().applyTo(map);
// 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
map.addShortTapListener(new ITouchListener() {
@Override
@@ -461,7 +461,7 @@ public class MapFragment extends AbstractFragment {
getRepository().mapMode.setValue(MapMode.values()[code]);
}
/**
* Applies the current map mode.
*/
@@ -17,16 +17,19 @@ import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import androidx.core.content.pm.PackageInfoCompat;
import androidx.preference.CheckBoxPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceGroup;
import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceScreen;
import android.util.Log;
import android.view.LayoutInflater;
@@ -144,6 +147,18 @@ public class SettingsFragment extends PreferenceFragmentCompat {
*/
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
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.
*
@@ -83,12 +83,18 @@ public class TermsFragment extends AbstractFragment {
View acceptView = view.findViewById(R.id.fragment_terms_accept);
acceptView.setVisibility(getRepository().isTermsAccepted()?View.GONE:View.VISIBLE);
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() {
@Override
public void onClick(View v) {
getRepository().setTermsAccepted(true);
getRepository().setShareable(permissionCheckbox.isChecked());
if (continueListener != null) continueListener.onClick(v);
}
});
@@ -10,7 +10,7 @@ import com.maptology.android.feign.model.User;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import androidx.preference.PreferenceManager;
/**
@@ -149,9 +149,9 @@ public class Repository {
*/
public Repository(Context context) {
this.context = context;
this.deviceHandle = new PersistentValue<DeviceHandle>(this, new JacksonSerializer<DeviceHandle>(DeviceHandle.class), "device.json");
this.user = new PersistentValue<User>(this, new JacksonSerializer<User>(User.class), "user.json");
this.lastUpdate = new PersistentValue<ReleasedLocation>(this, new JacksonSerializer<ReleasedLocation>(ReleasedLocation.class), "update.json");
this.deviceHandle = new PersistentValue<>(this, new JacksonSerializer<>(DeviceHandle.class), "device.json");
this.user = new PersistentValue<>(this, new JacksonSerializer<>(User.class), "user.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);
}
/**
* 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() {
return getPreference(KEY_PRIVACY_LOGGABLE, R.bool.privacy_loggable_default);
}
/**
* 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">
<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>
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
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">
<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>
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
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">
<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>
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
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">
<path android:fillColor="#FF000000" android:pathData="M6,19h4L10,5L6,5v14zM14,5v14h4L18,5h-4z"/>
</vector>
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
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">
<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>
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="48dp"
android:height="48dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -1,4 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorControlNormal"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
@@ -11,6 +11,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:itemIconTint="@color/white"
android:id="@+id/drawer_layout">
<FrameLayout
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -14,7 +15,7 @@
android:layout_margin="@dimen/space_large"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/login_title"
tools:text="@string/login_title_create"
android:layout_marginBottom="@dimen/space_medium"
@@ -23,7 +24,7 @@
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/login_explain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -31,10 +32,11 @@
tools:text="@string/login_explain_create"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<androidx.appcompat.widget.AppCompatEditText
<EditText
android:id="@+id/input_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="username"
android:drawableStart="@drawable/ic_perm_identity_black_24dp"
android:drawableLeft="@drawable/ic_perm_identity_black_24dp"
android:drawablePadding="@dimen/space_medium"
@@ -48,8 +50,9 @@
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/space_large"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatEditText
<EditText
android:id="@+id/input_password"
android:autofillHints="password"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
@@ -67,10 +70,10 @@
android:layout_height="wrap_content"
android:padding="@dimen/space_medium"
android:background="@android:color/transparent"
android:src="@drawable/ic_visibility_black_24dp" />
app:srcCompat="@drawable/ic_visibility_black_24dp" />
</LinearLayout>
<androidx.appcompat.widget.AppCompatButton
<Button
android:id="@+id/button_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -78,7 +81,7 @@
android:theme="@style/button_highlighted"
tools:text="@string/login_button_create"/>
<androidx.appcompat.widget.AppCompatButton
<Button
android:id="@+id/button_no_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -88,7 +91,7 @@
android:theme="@style/button"
android:text="@string/login_button_continue"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/text_register"
android:gravity="center"
android:layout_width="match_parent"
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:background="@drawable/bg_launch_gradient"
android:layout_width="match_parent"
@@ -8,7 +9,7 @@
<ImageView
android:id="@+id/icon_launch_map"
android:contentDescription="@string/application_long"
android:src="@drawable/icon_launch_map"
app:srcCompat="@drawable/icon_launch_map"
android:layout_alignParentBottom="true"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
@@ -24,14 +25,14 @@
<ImageView
android:contentDescription="@null"
android:src="@drawable/icon_launch_text"
app:srcCompat="@drawable/icon_launch_text"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/icon_launch_person"
android:src="@drawable/icon_launch_person"
app:srcCompat="@drawable/icon_launch_person"
android:contentDescription="@null"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
@@ -29,8 +29,8 @@
app:tabMode="fixed"
app:tabGravity="fill"
app:elevation="6dp"
app:tabTextColor="?android:attr/textColorPrimaryInverse"
app:tabSelectedTextColor="?android:attr/textColorPrimaryInverse"
app:tabTextColor="@color/white"
app:tabSelectedTextColor="@color/colorAccent"
app:tabIndicatorColor="@color/colorAccent"
android:minHeight="?attr/actionBarSize"/>
@@ -53,9 +53,10 @@
android:layout_marginEnd="@dimen/space_medium"
app:layout_dodgeInsetEdges="bottom"
app:layout_insetEdge="bottom"
android:contentDescription="@string/map_share"
app:layout_anchorGravity="top|right"
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"/>
@@ -66,10 +67,10 @@
android:layout_marginRight="@dimen/space_medium"
android:layout_marginEnd="@dimen/space_medium"
android:layout_marginBottom="64dp"
android:contentDescription="@string/nav_share"
android:contentDescription="@string/map_mode"
app:layout_anchor="@id/buttonShare"
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"/>
@@ -36,7 +36,7 @@
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/share_explain"
android:text="@string/share_explain_create"
android:layout_marginBottom="@dimen/space_medium"
@@ -44,9 +44,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatEditText
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="no"
android:maxLines="1"
android:drawablePadding="@dimen/space_medium"
android:textAppearance="?android:attr/textAppearanceMedium"
@@ -58,9 +59,10 @@
android:drawableStart="@drawable/ic_message_black_24dp"
android:drawableLeft="@drawable/ic_message_black_24dp"/>
<androidx.appcompat.widget.AppCompatEditText
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="no"
android:maxLines="1"
android:drawablePadding="@dimen/space_medium"
android:maxLength="140"
@@ -79,12 +81,12 @@
android:layout_marginBottom="@dimen/space_medium"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:text="@string/share_creation_time"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/share_creation_date"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="end"
@@ -92,7 +94,7 @@
tools:text="1.1.2003"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/share_creation_time"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="end"
@@ -109,12 +111,12 @@
android:layout_marginBottom="@dimen/space_medium"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:text="@string/share_expiration_time"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/share_expiration_date"
android:textAppearance="@style/text_medium_hyperlink"
android:gravity="end"
@@ -122,7 +124,7 @@
tools:text="1.1.2003"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/share_expiration_time"
style="@style/text_medium_hyperlink"
android:gravity="end"
@@ -142,7 +144,7 @@
android:layout_marginBottom="@dimen/space_medium"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatButton
<Button
android:id="@+id/share_button_link"
android:text="@string/share_action_link"
android:drawableStart="@drawable/ic_link_black_24dp"
@@ -162,7 +164,7 @@
android:paddingTop="@dimen/space_medium"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatCheckBox
<CheckBox
android:id="@+id/share_paused"
android:text="@string/share_paused"
android:textAppearance="@style/text_small_hyperlink"
@@ -187,7 +189,7 @@
android:layout_gravity="center_horizontal"
android:id="@+id/share_button_layout"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatButton
<Button
android:id="@+id/share_button_delete"
android:text="@string/share_action_delete"
android:layout_weight="1"
@@ -196,7 +198,7 @@
android:theme="@style/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatButton
<Button
android:id="@+id/share_button_save"
android:text="@string/share_action_save"
android:layout_weight="1"
@@ -205,7 +207,7 @@
android:theme="@style/button_highlighted"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatButton
<Button
android:id="@+id/share_button_create"
android:text="@string/share_action_create"
android:layout_weight="1"
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.AppCompatTextView
<TextView
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"
tools:text="Pick an action"
android:id="@+id/dialog_text"
android:drawableLeft="@drawable/ic_launch_black_24dp"
android:drawableStart="@drawable/ic_launch_black_24dp"
app:drawableStartCompat="@drawable/ic_launch_black_24dp"
android:drawablePadding="@dimen/space_large"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
@@ -1,4 +1,5 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/view_detail_plain"
android:layout_width="match_parent"
@@ -10,7 +11,8 @@
android:layout_height="wrap_content"
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:paddingRight="4dp"
android:paddingEnd="4dp"
@@ -27,12 +29,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/share_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/view_detail_name"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Marcus Handte"
@@ -48,13 +50,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/view_detail_creation_label"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/share_creation_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/view_detail_creation_time"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="12/12/12 10:30"
@@ -70,12 +72,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/share_expiration_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/view_detail_expiration_time"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="12/12/12 10:30"
@@ -98,15 +100,15 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/view_detail_message_line">
<androidx.appcompat.widget.AppCompatImageView
android:src="@drawable/ic_message_black_24dp"
<ImageView
app:srcCompat="@drawable/ic_message_black_24dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:alpha="0.75"
android:contentDescription="@string/share_hint_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/view_detail_message"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Message"
@@ -121,16 +123,16 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/view_detail_destination_line">
<androidx.appcompat.widget.AppCompatImageView
<ImageView
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:paddingRight="14dp"
android:alpha="0.75"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/view_detail_destination"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Destination"
@@ -145,16 +147,16 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/view_detail_position_line">
<androidx.appcompat.widget.AppCompatImageView
<ImageView
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:paddingRight="14dp"
android:alpha="0.75"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/view_detail_position"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Available"
@@ -169,16 +171,16 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/view_detail_updated_line">
<androidx.appcompat.widget.AppCompatImageView
<ImageView
android:contentDescription="@string/share_hint_updated"
android:src="@drawable/ic_update_black_24dp"
app:srcCompat="@drawable/ic_update_black_24dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:alpha="0.75"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/view_detail_updated"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Last update ..."
@@ -192,16 +194,16 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
<ImageView
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:paddingRight="14dp"
android:alpha="0.75"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/view_detail_token"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="abcdefghijklmnopqrs"
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/icon_header"
app:srcCompat="@drawable/icon_header"
android:contentDescription="@null"
android:scaleType="centerCrop" />
@@ -25,6 +26,7 @@
android:layout_height="wrap_content"
tools:text="Sony Xperia Foo"
android:layout_gravity="end"
android:textColor="@color/white"
android:id="@+id/view_header_device"
android:textAppearance="?android:attr/textAppearanceMediumInverse"
/>
@@ -32,6 +34,7 @@
android:layout_height="wrap_content"
android:id="@+id/view_header_username"
android:layout_gravity="end"
android:textColor="@color/white"
tools:text="John Doe"
android:textAppearance="?android:attr/textAppearanceMediumInverse"
android:textStyle="bold"/>
@@ -19,8 +19,9 @@
android:layout_toLeftOf="@android:id/text1"
android:layout_toStartOf="@android:id/text1"
tools:src="@drawable/ic_call_received_white_24dp"
app:tint="@color/white"
android:id="@android:id/icon"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_centerInParent="true"
@@ -5,11 +5,20 @@
<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="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 -->
<string name="language_code">de</string>
<!-- map constants -->
<string name="map_attribution">Kartendaten: &#169; OpenStreetMap | Visualisierung: &#169; Locoslab GmbH</string>
<string name="map_share">Freigabe erstellen</string>
<string name="map_mode">Ansicht ändern</string>
<!-- constants used in the notice related views -->
<string name="menu_notice_update_title">Aktualisieren</string>
@@ -5,11 +5,19 @@
<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="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 -->
<string name="language_code">en</string>
<!-- map constants -->
<string name="map_attribution">Map data: &#169; OpenStreetMap | Visualization: &#169; Locoslab GmbH</string>
<string name="map_share">Create share</string>
<string name="map_mode">Change view</string>
<!-- constants used in the notice related views -->
<string name="menu_notice_update_title">Update</string>
+3 -2
View File
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<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="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="preferenceTheme">@style/settingsTheme</item>
</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="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
+56 -27
View File
@@ -1,19 +1,13 @@
buildscript {
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.10.0'
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.0.Fixed'
classpath 'com.android.tools.build:gradle:4.2.1'
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.4'
classpath 'org.handte.gradle:gradle-android-eclipse:1.0.0'
}
repositories {
maven {
url = 'https://project.nes.uni-due.de/artifactory/releases';
credentials { username = 'public'; password = 'public' }
authentication { basic(BasicAuthentication) }
}
maven {
url = 'https://project.nes.uni-due.de/artifactory/snapshots';
url = 'https://project.nes.uni-due.de/nexus/repository/maven-public';
credentials { username = 'public'; password = 'public' }
authentication { basic(BasicAuthentication) }
}
@@ -23,12 +17,10 @@ buildscript {
allprojects {
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'
// set version for our project
group = 'com.maptology'
version = '1.0.5-SNAPSHOT'
version = '1.0.7'
// set versions for our libraries
ext {
@@ -43,7 +35,7 @@ allprojects {
versionWildfly = '17.0.1.Final'
versionPicketbox = '5.0.3.Final'
// testing dependencies
versionJunit = '4.12'
versionJunit = '4.13.1'
versionArquillianContainer = '2.2.0.Final'
versionArquillianJunit = '1.5.0.Final'
// thorntail dependencies
@@ -51,10 +43,15 @@ allprojects {
versionThorntail = '2.5.0.Final'
// 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'
versionPlay = '17.0.0'
versionAndroidxTest = '1.2.0'
versionAndroidxTest = '1.4.0'
}
}
@@ -116,25 +113,57 @@ subprojects {
repositories {
maven {
url = 'https://project.nes.uni-due.de/artifactory/releases';
credentials { username = 'public'; password = 'public' }
authentication { basic(BasicAuthentication) }
}
maven {
url = 'https://project.nes.uni-due.de/artifactory/snapshots';
url = 'https://project.nes.uni-due.de/nexus/repository/maven-public';
credentials { username = 'public'; password = 'public' }
authentication { basic(BasicAuthentication) }
}
}
artifactoryPublish.dependsOn('build')
artifactoryPublish {
publications(publishing.publications.maven);
publishing {
repositories {
maven {
url = version.endsWith('SNAPSHOT') ?
"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("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()
}
}
+1 -1
View File
@@ -6,7 +6,7 @@ description = 'Maptology Common Api'
dependencies {
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 "io.swagger:swagger-annotations:${versionSwagger}"
compileOnly "com.fasterxml.jackson.core:jackson-annotations:${versionJackson}"
+2 -1
View File
@@ -1,3 +1,4 @@
android.enableJetifier=true
android.useAndroidX=true
android.enableR8=true
org.gradle.jvmargs=-Xmx4g
org.gradle.parallel=true
+2 -2
View File
@@ -1,6 +1,6 @@
#Sun Jul 21 19:24:12 CEST 2019
#Mon Feb 15 21:00:24 CET 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
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) {
Location result = create();
result.setAvailability(source.getAvailability());
result.setTimestamp(source.getTimestamp());
result.setTimestamp(source.getMeasurementTime());
result.setCoordinate(convert(source.getCoordinate()));
return result;
}
@@ -58,7 +58,7 @@ public class PositionConverter extends AbstractConverter<PositionEntity, Positio
p.setOs(source.getOs());
p.setProvider(source.getProvider());
p.setSpeed(source.getSpeed());
p.setTimestamp(source.getTimestamp());
p.setTimestamp(source.getMeasurementTime());
p.setVersion(source.getVersion());
return p;
}
@@ -2,6 +2,7 @@ package com.maptology.service.entity;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.EnumType;
@@ -18,7 +19,7 @@ import javax.persistence.UniqueConstraint;
/**
* The entity that represents codes sent out to the user.
*
*
* @author Marcus
*/
@Entity
@@ -35,31 +36,32 @@ public class CodeEntity extends AbstractEntity {
* Serialization version.
*/
private static final long serialVersionUID = 2477619107225809934L;
/**
* The email to which a code has been sent.
*/
@ManyToOne
@JoinColumn(name="email_id")
private EmailEntity email;
/**
* The type of code that has been sent out.
*/
@Enumerated(EnumType.ORDINAL)
private CodeType type;
/**
* The value of the code.
*/
@Column(length = 100)
private String value;
/**
* The time when the code expires.
*/
private long expirationTime;
/**
* Returns the email.
*
@@ -131,10 +133,10 @@ public class CodeEntity extends AbstractEntity {
public void setExpirationTime(long expirationTime) {
this.expirationTime = expirationTime;
}
/**
* Finds a code by value.
*
*
* @param em The entity manager.
* @param value The value to search for.
* @return The code entity.
@@ -148,10 +150,10 @@ public class CodeEntity extends AbstractEntity {
return null;
}
}
/**
* Returns the active codes of the specified type
*
*
* @param em The entity manager.
* @param email The email to lookup.
* @param type The type.
@@ -163,5 +165,5 @@ public class CodeEntity extends AbstractEntity {
q.setParameter("email", email);
return q.getResultList();
}
}
@@ -1,5 +1,6 @@
package com.maptology.service.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
@@ -10,7 +11,7 @@ import javax.validation.constraints.Pattern;
/**
* An entity to manage email addresses of users.
*
*
* @author Marcus
*/
@Entity
@@ -29,19 +30,20 @@ public class EmailEntity extends AbstractEntity {
@ManyToOne
@JoinColumn(name="user_id")
private UserEntity user;
/**
* The actual email address.
*/
@NotNull
@Pattern(regexp=".+@.+\\..+", message="Invalid email address format.")
@Column(length = 100)
private String address;
/**
* A flag to determine whether this email is verified.
*/
private boolean verified;
/**
* A flag to determine whether this email is the primary email.
*/
@@ -119,5 +121,5 @@ public class EmailEntity extends AbstractEntity {
this.correspondence = correspondence;
}
}
@@ -23,10 +23,10 @@ import com.maptology.api.location.Availability;
@Entity
@Table(name = "location",
indexes = {
@Index(columnList = "timestamp", unique = false)
@Index(columnList = "measurementTime", unique = false)
})
public class LocationEntity extends AbstractEntity {
/**
* The serialization version.
*/
@@ -37,7 +37,7 @@ public class LocationEntity extends AbstractEntity {
*/
@ManyToOne(fetch = FetchType.LAZY)
private DeviceEntity device;
/**
* The (un-) availability information for the entity.
*/
@@ -47,8 +47,8 @@ public class LocationEntity extends AbstractEntity {
/**
* The measurement time of the location.
*/
private long timestamp;
private long measurementTime;
/**
* 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() {
return timestamp;
public long getMeasurementTime() {
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) {
this.timestamp = timestamp;
public void setMeasurementTime(long measurementTime) {
this.measurementTime = measurementTime;
}
/**
@@ -130,5 +130,5 @@ public class LocationEntity extends AbstractEntity {
public void setCoordinate(EmbeddedCoordinate coordinate) {
this.coordinate = coordinate;
}
}
@@ -15,14 +15,14 @@ import javax.persistence.Table;
import javax.validation.constraints.NotNull;
/**
* 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
* items.
*
* 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
* items.
*
* @author Marcus
*/
@Entity
@Table(name = "metadata",
@Table(name = "public_metadata",
indexes = {
@Index(columnList = "tag", unique = false)
})
@@ -31,7 +31,7 @@ import javax.validation.constraints.NotNull;
@IdClass(MetadataId.class)
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class MetadataEntity {
/**
* The reference to the position.
*/
@@ -40,7 +40,7 @@ public class MetadataEntity {
@JoinColumn(name = "position_id")
@ManyToOne(optional = false)
private PositionEntity position;
/**
* The tag to determine the metadata type.
*/
@@ -48,12 +48,12 @@ public class MetadataEntity {
@NotNull
@Column(name="tag", length = 64)
private String tag;
/**
* The value with the actual metadata.
*/
@Lob
@Column(name="value")
@Lob
@Column(name="value")
private String value;
/**
@@ -108,6 +108,6 @@ public class MetadataEntity {
*/
public void setValue(String value) {
this.value = value;
}
}
}
@@ -37,20 +37,20 @@ import com.maptology.api.location.Availability;
/**
* Represents a stored location that has been made available
* for research purposes.
*
*
* @author Marcus
*/
@Entity
@Table(name = "position",
@Table(name = "public_position",
indexes = {
@Index(columnList = "creationTime,timestamp", unique = false),
@Index(columnList = "device,timestamp", unique = false)
@Index(columnList = "creationTime,measurementTime", unique = false),
@Index(columnList = "device,measurementTime", unique = false)
})
@NamedQueries({
@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="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="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")
@@ -68,7 +68,7 @@ public class PositionEntity {
* The id of the device.
*/
private long device;
/**
* The (un-) availability information for the entity.
*/
@@ -87,17 +87,17 @@ public class PositionEntity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "pid_generator")
private long id;
/**
* The creation time of the position item.
*/
private long creationTime;
/**
* The measurement time of the location.
*/
private long timestamp;
private long measurementTime;
/**
* The (optional) coordinate of the location.
*/
@@ -107,43 +107,43 @@ public class PositionEntity {
@AttributeOverride(name="longitude", column=@Column(nullable=true))
})
private EmbeddedCoordinate coordinate;
/**
* The accuracy in meters.
*/
private Double accuracy;
/**
* The altitude in meters.
*/
private Double altitude;
/**
* The speed in m/s.
*/
private Double speed;
/**
* The bearing in degree.
*/
private Double bearing;
/**
* The location provider.
*/
private String provider;
/**
* The app version.
*/
private int version;
/**
* Additional meta data collected for the position.
*/
@OneToMany(mappedBy = "position", fetch = FetchType.LAZY)
private Set<MetadataEntity> metadata = new HashSet<>();
/**
* 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() {
return timestamp;
public long getMeasurementTime() {
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) {
this.timestamp = timestamp;
public void setMeasurementTime(long measurementTime) {
this.measurementTime = measurementTime;
}
/**
@@ -367,7 +367,7 @@ public class PositionEntity {
public void setVersion(int version) {
this.version = version;
}
/**
* Returns the metadata.
*
@@ -388,7 +388,7 @@ public class PositionEntity {
/**
* Returns the last creation time of the position.
*
*
* @param em The entity manager.
* @return The maximum time stamp of creation times.
*/
@@ -402,11 +402,11 @@ public class PositionEntity {
return 0;
}
}
/**
* Returns the number of positions stored.
*
*
* @param em The entity manager.
* @return The number of positions.
*/
@@ -420,10 +420,10 @@ public class PositionEntity {
return 0;
}
}
/**
* Finds all positions for the page.
*
*
* @param em The entity manager.
* @param page The page config.
* @return The positions for the page.
@@ -434,11 +434,11 @@ public class PositionEntity {
q.setMaxResults(page.getSize());
return q.getResultList();
}
/**
* Returns the last creation date of a position for the device.
*
*
* @param em The entity manager.
* @param device The device to search.
* @return The creation time stamp of the last position for the device.
@@ -454,11 +454,11 @@ public class PositionEntity {
return 0;
}
}
/**
* Returns the number of positions for a device.
*
*
* @param em The entity manager.
* @param device The device to search.
* @return The number of positions.
@@ -474,10 +474,10 @@ public class PositionEntity {
return 0;
}
}
/**
* Returns a page of positions for the device.
*
*
* @param em The entity manager.
* @param device The device.
* @param page The page.
@@ -490,10 +490,10 @@ public class PositionEntity {
q.setMaxResults(page.getSize());
return q.getResultList();
}
/**
* Find the positions for a certain set of devices in the specified time range.
*
*
* @param em The entity manager.
* @param devices The devices to search.
* @param start The minimum time to return (inclusive) in epoch milliseconds.
@@ -507,5 +507,5 @@ public class PositionEntity {
q.setParameter("maxTime", start + duration);
return q.getResultList();
}
}
@@ -2,6 +2,7 @@ package com.maptology.service.entity;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.FetchType;
@@ -16,7 +17,7 @@ import javax.validation.constraints.NotNull;
/**
* An entity to define user roles.
*
*
* @author Marcus
*/
@Entity
@@ -36,12 +37,14 @@ public class RoleEntity extends AbstractEntity {
* The name of the role.
*/
@NotNull
@Column(length = 100)
private String name;
/**
* A human readable description of the role.
*/
@NotNull
@Column(length = 100)
private String description;
/**
@@ -94,10 +97,10 @@ public class RoleEntity extends AbstractEntity {
public Set<UserEntity> getUsers() {
return users;
}
/**
* Finds a role with a given name.
*
*
* @param name The name.
* @param em The entity manager.
* @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>() {
@Override
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();
LocationEntity lastLocation = device.getLocation();
for (ReleasedLocation location: update.getLocations()) {
// 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.");
continue;
}
@@ -143,7 +143,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
lastLocation = new LocationEntity();
lastLocation.setAvailability(location.getAvailability());
lastLocation.setDevice(device);
lastLocation.setTimestamp(location.getTimestamp());
lastLocation.setMeasurementTime(location.getTimestamp());
Coordinate c = location.getCoordinate();
if (c != null) {
lastLocation.setCoordinate(new EmbeddedCoordinate(c.getLongitude(), c.getLatitude()));
@@ -440,7 +440,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
last = in.get(i);
} else if (last != null) {
// 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
for (int j = i; j >= 0; j--) {
out.add(0, in.remove(j));
@@ -461,7 +461,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
private static Long getFirst(List<LocationEntity> in) {
for (int i = 0, s = in.size(); i < s; i++) {
if (in.get(i).getCoordinate() != null) {
return in.get(i).getTimestamp();
return in.get(i).getMeasurementTime();
}
}
return null;
@@ -476,7 +476,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
private static Long getLast(List<LocationEntity> in) {
for (int i = in.size() - 1; i >= 0; i--) {
if (in.get(i).getCoordinate() != null) {
return in.get(i).getTimestamp();
return in.get(i).getMeasurementTime();
}
}
return null;
@@ -535,7 +535,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
*/
private static boolean isTooOld(LocationEntity current, Location next, long maxDuration) {
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.setProvider(location.getProvider());
p.setSpeed(location.getSpeed());
p.setTimestamp(location.getTimestamp());
p.setMeasurementTime(location.getTimestamp());
p.setVersion(location.getVersion());
HashSet<MetadataEntity> metadata = new HashSet<>();
if (location.getMetadata() != null) {
@@ -257,7 +257,7 @@ public class PositionSessionBean implements IPositionSessionBean {
p.setOs(location.getOs());
p.setProvider(location.getProvider());
p.setSpeed(location.getSpeed());
p.setTimestamp(location.getTimestamp());
p.setMeasurementTime(location.getTimestamp());
p.setVersion(location.getVersion());
em.persist(p);
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,
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
or contact us.
@@ -4,7 +4,7 @@ Dear ${name},
we have received an account request for a new Maptology account.
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
contact us.
@@ -4,7 +4,7 @@ Dear ${name},
we have received a request for a Maptology account reset.
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
contact us.
@@ -1,9 +1,9 @@
package com.maptology.service.test.login;
import java.security.Principal;
import java.security.acl.Group;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -11,11 +11,15 @@ import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
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 org.jboss.security.SecurityContextAssociation;
import org.jboss.security.SimpleGroup;
import org.jboss.security.auth.spi.UsernamePasswordLoginModule;
import com.maptology.api.access.Roles;
import com.maptology.service.entity.DeviceEntity;
@@ -24,148 +28,211 @@ import com.maptology.service.entity.UserEntity;
import com.maptology.service.principal.MaptologyPrincipal;
/**
* A simple login module that is used for testing. It assigns the
* password "password" for all users, so this can be used consistently.
* In addition, it allows encoding users and devices into a single
* login name by combining the username with the device secret in
* the following form: (login):(device).
*
* A simple login module that is used for testing. It assigns the password
* "password" for all users, so this can be used consistently. In addition, it
* allows encoding users and devices into a single login name by combining the
* username with the device secret in the following form: (login):(device).
*
* @author Marcus
*/
public class LoginModule extends UsernamePasswordLoginModule {
/**
* 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();
}
public class LoginModule implements javax.security.auth.spi.LoginModule {
@Override
protected Group[] getRoleSets() throws LoginException {
SimpleGroup group = new SimpleGroup("Roles");
for (final String r: roles) {
group.addMember(new Principal() {
@Override
public String getName() {
return r;
}
@Override
public String toString() {
return r;
}
});
}
return new Group[] { group };
}
/**
* The group name that wildfly uses to identify the caller principal.
*/
private static final String GROUP_NAME_CALLER = "CallerPrincipal";
@Override
protected String getUsersPassword() throws LoginException {
return "password";
}
/**
* 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 group name that wildfly uses to identify the roles of the caller.
*/
private static final String GROUP_NAME_ROLES = "Roles";
}
/**
* 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.
*
*
* @author Marcus
*/
public class GeocoderBuilder {
@@ -16,26 +16,26 @@ public class GeocoderBuilder {
/**
* 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.
*/
public String url = GEOCODER_URL;
/**
* The socket timeout in seconds.
*/
public Long socketTimeout = null;
/**
* The connection timeout in seconds.
*/
public Long connectionTimeout = null;
/**
* Sets the url.
*
*
* @param url The url to set.
* @return The builder.
*/
@@ -43,10 +43,10 @@ public class GeocoderBuilder {
this.url = url;
return this;
}
/**
* Sets the connection timeout in seconds.
*
*
* @param seconds The connection timeout in seconds.
* @return The builder.
*/
@@ -54,10 +54,10 @@ public class GeocoderBuilder {
this.connectionTimeout = seconds;
return this;
}
/**
* Sets the socket timeout in seconds.
*
*
* @param seconds The socket timeout in seconds.
* @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;
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.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
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.
*
@@ -20,7 +30,7 @@ public class ToolUtilities {
/**
* 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.
@@ -68,5 +78,28 @@ public class ToolUtilities {
double c = 2 * Math.atan2(Math.sqrt(ax), Math.sqrt(1 - ax));
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
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,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
id: 'mapbox/streets-v11'
'Visuals © <a href="https://www.locoslab.com/">LocosLab GmbH</a>'
}).addTo(mymap);
var polylineOptions = {
+2 -1
View File
@@ -11,6 +11,7 @@ dependencies {
task resolveWildfly(type: Copy) {
destinationDir = file("${project.projectDir}")
from { zipTree(configurations.wildfly.singleFile) }
onlyIf { !file("${project.projectDir}/wildfly-${versionWildfly}/").exists() }
}
// make sure wildfly is resolved as part of build
@@ -21,4 +22,4 @@ tasks.register("cleanWildfly") {
doLast {
delete "${project.projectDir}/wildfly-${versionWildfly}/"
}
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
rootProject.name = 'project'
rootProject.name = 'maptology'
include(':common-api')
include(':android-app')
include(':android-feign')
+3 -2
View File
@@ -36,7 +36,6 @@
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
@@ -55,7 +54,9 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "webapp-ng:build"
"baseHref": "/app",
"browserTarget": "webapp-ng:build",
"proxyConfig": "proxy.conf.json"
},
"configurations": {
"production": {
+3
View File
@@ -0,0 +1,3 @@
{
"ngVersion": "9.0.0"
}
+25 -11
View File
@@ -1,9 +1,14 @@
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'
dependencies {
swaggerCodegen 'io.swagger:swagger-codegen-cli:2.4.12'
}
node {
version = '10.16.0'
npmVersion = '6.9.0'
@@ -17,13 +22,6 @@ class IoNodeTask extends com.moowork.gradle.node.task.NodeTask {
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) {
delete './src/api', './dist'
}
@@ -35,11 +33,27 @@ task ngBuild(type: IoNodeTask) {
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
genApi.dependsOn(npmInstall)
genApi.dependsOn(project(":common-api").tasks['build'])
ngBuild.dependsOn(npmInstall)
// generate the api before running ng build
ngBuild.dependsOn("genApi")
ngBuild.dependsOn("generateSwaggerCode")
// run ng build whenever the project is built
build.dependsOn("ngBuild")

Some files were not shown because too many files have changed in this diff Show More