Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bertware committed Jan 18, 2018
2 parents b1699d4 + 9596796 commit 2b9b469
Show file tree
Hide file tree
Showing 176 changed files with 7,466 additions and 1,811 deletions.
36 changes: 23 additions & 13 deletions Hyperrail/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'com.google.firebase.firebase-crash'

def VERSION_CODE = 16
def VERSION_NAME = '0.9.14'
def VERSION_CODE = 17
def VERSION_NAME = '0.9.15'

android {
signingConfigs {
Expand All @@ -22,12 +22,12 @@ android {
}
}
}
compileSdkVersion 26
compileSdkVersion 27
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "be.hyperrail.android"
minSdkVersion 19
targetSdkVersion 26
targetSdkVersion 27
versionCode VERSION_CODE
versionName VERSION_NAME
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -50,23 +50,33 @@ android {
}

dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services-maps:11.4.2'
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})

compile 'com.android.volley:volley:1.0.0'
compile 'joda-time:joda-time:2.9.4'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.google.android.gms:play-services-location:11.6.0'
compile 'com.google.firebase:firebase-crash:11.6.0'
compile 'com.google.firebase:firebase-perf:11.6.0'
compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support:support-v4:27.0.2'
compile 'com.android.support:cardview-v7:27.0.2'
compile 'com.android.support:recyclerview-v7:27.0.2'
compile 'com.android.support:design:27.0.2'
compile 'com.google.android.gms:play-services-location:11.4.2'
compile 'com.google.firebase:firebase-crash:11.4.2'
compile 'com.google.firebase:firebase-perf:11.4.2'
compile 'com.google.firebase:firebase-core:11.4.2'
testCompile 'junit:junit:4.12'
testCompile 'org.json:json:20160810'
// org.json is included with Android, but Android.jar can not be used from unit tests
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
}

apply plugin: 'com.google.gms.google-services'

This file was deleted.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package be.hyperrail.android.test;

import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import be.hyperrail.android.irail.contracts.IrailStationProvider;
import be.hyperrail.android.irail.db.Station;
import be.hyperrail.android.irail.db.StationsDb;

import static junit.framework.Assert.assertEquals;

@RunWith(AndroidJUnit4.class)
public class StationsDbInstrumentedTest {

IrailStationProvider provider = new StationsDb(InstrumentationRegistry.getTargetContext());

@Test
public void testStationSearch(){
//BE.NMBS.008811437 Bosvoorde/Boitsfort Boitsfort Bosvoorde be 4.408112 50.794698 31.947976878613
Station bosvoorde = provider.getStationById("BE.NMBS.008811437");
assertEquals("BE.NMBS.008811437", bosvoorde.getId());
assertEquals("Bosvoorde/Boitsfort", bosvoorde.getName());
assertEquals("Bosvoorde", bosvoorde.getAlternativeNl());
assertEquals("Boitsfort", bosvoorde.getAlternativeFr());
assertEquals("", bosvoorde.getAlternativeEn());
assertEquals("", bosvoorde.getAlternativeDe());
assertEquals("be", bosvoorde.getCountryCode());
assertEquals(4.408112, bosvoorde.getLongitude(),0.0000001);
assertEquals(50.794698, bosvoorde.getLatitude(),0.0000001);
assertEquals( 31.947976878613, bosvoorde.getAvgStopTimes(),0.0001);

// Test for caps variations, different languages, and diferent separator symbols
String searchnames[] = new String[]{"Bosvoorde","Boitsfort","Bosvoorde/Boitsfort","Bosvoorde Boitsfort","Bosvoorde-Boitsfort","BOSVOORDE"};
for (String name :searchnames) {
assertEquals(bosvoorde.getId(),provider.getStationByName(name).getId());
}
// BE.NMBS.008866001 Arlon Aarlen Arel
Station arlon = provider.getStationById("BE.NMBS.008866001");
assertEquals("BE.NMBS.008866001", arlon.getId());
assertEquals("Arlon", arlon.getName());
assertEquals("Aarlen", arlon.getAlternativeNl());
assertEquals("", arlon.getAlternativeFr());
assertEquals("", arlon.getAlternativeEn());
assertEquals("Arel", arlon.getAlternativeDe());

}
}
28 changes: 28 additions & 0 deletions Hyperrail/src/debug/res/values/google_maps_api.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!--
~ This Source Code Form is subject to the terms of the Mozilla Public
~ License, v. 2.0. If a copy of the MPL was not distributed with this
~ file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->

