Skip to content

Commit cac3391

Browse files
committed
Merge branch 'v1.2.x' of github.com:mattvb91/Subterminal
2 parents 5e928c9 + e78a242 commit cac3391

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2821
-231
lines changed

app/build.gradle

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ repositories {
77

88
android {
99
compileSdkVersion 24
10-
buildToolsVersion "24.0.3"
10+
buildToolsVersion '25.0.0'
1111
defaultConfig {
1212
applicationId "mavonie.subterminal"
1313
minSdkVersion 19
1414
targetSdkVersion 24
15-
versionCode 27
16-
versionName "1.1.11"
15+
versionCode 29
16+
versionName "1.2.1"
1717
multiDexEnabled true
1818
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1919
}
@@ -44,13 +44,13 @@ dependencies {
4444
exclude group: 'com.android.support', module: 'design'
4545
exclude group: 'com.android.support', module: 'recyclerview-v7'
4646
}
47-
compile('com.facebook.fresco:fresco:0.14.1') {
47+
compile('com.facebook.fresco:fresco:1.2.0') {
4848
exclude group: 'com.parse.bolts', module: 'bolts-tasks';
4949
}
50-
compile 'com.google.firebase:firebase-core:9.8.0'
51-
compile 'com.google.firebase:firebase-crash:9.8.0'
52-
compile 'com.google.firebase:firebase-messaging:9.8.0'
53-
compile 'com.google.firebase:firebase-ads:9.8.0'
50+
compile 'com.google.firebase:firebase-core:10.2.1'
51+
compile 'com.google.firebase:firebase-crash:10.2.1'
52+
compile 'com.google.firebase:firebase-messaging:10.2.1'
53+
compile 'com.google.firebase:firebase-ads:10.2.1'
5454

5555
compile 'co.lujun:androidtagview:1.0.5'
5656
compile 'com.github.developer-shivam:crescento:1.1.0'
@@ -61,13 +61,13 @@ dependencies {
6161
compile 'com.facebook.android:facebook-android-sdk:4.3.0'
6262
compile 'com.android.support:support-v4:24.2.1'
6363
compile 'com.android.support:recyclerview-v7:24.2.1'
64-
compile 'com.google.android.gms:play-services-maps:9.8.0'
64+
compile 'com.google.android.gms:play-services-maps:10.2.1'
6565
compile 'com.android.support:cardview-v7:24.2.1'
6666
compile 'de.cketti.library.changelog:ckchangelog:1.2.2'
6767
compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
6868
compile 'com.kbeanie:multipicker:1.1.2@aar'
69-
compile 'com.squareup.retrofit2:retrofit:2.1.0'
70-
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
69+
compile 'com.squareup.retrofit2:retrofit:2.2.0'
70+
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
7171
compile 'com.sa90.materialarcmenu:library:1.4.1'
7272
compile 'com.tomer:fadingtextview:1.2'
7373
compile 'com.android.support:design:24+'
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
package mavonie.subterminal.Skydiving;
2+
3+
4+
import android.support.test.espresso.ViewInteraction;
5+
import android.support.test.espresso.matcher.ViewMatchers;
6+
import android.view.View;
7+
import android.view.ViewGroup;
8+
import android.view.ViewParent;
9+
10+
import com.pixplicity.easyprefs.library.Prefs;
11+
12+
import org.hamcrest.Description;
13+
import org.hamcrest.Matcher;
14+
import org.hamcrest.TypeSafeMatcher;
15+
import org.junit.Before;
16+
import org.junit.Test;
17+
18+
import mavonie.subterminal.BaseTest;
19+
import mavonie.subterminal.MainActivityTest;
20+
import mavonie.subterminal.Preference;
21+
import mavonie.subterminal.R;
22+
import mavonie.subterminal.Utils.Subterminal;
23+
24+
import static android.support.test.espresso.Espresso.onView;
25+
import static android.support.test.espresso.action.ViewActions.click;
26+
import static android.support.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition;
27+
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
28+
import static android.support.test.espresso.matcher.ViewMatchers.withId;
29+
import static android.support.test.espresso.matcher.ViewMatchers.withParent;
30+
import static android.support.test.espresso.matcher.ViewMatchers.withText;
31+
import static org.hamcrest.Matchers.allOf;
32+
33+
34+
public class TunnelsTest extends BaseTest {
35+
36+
@Before
37+
public void setMode() {
38+
if (!Prefs.getString(Preference.PREFS_MODE, null).equals(Subterminal.MODE_SKYDIVING)) {
39+
MainActivityTest.testSkydiveMode();
40+
}
41+
}
42+
43+
private void navigateToTunnels() {
44+
openNavigationDrawer();
45+
46+
ViewInteraction appCompatCheckedTextView = onView(
47+
allOf(ViewMatchers.withId(R.id.design_menu_item_text), withText("Tunnels"), isDisplayed()));
48+
appCompatCheckedTextView.perform(click());
49+
}
50+
51+
@Test
52+
public void tunnelsTest() {
53+
navigateToTunnels();
54+
55+
ViewInteraction recyclerView = onView(
56+
allOf(withId(R.id.list),
57+
withParent(withId(R.id.flContent)),
58+
isDisplayed()));
59+
recyclerView.perform(actionOnItemAtPosition(0, click()));
60+
61+
}
62+
63+
private static Matcher<View> childAtPosition(
64+
final Matcher<View> parentMatcher, final int position) {
65+
66+
return new TypeSafeMatcher<View>() {
67+
@Override
68+
public void describeTo(Description description) {
69+
description.appendText("Child at position " + position + " in parent ");
70+
parentMatcher.describeTo(description);
71+
}
72+
73+
@Override
74+
public boolean matchesSafely(View view) {
75+
ViewParent parent = view.getParent();
76+
return parent instanceof ViewGroup && parentMatcher.matches(parent)
77+
&& view.equals(((ViewGroup) parent).getChildAt(position));
78+
}
79+
};
80+
}
81+
}

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="mavonie.subterminal"
4-
android:versionName="1.1.11">
4+
android:versionName="1.2.1">
55

66
<uses-permission android:name="android.permission.INTERNET"/>
77
<uses-permission android:name="android.permission.ACCESS_GPS"/>

app/src/main/assets/sql/create.sql

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ CREATE TABLE jump (
4747
exit_id INTEGER,
4848
gear_id INTEGER,
4949
pc_size INTEGER,
50+
pc_config INTEGER,
5051
slider INTEGER,
5152
delay INTEGER,
5253
description TEXT,
@@ -124,6 +125,33 @@ CREATE TABLE skydive_dropzone (
124125
featured INTEGER DEFAULT 0
125126
);
126127

128+
CREATE TABLE skydive_tunnel (
129+
_id INTEGER PRIMARY KEY,
130+
name TEXT,
131+
description TEXT,
132+
latitude DOUBLE,
133+
longtitude DOUBLE,
134+
website TEXT,
135+
phone TEXT,
136+
email TEXT,
137+
formatted_address TEXT,
138+
local TEXT,
139+
country TEXT,
140+
tunnel_diameter,
141+
tunnel_height,
142+
featured INTEGER DEFAULT 0
143+
);
144+
145+
CREATE TABLE skydive_tunnel_session (
146+
_id INTEGER PRIMARY KEY,
147+
date DATE,
148+
description TEXT,
149+
length INTEGER,
150+
tunnel_id INTEGER,
151+
synced INTEGER DEFAULT 0,
152+
deleted INTEGER DEFAULT 0
153+
);
154+
127155
CREATE TABLE skydive_rig (
128156
_id INTEGER PRIMARY KEY,
129157
container_manufacturer TEXT,
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
CREATE TABLE skydive_tunnel (
2+
_id INTEGER PRIMARY KEY,
3+
name TEXT,
4+
description TEXT,
5+
latitude DOUBLE,
6+
longtitude DOUBLE,
7+
website TEXT,
8+
phone TEXT,
9+
email TEXT,
10+
formatted_address TEXT,
11+
local TEXT,
12+
country TEXT,
13+
tunnel_diameter,
14+
tunnel_height,
15+
featured INTEGER DEFAULT 0
16+
);
17+
18+
CREATE TABLE skydive_tunnel_session (
19+
_id INTEGER PRIMARY KEY,
20+
date DATE,
21+
description TEXT,
22+
length INTEGER,
23+
tunnel_id INTEGER,
24+
synced INTEGER DEFAULT 0,
25+
deleted INTEGER DEFAULT 0
26+
);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE jump ADD COLUMN pc_config INTEGER;

app/src/main/java/mavonie/subterminal/Dashboard.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
3030
import com.github.mikephil.charting.utils.ColorTemplate;
3131
import com.github.mikephil.charting.utils.ViewPortHandler;
32-
import com.pixplicity.easyprefs.library.Prefs;
3332
import com.tomer.fadingtextview.FadingTextView;
3433

3534
import java.util.ArrayList;
@@ -105,8 +104,8 @@ public void onClick(View v) {
105104
whereNotGlobal.put(Model.FILTER_WHERE_FIELD, Exit.COLUMN_NAME_GLOBAL_ID);
106105
whereNotGlobal.put(Model.FILTER_WHERE_VALUE, null);
107106

108-
skydiveCount.setText(Integer.toString(Prefs.getInt(Preference.PREFS_SKYDIVE_START_COUNT, 0) + new Skydive().count(Synchronizable.getActiveParams())));
109-
baseCount.setText(Integer.toString(Prefs.getInt(Preference.PREFS_JUMP_START_COUNT, 0) + new Jump().count(Synchronizable.getActiveParams())));
107+
skydiveCount.setText(Integer.toString(Subterminal.getUser().getSettings().getSkydiveStartJumpNo() + new Skydive().count(Synchronizable.getActiveParams())));
108+
baseCount.setText(Integer.toString(Subterminal.getUser().getSettings().getBaseStartJumpNo() + new Jump().count(Synchronizable.getActiveParams())));
110109
dropzoneCount.setText(Integer.toString(Dropzone.getDropzonesVisitedCount()));
111110
exitsCount.setText(Integer.toString(new Exit().count(whereNotGlobal)));
112111

app/src/main/java/mavonie/subterminal/Forms/JumpForm.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
import android.widget.Spinner;
1313
import android.widget.TextView;
1414

15-
import com.pixplicity.easyprefs.library.Prefs;
16-
1715
import java.util.Arrays;
1816
import java.util.Calendar;
1917
import java.util.LinkedHashMap;
@@ -24,7 +22,6 @@
2422
import mavonie.subterminal.Models.Gear;
2523
import mavonie.subterminal.Models.Jump;
2624
import mavonie.subterminal.Models.Suit;
27-
import mavonie.subterminal.Preference;
2825
import mavonie.subterminal.R;
2926
import mavonie.subterminal.Utils.Adapters.LinkedHashMapAdapter;
3027
import mavonie.subterminal.Utils.Date.DateFormat;
@@ -42,7 +39,8 @@ public class JumpForm extends BaseForm implements AdapterView.OnItemClickListene
4239
pilotChute,
4340
sliderConfig,
4441
jumpTypeSpinner,
45-
suitSpinner;
42+
suitSpinner,
43+
pcConfigSpinner;
4644

4745
private TextView delay,
4846
description,
@@ -57,6 +55,8 @@ public class JumpForm extends BaseForm implements AdapterView.OnItemClickListene
5755
private LinkedHashMap suits = new LinkedHashMap();
5856
LinkedHashMapAdapter suitsAdapter = new LinkedHashMapAdapter<Integer, String>(MainActivity.getActivity(), android.R.layout.simple_spinner_item, this.suits);
5957

58+
LinkedHashMapAdapter pcConfigAdapter = new LinkedHashMapAdapter<Integer, String>(MainActivity.getActivity(), android.R.layout.simple_spinner_item, new LinkedHashMap<>(Jump.pc_configs));
59+
6060
@Override
6161
protected String getItemClass() {
6262
return Jump.class.getCanonicalName();
@@ -76,6 +76,7 @@ protected void assignFormElements(View view) {
7676
this.sliderConfig = (Spinner) view.findViewById(R.id.jump_edit_slider);
7777
this.delay = (TextView) view.findViewById(R.id.jump_edit_delay);
7878
this.description = (TextView) view.findViewById(R.id.jump_edit_description);
79+
this.pcConfigSpinner = (Spinner) view.findViewById(R.id.jump_edit_pc_config);
7980

8081
this.exitNames = new Exit().getItemsForSelect("name");
8182

@@ -97,6 +98,11 @@ protected void assignFormElements(View view) {
9798
gearSpinner.setVisibility(View.GONE);
9899
}
99100

101+
//PC Config Spinner
102+
pcConfigAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
103+
this.pcConfigSpinner.setAdapter(pcConfigAdapter);
104+
//End PC Config Spinner
105+
100106
//SUIT SPINNER
101107
this.suitSpinner = (Spinner) view.findViewById(R.id.jump_edit_suit);
102108
this.suitsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
@@ -111,7 +117,7 @@ protected void assignFormElements(View view) {
111117
ArrayAdapter<Integer> pcSizeAdapter = new ArrayAdapter<Integer>(MainActivity.getActivity(), android.R.layout.simple_spinner_item, Jump.getPcSizeArray());
112118
pcSizeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
113119
pcSizeSpinner.setAdapter(pcSizeAdapter);
114-
pcSizeSpinner.setSelection(Arrays.asList(Jump.getPcSizeArray()).indexOf(Prefs.getInt(Preference.PREFS_DEFAULT_PC, 32)), false);
120+
pcSizeSpinner.setSelection(Arrays.asList(Jump.getPcSizeArray()).indexOf(Subterminal.getUser().getSettings().getBaseDefaultPcSize()), false);
115121

116122

117123
Spinner sliderConfigSpinner = (Spinner) view.findViewById(R.id.jump_edit_slider);
@@ -122,7 +128,7 @@ protected void assignFormElements(View view) {
122128

123129
sliderAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
124130
sliderConfigSpinner.setAdapter(sliderAdapter);
125-
sliderConfigSpinner.setSelection(Prefs.getInt(Preference.PREFS_DEFAULT_SLIDER, Jump.SLIDER_DOWN), false);
131+
sliderConfigSpinner.setSelection(Subterminal.getUser().getSettings().getBaseDefaultSliderConfig(), false);
126132

127133
jumpTypeSpinner = (Spinner) view.findViewById(R.id.jump_edit_type);
128134
ArrayAdapter<String> typeAdapter =
@@ -170,7 +176,7 @@ public void onNothingSelected(AdapterView<?> adapterView) {
170176

171177
}
172178
});
173-
jumpTypeSpinner.setSelection(Prefs.getInt(Preference.PREFS_DEFAULT_JUMP_TYPE, Jump.TYPE_SLICK));
179+
jumpTypeSpinner.setSelection(Subterminal.getUser().getSettings().getBaseDefaultJumpType());
174180

175181
this.date = (EditText) view.findViewById(R.id.jump_edit_date);
176182
DateFormat df = new DateFormat();
@@ -237,7 +243,7 @@ public void save() {
237243
if (exit == null) {
238244
exit = new Exit();
239245
exit.setName(exitName);
240-
exit.setHeightUnit(Prefs.getInt(Preference.PREFS_DEFAULT_HEIGHT_UNIT, Subterminal.HEIGHT_UNIT_IMPERIAL));
246+
exit.setHeightUnit(Subterminal.getUser().getSettings().getDefaultHeightUnit());
241247
exit.save();
242248
}
243249

@@ -260,6 +266,7 @@ public void save() {
260266
getItem().setPcSize(Integer.parseInt(pilotChuteSize));
261267
getItem().setSlider(Integer.parseInt(Long.toString(sliderConfigID)));
262268
getItem().setDate(date.getText().toString());
269+
getItem().setPcConfig((Integer) pcConfigAdapter.getItem(pcConfigSpinner.getSelectedItemPosition()).getKey());
263270

264271
if (delayString.length() > 0) {
265272
getItem().setDelay(Integer.parseInt(delayString));
@@ -311,6 +318,10 @@ protected void updateForm() {
311318
suitSpinner.setSelection(this.suitsAdapter.findPositionFromKey(getItem().getSuitId()), false);
312319
}
313320

321+
if (getItem().getPcConfig() != null) {
322+
pcConfigSpinner.setSelection(this.pcConfigAdapter.findPositionFromKey(getItem().getPcConfig()), false);
323+
}
324+
314325
this.delay.setText(Integer.toString(getItem().getDelay()));
315326
this.description.setText(getItem().getDescription());
316327

0 commit comments

Comments
 (0)