Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb507e9a8c | ||
|
|
e32460116f | ||
|
|
cfb2fcbe2f | ||
|
|
4ea3d60932 | ||
|
|
6c4ca9d622 | ||
|
|
62d0331a32 | ||
|
|
5553dd4757 | ||
|
|
3f89f50492 | ||
|
|
b96615419e | ||
|
|
e1b5c70fb7 | ||
|
|
11f5d372b6 | ||
|
|
bbe51ebbf4 | ||
|
|
8319f56304 | ||
|
|
e9704b46f6 | ||
|
|
34a98136be |
@@ -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.usesPlugin = true
|
||||
gradleBuild.useWrapper = true
|
||||
|
||||
environment {
|
||||
ANDROID_SDK_ROOT = '/var/lib/android-sdk'
|
||||
}
|
||||
@@ -26,43 +19,36 @@ node {
|
||||
// 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'
|
||||
release = true
|
||||
}
|
||||
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" && release) {
|
||||
withCredentials([sshUserPrivateKey(credentialsId: "maptology-server-key", keyFileVariable: "keyfile")]) {
|
||||
sh "scp -i ${keyfile} site-ear/build/libs/site-ear-${version}.ear wildfly@apps.nes.uni-due.de:/opt/wildfly-17-maptology/standalone/deployments/maptology.ear"
|
||||
sh "scp -i ${keyfile} android-app/build/outputs/apk/release/*.apk wildfly@apps.nes.uni-due.de:/opt/android/maptology/"
|
||||
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 or non-release build."
|
||||
|
||||
@@ -22,12 +22,12 @@ configurations {
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
compileSdkVersion 30
|
||||
defaultConfig {
|
||||
applicationId "com.maptology.android.app"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 29
|
||||
versionCode 11
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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: © OpenStreetMap | Visualisierung: © Locoslab GmbH</string>
|
||||
<string name="map_share">Freigabe erstellen</string>
|
||||
<string name="map_mode">Ansicht ändern</string>
|
||||
|
||||
|
||||
<!-- constants used in the notice related views -->
|
||||
<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: © OpenStreetMap | Visualization: © Locoslab GmbH</string>
|
||||
<string name="map_share">Create share</string>
|
||||
<string name="map_mode">Change view</string>
|
||||
|
||||
<!-- constants used in the notice related views -->
|
||||
<string name="menu_notice_update_title">Update</string>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
buildscript {
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.0.0'
|
||||
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.10.0'
|
||||
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.2'
|
||||
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.6'
|
||||
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,15 +43,15 @@ allprojects {
|
||||
versionThorntail = '2.5.0.Final'
|
||||
|
||||
// android stuff
|
||||
versionAndroidxCompat = '1.2.0'
|
||||
versionAndroidxCompat = '1.3.0'
|
||||
versionAndroidxLegacy = '1.0.0'
|
||||
versionAndroidxPreference = '1.1.1'
|
||||
versionAndroidxCard = '1.0.0'
|
||||
versionAndroidxRecycler = '1.1.0'
|
||||
versionAndroidxMaterial = '1.2.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'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,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,2 +1,4 @@
|
||||
android.enableJetifier=true
|
||||
android.useAndroidX=true
|
||||
org.gradle.jvmargs=-Xmx4g
|
||||
org.gradle.parallel=true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#Sat Jun 20 07:42:08 CEST 2020
|
||||
#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-6.1.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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,4 +1,4 @@
|
||||
rootProject.name = 'project'
|
||||
rootProject.name = 'maptology'
|
||||
include(':common-api')
|
||||
include(':android-app')
|
||||
include(':android-feign')
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
],
|
||||
"optimization": true,
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"extractCss": true,
|
||||
"namedChunks": false,
|
||||
"aot": true,
|
||||
|
||||
@@ -13,49 +13,48 @@
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^9.0.1",
|
||||
"@angular/cdk": "^9.0.0",
|
||||
"@angular/common": "^9.0.1",
|
||||
"@angular/compiler": "^9.0.1",
|
||||
"@angular/core": "^9.0.1",
|
||||
"@angular/flex-layout": "^9.0.0-beta.29",
|
||||
"@angular/forms": "^9.0.1",
|
||||
"@angular/material": "^9.0.0",
|
||||
"@angular/platform-browser": "^9.0.1",
|
||||
"@angular/platform-browser-dynamic": "^9.0.1",
|
||||
"@angular/router": "^9.0.1",
|
||||
"@angular/animations": "^11.0.5",
|
||||
"@angular/cdk": "^11.0.3",
|
||||
"@angular/common": "^11.0.5",
|
||||
"@angular/compiler": "^11.0.5",
|
||||
"@angular/core": "^11.0.5",
|
||||
"@angular/flex-layout": "^11.0.0-beta.33",
|
||||
"@angular/forms": "^11.0.5",
|
||||
"@angular/material": "^11.0.3",
|
||||
"@angular/platform-browser": "^11.0.5",
|
||||
"@angular/platform-browser-dynamic": "^11.0.5",
|
||||
"@angular/router": "^11.0.5",
|
||||
"@types/jszip": "^3.1.6",
|
||||
"core-js": "^2.6.9",
|
||||
"jszip": "^3.2.2",
|
||||
"leaflet": "^1.5.1",
|
||||
"ngx-gauge": "^1.0.0",
|
||||
"rxjs": "^6.5.2",
|
||||
"saturn-datepicker": "^8.0.1",
|
||||
"tslib": "^1.10.0",
|
||||
"zone.js": "~0.10.2"
|
||||
"ngx-gauge": "^1.1.0",
|
||||
"rxjs": "^6.6.3",
|
||||
"tslib": "^2.0.0",
|
||||
"zone.js": "~0.10.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "~0.900.2",
|
||||
"@angular/cli": "^9.0.2",
|
||||
"@angular/compiler-cli": "^9.0.1",
|
||||
"@angular/language-service": "^9.0.1",
|
||||
"@angular-devkit/build-angular": "~0.1100.5",
|
||||
"@angular/cli": "^11.0.5",
|
||||
"@angular/compiler-cli": "^11.0.5",
|
||||
"@angular/language-service": "^11.0.5",
|
||||
"@types/jasmine": "^2.8.16",
|
||||
"@types/jasminewd2": "^2.0.6",
|
||||
"@types/leaflet": "^1.4.6",
|
||||
"@types/node": "^12.11.1",
|
||||
"acorn": "^6.2.0",
|
||||
"codelyzer": "^5.1.2",
|
||||
"codelyzer": "^6.0.1",
|
||||
"events": "^3.0.0",
|
||||
"jasmine-core": "^2.8.0",
|
||||
"jasmine-spec-reporter": "^4.2.1",
|
||||
"karma": "^4.2.0",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-coverage-istanbul-reporter": "^1.4.3",
|
||||
"karma-jasmine": "^1.1.0",
|
||||
"karma-jasmine-html-reporter": "^0.2.2",
|
||||
"protractor": "^6.0.0",
|
||||
"jasmine-core": "~3.5.0",
|
||||
"jasmine-spec-reporter": "~5.0.0",
|
||||
"karma": "~5.1.1",
|
||||
"karma-chrome-launcher": "~3.1.0",
|
||||
"karma-coverage-istanbul-reporter": "~3.0.2",
|
||||
"karma-jasmine": "~4.0.0",
|
||||
"karma-jasmine-html-reporter": "^1.5.0",
|
||||
"protractor": "~7.0.0",
|
||||
"ts-node": "~4.1.0",
|
||||
"tslint": "~5.9.1",
|
||||
"typescript": "~3.7.5"
|
||||
"tslint": "~6.1.0",
|
||||
"typescript": "~4.0.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
||||
import { CdkTableModule } from '@angular/cdk/table';
|
||||
import { SatDatepickerModule, SatNativeDateModule } from 'saturn-datepicker';
|
||||
|
||||
import { LocationStrategy, PathLocationStrategy, registerLocaleData, DatePipe } from '@angular/common';
|
||||
import LocaleDE from '@angular/common/locales/de';
|
||||
@@ -220,8 +219,6 @@ registerLocaleData(LocaleDE);
|
||||
MatMenuModule,
|
||||
CdkTableModule,
|
||||
AppRoutingModule,
|
||||
SatDatepickerModule,
|
||||
SatNativeDateModule,
|
||||
MatButtonToggleModule
|
||||
],
|
||||
providers: [
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Time, formatDate } from '@angular/common';
|
||||
import { HttpResponse } from '@angular/common/http';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { DateRange } from '@angular/material/datepicker' ;
|
||||
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { SatDatepickerRangeValue } from 'saturn-datepicker';
|
||||
|
||||
import { Page } from '../utils/pagination';
|
||||
import { DefaultService, VisitPage, Device, Place, Visit } from '../api';
|
||||
@@ -38,8 +37,8 @@ export enum Grouping {
|
||||
RAW = 4 /* Raw data which was extracted from the call to the '/users/current/visits' api */
|
||||
}
|
||||
|
||||
interface DateRange {
|
||||
range?: SatDatepickerRangeValue<Date>;
|
||||
interface TimeSheetRange {
|
||||
range?: DateRange<Date>;
|
||||
begin?: number;
|
||||
end?: number;
|
||||
}
|
||||
@@ -82,7 +81,7 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
|
||||
private _prevDevice: Device = null;
|
||||
private _breakTime: number = null;
|
||||
private _prevBreakTime: number = null;
|
||||
private _dateRange: DateRange = {};
|
||||
private _dateRange: TimeSheetRange = { range: new DateRange<Date>(null, null), begin: null, end: null };
|
||||
private _workPlaces: Place[] = [];
|
||||
|
||||
/** Creates an empty page. */
|
||||
@@ -149,13 +148,13 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
|
||||
this.updateTimeSheet();
|
||||
}
|
||||
|
||||
get dateRange(): SatDatepickerRangeValue<Date> | null {
|
||||
get dateRange(): DateRange<Date> {
|
||||
return this._dateRange.range;
|
||||
}
|
||||
|
||||
set dateRange(dateRange: SatDatepickerRangeValue<Date> | null) {
|
||||
if (dateRange !== null) {
|
||||
const beginMillis = dateRange.begin.getTime();
|
||||
set dateRange(dateRange: DateRange<Date>) {
|
||||
if (dateRange.start != null && dateRange.end != null) {
|
||||
const beginMillis = dateRange.start.getTime();
|
||||
const endMillis = new Date(dateRange.end.getTime() + TimeSheetService.DAY_IN_MILLI).getTime();
|
||||
this._dateRange = {
|
||||
range: dateRange,
|
||||
@@ -163,7 +162,7 @@ export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
|
||||
end: endMillis
|
||||
};
|
||||
} else {
|
||||
this._dateRange = {};
|
||||
this._dateRange = { range: dateRange, begin: null, end: null };
|
||||
}
|
||||
this.updateTimeSheet();
|
||||
}
|
||||
|
||||
@@ -84,13 +84,17 @@
|
||||
</mat-list-item>
|
||||
<mat-list-item class="vrt-margin">
|
||||
<mat-form-field class="hrz-margin" [matTooltip]="res.strings('time_sheet_time_period_tooltip')">
|
||||
<input matInput
|
||||
[placeholder]="res.strings('time_sheet_time_period_label')"
|
||||
[satDatepicker]="picker"
|
||||
[value]="timeSheetService.dateRange"
|
||||
(dateChange)="timeSheetService.dateRange = $event.target.value">
|
||||
<sat-datepicker #picker [rangeMode]="true" orderPeriodLabel="month"></sat-datepicker>
|
||||
<sat-datepicker-toggle matSuffix [for]="picker"></sat-datepicker-toggle>
|
||||
<mat-label>{{ res.strings('time_sheet_time_period_label') }}</mat-label>
|
||||
<mat-date-range-input [rangePicker]="picker">
|
||||
<input matStartDate placeholder="Start date"
|
||||
[value]="timeSheetService.dateRange.start"
|
||||
(dateChange)="setStart($event.target.value)">
|
||||
<input matEndDate placeholder="End date"
|
||||
[value]="timeSheetService.dateRange.end"
|
||||
(dateChange)="setEnd($event.target.value)">
|
||||
</mat-date-range-input>
|
||||
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
|
||||
<mat-date-range-picker #picker></mat-date-range-picker>
|
||||
</mat-form-field>
|
||||
</mat-list-item>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Time, formatDate } from '@angular/common';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { DateRange } from '@angular/material/datepicker';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
import { DeviceService } from '../services/device.service';
|
||||
@@ -191,4 +192,12 @@ export class TimeSheetComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
this.displayedColumns = TimeSheetComponent.normalDisplayCol;
|
||||
}
|
||||
}
|
||||
|
||||
setStart(date: Date) {
|
||||
this.timeSheetService.dateRange = new DateRange<Date>(date, this.timeSheetService.dateRange.end);
|
||||
}
|
||||
|
||||
setEnd(date: Date) {
|
||||
this.timeSheetService.dateRange = new DateRange<Date>(this.timeSheetService.dateRange.start, date);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
@import '~@angular/material/theming';
|
||||
@import '~saturn-datepicker/theming';
|
||||
// Plus imports for other components in your app.
|
||||
|
||||
// Include the common styles for Angular Material. We include this here so that you only
|
||||
@@ -32,4 +31,3 @@ $app-theme: mat-light-theme($app-primary, $app-accent, $app-warn);
|
||||
// Alternatively, you can import and @include the theme mixins for each component
|
||||
// that you are using.
|
||||
@include angular-material-theme($app-theme);
|
||||
@include sat-datepicker-theme($app-theme);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"../node_modules/jszip/dist/jszip.min.js"
|
||||
]
|
||||
},
|
||||
"module": "esnext",
|
||||
"module": "es2020",
|
||||
"baseUrl": "./"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,6 @@
|
||||
"no-trailing-whitespace": true,
|
||||
"no-unnecessary-initializer": true,
|
||||
"no-unused-expression": true,
|
||||
"no-use-before-declare": true,
|
||||
"no-var-keyword": true,
|
||||
"object-literal-sort-keys": false,
|
||||
"one-line": [
|
||||
|
||||