<resources>
<!--
To get one, follow this link, follow the directions and press "Create" at the end:
https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=A1:A3:0E:79:C2:F8:0C:4A:B9:69:A5:1B:F0:91:CB:45:8E:4C:40:31%3Bbe.hyperrail.android
You can also add your credentials to an existing key, using these values:
Package name:
A1:A3:0E:79:C2:F8:0C:4A:B9:69:A5:1B:F0:91:CB:45:8E:4C:40:31
SHA-1 certificate fingerprint:
A1:A3:0E:79:C2:F8:0C:4A:B9:69:A5:1B:F0:91:CB:45:8E:4C:40:31
Alternatively, follow the directions here:
https://developers.google.com/maps/documentation/android/start#get-key
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.
-->
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyAcxOmBuJfsO11qC1Ig9xP4FewwXpb_KN0</string>
</resources>
65 changes: 50 additions & 15 deletions Hyperrail/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>

<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

<application
android:name="be.hyperrail.android.Launcher"
android:name=".Launcher"
android:allowBackup="true"
android:icon="@drawable/hyperrail"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="false"
android:theme="@style/Hyperrail">

<activity
android:name="be.hyperrail.android.MainActivity"
android:name=".MainActivity"
android:windowSoftInputMode="stateUnchanged">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
Expand All @@ -24,23 +30,52 @@
</intent-filter>
</activity>
<activity
android:name=".LiveboardActivity"
android:exported="true"
android:name="be.hyperrail.android.LiveboardActivity"
android:parentActivityName="be.hyperrail.android.MainActivity"/>
android:parentActivityName=".MainActivity"/>
<activity
android:name=".RouteActivity"
android:exported="true"
android:name="be.hyperrail.android.RouteActivity"
android:parentActivityName="be.hyperrail.android.MainActivity"/>
android:parentActivityName=".MainActivity"/>
<activity
android:name=".TrainActivity"
android:exported="true"
android:name="be.hyperrail.android.TrainActivity"
android:parentActivityName="be.hyperrail.android.MainActivity"/>
android:parentActivityName=".MainActivity"/>
<activity
android:name="be.hyperrail.android.SettingsActivity"
android:name=".SettingsActivity"
android:label="@string/title_activity_settings"
android:parentActivityName="be.hyperrail.android.MainActivity"/>
<activity android:name="be.hyperrail.android.RouteDetailActivity"
android:parentActivityName="be.hyperrail.android.MainActivity">
android:parentActivityName=".MainActivity"/>
<activity
android:name=".RouteDetailActivity"
android:parentActivityName=".MainActivity">
</activity>
<activity
android:name=".StationActivity"
android:parentActivityName=".MainActivity">
</activity>
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key"/>

<receiver android:name=".NextDeparturesWidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>

<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/appwidget_provider"/>
</receiver>

<activity android:name=".StationPickerActivity">
</activity>
</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public class DisturbanceListFragment extends Fragment implements OnRecyclerItemC
private Disturbance[] disturbances;
private DateTime lastUpdate;

DisturbanceCardAdapter disturbanceCardAdapter;

public DisturbanceListFragment() {
// Required empty public constructor
}
Expand All @@ -62,6 +64,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
return inflater.inflate(R.layout.fragment_disturbance_list, container, false);
}


@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Expand All @@ -88,9 +91,9 @@ public void onRefresh() {
vRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
}

DisturbanceCardAdapter adapter = new DisturbanceCardAdapter(this.getActivity().getApplicationContext(), null);
adapter.setOnItemClickListener(this);
vRecyclerView.setAdapter(adapter);
disturbanceCardAdapter = new DisturbanceCardAdapter(this.getActivity().getApplicationContext(), null);
disturbanceCardAdapter.setOnItemClickListener(this);
vRecyclerView.setAdapter(disturbanceCardAdapter);

if (savedInstanceState != null && savedInstanceState.containsKey("updated")) {
this.disturbances = (Disturbance[]) savedInstanceState.getSerializable("disturbances");
Expand Down Expand Up @@ -137,7 +140,7 @@ private void setData(Disturbance[] disturbances) {
}

this.disturbances = disturbances;
((DisturbanceCardAdapter) vRecyclerView.getAdapter()).updateDisturbances(disturbances);
disturbanceCardAdapter.updateDisturbances(disturbances);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected int getLayout() {

@Override
protected int getMenuLayout() {
return R.menu.actionbar_searchresult_station;
return R.menu.actionbar_searchresult_liveboard;
}

@Override
Expand All @@ -141,6 +141,9 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.action_to:
startActivity(MainActivity.createRouteToIntent(getApplicationContext(), mCurrentStation.getName()));
return true;
case R.id.action_details:
startActivity(StationActivity.createIntent(getApplicationContext(),mCurrentStation));
return true;
case R.id.action_shortcut:
Intent shortcutIntent = createShortcutIntent();

Expand Down
Loading

0 comments on commit 2b9b469

Please sign in to comment.