12 Commits
Author SHA1 Message Date
Marcus Handte 1a1219625f Release 1.0.1
LocationBasedServices/maptology/master This commit looks good
2019-08-07 15:32:54 +02:00
Marcus Handte 7633ca1053 Migrate app to androidx.
LocationBasedServices/maptology/master This commit looks good
2019-08-07 15:18:32 +02:00
Marcus Handte 274b9cb259 Fix outer join, reduce android liniting warnings.
LocationBasedServices/maptology/master This commit looks good
Fix spelling in strings.
Move filter condition in on of outer join.
Fix layout issues and remove unused resources.
Add target api to settings fragment.
Increase version number of app.
2019-08-07 13:55:50 +02:00
handte 9876848156 Fix order query, add terms, fix app icon, support Android 9.
LocationBasedServices/maptology/master This commit looks good
Closes #62 Change place and visit join to outer join.
Closes #61 Add attribution and open source licenses to app and webapp.
Closes #60 Change icon shape of Android app.
Closes #59 Add missing foreground service permission.
2019-08-07 12:47:48 +02:00
handte e193eec1f8 Add user interface to webapp to sort places.
LocationBasedServices/maptology/master This commit looks good
Closes #57 Support to sort places
2019-08-06 18:28:51 +02:00
handte 8922e67858 Add configurable order criterion to place pages.
LocationBasedServices/maptology/master This commit looks good
2019-08-06 16:33:58 +02:00
Marcus Handte a86053b4e3 Finalize app layout improvements.
LocationBasedServices/maptology/master This commit looks good
Limit size of views on large screens and make sure they are centered.
Improve start screen proportions to improve looks on landscape mode.
2019-08-05 13:58:17 +02:00
Marcus Handte 44a1543c6d Add account linking to android app.
LocationBasedServices/maptology/master This commit looks good
Closes #55 Allow linking of accounts after initialization.
Improve recycler view layouts on 10+ inch tablets.
Improve drawer menu using groups and revert strings to verbs.
2019-08-05 11:19:22 +02:00
Marcus Handte f351ad1412 Improve handling of multiple headers.
LocationBasedServices/maptology/master This commit looks good
2019-08-05 09:14:19 +02:00
Marcus Handte 4aea00d0b0 Improve tests, add rest method to associate user and device.
LocationBasedServices/maptology/master This commit looks good
Impove test stability (hopefully) by using direct references to ejbs.
Add documentation to tests and improve naming in helper classes.
Add new api to associate an existing device with a user account.
2019-08-04 14:59:59 +02:00
Marcus Handte 8b9fdf6aa1 Remove outdated files.
LocationBasedServices/maptology/master This commit looks good
2019-08-04 12:08:17 +02:00
Marcus Handte 6429ee23ef Update to 1.0.1-SNAPSHOT
LocationBasedServices/maptology/master There was a failure building this commit
2019-08-04 12:05:50 +02:00
123 changed files with 18371 additions and 16107 deletions
+12 -11
View File
@@ -3,16 +3,16 @@ description = "Maptology Android App"
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation project(":android-feign")
implementation "com.android.support:support-v4:${versionSupport}"
implementation "com.android.support:appcompat-v7:${versionSupport}"
implementation "com.android.support:design:${versionSupport}"
implementation "com.android.support:preference-v7:${versionSupport}"
implementation "com.android.support:cardview-v7:${versionSupport}"
implementation "com.android.support:recyclerview-v7:${versionSupport}"
implementation "androidx.legacy:legacy-support-v4:${versionAndroidx}"
implementation "androidx.appcompat:appcompat:${versionAndroidx}"
implementation "androidx.preference:preference:${versionAndroidx}"
implementation "androidx.cardview:cardview:${versionAndroidx}"
implementation "androidx.recyclerview:recyclerview:${versionAndroidx}"
implementation "com.google.android.material:material:${versionAndroidx}"
implementation "com.google.android.gms:play-services-oss-licenses:${versionPlay}"
testImplementation "junit:junit:${versionJunit}"
testImplementation "org.robolectric:robolectric:${versionRobolectric}"
testImplementation "org.robolectric:shadows-supportv4:${versionRobolectric}"
testImplementation "androidx.test:core:${versionAndroidx}"
testImplementation "androidx.test:core:${versionAndroidxTest}"
}
configurations {
@@ -27,10 +27,10 @@ android {
applicationId "com.maptology.android.app"
minSdkVersion 14
targetSdkVersion 28
versionCode 4
versionName "1.0.0"
versionCode 5
versionName "1.0.1"
buildConfigField "long", "BUILD_TIME", System.currentTimeMillis() + "L"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
@@ -62,6 +62,7 @@ android {
disable 'RtlSymmetry', 'RelativeOverlap'
// abortOnError false
}
}
tasks.register('makeEclipseDir') {
+3
View File
@@ -9,6 +9,7 @@
<uses-permission android:name="android.permission.ACCESS_COARSE_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" />
<!-- required for notification with LED lights, this is idiotic -->
<uses-permission android:name="android.permission.VIBRATE"/>
@@ -50,9 +51,11 @@
android:exported="false"
android:label="@string/application_long">
</activity>
<activity
android:launchMode="singleTask"
android:name=".MainActivity"
android:windowSoftInputMode="adjustResize"
android:exported="true"
android:label="@string/application_long">
</activity>
+3
View File
@@ -71,4 +71,7 @@
<p>Email: <a href="mailto:marcus.handte@uni-due.de">marcus.handte@uni-due.de</a></p>
<h2>Lizenzhinweise</h2>
<p>Grundlage unserer Kartendarstellung und unserer Adressauflösung sind die Daten der <a href="http://www.openstreetmap.org">OpenStreetMap</a>, die gemäß der <a href="https://opendatacommons.org/licenses/odbl/">Open Data Commons Open Database Lizenz</a> (ODbL) durch die <a href="https://osmfoundation.org/">OpenStreetMap Foundation</a> (OSMF) verfügbar sind (© OpenStreetMap-Mitwirkende). Die Visualisierung der Kartendaten erfolgt mit Hilfe einer Bibliothek zur Bilderzeugung der<a href="http://www.locoslab.com"> Locoslab GmbH</a>. Die Auflösung von Adressen wird ebenfalls über Werkzeuge der <a href="http://www.locoslab.com">Locoslab GmbH</a> bewerkstelligt. Weitere Hinweise zu den Lizenzen verwendeten Bibliotheken findest Du in den Einstellungen der Android App und am unteren Rand der Webanwendung.</p>
</body></html>
@@ -39,10 +39,10 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.PowerManager;
import android.os.SystemClock;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.pm.PackageInfoCompat;
import androidx.core.app.ActivityCompat;
import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.pm.PackageInfoCompat;
import android.util.Log;
/**
@@ -1,12 +1,14 @@
package com.maptology.android.app;
import com.maptology.android.app.fragment.LoginFragment;
import com.maptology.android.app.fragment.AbstractLoginFragment;
import com.maptology.android.app.fragment.LoginCreateFragment;
import com.maptology.android.app.fragment.LoginUpdateFragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.appcompat.app.AppCompatActivity;
/**
* The activity to login or create a device. The
@@ -23,11 +25,25 @@ public class LoginActivity extends AppCompatActivity {
setContentView(R.layout.activity_login);
Fragment f = getSupportFragmentManager().findFragmentById(R.id.coordinator);
if (f == null) {
// do everything in the fragment
AbstractLoginFragment loginFragment = null;
if (getApp().getRepository().deviceHandle.getValue() == null) {
loginFragment = new LoginCreateFragment();
} else {
loginFragment = new LoginUpdateFragment();
}
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.coordinator, new LoginFragment());
ft.replace(R.id.coordinator, loginFragment);
ft.commit();
}
}
private MaptologyApp getApp() {
return (MaptologyApp) getApplicationContext();
}
@Override
protected void onDestroy() {
if (isFinishing()) getApp().getRepository().creatingDevice.setValue(null);
super.onDestroy();
}
}
@@ -18,19 +18,21 @@ import com.maptology.android.feign.model.User;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.content.PermissionChecker;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import androidx.annotation.NonNull;
import com.google.android.material.navigation.NavigationView;
import androidx.core.app.ActivityCompat;
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 android.util.Log;
import android.view.MenuItem;
import android.view.View;
@@ -86,6 +88,21 @@ public class MainActivity extends AppCompatActivity implements
}
};
/**
* Updates the visibility of the menu items based on the login state.
*/
private IValueListener<DeviceHandle> deviceListener = new IValueListener<DeviceHandle>() {
@Override
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);
connect.setVisible(newValue.getUser() == null);
webapp.setVisible(newValue.getUser() != null);
}
}
};
/**
* Navigation Drawer menu.
*/
@@ -128,10 +145,12 @@ public class MainActivity extends AppCompatActivity implements
protected void onResume() {
super.onResume();
app.getRepository().user.addValueListener(userListener, true);
app.getRepository().deviceHandle.addValueListener(deviceListener, true);
}
@Override
protected void onPause() {
app.getRepository().deviceHandle.removeValueListener(deviceListener);
app.getRepository().user.removeValueListener(userListener);
super.onPause();
}
@@ -154,26 +173,27 @@ public class MainActivity extends AppCompatActivity implements
switch (item.getItemId()) {
case R.id.menu_notice:
setScreen(Screen.NOTICE);
closeDrawerIfNeeded();
break;
case R.id.menu_map:
setScreen(Screen.MAP);
closeDrawerIfNeeded();
break;
case R.id.menu_share:
createShare();
closeDrawerIfNeeded();
break;
case R.id.menu_manage:
setScreen(Screen.MANAGE);
closeDrawerIfNeeded();
break;
case R.id.menu_settings:
showSettings();
closeDrawerIfNeeded();
break;
case R.id.menu_connect:
showLogin();
break;
case R.id.menu_webapp:
showPlaces();
break;
}
closeDrawerIfNeeded();
return false;
}
});
@@ -348,6 +368,16 @@ public class MainActivity extends AppCompatActivity implements
showSlave(new SettingsFragment());
}
private void showLogin() {
startActivity(new Intent(this, LoginActivity.class));
}
private void showPlaces() {
// start browser to goto places
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.maptology_url_places)));
startActivity(intent);
}
private void showSlave(Fragment fragment) {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.container, fragment);
@@ -1,6 +1,9 @@
package com.maptology.android.app;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import com.maptology.android.app.location.LocationStore;
import com.maptology.android.app.notice.NoticeStore;
@@ -16,7 +19,7 @@ import com.maptology.android.feign.model.Message;
import android.app.Application;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import android.util.Log;
import feign.RequestInterceptor;
import feign.RequestTemplate;
@@ -195,6 +198,19 @@ public class MaptologyApp extends Application {
ApiClient client = new ApiClient();
client.setBasePath(getMaptologyUrl());
client.addAuthorization("basic", new BasicAuthRequestInterceptor(username, password));
if (repository.deviceHandle.getValue() != null) {
final String token = repository.deviceHandle.getValue().getToken();
client.addAuthorization("bearer", new RequestInterceptor() {
@Override
public void apply(RequestTemplate requestTemplate) {
Collection<String> headers = requestTemplate.headers().get("Authorization");
List<String> newHeaders = new ArrayList<>();
if (headers != null) newHeaders.addAll(headers);
newHeaders.add("Bearer " + token);
requestTemplate.header("Authorization", newHeaders);
}
});
}
return client.buildClient(DefaultApi.class);
}
@@ -5,15 +5,13 @@ import com.maptology.android.app.fragment.TermsFragment;
import com.maptology.android.app.model.Grant;
import com.maptology.android.app.repository.Repository;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
/**
@@ -7,7 +7,7 @@ import com.maptology.android.app.util.DateFormatter;
import com.maptology.android.feign.model.Location;
import com.maptology.android.feign.model.ShareInfo;
import android.support.v7.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
@@ -6,8 +6,8 @@ import com.maptology.android.app.model.Grant;
import com.maptology.android.app.share.ShareStore;
import android.database.Cursor;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -6,8 +6,8 @@ import com.maptology.android.app.notice.NoticeContract;
import com.maptology.android.app.util.DateFormatter;
import android.database.Cursor;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -6,8 +6,8 @@ import com.maptology.android.app.model.LocalShare;
import com.maptology.android.app.share.ShareStore;
import android.database.Cursor;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -4,8 +4,8 @@ import com.maptology.android.app.MaptologyApp;
import com.maptology.android.app.repository.Repository;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.util.Log;
/**
@@ -1,72 +1,81 @@
package com.maptology.android.app.fragment;
import com.maptology.android.app.MainActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.appcompat.app.AlertDialog;
import android.text.method.PasswordTransformationMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.maptology.android.app.R;
import com.maptology.android.app.repository.AsyncError;
import com.maptology.android.app.repository.AsyncInteraction;
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.CreateDeviceTask;
import com.maptology.android.feign.model.DeviceHandle;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
/**
* Fragment that handles the login.
* A base class for fragment that handle the login.
*
* @author sarah
*/
public class LoginFragment extends AbstractFragment {
/**
* The listener that keeps track of the device creation.
*/
private IValueListener<DeviceHandle> deviceListener = new IValueListener<DeviceHandle>() {
@Override
public void onValueChanged(Value<DeviceHandle> source, DeviceHandle oldValue, DeviceHandle newValue) {
if (newValue != null) {
Intent intent = new Intent();
intent.setClass(getActivity(), MainActivity.class);
getActivity().startActivity(intent);
getActivity().finish();
}
}
};
public abstract class AbstractLoginFragment extends AbstractFragment {
private Button loginButton;
private Button noLoginButton;
private ImageButton passwordButton;
private TextView registerText;
private EditText usernameText;
private EditText passwordText;
private AlertDialog dialog;
private ProgressBar progressBar;
private int title;
private int explanation;
private int login;
/**
* The listener that listens to changes announced by the async task.
*/
private IValueListener<AsyncInteraction> creationListener = new IValueListener<AsyncInteraction>() {
private IValueListener<AsyncInteraction> loginListener = new IValueListener<AsyncInteraction>() {
@Override
public void onValueChanged(Value<AsyncInteraction> source, AsyncInteraction oldValue, AsyncInteraction newValue) {
onUpdateInteraction(newValue);
}
};
/**
* Creates a login fragment with the specified title resource,
* explanation resource and login button resource.
*
* @param title The string resource with the title.
* @param explanation The string resource with the explanation.
* @param login The string resource with the login button.
*/
public AbstractLoginFragment(int title, int explanation, int login) {
this.title = title;
this.explanation = explanation;
this.login = login;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_login, container, false);
TextView titleView = (TextView)view.findViewById(R.id.login_title);
titleView.setText(title);
TextView explainView = (TextView)view.findViewById(R.id.login_explain);
explainView.setText(explanation);
loginButton = (Button) view.findViewById(R.id.button_login);
loginButton.setText(login);
noLoginButton = (Button) view.findViewById(R.id.button_no_login);
registerText = (TextView) view.findViewById(R.id.text_register);
usernameText = (EditText) view.findViewById(R.id.input_username);
@@ -85,19 +94,30 @@ public class LoginFragment extends AbstractFragment {
builder.setMessage(R.string.login_failed_msg);
builder.setPositiveButton(android.R.string.ok, null);
builder.create().show();
return;
} else {
onLogin(username, password);
}
}
});
passwordButton = (ImageButton) view.findViewById(R.id.button_password);
passwordButton.setOnClickListener(new View.OnClickListener() {
private boolean visible = false;
@Override
public void onClick(View v) {
visible = !visible;
if (visible) {
passwordButton.setImageResource(R.drawable.ic_visibility_off_black_24dp);
passwordText.setTransformationMethod(null);
} else {
passwordButton.setImageResource(R.drawable.ic_visibility_black_24dp);
passwordText.setTransformationMethod(new PasswordTransformationMethod());
}
CreateDeviceTask task = new CreateDeviceTask(getApp(), username, password);
task.execute();
}
});
noLoginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getApp().getRepository().setAnalyzeable(false);
CreateDeviceTask task = new CreateDeviceTask(getApp());
task.execute();
onContinue();
}
});
registerText.setOnClickListener(new View.OnClickListener() {
@@ -111,6 +131,10 @@ public class LoginFragment extends AbstractFragment {
return view;
}
public abstract void onLogin(String username, String password);
public abstract void onContinue();
private void onUpdateInteraction(AsyncInteraction interaction) {
if (interaction == null) {
setEnabled(true);
@@ -172,15 +196,13 @@ public class LoginFragment extends AbstractFragment {
public void onResume() {
super.onResume();
Repository repository = getRepository();
repository.creatingDevice.addValueListener(creationListener, true);
repository.deviceHandle.addValueListener(deviceListener, true);
repository.creatingDevice.addValueListener(loginListener, true);
}
@Override
public void onPause() {
Repository repository = getRepository();
repository.deviceHandle.removeValueListener(deviceListener);
repository.creatingDevice.removeValueListener(creationListener);
repository.creatingDevice.removeValueListener(loginListener);
super.onPause();
}
}
@@ -3,7 +3,7 @@ package com.maptology.android.app.fragment;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import androidx.fragment.app.DialogFragment;
/**
* A simple dialog with a date picker.
@@ -6,7 +6,7 @@ import com.maptology.android.app.map.MapMode;
import com.maptology.android.app.model.Grant;
import android.os.Bundle;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -7,13 +7,13 @@ import com.maptology.android.app.R;
import com.maptology.android.app.model.Grant;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.fragment.app.FragmentTransaction;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -15,10 +15,10 @@ import com.maptology.android.app.util.TabletUtil;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import androidx.annotation.Nullable;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -132,7 +132,7 @@ public class GrantListFragment extends AbstractFragment {
explainText = view.findViewById(R.id.fragment_list_grant_explain);
recyclerView = (RecyclerView) view.findViewById(R.id.grant_recycler);
int span = (TabletUtil.isLandscapeTablet(view.getContext()))?2:1;
recyclerView.setLayoutManager(new GridLayoutManager(container.getContext(), span));
recyclerView.setLayoutManager(new StaggeredGridLayoutManager(span, StaggeredGridLayoutManager.VERTICAL));
swipeRefreshLayout = (SwipeRefreshLayout)view.findViewById(R.id.fragment_grant_swipe);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
@@ -0,0 +1,71 @@
package com.maptology.android.app.fragment;
import com.maptology.android.app.MainActivity;
import com.maptology.android.app.R;
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.CreateDeviceTask;
import com.maptology.android.feign.model.DeviceHandle;
import android.content.Intent;
import androidx.appcompat.app.AlertDialog;
/**
* Fragment that handles the login.
*
* @author sarah
*/
public class LoginCreateFragment extends AbstractLoginFragment {
/**
* The listener that keeps track of the device creation.
*/
private IValueListener<DeviceHandle> deviceListener = new IValueListener<DeviceHandle>() {
@Override
public void onValueChanged(Value<DeviceHandle> source, DeviceHandle oldValue, DeviceHandle newValue) {
if (newValue != null) {
Intent intent = new Intent();
intent.setClass(getActivity(), MainActivity.class);
getActivity().startActivity(intent);
getActivity().finish();
}
}
};
/**
* Creates the fragment and sets the strings.
*/
public LoginCreateFragment() {
super(R.string.login_title_create, R.string.login_explain_create, R.string.login_button_create);
}
@Override
public void onLogin(String username, String password) {
CreateDeviceTask task = new CreateDeviceTask(getApp(), username, password);
task.execute();
}
@Override
public void onContinue() {
getApp().getRepository().setAnalyzeable(false);
CreateDeviceTask task = new CreateDeviceTask(getApp());
task.execute();
}
@Override
public void onResume() {
super.onResume();
Repository repository = getRepository();
repository.deviceHandle.addValueListener(deviceListener, true);
}
@Override
public void onPause() {
Repository repository = getRepository();
repository.deviceHandle.removeValueListener(deviceListener);
super.onPause();
}
}
@@ -0,0 +1,64 @@
package com.maptology.android.app.fragment;
import android.content.Intent;
import com.maptology.android.app.MainActivity;
import com.maptology.android.app.R;
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.UpdateDeviceTask;
import com.maptology.android.feign.model.DeviceHandle;
/**
* A fragment that enables the user to associate an existing device
* with an account.
*
* @author Marcus
*/
public class LoginUpdateFragment extends AbstractLoginFragment {
/**
* The listener that keeps track of the device updates.
*/
private IValueListener<DeviceHandle> deviceListener = new IValueListener<DeviceHandle>() {
@Override
public void onValueChanged(Value<DeviceHandle> source, DeviceHandle oldValue, DeviceHandle newValue) {
if (newValue != null && newValue.getUser() != null) {
getActivity().finish();
}
}
};
/**
* Creates the fragment and sets the strings.
*/
public LoginUpdateFragment() {
super(R.string.login_title_update, R.string.login_explain_update, R.string.login_button_update);
}
@Override
public void onLogin(String username, String password) {
UpdateDeviceTask task = new UpdateDeviceTask(getApp(), username, password);
task.execute();
}
@Override
public void onContinue() {
getActivity().finish();
}
@Override
public void onResume() {
super.onResume();
Repository repository = getRepository();
repository.deviceHandle.addValueListener(deviceListener, true);
}
@Override
public void onPause() {
Repository repository = getRepository();
repository.deviceHandle.removeValueListener(deviceListener);
super.onPause();
}
}
@@ -3,7 +3,7 @@ package com.maptology.android.app.fragment;
import com.maptology.android.app.R;
import android.os.Bundle;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -3,12 +3,12 @@ package com.maptology.android.app.fragment;
import com.maptology.android.app.R;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import androidx.annotation.Nullable;
import com.google.android.material.tabs.TabLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -1,9 +1,7 @@
package com.maptology.android.app.fragment;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.locoslab.android.leafless.IMapStateListener;
import com.locoslab.android.leafless.ITouchListener;
@@ -33,12 +31,12 @@ import com.maptology.android.feign.model.Coordinate;
import android.database.Cursor;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.util.LongSparseArray;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.fragment.app.FragmentTransaction;
import androidx.collection.LongSparseArray;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -8,10 +8,10 @@ import com.maptology.android.app.task.SyncNoticeTask;
import com.maptology.android.app.util.TabletUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import androidx.annotation.Nullable;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -89,7 +89,8 @@ public class NoticeListFragment extends AbstractFragment {
swipeLayout.setOnRefreshListener(refreshListener);
recyclerView = (RecyclerView)v.findViewById(R.id.fragment_notice_recycler);
int span = (TabletUtil.isLandscapeTablet(v.getContext()))?2:1;
recyclerView.setLayoutManager(new GridLayoutManager(container.getContext(), span));
StaggeredGridLayoutManager glm = new StaggeredGridLayoutManager(span, StaggeredGridLayoutManager.VERTICAL);
recyclerView.setLayoutManager(glm);
return v;
}
@@ -2,15 +2,15 @@
package com.maptology.android.app.fragment;
import java.text.SimpleDateFormat;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity;
import com.maptology.android.app.BuildConfig;
import com.maptology.android.app.MaptologyApp;
import com.maptology.android.app.R;
import com.maptology.android.app.repository.Repository;
import com.maptology.android.feign.model.DeviceHandle;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
@@ -21,12 +21,12 @@ import android.content.pm.PackageInfo;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.support.v4.content.pm.PackageInfoCompat;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceCategory;
import android.support.v7.preference.PreferenceFragmentCompat;
import android.support.v7.preference.PreferenceGroup;
import android.support.v7.preference.PreferenceScreen;
import androidx.core.content.pm.PackageInfoCompat;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceGroup;
import androidx.preference.PreferenceScreen;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -71,6 +71,11 @@ public class SettingsFragment extends PreferenceFragmentCompat {
*/
private static final String KEY_ABOUT_TERMS = "about_terms";
/**
* The key to show the oss licenses.
*/
private static final String KEY_ABOUT_LICENSES = "about_licenses";
/**
* Key to clear the cache.
*/
@@ -145,6 +150,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
bindReset();
bindClear();
bindTerms();
bindLicenses();
return v;
}
@@ -244,6 +250,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
* otherwise it will open the channel settings.
* @return The preference listener to trigger the action.
*/
@TargetApi(26)
private Preference.OnPreferenceClickListener createNotificationSettingsListener(final String packageName, final String channelId) {
return new Preference.OnPreferenceClickListener() {
@Override
@@ -328,6 +335,17 @@ public class SettingsFragment extends PreferenceFragmentCompat {
}
private void bindLicenses() {
setClickListener(KEY_ABOUT_LICENSES, new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
OssLicensesMenuActivity.setActivityTitle(getString(R.string.setting_about_licenses_title));
startActivity(new Intent(getApp(), OssLicensesMenuActivity.class));
return false;
}
});
}
/**
* Enables the developmentGroup mode.
*/
@@ -21,8 +21,8 @@ import android.app.TimePickerDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import androidx.annotation.Nullable;
import com.google.android.material.snackbar.Snackbar;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
@@ -6,9 +6,9 @@ import com.maptology.android.app.model.LocalShare;
import com.maptology.android.app.util.TabletUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -81,7 +81,7 @@ public class ShareListFragment extends AbstractFragment {
explainText = view.findViewById(R.id.fragment_list_share_explain);
recyclerView = (RecyclerView) view.findViewById(R.id.share_recycler);
int span = (TabletUtil.isLandscapeTablet(view.getContext()))?2:1;
recyclerView.setLayoutManager(new GridLayoutManager(container.getContext(), span));
recyclerView.setLayoutManager(new StaggeredGridLayoutManager(span, StaggeredGridLayoutManager.VERTICAL));
return view;
}
@@ -9,7 +9,7 @@ import android.net.MailTo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -3,7 +3,7 @@ package com.maptology.android.app.fragment;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import androidx.fragment.app.DialogFragment;
/**
* A simple fragment that shows a time picker dialog.
@@ -13,8 +13,8 @@ import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.util.Log;
/**
@@ -6,8 +6,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.util.Log;
/**
@@ -12,8 +12,8 @@ import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.util.Log;
/**
@@ -7,7 +7,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import android.content.Context;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.util.Log;
/**
@@ -3,8 +3,8 @@ package com.maptology.android.app.repository;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/**
* A value that can be observed by a value listener.
@@ -12,8 +12,8 @@ import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.util.Log;
/**
@@ -19,8 +19,8 @@ import android.content.Intent;
import android.content.pm.PackageInfo;
import android.graphics.Color;
import android.os.Build;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.pm.PackageInfoCompat;
import androidx.core.app.NotificationCompat;
import androidx.core.content.pm.PackageInfoCompat;
import android.util.Log;
/**
@@ -0,0 +1,162 @@
package com.maptology.android.app.task;
import android.os.Build;
import android.util.Log;
import com.maptology.android.app.MaptologyApp;
import com.maptology.android.app.R;
import com.maptology.android.app.repository.AsyncError;
import com.maptology.android.app.repository.AsyncInteraction;
import com.maptology.android.feign.model.Device;
import com.maptology.android.feign.model.DeviceHandle;
import com.maptology.android.feign.model.DeviceInfo;
import com.maptology.android.feign.model.User;
import java.net.HttpURLConnection;
import feign.FeignException;
/**
* A task that will associate an existing device with a user.
* The task will report the result through the repository.
*
* @author Marcus
*/
public class UpdateDeviceTask extends AbstractApiTask<Void, Void, AsyncError> {
/**
* The log tag for the task.
*/
private static final String TAG = "UpdateDeviceTask";
/**
* The error code for network errors.
*/
public static final int ERROR_NETWORK = 1;
/**
* The error code for login errors.
*/
public static final int ERROR_LOGIN = 2;
/**
* The error code if the device has been associated already.
*/
public static final int ERROR_UPDATE = 3;
/**
* The optional username.
*/
private String username;
/**
* The optional password.
*/
private String password;
/**
* The device that has been registered.
*/
private Device device;
/**
* The user that has been fetched.
*/
private User user;
/**
* Creates a create device task with the specified username and
* password.
*
* @param app The app.
* @param username The username.
* @param password The password.
*/
public UpdateDeviceTask(MaptologyApp app, String username, String password) {
super(app);
this.username = username;
this.password = password;
apiClient = app.getApiClient(username, password);
}
/**
* Executes the task.
*/
public void execute() {
app.getRepository().creatingDevice.setValue(new AsyncInteraction(false));
super.execute(new Void[0]);
}
@Override
protected AsyncError doInBackground(Void... voids) {
try {
user = apiClient.getCurrentUser();
Log.d(TAG, "Login success for " + username + " with id " + (user==null?"":user.getId()) + ".");
} catch (FeignException e) {
Log.d(TAG, "Login failure for user: " + e.status() + " " + e.getMessage());
return getError(e);
}
try {
device = apiClient.getCurrentDevice();
Log.d(TAG, "Login success for device with id " + (device==null?"":device.getId()) + ".");
} catch (FeignException e) {
Log.d(TAG, "Login failure for device:" + e.status() + " " + e.getMessage());
return getError(e);
}
try {
device = apiClient.setCurrentDeviceUser();
Log.d(TAG, "Device associated for user id " + device.getUser() + ".");
} catch (FeignException e) {
Log.d(TAG, "Device creation failure: " + e.status() + " " + e.getMessage());
return getError(e);
}
return null;
}
/**
* Converts a feign exception into an error.
*
* @param e The exception.
* @return The associated error.
*/
private AsyncError getError(FeignException e) {
if (e.status() == HttpURLConnection.HTTP_FORBIDDEN) {
return new AsyncError(ERROR_LOGIN, R.string.login_failed_msg);
} else if (e.status() == HttpURLConnection.HTTP_CONFLICT) {
return new AsyncError(ERROR_UPDATE, R.string.login_conflict_msg);
} else {
return new AsyncError(ERROR_NETWORK, R.string.login_device_failed);
}
}
@Override
protected void onPostExecute(AsyncError asyncError) {
AsyncInteraction interaction;
if (asyncError == null) {
interaction = new AsyncInteraction(true);
} else if (asyncError.getCode() == ERROR_LOGIN || asyncError.getCode() == ERROR_UPDATE){
// do not allow retry when username and password are wrong
interaction = new AsyncInteraction(asyncError);
} else {
// allow retry for everything else
final UpdateDeviceTask retry = new UpdateDeviceTask(app, username, password);
interaction = new AsyncInteraction(asyncError, new Runnable() {
@Override
public void run() {
retry.execute();
}
});
}
app.getRepository().creatingDevice.setValue(interaction);
DeviceHandle handle = app.getRepository().deviceHandle.getValue();
if (device != null && device.getUser() != null) {
Log.d(TAG, "Updating device handle.");
handle.setUser(device.getUser());
app.getRepository().deviceHandle.setValue(handle);
if (user != null && device.getUser().equals(user.getId())) {
Log.d(TAG, "Setting user directly.");
app.getRepository().user.setValue(user);
} else {
Log.d(TAG, "Setting user via task.");
new UpdateUserTask(app).execute();
}
}
}
}
@@ -7,7 +7,7 @@ import com.maptology.android.app.R;
import android.content.Context;
import android.graphics.Color;
import android.support.design.widget.Snackbar;
import com.google.android.material.snackbar.Snackbar;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4 9.11,4 6.6,5.64 5.35,8.04 2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h13c2.76,0 5,-2.24 5,-5 0,-2.64 -2.05,-4.78 -4.65,-4.96zM19,18H6c-2.21,0 -4,-1.79 -4,-4s1.79,-4 4,-4h0.71C7.37,7.69 9.48,6 12,6c3.04,0 5.5,2.46 5.5,5.5v0.5H19c1.66,0 3,1.34 3,3s-1.34,3 -3,3z"/>
</vector>
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M9.4,16.6L4.8,12l4.6,-4.6L8,6l-6,6 6,6 1.4,-1.4zM14.6,16.6l4.6,-4.6 -4.6,-4.6L16,6l6,6 -6,6 -1.4,-1.4z"/>
</vector>
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M15,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM6,10L6,7L4,7v3L1,10v2h3v3h2v-3h3v-2L6,10zM15,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>
</vector>
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
</vector>
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,7c2.76,0 5,2.24 5,5 0,0.65 -0.13,1.26 -0.36,1.83l2.92,2.92c1.51,-1.26 2.7,-2.89 3.43,-4.75 -1.73,-4.39 -6,-7.5 -11,-7.5 -1.4,0 -2.74,0.25 -3.98,0.7l2.16,2.16C10.74,7.13 11.35,7 12,7zM2,4.27l2.28,2.28 0.46,0.46C3.08,8.3 1.78,10.02 1,12c1.73,4.39 6,7.5 11,7.5 1.55,0 3.03,-0.3 4.38,-0.84l0.42,0.42L19.73,22 21,20.73 3.27,3 2,4.27zM7.53,9.8l1.55,1.55c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.66 1.34,3 3,3 0.22,0 0.44,-0.03 0.65,-0.08l1.55,1.55c-0.67,0.33 -1.41,0.53 -2.2,0.53 -2.76,0 -5,-2.24 -5,-5 0,-0.79 0.2,-1.53 0.53,-2.2zM11.84,9.02l3.15,3.15 0.02,-0.16c0,-1.66 -1.34,-3 -3,-3l-0.17,0.01z"/>
</vector>
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:id="@+id/coordinator">
</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/coordinator">
<android.support.v4.widget.DrawerLayout
<androidx.drawerlayout.widget.DrawerLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -20,7 +20,7 @@
android:orientation="vertical">
</FrameLayout>
<android.support.design.widget.NavigationView
<com.google.android.material.navigation.NavigationView
android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
@@ -30,5 +30,5 @@
</android.support.v4.widget.DrawerLayout>
</android.support.design.widget.CoordinatorLayout>
</androidx.drawerlayout.widget.DrawerLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
@@ -7,7 +7,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.design.widget.NavigationView
<com.google.android.material.navigation.NavigationView
android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
@@ -17,7 +17,7 @@
<android.support.design.widget.CoordinatorLayout
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="match_parent"
@@ -30,6 +30,6 @@
android:orientation="vertical">
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>
@@ -9,7 +9,7 @@
android:layout_height="2dp"
android:background="@color/colorPrimary"/>
<android.support.v4.widget.NestedScrollView
<androidx.core.widget.NestedScrollView
android:orientation="vertical"
android:padding="@dimen/space_medium"
android:layout_width="match_parent"
@@ -20,5 +20,5 @@
android:layout_width="match_parent"
layout="@layout/view_detail_plain"/>
</android.support.v4.widget.NestedScrollView>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
@@ -7,11 +7,11 @@
<android.support.v4.view.ViewPager
<androidx.viewpager.widget.ViewPager
android:id="@+id/detail_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v4.view.ViewPager>
</androidx.viewpager.widget.ViewPager>
</LinearLayout>
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_grant_swipe"
android:orientation="vertical"
@@ -7,15 +7,16 @@
android:layout_height="match_parent">
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/grant_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layout_margin="@dimen/margin_default"
android:id="@+id/fragment_list_grant_explain"
android:text="@string/grant_list_explain"
android:textAppearance="?android:attr/textAppearanceSmall"/>
</LinearLayout>
</android.support.v4.widget.SwipeRefreshLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- swipe refresh layout see https://developer.android.com/training/swipe/add-swipe-interface.html -->
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_notice_swipe"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/fragment_notice_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.v4.widget.SwipeRefreshLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
@@ -4,12 +4,13 @@
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/share_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layout_margin="@dimen/margin_default"
android:id="@+id/fragment_list_share_explain"
android:text="@string/share_list_explain"
@@ -1,33 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp">
android:layout_centerHorizontal="true"
android:gravity="center"
android:layout_width="@dimen/max_view_width"
android:layout_height="match_parent">
<android.support.v7.widget.AppCompatTextView
android:text="@string/login_title"
android:layout_marginBottom="@dimen/space_medium"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ScrollView android:layout_width="match_parent" android:layout_height="wrap_content">
<ScrollView android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/space_large"
android:orientation="vertical">
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/login_title"
tools:text="@string/login_title_create"
android:layout_marginBottom="@dimen/space_medium"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/login_explain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/space_medium"
android:text="@string/login_explain_account"
tools:text="@string/login_explain_create"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<android.support.v7.widget.AppCompatEditText
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/input_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -39,9 +47,14 @@
android:inputType="text"
style="@style/input"/>
<android.support.v7.widget.AppCompatEditText
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/input_password"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/space_medium"
android:drawableStart="@drawable/ic_lock_outline_black_24dp"
@@ -50,25 +63,37 @@
android:hint="@string/login_hint_password"
android:inputType="textPassword"
style="@style/input"/>
<ImageButton
android:id="@+id/button_password"
android:contentDescription="@string/login_password_show"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/space_medium"
android:background="@color/white"
android:src="@drawable/ic_visibility_black_24dp" />
</LinearLayout>
<android.support.v7.widget.AppCompatButton
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/button_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/space_medium"
android:layout_margin="@dimen/space_large"
android:theme="@style/button_highlighted"
android:text="@string/login_button_login"/>
tools:text="@string/login_button_create"/>
<android.support.v7.widget.AppCompatButton
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/button_no_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/space_medium"
android:layout_marginLeft="@dimen/space_large"
android:layout_marginRight="@dimen/space_large"
android:layout_marginBottom="@dimen/space_large"
android:theme="@style/button"
android:text="@string/login_button_continue"/>
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/text_register"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
@@ -15,28 +15,31 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/icon_launch_person"
android:src="@drawable/icon_launch_person"
android:contentDescription="@null"
android:paddingBottom="60dp"
android:paddingRight="60dp"
android:paddingLeft="60dp"
android:adjustViewBounds="true"
android:layout_alignParentBottom="true"
android:scaleType="fitCenter"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="800dp"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:orientation="vertical"
android:layout_height="wrap_content">
<ImageView
<ImageView
android:contentDescription="@null"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:layout_marginTop="60dp"
android:src="@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"
android:contentDescription="@null"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:paddingBottom="40dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</RelativeLayout>
@@ -7,19 +7,19 @@
<android.support.v4.view.ViewPager
<androidx.viewpager.widget.ViewPager
android:id="@+id/manage_pager"
android:layout_weight="1.0"
android:layout_width="match_parent"
android:layout_height="0dp">
</android.support.v4.view.ViewPager>
</androidx.viewpager.widget.ViewPager>
<!-- funky: the tab layout draws the indicators at the bottom, but we
want them at the top. so we simply draw the view inverted (scaleY=-1)
and then we invert the tabs as well (see view_manage_tab
also funky: max width must be 0dp to ensure that the tabs will fill
the view on landscape -->
<android.support.design.widget.TabLayout
<com.google.android.material.tabs.TabLayout
android:id="@+id/manage_tab"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
@@ -38,14 +38,14 @@
android:focusable="true"
app:behavior_hideable="true"
app:behavior_peekHeight="72dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<TextView android:layout_width="match_parent" android:layout_height="match_parent"/>
</FrameLayout>
<android.support.design.widget.FloatingActionButton
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/buttonShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -59,7 +59,7 @@
style="@style/button_fab_highlighted"/>
<android.support.design.widget.FloatingActionButton
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/buttonMode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -73,4 +73,4 @@
style="@style/button_fab"/>
</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
@@ -7,28 +7,36 @@
<LinearLayout
android:id="@+id/share_editor"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_centerHorizontal="true"
android:layout_width="@dimen/max_view_width"
android:layout_height="match_parent">
<android.support.v7.widget.AppCompatTextView
android:id="@+id/share_title"
android:text="@string/share_title_create"
android:layout_margin="@dimen/margin_default"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.v4.widget.NestedScrollView android:layout_width="match_parent"
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_gravity="center_horizontal"
android:fillViewport="true"
android:layout_height="0dp"
android:layout_weight="1.0">
<LinearLayout android:orientation="vertical"
android:layout_marginLeft="@dimen/margin_default"
android:layout_marginRight="@dimen/margin_default"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.AppCompatTextView
<TextView
android:id="@+id/share_title"
android:text="@string/share_title_create"
android:layout_marginTop="@dimen/margin_default"
android:layout_marginBottom="@dimen/margin_default"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/share_explain"
android:text="@string/share_explain_create"
android:layout_marginBottom="@dimen/space_medium"
@@ -36,7 +44,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.v7.widget.AppCompatEditText
<androidx.appcompat.widget.AppCompatEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
@@ -50,7 +58,7 @@
android:drawableStart="@drawable/ic_message_black_24dp"
android:drawableLeft="@drawable/ic_message_black_24dp"/>
<android.support.v7.widget.AppCompatEditText
<androidx.appcompat.widget.AppCompatEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
@@ -71,12 +79,12 @@
android:layout_marginBottom="@dimen/space_medium"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:text="@string/share_creation_time"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/share_creation_date"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="end"
@@ -84,7 +92,7 @@
tools:text="1.1.2003"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/share_creation_time"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="end"
@@ -101,12 +109,12 @@
android:layout_marginBottom="@dimen/space_medium"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:text="@string/share_expiration_time"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/share_expiration_date"
android:textAppearance="@style/text_medium_hyperlink"
android:gravity="end"
@@ -114,7 +122,7 @@
tools:text="1.1.2003"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/share_expiration_time"
style="@style/text_medium_hyperlink"
android:gravity="end"
@@ -129,24 +137,22 @@
android:id="@+id/share_layout_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/space_large"
android:paddingRight="@dimen/space_large"
android:layout_marginBottom="@dimen/space_medium"
android:orientation="horizontal">
<View android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="0dp"/>
android:orientation="vertical">
<android.support.v7.widget.AppCompatButton
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/share_button_link"
android:text="@string/share_action_link"
android:drawableStart="@drawable/ic_link_black_24dp"
android:drawableLeft="@drawable/ic_link_black_24dp"
android:layout_weight="2"
android:paddingLeft="@dimen/space_large"
android:paddingRight="@dimen/space_large"
android:layout_gravity="center_horizontal"
android:theme="@style/button_highlighted"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<View android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="0dp"/>
</LinearLayout>
<LinearLayout
@@ -154,61 +160,68 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/space_medium"
android:orientation="horizontal">
android:orientation="vertical">
<android.support.v7.widget.AppCompatCheckBox
<androidx.appcompat.widget.AppCompatCheckBox
android:id="@+id/share_paused"
android:text="@string/share_paused"
android:textAppearance="@style/text_small_hyperlink"
android:textColor="@color/colorPrimary"
android:gravity="center"
android:layout_marginRight="@dimen/space_medium"
android:layout_marginLeft="@dimen/space_medium"
android:layout_width="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginRight="@dimen/space_large"
android:layout_marginLeft="@dimen/space_large"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<View
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="0dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_default"
android:layout_gravity="center_horizontal"
android:id="@+id/share_button_layout"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/share_button_delete"
android:text="@string/share_action_delete"
android:layout_weight="1"
android:drawableStart="@drawable/ic_delete_white_24dp"
android:drawableLeft="@drawable/ic_delete_white_24dp"
android:theme="@style/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/share_button_save"
android:text="@string/share_action_save"
android:layout_weight="1"
android:drawableStart="@drawable/ic_save_black_24dp"
android:drawableLeft="@drawable/ic_save_black_24dp"
android:theme="@style/button_highlighted"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/share_button_create"
android:text="@string/share_action_create"
android:layout_weight="1"
android:drawableStart="@drawable/ic_check_black_24dp"
android:drawableLeft="@drawable/ic_check_black_24dp"
android:theme="@style/button_highlighted"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</androidx.core.widget.NestedScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_default"
android:id="@+id/share_button_layout"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatButton
android:id="@+id/share_button_delete"
android:text="@string/share_action_delete"
android:layout_weight="1"
android:drawableStart="@drawable/ic_delete_white_24dp"
android:drawableLeft="@drawable/ic_delete_white_24dp"
android:theme="@style/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.v7.widget.AppCompatButton
android:id="@+id/share_button_save"
android:text="@string/share_action_save"
android:layout_weight="1"
android:drawableStart="@drawable/ic_save_black_24dp"
android:drawableLeft="@drawable/ic_save_black_24dp"
android:theme="@style/button_highlighted"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.v7.widget.AppCompatButton
android:id="@+id/share_button_create"
android:text="@string/share_action_create"
android:layout_weight="1"
android:drawableStart="@drawable/ic_check_black_24dp"
android:drawableLeft="@drawable/ic_check_black_24dp"
android:theme="@style/button_highlighted"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<TextView
tools:text="The title is too long."
android:padding="@dimen/space_medium"
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:text="Pick an action"
@@ -4,9 +4,9 @@
xmlns:auto="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
<androidx.cardview.widget.CardView
android:id="@+id/card_view"
android:layout_gravity="center"
android:layout_gravity="top|center_horizontal"
auto:cardCornerRadius="@dimen/card_corner"
auto:cardElevation="@dimen/card_corner"
auto:cardUseCompatPadding="true"
@@ -22,5 +22,5 @@
android:layout_marginBottom="@dimen/card_margin"
android:layout_marginTop="@dimen/card_margin"
layout="@layout/view_detail_plain"/>
</android.support.v7.widget.CardView>
</androidx.cardview.widget.CardView>
</FrameLayout>
@@ -10,7 +10,7 @@
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatImageView android:src="@drawable/ic_share_black_48dp"
<androidx.appcompat.widget.AppCompatImageView android:src="@drawable/ic_share_black_48dp"
android:id="@+id/view_detail_status"
android:paddingRight="4dp"
android:paddingEnd="4dp"
@@ -27,12 +27,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/share_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/view_detail_name"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Marcus Handte"
@@ -48,13 +48,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
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"/>
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/view_detail_creation_time"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="12/12/12 10:30"
@@ -70,12 +70,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/share_expiration_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/view_detail_expiration_time"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="12/12/12 10:30"
@@ -98,7 +98,7 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/view_detail_message_line">
<android.support.v7.widget.AppCompatImageView
<androidx.appcompat.widget.AppCompatImageView
android:src="@drawable/ic_message_black_24dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
@@ -106,7 +106,7 @@
android:contentDescription="@string/share_hint_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/view_detail_message"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Message"
@@ -121,7 +121,7 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/view_detail_destination_line">
<android.support.v7.widget.AppCompatImageView
<androidx.appcompat.widget.AppCompatImageView
android:contentDescription="@string/share_hint_message"
android:src="@drawable/ic_card_travel_black_24dp"
android:paddingLeft="14dp"
@@ -130,7 +130,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/view_detail_destination"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Destination"
@@ -145,7 +145,7 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/view_detail_position_line">
<android.support.v7.widget.AppCompatImageView
<androidx.appcompat.widget.AppCompatImageView
android:contentDescription="@string/share_hint_position"
android:src="@drawable/ic_gps_fixed_black_24dp"
android:paddingLeft="14dp"
@@ -154,7 +154,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/view_detail_position"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Available"
@@ -169,7 +169,7 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/view_detail_updated_line">
<android.support.v7.widget.AppCompatImageView
<androidx.appcompat.widget.AppCompatImageView
android:contentDescription="@string/share_hint_updated"
android:src="@drawable/ic_update_black_24dp"
android:paddingLeft="14dp"
@@ -178,7 +178,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/view_detail_updated"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Last update ..."
@@ -192,7 +192,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatImageView
<androidx.appcompat.widget.AppCompatImageView
android:contentDescription="@string/share_token"
android:src="@drawable/ic_vpn_key_black_24dp"
android:paddingLeft="14dp"
@@ -201,7 +201,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/view_detail_token"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="abcdefghijklmnopqrs"
@@ -20,7 +20,7 @@
android:layout_toStartOf="@android:id/text1"
tools:src="@drawable/ic_call_received_white_24dp"
android:id="@android:id/icon"/>
<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_centerInParent="true"
@@ -5,9 +5,9 @@
xmlns:auto="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
<androidx.cardview.widget.CardView
android:id="@+id/card_view"
android:layout_gravity="center"
android:layout_gravity="top|center_horizontal"
auto:cardCornerRadius="@dimen/card_corner"
auto:cardElevation="@dimen/card_corner"
auto:cardUseCompatPadding="true"
@@ -22,6 +22,7 @@
android:id="@+id/view_notice_title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="start"
android:layout_marginBottom="@dimen/space_medium"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
@@ -75,5 +76,5 @@
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</androidx.cardview.widget.CardView>
</FrameLayout>
+34 -22
View File
@@ -3,26 +3,38 @@
xmlns:auto="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item android:title="@string/nav_notice"
android:id="@+id/menu_notice"
android:icon="@drawable/ic_message_black_24dp"
/>
<item android:title="@string/nav_map"
android:id="@+id/menu_map"
android:icon="@drawable/ic_map_black_24dp"
/>
<item android:title="@string/nav_share"
android:id="@+id/menu_share"
android:icon="@drawable/ic_share_black_24dp"
/>
<item android:title="@string/nav_manage"
android:id="@+id/menu_manage"
android:icon="@drawable/ic_import_export_black_24dp"
/>
<item android:title="@string/nav_settings"
android:id="@+id/menu_settings"
android:icon="@drawable/ic_settings_black_24dp"
/>
</group>
<group android:id="@+id/group_main" android:checkableBehavior="single" >
<item android:title="@string/nav_notice"
android:id="@+id/menu_notice"
android:icon="@drawable/ic_message_black_24dp"
/>
<item android:title="@string/nav_map"
android:id="@+id/menu_map"
android:icon="@drawable/ic_map_black_24dp"
/>
<item android:title="@string/nav_share"
android:id="@+id/menu_share"
android:icon="@drawable/ic_share_black_24dp"
/>
<item android:title="@string/nav_manage"
android:id="@+id/menu_manage"
android:icon="@drawable/ic_import_export_black_24dp"
/>
</group>
<group android:id="@+id/group_settings" android:checkableBehavior="single" >
<item android:title="@string/nav_settings"
android:id="@+id/menu_settings"
android:icon="@drawable/ic_settings_black_24dp"
/>
</group>
<group android:id="@+id/group_account" android:checkableBehavior="single" >
<item android:title="@string/nav_signin"
android:id="@+id/menu_connect"
android:icon="@drawable/ic_person_add_black_24dp" />
<item android:title="@string/nav_webapp"
android:id="@+id/menu_webapp"
android:icon="@drawable/ic_cloud_queue_black_24dp" />
</group>
</menu>
+2 -2
View File
@@ -6,11 +6,11 @@
<item android:title="@string/menu_grant_update_title"
android:id="@+id/menu_grant_update"
android:icon="@drawable/ic_update_white_24dp"
auto:showAsAction="ifRoom"
auto:showAsAction="ifRoom|withText"
/>
<item android:title="@string/menu_grant_delete_title"
android:id="@+id/menu_grant_delete"
android:icon="@drawable/ic_delete_sweep_white_24dp"
auto:showAsAction="ifRoom"
auto:showAsAction="ifRoom|withText"
/>
</menu>
+2 -2
View File
@@ -6,9 +6,9 @@
<item android:title="@string/menu_map_zoom_in_title"
android:id="@+id/menu_map_zoom_in"
android:icon="@drawable/ic_zoom_in_white_24dp"
auto:showAsAction="ifRoom"/>
auto:showAsAction="ifRoom|withText"/>
<item android:title="@string/menu_map_zoom_out_title"
android:id="@+id/menu_map_zoom_out"
android:icon="@drawable/ic_zoom_out_white_24dp"
auto:showAsAction="ifRoom"/>
auto:showAsAction="ifRoom|withText"/>
</menu>
@@ -6,6 +6,6 @@
<item android:title="@string/menu_notice_update_title"
android:id="@+id/menu_notice_update"
android:icon="@drawable/ic_update_white_24dp"
auto:showAsAction="ifRoom"
auto:showAsAction="ifRoom|withText"
/>
</menu>
+1 -1
View File
@@ -6,6 +6,6 @@
<item android:title="@string/menu_share_create_title"
android:id="@+id/menu_share_create"
android:icon="@drawable/ic_add_white_24dp"
auto:showAsAction="ifRoom"
auto:showAsAction="ifRoom|withText"
/>
</menu>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

+16 -7
View File
@@ -31,27 +31,34 @@
<string name="drawer_open">Navigationsmenü öffnen</string>
<string name="drawer_close">Navigationsmenü schließen</string>
<string name="drawer_title">Navigationsmenü</string>
<string name="nav_notice">Neues</string>
<string name="nav_map">Kartenansicht</string>
<string name="nav_notice">Neues erfahren</string>
<string name="nav_map">Karte anzeigen</string>
<string name="nav_share">Freigabe erstellen</string>
<string name="nav_manage">Freigaben verwalten</string>
<string name="nav_share_out">Erteilt</string>
<string name="nav_share_in">Erhalten</string>
<string name="nav_settings">Einstellungen</string>
<string name="nav_settings">Einstellungen ändern</string>
<string name="nav_signin">Konto verbinden</string>
<string name="nav_webapp">Orte anzeigen</string>
<string name="nav_user_none">Nutzung ohne Konto</string>
<string name="nav_user_error">Verbindungsfehler</string>
<!-- login and register -->
<string name="login_title">Geräteeinrichtung</string>
<string name="login_explain_account">Hallo! Damit wir Deinen Standort vor unbefugtem Zugriff schützen können, müssen wir Dein Gerät einrichten. Falls Du ein Konto hast, können wir das Gerät damit verbinden. Dadurch kannst Du über einen Webbrowser auf Deine Daten auch ohne App zugreifen.</string>
<string name="login_title_create">Geräteeinrichtung</string>
<string name="login_title_update">Kontoeinrichtung</string>
<string name="login_explain_create">Hallo! Damit wir Deinen Standort vor unbefugtem Zugriff schützen können, müssen wir Dein Gerät einrichten. Falls Du ein Konto hast, können wir das Gerät damit verbinden. Dadurch kannst Du über einen Webbrowser auf Deine Daten auch ohne App zugreifen.</string>
<string name="login_explain_update">Falls Du ein Konto hast, können wir Dein Gerät damit verbinden. Dadurch kannst Du über einen Webbrowser auf den Gerätestandort und den Standortverlauf jederzeit zugreifen.</string>
<string name="login_hint_user">Login</string>
<string name="login_hint_password">Passwort</string>
<string name="login_button_login">Anmelden und Gerät verbinden</string>
<string name="login_button_create">Anmelden und Gerät einrichten</string>
<string name="login_button_update">Anmelden und Gerät verbinden</string>
<string name="login_text_register">Falls Du noch keins hast, kannst Du Dir <b>hier</b> ein neues Konto anlegen.</string>
<string name="login_button_continue">Weiter ohne Anmeldung</string>
<string name="login_failed_msg">Deine Zugangsdaten stimmen vermutlich nicht. Schau sie Dir bitte nochmal an.</string>
<string name="login_button_retry">Nochmal</string>
<string name="login_device_failed">Einrichtung fehlgeschlagen. Hat Dein Gerät gerade kein Netz?</string>
<string name="login_conflict_msg">Dein Gerät ist bereits mit einem Konto verbunden.</string>
<string name="login_password_show">Passwort anzeigen oder verstecken</string>
<!-- shares and grants -->
<string name="share_title_create">Standortfreigabe erstellen</string>
@@ -124,10 +131,12 @@
<string name="setting_notification_app_title">Anwendung</string>
<string name="setting_notification_app_summary">Ermöglicht das Ein- und Ausblenden von Benachrichtigungen, die von der App erstellt werden.</string>
<string name="setting_notification_os_title">Android</string>
<string name="setting_notification_os_summary">Ermöglicht das Ein- und Ausblenden der Warnung des Betriebssystems über die Ausführung von Anwendungen im Hintegrund.</string>
<string name="setting_notification_os_summary">Ermöglicht das Ein- und Ausblenden der Warnung des Betriebssystems über die Ausführung von Anwendungen im Hintergrund.</string>
<string name="setting_category_about">Über</string>
<string name="setting_about_terms_title">Lizenz und Datenschutz</string>
<string name="setting_about_terms_summary">Zeigt die Lizenzbedinungen und die Datenschutzerklärung der App an.</string>
<string name="setting_about_licenses_title">Softwarebibliotheken</string>
<string name="setting_about_licenses_summary">Zeigt die Lizenzinformationen der Bibliotheken an, die zur Entwicklung der App genutzt wurden.</string>
<string name="setting_about_build_title">Version</string>
<string name="setting_about_build_summary">$code$ | $version$ @ $build$</string>
<string name="setting_category_development">Entwicklung</string>
@@ -5,6 +5,7 @@
<dimen name="space_large">16dp</dimen>
<dimen name="space_medium">8dp</dimen>
<dimen name="space_small">4dp</dimen>
<dimen name="max_view_width">600dp</dimen>
<dimen name="card_corner">4dp</dimen>
<dimen name="card_margin">8dp</dimen>
@@ -6,6 +6,7 @@
<string name="maptology_url_default" translatable="false">https://www.maptology.com/api</string>
<string name="maptology_url_share" translatable="false">https://www.maptology.com/app/shares/</string>
<string name="maptology_url_register" translatable="false">https://www.maptology.com/app/register</string>
<string name="maptology_url_places" translatable="false">https://www.maptology.com/app/places</string>
<bool name="privacy_localize_default">true</bool>
<bool name="privacy_analyze_default">false</bool>
<bool name="privacy_share_default">false</bool>
+22 -12
View File
@@ -33,27 +33,35 @@
<string name="drawer_open">Open navigation</string>
<string name="drawer_close">Close navigation</string>
<string name="drawer_title">Navigation</string>
<string name="nav_notice">News</string>
<string name="nav_map">View Map</string>
<string name="nav_share">Create Share</string>
<string name="nav_manage">Manage Shares</string>
<string name="nav_notice">Read news</string>
<string name="nav_map">View map</string>
<string name="nav_share">Create share</string>
<string name="nav_manage">Manage shares</string>
<string name="nav_share_out">Created</string>
<string name="nav_share_in">Received</string>
<string name="nav_settings">Settings</string>
<string name="nav_user_none">Not signed in</string>
<string name="nav_user_error">Not connected</string>
<string name="nav_settings">Edit settings</string>
<string name="nav_signin">Link account</string>
<string name="nav_webapp">Show places</string>
<string name="nav_user_none">No account</string>
<string name="nav_user_error">No connection</string>
<!-- login and register -->
<string name="login_title">Device registration</string>
<string name="login_explain_account">Hi there! To protect your location, we must register your device. If you have an account, we can link your device to it, so you can access its location through a web browser.</string>
<string name="login_title_create">Device registration</string>
<string name="login_title_update">Account setup</string>
<string name="login_explain_create">Hi there! To protect your location, we must register your device. If you have an account, we can link your device to it, so you can access its location through a web browser.</string>
<string name="login_explain_update">If you have an account, we can link your device to it. This allows you to access the device location and its location history through a web browser at any time.</string>
<string name="login_hint_user">Username</string>
<string name="login_hint_password">Password</string>
<string name="login_button_login">Register with account</string>
<string name="login_button_create">Register with account</string>
<string name="login_button_update">Link with account</string>
<string name="login_text_register">You don\'t have an account yet? <b>Register here.</b></string>
<string name="login_button_continue">Continue without account</string>
<string name="login_failed_msg">Please check your username and password.</string>
<string name="login_button_retry">Retry</string>
<string name="login_device_failed">Please check your internet connection.</string>
<string name="login_conflict_msg">Your device is already connected with an account.</string>
<string name="login_password_show">Show or hide password</string>
<!-- shares and grants -->
<string name="share_title_create">New share</string>
@@ -61,10 +69,10 @@
<string name="share_hint_message">Message</string>
<string name="share_hint_destination">Destination</string>
<string name="share_added_time">Added on:</string>
<string name="share_creation_time">Create on</string>
<string name="share_creation_time">Created on</string>
<string name="share_expiration_time">Expires on</string>
<string name="share_name">Shared by</string>
<string name="share_name_none">an anonymous user</string>
<string name="share_name_none">anonymous user</string>
<string name="share_name_self">you</string>
<string name="share_token">Identifier:</string>
<string name="share_hint_position">Location status</string>
@@ -130,6 +138,8 @@
<string name="setting_category_about">About</string>
<string name="setting_about_terms_title">Terms</string>
<string name="setting_about_terms_summary">Shows the license terms and privacy policy of the app.</string>
<string name="setting_about_licenses_title">Libraries</string>
<string name="setting_about_licenses_summary">Shows licensing information about the libraries used by the app.</string>
<string name="setting_about_build_title">Version</string>
<string name="setting_about_build_summary">$code$ | $version$ @ $build$</string>
<string name="setting_category_development">Development</string>
@@ -1,11 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- text styles -->
<style name="text_large" parent="TextAppearance.AppCompat.Large">
<item name="android:textColor">@color/black</item>
<item name="android:textSize">24sp</item>
</style>
<style name="text_medium" parent="TextAppearance.AppCompat.Medium">
<item name="android:textColor">@color/black</item>
<item name="android:textSize">18sp</item>
@@ -13,18 +8,10 @@
<style name="text_small" parent="TextAppearance.AppCompat.Small">
<item name="android:textColor">@color/black</item>
</style>
<style name="text_large_inverse" parent="TextAppearance.AppCompat.Large.Inverse">
<item name="android:textColor">@color/white</item>
<item name="android:textSize">24sp</item>
</style>
<style name="text_medium_inverse" parent="TextAppearance.AppCompat.Medium.Inverse">
<item name="android:textColor">@color/white</item>
<item name="android:textSize">18sp</item>
</style>
<style name="text_small_inverse" parent="TextAppearance.AppCompat.Small.Inverse">
<item name="android:textColor">@color/white</item>
<item name="android:textSize">14sp</item>
</style>
<style name="text_medium_hyperlink" parent="text_medium">
<item name="android:textColor">@color/colorPrimary</item>
<item name="android:textStyle">bold</item>
@@ -46,6 +46,11 @@
android:key="about_terms"
android:summary="@string/setting_about_terms_summary"
android:title="@string/setting_about_terms_title" />
<Preference
android:icon="@drawable/ic_code_black_24dp"
android:key="about_licenses"
android:summary="@string/setting_about_licenses_summary"
android:title="@string/setting_about_licenses_title" />
<Preference
android:icon="@drawable/ic_perm_device_information_black_24dp"
android:key="about_build"
@@ -1,6 +1,6 @@
package com.maptology.android.app.test.notice;
import android.support.v4.widget.SwipeRefreshLayout;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.maptology.android.app.R;
import com.maptology.android.app.fragment.NoticeListFragment;
import com.maptology.android.app.test.util.FragmentActivity;
@@ -1,8 +1,8 @@
package com.maptology.android.app.test.util;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.appcompat.app.AppCompatActivity;
import android.widget.FrameLayout;
/**
+24 -24
View File
@@ -2,25 +2,30 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.8.1'
classpath 'com.google.android.gms:oss-licenses-plugin:0.9.5'
classpath files('gradle/gradle-android-eclipse-1.1.jar')
}
repositories {
maven {
url "http://repository.jboss.org/nexus/content/groups/public/"
url = 'https://project.nes.uni-due.de/artifactory/releases';
credentials { username = 'public'; password = 'public' }
}
maven { url = 'https://project.nes.uni-due.de/artifactory/releases'; credentials { username = 'public'; password = 'public' } }
maven { url = 'https://project.nes.uni-due.de/artifactory/snaphsots'; credentials { username = 'public'; password = 'public'} }
maven {
url = 'https://project.nes.uni-due.de/artifactory/snaphsots';
credentials { username = 'public'; password = 'public' }
}
maven { url "http://repository.jboss.org/nexus/content/groups/public/" }
google()
mavenCentral()
jcenter()
google()
}
}
}
allprojects {
// set version for our project
group = 'com.maptology'
version = '1.0.0'
version = '1.0.1'
// set versions for our libraries
ext {
@@ -43,9 +48,10 @@ allprojects {
versionThorntail = '2.5.0.Final'
// android stuff
versionAndroidx = '1.2.0'
versionAndroidx = '1.0.0'
versionRobolectric = '4.3'
versionSupport = "28.0.0"
versionPlay = '17.0.0'
versionAndroidxTest = '1.2.0'
}
}
@@ -57,6 +63,7 @@ subprojects {
if (name.equals('android-app')) {
apply plugin: 'com.greensopinion.gradle-android-eclipse'
apply plugin: 'com.android.application'
apply plugin: 'com.google.android.gms.oss-licenses-plugin'
publishing {
publications {
@@ -119,25 +126,18 @@ subprojects {
repositories {
maven {
url "http://repository.jboss.org/nexus/content/groups/public/"
url = 'https://project.nes.uni-due.de/artifactory/releases';
credentials { username = 'public'; password = 'public' }
}
maven { url = 'https://project.nes.uni-due.de/artifactory/releases'; credentials { username = 'public'; password = 'public' } }
maven { url = 'https://project.nes.uni-due.de/artifactory/snaphsots'; credentials { username = 'public'; password = 'public'} }
maven {
url = 'https://project.nes.uni-due.de/artifactory/snaphsots';
credentials { username = 'public'; password = 'public' }
}
maven { url "http://repository.jboss.org/nexus/content/groups/public/" }
google()
mavenCentral()
jcenter()
google()
maven {
url 'https://maven.repository.redhat.com/nexus/content/repositories/thirdparty-releases/'
}
maven {
name 'Gradle Tooling'
url 'https://repo.gradle.org/gradle/libs-releases/'
}
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
}
artifactoryPublish.dependsOn('build')
@@ -62,6 +62,26 @@ public interface IDeviceService {
@PermitAll
Response createDevice(@ApiParam(value = "Necessary data from to create a device.", required = true) @NotNull @Valid DeviceInfo info);
/**
* Sets the user account for a previously registered device.
*
* @return A response.
*/
@PUT
@Path("devices/current/user")
@ApiOperation(value = "Connects a device created without user account with a user account.",
notes = "Executing this is operation requires a valid device and a valid user authentication to be transmitted simultaneously. ",
tags = {Tags.DEFAULT, Tags.DEVICE})
@ApiResponses({
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "The device or user credentials are missing or incorrect."),
@ApiResponse(code = HttpServletResponse.SC_CONFLICT, message = "The device is already connected to a user account.", response=Device.class),
@ApiResponse(code = HttpServletResponse.SC_OK, message = "The device has been connected to the user account.", response=Device.class),
})
@PermitAll
@RolesAllowed({Roles.DEVICE, Roles.USER})
Response setCurrentDeviceUser();
/**
* Returns the current device.
*
@@ -110,6 +110,7 @@ public interface IHistoryService {
/**
* Returns the places for a particular user.
*
* @param order The order criterion.
* @param pageConfig The page configuration.
* @param id The id of the user.
* @return The list of places.
@@ -124,7 +125,8 @@ public interface IHistoryService {
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The user does not exists.")
})
@RolesAllowed({Roles.ADMIN})
Response getUserPlaces(@ApiParam(value = "The user id.", required = true) @PathParam("id") @Valid @NotNull long id, @BeanParam @Valid PageConfig pageConfig);
Response getUserPlaces(@ApiParam(value = "The user id.", required = true) @PathParam("id") @Valid @NotNull long id,
@ApiParam(value = "The sorting criterion.", required = true) @QueryParam("order") @Valid @NotNull PlaceOrder order, @BeanParam @Valid PageConfig pageConfig);
/**
* Returns the visits for a particular user.
@@ -149,6 +151,7 @@ public interface IHistoryService {
/**
* Returns the places for the current user.
*
* @param order The order criterion.
* @param pageConfig The page configuration.
* @return The list of places.
*/
@@ -163,7 +166,7 @@ public interface IHistoryService {
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "Insufficient rights to execute this method.")
})
@RolesAllowed({Roles.USER})
Response getCurrentUserPlaces(@BeanParam @Valid PageConfig pageConfig);
Response getCurrentUserPlaces(@ApiParam(value = "The sorting criterion.", required = true) @QueryParam("order") @Valid @NotNull PlaceOrder order, @BeanParam @Valid PageConfig pageConfig);
/**
* Returns the visits for the current user.
@@ -0,0 +1,63 @@
package com.maptology.api.history;
/**
* The possible order criteria for places.
*
* @author Marcus
*/
public enum PlaceOrder {
/**
* Uses the ascending order of their identifiers. For user
* interface purposes, this is basically the creation time. Places
* that have been created first are displayed first.
*/
IDENTIFIER,
/**
* The importance is a mixture of place duration and place time.
* Places that have been visited longer and have been visited more
* recently, are displayed first.
*/
IMPORTANCE,
/**
* The duration ranks places by the total duration of the visits
* associated with the place. Places that have been visited longer
* are returned first.
*/
DURATION,
/**
* The count ranks the places by the number of visits associated
* with the place. Places that have been visited more frequently
* are returned first.
*/
FREQUENCY,
/**
* The time ranks the places by the end of the last visit. Thus,
* the last visited place should be returned first.
*/
TIME;
@Override
public String toString() {
return name().toLowerCase();
}
/**
* Deserializes the place order.
*
* @param string The place order string.
* @return The place order or null.
*/
public PlaceOrder fromString(String string) {
for (PlaceOrder o: PlaceOrder.values()) {
if (o.name().equalsIgnoreCase(string)) {
return o;
}
}
return null;
}
}
+2
View File
@@ -0,0 +1,2 @@
android.enableJetifier=true
android.useAndroidX=true
BIN
View File
Binary file not shown.
@@ -1,6 +1,8 @@
package com.maptology.service.entity;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Embedded;
@@ -12,10 +14,22 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Expression;
import javax.persistence.criteria.JoinType;
import javax.persistence.criteria.Order;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.persistence.criteria.SetJoin;
import javax.validation.constraints.NotNull;
import com.maptology.api.PageConfig;
import com.maptology.api.history.PlaceOrder;
/**
* A user-specific entity that stores information about a place.
*
@@ -63,6 +77,12 @@ public class PlaceEntity extends AbstractUserSpecificEntity {
@Column(length=140)
private String nickname;
/**
* A mapping to the place's visits used for queries.
*/
@OneToMany(fetch = FetchType.LAZY, mappedBy = "place")
private Set<VisitEntity> visits;
@Override
public UserEntity getUser() {
return user;
@@ -72,6 +92,24 @@ public class PlaceEntity extends AbstractUserSpecificEntity {
public void setUser(UserEntity user) {
this.user = user;
}
/**
* Returns the visits at the place.
*
* @return The visits at the place.
*/
public Set<VisitEntity> getVisits() {
return visits;
}
/**
* Sets the visit at the place.
*
* @param visits The visits.
*/
public void setVisits(Set<VisitEntity> visits) {
this.visits = visits;
}
/**
* Returns the coordinate.
@@ -163,4 +201,87 @@ public class PlaceEntity extends AbstractUserSpecificEntity {
return q.getResultList();
}
/**
* Computes the last modification date based on the order. This is either the modification date
* of the places or the maximum of the modification date of the places and visits.
*
* @param em The entity manager.
* @param user The user.
* @param order The order criterion.
* @return The modification date to use.
*/
public static long getLastModifiedForUser(EntityManager em, UserEntity user, PlaceOrder order) {
if (order.equals(PlaceOrder.IDENTIFIER)) {
return getLastModifiedForUser(em, PlaceEntity.class, user);
} else {
return Math.max(getLastModifiedForUser(em, PlaceEntity.class, user), VisitEntity.getLastModifiedForUser(em, user));
}
}
/**
* Computes a page of places for a user, thereby considering the ordering criterion and the filters.
*
*
* @param em The entity manager.
* @param user The user.
* @param order The order criterion.
* @param config The page configuration.
* @param filtered True to filter deleted, true to return everything.
* @return The place entities matching the query.
*/
public static List<PlaceEntity> findAllForUser(EntityManager em, UserEntity user, PlaceOrder order, PageConfig config, boolean filtered) {
if (order.equals(PlaceOrder.IDENTIFIER)) {
return findAllForUser(em, PlaceEntity.class, user, config, new OrderCriterion("id"), filtered);
} else {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<PlaceEntity> cq = cb.createQuery(PlaceEntity.class);
Root<PlaceEntity> r = cq.from(PlaceEntity.class); // from place
cq.select(r); // select e
SetJoin<PlaceEntity, VisitEntity> visits = r.joinSet("visits", JoinType.LEFT); // join visits (outer)
if (filtered) {
visits.on(cb.equal(visits.get("deleted"), false)); // add visits not deleted to on clause
}
Expression<?> expression = null;
Order o = null;
switch (order) {
case DURATION:
expression = cb.sum(cb.diff(visits.get("endTime"), visits.get("beginTime")));
o = cb.desc(expression);
break;
case FREQUENCY:
expression = cb.count(visits);
o = cb.desc(expression);
break;
case TIME:
expression = cb.max(visits.get("endTime"));
o = cb.desc(expression);
break;
case IMPORTANCE:
// one day not seen should be made up by 6 hours of staying there
Expression<Number> stayDuration = cb.quot(cb.sum(cb.diff(visits.get("endTime"), visits.get("beginTime"))), cb.literal(1000 * 60 * 60 * 6));
Expression<Number> lastVisit = cb.quot(cb.max(visits.get("endTime")), cb.literal(1000 * 60 * 60 * 24));
expression = cb.prod(stayDuration, lastVisit);
o = cb.desc(expression);
break;
default:
// this should not happen
return new ArrayList<PlaceEntity>();
}
Predicate where = cb.equal(r.get("user"), user); // where place.user = user
if (filtered) {
where = cb.and(where, cb.equal(r.get("deleted"), false)); // and place.deleted=false
}
cq.where(where);
cq.groupBy(r); // group by place
cq.orderBy(o, cb.asc(r.get("id"))); // order by sum and id
TypedQuery<PlaceEntity> q = em.createQuery(cq);
q.setFirstResult(config.getOffset());
q.setMaxResults(config.getSize());
return q.getResultList();
}
}
}
@@ -45,18 +45,30 @@ public class VisitEntity extends AbstractEntity {
*/
private static final long serialVersionUID = -7288037414082252162L;
/**
* The place that was visited.
*/
@NotNull
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="place_id")
private PlaceEntity place;
/**
* The device that has visited.
*/
@NotNull
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="device_id")
private DeviceEntity device;
/**
* The start time of the visit.
*/
private long beginTime;
/**
* The end time of the visit.
*/
private long endTime;
/**
@@ -19,6 +19,7 @@ import com.maptology.service.crypto.TokenType;
import com.maptology.service.entity.AbstractEntity;
import com.maptology.service.entity.AbstractUserSpecificEntity;
import com.maptology.service.entity.DeviceEntity;
import com.maptology.service.entity.EntityConflictException;
import com.maptology.service.entity.EntityForbiddenException;
import com.maptology.service.entity.EntityNotFoundException;
import com.maptology.service.entity.OrderCriterion;
@@ -55,6 +56,27 @@ public class DeviceSessionBean extends AbstractUserSpecificSessionBean {
return new DeviceHandleConverter(true).convert(entity);
}
/**
* Connects a device that has been created without user account with
* an existing user account.
*
* @return The device, if successful.
* @throws EntityForbiddenException Thrown if the user or device is not valid.
* @throws EntityConflictException Thrown if the device is already connected with
* a user account.
*/
@RolesAllowed({Roles.DEVICE, Roles.USER})
public Device setCurrentDeviceUser() throws EntityForbiddenException, EntityConflictException {
DeviceEntity device = getPrincipalDevice();
UserEntity user = getPrincipalUser();
if (device == null) throw new EntityForbiddenException(DeviceEntity.class, null);
if (user == null) throw new EntityForbiddenException(UserEntity.class, null);
if (device.getUser() != null) throw new EntityConflictException(DeviceEntity.class, device.getId());
device.setUser(user);
em.flush();
return new DeviceConverter(true).convert(device);
}
/**
* Returns the current device.
@@ -1,12 +1,9 @@
package com.maptology.service.session;
import com.maptology.service.template.EmailAssignment;
import com.maptology.service.template.EmailMessage;
import com.maptology.service.template.EmailTemplate;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import javax.ejb.Stateful;
import javax.enterprise.context.RequestScoped;
@@ -20,6 +17,10 @@ import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import com.maptology.service.template.EmailAssignment;
import com.maptology.service.template.EmailMessage;
import com.maptology.service.template.EmailTemplate;
/**
* The default email session bean that uses javax.mail to send
* emails.
@@ -33,7 +34,7 @@ public class EmailSessionBean implements IEmailSessionBean {
@Inject
private Logger log;
@Inject
@Resource
private Session mailSession;
@Override
@@ -9,6 +9,7 @@ import java.util.logging.Level;
import javax.annotation.security.DeclareRoles;
import javax.annotation.security.PermitAll;
import javax.annotation.security.RolesAllowed;
import javax.ejb.EJB;
import javax.ejb.Stateful;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
@@ -46,7 +47,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
/**
* The bean to find shares.
*/
@Inject
@EJB
ShareSessionBean shareSession;
/**
@@ -58,7 +59,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
/**
* The bean to perform geocoding.
*/
@Inject
@EJB
GeocoderSessionBean geocoderSession;
@@ -1,13 +1,18 @@
package com.maptology.service.session;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.security.DeclareRoles;
import javax.annotation.security.RolesAllowed;
import javax.ejb.EJB;
import javax.ejb.Stateful;
import javax.enterprise.context.RequestScoped;
import com.maptology.api.PageConfig;
import com.maptology.api.access.Roles;
import com.maptology.api.history.Place;
import com.maptology.api.history.PlaceOrder;
import com.maptology.api.history.PlacePage;
import com.maptology.service.conversion.PlaceConverter;
import com.maptology.service.entity.AbstractUserSpecificEntity;
@@ -15,7 +20,6 @@ import com.maptology.service.entity.DeviceEntity;
import com.maptology.service.entity.EntityConflictException;
import com.maptology.service.entity.EntityForbiddenException;
import com.maptology.service.entity.EntityNotFoundException;
import com.maptology.service.entity.OrderCriterion;
import com.maptology.service.entity.PlaceEntity;
import com.maptology.service.entity.UserEntity;
import com.maptology.service.entity.VisitEntity;
@@ -31,62 +35,100 @@ import com.maptology.service.entity.VisitEntity;
@DeclareRoles({ Roles.ADMIN, Roles.USER, Roles.DEVICE })
public class PlaceSessionBean extends AbstractUserSpecificSessionBean {
/**
* The visit session bean.
*/
@EJB
protected VisitSessionBean visitSession;
/**
* Returns the highest modification date for the current user.
* Returns the highest modification date for the current user based on the order.
*
* @param order The order criterion.
* @return The highest modification date.
* @throws EntityForbiddenException Thrown if the user is not logged in.
*/
@RolesAllowed(Roles.USER)
public long getLastModifiedPlacesForCurrentUser() throws EntityForbiddenException {
public long getLastModifiedPlacesForCurrentUser(PlaceOrder order) throws EntityForbiddenException {
UserEntity user = getPrincipalUser();
if (user == null) throw new EntityForbiddenException(UserEntity.class, null, "Cannot find principal user.");
return AbstractUserSpecificEntity.getLastModifiedForUser(em, PlaceEntity.class, user);
return PlaceEntity.getLastModifiedForUser(em, user, order);
}
/**
* Returns the highest modification date for the specified user.
* Returns the highest modification date for the specified user based on the order.
*
* @param id The user id.
* @param order The order criterion.
* @return The highest modification date.
* @throws EntityNotFoundException Thrown if the user is not found.
*/
@RolesAllowed(Roles.ADMIN)
public long getLastModifiedPlacesForUser(long id) throws EntityNotFoundException {
public long getLastModifiedPlacesForUser(long id, PlaceOrder order) throws EntityNotFoundException {
UserEntity user = em.find(UserEntity.class, new Long(id));
if (user == null) throw new EntityNotFoundException(UserEntity.class, id, "Cannot find user.");
return AbstractUserSpecificEntity.getLastModifiedForUser(em, PlaceEntity.class, user);
return PlaceEntity.getLastModifiedForUser(em, user, order);
}
/**
* Returns the places for the current user.
*
* @param order The order criterion.
* @param config The page configuration.
* @return The places for the current user.
* @throws EntityForbiddenException Thrown if the current user cannot be determined.
*/
@RolesAllowed(Roles.USER)
public PlacePage getCurrentUserPlaces(PageConfig config) throws EntityForbiddenException {
public PlacePage getCurrentUserPlaces(PlaceOrder order, PageConfig config) throws EntityForbiddenException {
UserEntity user = getPrincipalUser();
if (user == null) throw new EntityForbiddenException(UserEntity.class, null, "Cannot access principal user.");
return getAllForUser(PlaceEntity.class, user, config, new OrderCriterion("id"), true, new PlacePage(), new PlaceConverter(true));
return getUserPlaces(user, order, config, true);
}
/**
* Returns the places for the specified user.
*
* @param id The id of the user.
* @param order The order criterion.
* @param config The page configuration.
* @param filtered True to filter deleted, false otherwise.
* @return The places for the specified user.
* @throws EntityNotFoundException Thrown if the user cannot be found.
*/
@RolesAllowed(Roles.ADMIN)
public PlacePage getUserPlaces(long id, PageConfig config, boolean filtered) throws EntityNotFoundException {
public PlacePage getUserPlaces(long id, PlaceOrder order, PageConfig config, boolean filtered) throws EntityNotFoundException {
UserEntity user = em.find(UserEntity.class, new Long(id));
if (user == null) throw new EntityNotFoundException(UserEntity.class, id, "Cannot find user.");
return getAllForUser(PlaceEntity.class, user, config, new OrderCriterion("id"), filtered, new PlacePage(), new PlaceConverter(filtered));
return getUserPlaces(user, order, config, filtered);
}
/**
* Returns a page of places for the user that is optionally filtered and sorted based on the criterion.
*
*
* @param user The user to search for.
* @param order The order criterion.
* @param config The page configuration.
* @param filtered True to filter, false to also return deleted data.
* @return The place page.
*/
private PlacePage getUserPlaces(UserEntity user, PlaceOrder order, PageConfig config, boolean filtered) {
int count = AbstractUserSpecificEntity.getCountForUser(em, PlaceEntity.class, user, filtered);
List<PlaceEntity> data = new ArrayList<>();
if (count > config.getOffset()) {
data = PlaceEntity.findAllForUser(em, user, order, config, filtered);
}
PlacePage page = new PlacePage();
page.setElements(new PlaceConverter(filtered).convert(data));
page.setOffset(config.getOffset());
page.setSize(config.getSize());
page.setTotal(count);
return page;
}
/**
* Returns the place with the specified id.
@@ -2,6 +2,7 @@ package com.maptology.service.test;
import java.io.File;
import org.jboss.shrinkwrap.api.Filters;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
@@ -25,7 +26,7 @@ public class EjbDeployment {
public static JavaArchive createEjb() {
return ShrinkWrap.create(JavaArchive.class)
.addAsManifestResource(new StringAsset(getManifest()), "MANIFEST.MF")
.addPackages(true, "com.maptology.api", "com.maptology.service")
.addPackages(true, Filters.exclude("com.maptology.service.test.*"), "com.maptology.api", "com.maptology.service")
.addAsManifestResource(new File("src/test/resources/META-INF/beans.xml"), "beans.xml")
// use the persistence.xml from the test resource (in-memory db)
.addAsManifestResource(new File("src/test/resources/META-INF/persistence.xml"), "persistence.xml")
@@ -32,7 +32,6 @@ import com.maptology.service.principal.MaptologyPrincipal;
*
* @author Marcus
*/
@SuppressWarnings("deprecation")
public class LoginModule extends UsernamePasswordLoginModule {
/**
@@ -1,6 +1,6 @@
package com.maptology.service.test.session;
import javax.inject.Inject;
import javax.ejb.EJB;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Assert;
@@ -13,6 +13,7 @@ import com.maptology.api.device.DeviceHandle;
import com.maptology.api.device.DeviceInfo;
import com.maptology.api.device.DevicePage;
import com.maptology.api.device.OperatingSystem;
import com.maptology.service.entity.EntityConflictException;
import com.maptology.service.entity.EntityForbiddenException;
import com.maptology.service.session.DeviceSessionBean;
import com.maptology.service.session.UserSessionBean;
@@ -25,10 +26,10 @@ import com.maptology.service.session.UserSessionBean;
@RunWith(Arquillian.class)
public class DeviceSessionTest extends AbstractSessionTest {
@Inject
@EJB
DeviceSessionBean deviceSession;
@Inject
@EJB
UserSessionBean userSession;
@@ -93,7 +94,7 @@ public class DeviceSessionTest extends AbstractSessionTest {
/**
* Tests the addition of a new device with
* Tests the addition of a new device without a user.
*/
@Test
public void testAddDeviceWithoutUser() {
@@ -101,6 +102,52 @@ public class DeviceSessionTest extends AbstractSessionTest {
createDevice(this, deviceSession, null);
Assert.assertEquals("Should have one more device.", initialDevices + 1, getDeviceCount(this, deviceSession));
}
/**
* Test the creation of device associations.
*/
@Test
public void testAddDeviceAndConnectToUser() {
int initialDevices = getDeviceCount(this, deviceSession);
DeviceHandle handle = createDevice(this, deviceSession, null);
Assert.assertNull("User should be null.", handle.getUser());
Assert.assertEquals("Should have one more device.", initialDevices + 1, getDeviceCount(this, deviceSession));
Runnable failingAssociations = new Runnable() {
@Override
public void run() {
try {
deviceSession.setCurrentDeviceUser();
Assert.fail("Setting a device without user or device should fail.");
} catch (Exception e) {
Assert.assertEquals("Setting device without user or device should be forbidden.", EntityForbiddenException.class, e.getClass());
}
}
};
executeAs("handte", null, failingAssociations);
executeAs(null, handle.getToken(), failingAssociations);
executeAs("handte", handle.getToken(), new Runnable() {
@Override
public void run() {
try {
Device device = deviceSession.setCurrentDeviceUser();
Assert.assertNotNull("Device user should be set after association.", device.getUser());
} catch (Exception e) {
Assert.fail("Setting a device user should succeed.");
}
}
});
executeAs("handte", handle.getToken(), new Runnable() {
@Override
public void run() {
try {
deviceSession.setCurrentDeviceUser();
Assert.fail("Setting a device user for a connected device should fail.");
} catch (Exception e) {
Assert.assertEquals("Setting a user for a connected device should raise conflict.", EntityConflictException.class, e.getClass());
}
}
});
}
/**
* Tests the addition of new devices.
@@ -3,7 +3,7 @@ package com.maptology.service.test.session;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import javax.ejb.EJB;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Assert;
@@ -13,6 +13,8 @@ import org.junit.runner.RunWith;
import com.maptology.api.PageConfig;
import com.maptology.api.device.DeviceHandle;
import com.maptology.api.history.Place;
import com.maptology.api.history.PlaceOrder;
import com.maptology.api.history.PlacePage;
import com.maptology.api.history.Visit;
import com.maptology.api.history.VisitPage;
import com.maptology.api.location.LocationUpdate;
@@ -30,16 +32,16 @@ import com.maptology.service.session.VisitSessionBean;
@RunWith(Arquillian.class)
public class HistorySessionTest extends AbstractSessionTest {
@Inject
@EJB
DeviceSessionBean deviceSession;
@Inject
@EJB
PlaceSessionBean placeSession;
@Inject
@EJB
VisitSessionBean visitSession;
@Inject
@EJB
LocationSessionBean locationSession;
/**
@@ -113,6 +115,21 @@ public class HistorySessionTest extends AbstractSessionTest {
if (v.getId() == visits.get(1).getId()) secondVisit = true;
}
Assert.assertTrue("Both visits should be found.", firstVisit && secondVisit);
// test ordering criteria
PlacePage placesById = placeSession.getCurrentUserPlaces(PlaceOrder.IDENTIFIER, new PageConfig(0, 1000));
Assert.assertTrue("Place page should not be empty.", placesById.getSize() > 0);
for (int i = 1; i < placesById.getElements().size(); i++) {
Assert.assertTrue("Should be ordered by identifier (asc)", placesById.getElements().get(i - 1).getId() < placesById.getElements().get(i).getId());
}
PlacePage placesByTime = placeSession.getCurrentUserPlaces(PlaceOrder.TIME, new PageConfig(0, 1000));
printApiObject(placesByTime);
Assert.assertTrue("Place page should not be empty.", placesByTime.getSize() > 0);
int firstVisitPlace = indexOf(placesByTime, visits.get(0).getPlace());
Assert.assertTrue("Place should be found in page.", (firstVisitPlace != -1));
int secondVisitPlace = indexOf(placesByTime, visits.get(1).getPlace());
Assert.assertTrue("Place should be found in page.", (secondVisitPlace != -1));
Assert.assertTrue("First visit should be after second.", firstVisitPlace > secondVisitPlace);
} catch (Exception e) {
Assert.assertNull("Should not receive an exception.", e);
}
@@ -120,6 +137,21 @@ public class HistorySessionTest extends AbstractSessionTest {
});
}
/**
* Finds the index of the first occurrence of the place in the page.
*
* @param page The page.
* @param place The place.
* @return The first occurrence or -1, if not contained.
*/
private static int indexOf(PlacePage page, long place) {
for (int i = 0; i < page.getElements().size(); i++) {
if (page.getElements().get(i).getId() == place) return i;
}
return -1;
}
/**
* Emulates a continuous motion at 50m/minute that is processed in a single batch.
*/
@@ -1,7 +1,9 @@
package com.maptology.service.test.session;
import javax.inject.Inject;
import javax.ejb.EJB;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -17,9 +19,6 @@ import com.maptology.service.session.DeviceSessionBean;
import com.maptology.service.session.LocationSessionBean;
import com.maptology.service.session.ShareSessionBean;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Assert;
/**
* Tests the location session.
*
@@ -28,13 +27,13 @@ import org.junit.Assert;
@RunWith(Arquillian.class)
public class LocationSessionTest extends AbstractSessionTest {
@Inject
@EJB
DeviceSessionBean deviceSession;
@Inject
@EJB
ShareSessionBean shareSession;
@Inject
@EJB
LocationSessionBean locationSession;
/**
@@ -5,6 +5,7 @@ import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.inject.Inject;
import org.jboss.arquillian.junit.Arquillian;
@@ -24,7 +25,7 @@ import com.maptology.service.session.LogSessionBean.ILogListener;
@RunWith(Arquillian.class)
public class LogSessionTest extends AbstractSessionTest {
@Inject
@EJB
LogSessionBean logSession;
@Inject
@@ -2,7 +2,7 @@ package com.maptology.service.test.session;
import java.util.List;
import javax.inject.Inject;
import javax.ejb.EJB;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Assert;
@@ -23,7 +23,7 @@ import com.maptology.service.session.NoticeSessionBean;
@RunWith(Arquillian.class)
public class NoticeSessionTest extends AbstractSessionTest {
@Inject
@EJB
NoticeSessionBean noticeSession;
/**
@@ -1,6 +1,6 @@
package com.maptology.service.test.session;
import javax.inject.Inject;
import javax.ejb.EJB;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Assert;
@@ -29,16 +29,16 @@ import com.maptology.service.session.ShareSessionBean;
@RunWith(Arquillian.class)
public class PrivilegeSessionTest extends AbstractSessionTest {
@Inject
@EJB
private ShareSessionBean shareSession;
@Inject
@EJB
private DeviceSessionBean deviceSession;
@Inject
@EJB
private LocationSessionBean locationSession;
@Inject
@EJB
private PrivilegeSessionBean privilegeSession;
@@ -1,6 +1,6 @@
package com.maptology.service.test.session;
import javax.inject.Inject;
import javax.ejb.EJB;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Assert;
@@ -25,13 +25,13 @@ import com.maptology.service.session.ShareSessionBean;
@RunWith(Arquillian.class)
public class ShareSessionTest extends AbstractSessionTest {
@Inject
@EJB
private ShareSessionBean shareSession;
@Inject
@EJB
private DeviceSessionBean deviceSession;
@Inject
@EJB
private LocationSessionBean locationSession;
/**

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