Commit d64281b6 authored by Toni Beier's avatar Toni Beier

Merge branch 'feature/public_transportation_system/favorites' into 'develop'

Feature/public transportation system/favorites

See merge request OpenASiST/openasist4android_core!28
parents a1806031 78d32800
......@@ -47,7 +47,7 @@
</service>
<service android:name=".core.manager.push.FirebaseIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
......
......@@ -31,10 +31,10 @@ android {
androidTest.setRoot('tests')
}
compileSdkVersion 28
buildToolsVersion '25.0.3'
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
minSdkVersion 21
targetSdkVersion 26
useLibrary 'org.apache.http.legacy'
versionCode 1
versionName '1.0'
......@@ -128,34 +128,37 @@ def parseFile(name) {
}
dependencies {
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile 'me.dm7.barcodescanner:zxing:1.9.8'
implementation 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
implementation 'me.dm7.barcodescanner:zxing:1.9.8'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.fasterxml.jackson.core:jackson-databind:2.9.4'
//compile 'com.j256.ormlite:ormlite-core:4.48'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.4'
//android support libraries
//simply compile google maps only
//compile 'com.google.android.gms:play-services:11.8.0'
compile 'com.google.android.gms:play-services-maps:12.0.1'
compile 'com.google.android.gms:play-services-location:12.0.1'
compile 'com.google.firebase:firebase-core:12.0.1'
compile 'com.google.firebase:firebase-messaging:12.0.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.jjoe64:graphview:3.1.3'
compile 'com.github.machinarius:preferencefragment:0.1.2'
compile 'com.loopj.android:android-async-http:1.4.5'
compile 'org.greenrobot:eventbus:3.0.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support.constraint:constraint-layout:1.1.3'
compile 'com.android.support:preference-v7:28.0.0'
//compile 'com.google.android.gms:play-services:12.0.1'
compile 'com.google.android.gms:play-services-maps:17.0.0'
compile 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.jjoe64:graphview:3.1.3'
implementation 'com.github.machinarius:preferencefragment:0.1.2'
implementation 'com.loopj.android:android-async-http:1.4.5'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha4'
implementation 'androidx.preference:preference:1.0.0'
// AndroidX Libraries
implementation 'androidx.work:work-runtime:2.0.0'
implementation 'androidx.work:work-runtime:2.1.0'
implementation group: 'androidx.appcompat', name: 'appcompat', version: '1.0.2'
// Material Design Libraries
implementation 'com.google.android.material:material:1.0.0'
}
allprojects {
......
......@@ -2,6 +2,7 @@ package de.bps.asist.core.manager.parser;
import android.content.res.Resources;
import android.os.Build;
import android.util.Log;
import org.springframework.http.HttpMethod;
import org.springframework.http.client.AbstractClientHttpRequestFactoryWrapper;
......@@ -43,6 +44,7 @@ public class ASiSTParser {
public <T extends Serializable> void parseWithTask(final String url, final Class<T> cl, final ParserCallback<T> callback){
final BackgroundParserTask<T> parser = new BackgroundParserTask<>(url, cl, callback, createStandartClientHttpRequestFactory());
parser.execute();
}
/**
......
......@@ -4,7 +4,9 @@ import android.content.Context;
import android.util.Log;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.FirebaseInstanceIdService;
//import com.google.firebase.iid.FirebaseInstanceIdService;
import com.google.firebase.messaging.FirebaseMessagingService;
import de.bps.asist.core.manager.environment.EnvironmentManager;
......@@ -12,7 +14,7 @@ import de.bps.asist.core.manager.environment.EnvironmentManager;
* Created by EPereira on 06.02.2017.
*/
public class FirebaseIDService extends FirebaseInstanceIdService {
public class FirebaseIDService extends FirebaseMessagingService {
private static final String TAG = "FirebaseIDService";
private EnvironmentManager environment;
......@@ -28,16 +30,21 @@ public class FirebaseIDService extends FirebaseInstanceIdService {
}
@Override
public void onTokenRefresh() {
public void onNewToken(String token) {
Log.d(TAG, "Refreshed token: " + token);
// Get updated InstanceID token.
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
//String refreshedToken = FirebaseInstanceId.getInstance().getToken();
//Log.d(TAG, "Refreshed token: " + refreshedToken);
// If you want to send messages to this application instance or
// manage this apps subscriptions on the server side, send the
// Instance ID token to your app server.
environment.setDeviceToken(context, refreshedToken);
pnm.registerDevice(context, refreshedToken);
sendRegistrationToServer(token);
}
private void sendRegistrationToServer(String token) {
//this method is to send token to your app server.
environment.setDeviceToken(context, token);
pnm.registerDevice(context, token);
}
}
\ No newline at end of file
......@@ -26,8 +26,8 @@ public class CanteenFragment extends AbstractASiSTFragment {
private ListView menus;
/**
* @see android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater,
/*
* @see androidx.core.app.Fragment#onCreateView(android.view.LayoutInflater,
* android.view.ViewGroup, android.os.Bundle)
*/
@Override
......
......@@ -22,8 +22,8 @@ public class FeedFragment extends AbstractASiSTFragment {
private ListView listView;
/**
* @see android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater,
/*
* @see androidx.core.app.Fragment#onCreateView(android.view.LayoutInflater,
* android.view.ViewGroup, android.os.Bundle)
*/
@Override
......
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#FFFFFF">
<path
android:fillColor="#FF000000"
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
</vector>
<vector android:height="24dp" android:viewportHeight="53.867"
android:viewportWidth="53.867" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#EFCE4A" android:pathData="M26.934,1.318l8.322,16.864l18.611,2.705l-13.467,13.126l3.179,18.536l-16.645,-8.751l-16.646,8.751l3.179,-18.536l-13.467,-13.126l18.611,-2.705z"/>
</vector>
<vector android:height="24dp" android:viewportHeight="55.867"
android:viewportWidth="55.867" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M11.287,54.548c-0.207,0 -0.414,-0.064 -0.588,-0.191c-0.308,-0.224 -0.462,-0.603 -0.397,-0.978l3.091,-18.018L0.302,22.602c-0.272,-0.266 -0.37,-0.663 -0.253,-1.024c0.118,-0.362 0.431,-0.626 0.808,-0.681l18.09,-2.629l8.091,-16.393c0.168,-0.342 0.516,-0.558 0.896,-0.558l0,0c0.381,0 0.729,0.216 0.896,0.558l8.09,16.393l18.091,2.629c0.377,0.055 0.689,0.318 0.808,0.681c0.117,0.361 0.02,0.759 -0.253,1.024L42.475,35.363l3.09,18.017c0.064,0.375 -0.09,0.754 -0.397,0.978c-0.308,0.226 -0.717,0.255 -1.054,0.076l-16.18,-8.506l-16.182,8.506C11.606,54.51 11.446,54.548 11.287,54.548zM3.149,22.584l12.016,11.713c0.235,0.229 0.343,0.561 0.287,0.885L12.615,51.72l14.854,-7.808c0.291,-0.154 0.638,-0.154 0.931,0l14.852,7.808l-2.836,-16.538c-0.056,-0.324 0.052,-0.655 0.287,-0.885l12.016,-11.713l-16.605,-2.413c-0.326,-0.047 -0.607,-0.252 -0.753,-0.547L27.934,4.578l-7.427,15.047c-0.146,0.295 -0.427,0.5 -0.753,0.547L3.149,22.584z"/>
</vector>
......@@ -3,12 +3,16 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/swipeRefreshLayout">
<ListView
android:id="@+id/dep_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:background="@color/white"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="5dp"
android:paddingRight="5dp"
android:baselineAligned="false">
<TextView
android:id="@+id/emptyStationList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/descColor"
style="@style/TitleTextField"
android:visibility="gone"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/pts_list_item"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:layout_gravity="center_vertical"
android:textColor="@color/defaultTitleColor"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingTop="5dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/defaultTitleColor"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:id="@+id/constraintLayoutHeader"
>
<androidx.constraintlayout.widget.Guideline
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/guideline"
app:layout_constraintGuide_begin="0dp"
app:layout_constraintGuide_percent="0.6"
android:orientation="vertical"
/>
<TextView
android:id="@+id/stationName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/defaultTitleColor"
style="@style/TitleTextField"
android:lines= "1"
android:singleLine="true"
android:ellipsize="end"
android:maxLines="1"
android:ems="6"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:autoSizeTextType="uniform"
app:autoSizeMinTextSize="16sp"
app:autoSizeMaxTextSize="100sp"
app:autoSizeStepGranularity="1sp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<ListView
android:id="@+id/dep_list"
android:layout_width="0dp"
android:layout_height="0dp"
android:divider="@null"
android:dividerHeight="0dp"
app:layout_constraintTop_toBottomOf="@id/constraintLayoutHeader"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
\ No newline at end of file
......@@ -15,19 +15,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/defaultTitleColor"
android:orientation="horizontal"
>
<RelativeLayout
android:id="@+id/ptsspinner"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" >
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
</RelativeLayout>
android:orientation="horizontal">
<TextView
android:id="@+id/ptsupdate"
android:layout_width="match_parent"
......@@ -37,9 +25,49 @@
android:textAlignment="gravity"
android:textSize="@dimen/descTextSize"
android:paddingLeft="10dp"
style="@style/TitleTextField"
/>
style="@style/TitleTextField"/>
</LinearLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/swipeRefreshLayout">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/module_publictransport_favorites"/>
<TextView
android:id="@+id/emptyFavStationList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/descColor"
style="@style/TitleTextField"
android:visibility="gone"
android:paddingLeft="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/emptyFavStationsTV"
android:visibility="gone"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/pts_fav_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/nearby_stations"/>
<TextView
android:id="@+id/emptyStationList"
android:layout_width="fill_parent"
......@@ -49,11 +77,19 @@
android:visibility="gone"
android:paddingLeft="10dp"
/>
<ListView
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/emptyNearStationsTV"
android:visibility="gone"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/pts_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
......@@ -3,7 +3,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/white">
android:background="@color/white"
android:padding="15dp">
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
......@@ -15,7 +16,7 @@
android:orientation="horizontal">
<ImageView
android:id="@+id/ptstype"
android:layout_height="@dimen/descTextSize"
android:layout_height="@dimen/defaultTitleSize"
android:layout_gravity="left|center_vertical"
android:scaleType="fitCenter"
/>
......@@ -24,7 +25,7 @@
android:id="@+id/number"
android:layout_gravity="center_horizontal"
android:textColor="@color/descColor"
android:textSize="@dimen/descTextSize"
android:textSize="@dimen/defaultTitleSize"
android:textStyle="bold"
style="@style/TitleTextField"
/>
......@@ -32,7 +33,12 @@
android:id="@+id/direction"
android:layout_gravity="center_horizontal"
android:textColor="@color/descColor"
android:textSize="@dimen/descTextSize"
android:lines= "1"
android:singleLine="true"
android:ellipsize="end"
android:maxLines="1"
android:ems="9"
android:textSize="@dimen/defaultTitleSize"
android:paddingLeft="10dp"
style="@style/TitleTextField"
/>
......@@ -40,7 +46,7 @@
android:id="@+id/ptstime"
android:layout_gravity="right"
android:textColor="@color/descColor"
android:textSize="@dimen/descTextSize"
android:textSize="@dimen/defaultTitleSize"
android:textStyle="bold"
android:paddingRight="2dp"
style="@style/TitleTextField"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/white">
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/GridLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="4"
android:rowCount="1"
android:orientation="horizontal">
<ImageView
android:id="@+id/ptstype"
android:layout_height="@dimen/defaultTitleSize"
android:layout_gravity="left|center_vertical"
android:scaleType="fitCenter"
/>
<TextView
android:id="@+id/number"
android:layout_gravity="center_horizontal"
android:textColor="@color/descColor"
android:textSize="@dimen/descTextSize"
android:textStyle="bold"
style="@style/TitleTextField"
/>
<TextView
android:id="@+id/direction"
android:layout_gravity="center_horizontal"
android:textColor="@color/descColor"
android:lines= "1"
android:singleLine="true"
android:ellipsize="end"
android:maxLines="1"
android:ems="9"
android:textSize="@dimen/descTextSize"
android:paddingLeft="10dp"
style="@style/TitleTextField"
/>
<TextView
android:id="@+id/ptstime"
android:layout_gravity="right"
android:textColor="@color/descColor"
android:textSize="@dimen/descTextSize"
android:textStyle="bold"
android:paddingRight="2dp"
style="@style/TitleTextField"
/>
</GridLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:background="@color/white"
android:paddingStart="10dp"
......@@ -20,9 +21,9 @@
android:visibility="gone"
/>
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/pts_list_item"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:layout_gravity="center_vertical"
......@@ -30,38 +31,86 @@
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingTop="5dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
>
<LinearLayout
android:layout_width="wrap_content"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/defaultTitleColor"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:id="@+id/constraintLayoutHeader"
>
<androidx.constraintlayout.widget.Guideline
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/guideline"
app:layout_constraintGuide_begin="0dp"
app:layout_constraintGuide_percent="0.6"
android:orientation="vertical"
/>
<TextView
android:id="@+id/stationName"
android:layout_width="fill_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/defaultTitleColor"
style="@style/TitleTextField"
android:lines= "1"
android:singleLine="true"
android:ellipsize="end"
android:maxLines="1"
android:ems="6"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:autoSizeTextType="uniform"
app:autoSizeMinTextSize="16sp"
app:autoSizeMaxTextSize="100sp"
app:autoSizeStepGranularity="1sp"
/>
<TextView
android:id="@+id/distance"
android:layout_width="fill_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/descColor"
android:textSize="@dimen/descTextSize"
android:paddingLeft="7dp"
style="@style/TitleTextField"
app:layout_constraintLeft_toRightOf="@id/stationName"
app:layout_constraintRight_toLeftOf="@id/favStation"
app:layout_constraintTop_toTopOf="parent"
/>
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/favStation"
app:srcCompat="@drawable/ic_fav_unselected"
android:paddingLeft="7dp"
android:paddingBottom="10dp"
android:paddingTop="5dp"
android:layout_marginRight="5dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<ListView
android:id="@+id/dep_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_height="0dp"
android:divider="@null"
android:dividerHeight="0dp"
app:layout_constraintTop_toBottomOf="@id/constraintLayoutHeader"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
</menu>
\ No newline at end of file
......@@ -229,6 +229,7 @@
<!-- Public Transport Module -->
<string name="module_publictransport_name">Public transport</string>
<string name="module_publictransport_favorites">Favorites</string>
<!-- Telephone Directory Module -->
<string name="module_telephonedirectory_name">Directory</string>
......@@ -297,6 +298,7 @@
<string name="module_pts_update_extended">updated</string>
<string name="module_pts_error_location">No geocoordinates could be found.</string>
<string name="module_pts_empty_station_list">No stations could be found nearby.</string>
<string name="module_pts_empty_fav_station_list">No favorite stations</string>
<string name="module_pts_api_not_available">Google Play services not usable.</string>
<string name="module_pts_location_permission_request_failed">GPS disabled, because no permission to activate GPS</string>
<string name="module_pts_location_permission_request_dialog_titel">Grand GPS access</string>
......@@ -334,4 +336,5 @@
<p style="text-align: justify;"