Skip to content

Commit 318ec5e

Browse files
committed
Merge tag 'v1.2.5'
2 parents cac3391 + 8af9f9f commit 318ec5e

39 files changed

+733
-382
lines changed

app/build.gradle

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ android {
1212
applicationId "mavonie.subterminal"
1313
minSdkVersion 19
1414
targetSdkVersion 24
15-
versionCode 29
16-
versionName "1.2.1"
15+
versionCode 33
16+
versionName "1.2.5"
1717
multiDexEnabled true
1818
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1919
}
@@ -44,14 +44,17 @@ 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:1.2.0') {
47+
compile('com.facebook.fresco:fresco:1.3.0') {
4848
exclude group: 'com.parse.bolts', module: 'bolts-tasks';
4949
}
5050
compile 'com.google.firebase:firebase-core:10.2.1'
5151
compile 'com.google.firebase:firebase-crash:10.2.1'
5252
compile 'com.google.firebase:firebase-messaging:10.2.1'
5353
compile 'com.google.firebase:firebase-ads:10.2.1'
5454

55+
compile 'com.jakewharton:butterknife:8.5.1'
56+
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
57+
5558
compile 'co.lujun:androidtagview:1.0.5'
5659
compile 'com.github.developer-shivam:crescento:1.1.0'
5760
compile 'com.flaviofaria:kenburnsview:1.0.7'

app/proguard-rules.pro

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,15 @@
2626
-keep class com.birbit.android.jobqueue.** { *; }
2727

2828
-dontwarn okio.**
29-
-keep class okio.** { *; }
3029

31-
-dontwarn retrofit2.**
32-
-keep class retrofit2.** { *; }
30+
-dontwarn retrofit.**
31+
-keep class retrofit.** { *; }
32+
33+
# Platform calls Class.forName on types which do not exist on Android to determine platform.
34+
-dontnote retrofit2.Platform
35+
# Platform used when running on Java 8 VMs. Will not be used at runtime.
36+
-dontwarn retrofit2.Platform$Java8
37+
# Retain generic type information for use by reflection by converters and adapters.
38+
-keepattributes Signature
39+
# Retain declared checked exceptions for use by a Proxy instance.
40+
-keepattributes Exceptions

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.2.1">
4+
android:versionName="1.2.5">
55

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

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

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
import java.util.List;
3939
import java.util.Map;
4040

41+
import butterknife.BindView;
42+
import butterknife.ButterKnife;
4143
import mavonie.subterminal.Models.Exit;
4244
import mavonie.subterminal.Models.Jump;
4345
import mavonie.subterminal.Models.Model;
@@ -57,28 +59,20 @@ public class Dashboard extends Fragment {
5759

5860
private static final int ANIMATION_SPEED = 1000;
5961

60-
PieChart mChart;
61-
BarChart favouriteExits;
62-
LineChart pullLineChart;
62+
@BindView(R.id.dashboard_base_objects_pie) PieChart mChart;
63+
@BindView(R.id.dashboard_base_fav_exits) BarChart favouriteExits;
64+
@BindView(R.id.dashboard_pull_height_linechart) LineChart pullLineChart;
6365

64-
TextView skydiveCount;
65-
TextView baseCount;
66-
TextView dropzoneCount;
67-
TextView exitsCount;
66+
@BindView(R.id.dashboard_skydive_count) TextView skydiveCount;
67+
@BindView(R.id.dashboard_base_count) TextView baseCount;
68+
@BindView(R.id.dashboard_dropzone_count) TextView dropzoneCount;
69+
@BindView(R.id.dashboard_exits_count) TextView exitsCount;
6870

6971
@Override
7072
public View onCreateView(LayoutInflater inflater, ViewGroup container,
7173
Bundle savedInstanceState) {
7274
View view = inflater.inflate(R.layout.fragment_dashboard, container, false);
73-
74-
mChart = (PieChart) view.findViewById(R.id.dashboard_base_objects_pie);
75-
favouriteExits = (BarChart) view.findViewById(R.id.dashboard_base_fav_exits);
76-
pullLineChart = (LineChart) view.findViewById(R.id.dashboard_pull_height_linechart);
77-
78-
skydiveCount = (TextView) view.findViewById(R.id.dashboard_skydive_count);
79-
baseCount = (TextView) view.findViewById(R.id.dashboard_base_count);
80-
dropzoneCount = (TextView) view.findViewById(R.id.dashboard_dropzone_count);
81-
exitsCount = (TextView) view.findViewById(R.id.dashboard_exits_count);
75+
ButterKnife.bind(this, view);
8276

8377
clickableSummaryStats(view);
8478

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,20 @@ public void onClick(View v) {
142142
}
143143
});
144144

145+
exit_edit_lat.setOnFocusChangeListener(new View.OnFocusChangeListener() {
146+
@Override public void onFocusChange(View v, boolean hasFocus) {
147+
if (hasFocus)
148+
locationManager.removeUpdates(locationListener);
149+
}
150+
});
151+
152+
exit_edit_long.setOnFocusChangeListener(new View.OnFocusChangeListener() {
153+
@Override public void onFocusChange(View v, boolean hasFocus) {
154+
if (hasFocus)
155+
locationManager.removeUpdates(locationListener);
156+
}
157+
});
158+
145159
heightUnit = (RadioGroup) view.findViewById(R.id.height_unit_radio_group);
146160
UIHelper.prefillHeightUnit(heightUnit);
147161

@@ -271,4 +285,10 @@ public void onItemSelected(AdapterView<?> parent, View view, int position, long
271285
public void onNothingSelected(AdapterView<?> parent) {
272286

273287
}
288+
289+
@Override
290+
public void onPause() {
291+
super.onPause();
292+
locationManager.removeUpdates(locationListener);
293+
}
274294
}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,11 @@ protected void updateForm() {
312312
this.suits.putAll(new Suit().getItemsForSpinner(convertTypes(getItem().getType())));
313313
this.suitsAdapter.notifyDataSetChanged();
314314
}
315+
315316
suitSpinner.setAdapter(this.suitsAdapter);
316-
if (getItem().getSuitId() != null) {
317-
suitEntry = suitsAdapter.getItem(this.suitsAdapter.findPositionFromKey(getItem().getSuitId()));
318-
suitSpinner.setSelection(this.suitsAdapter.findPositionFromKey(getItem().getSuitId()), false);
317+
if (getItem().getSuit() != null) {
318+
suitEntry = suitsAdapter.getItem(this.suitsAdapter.findPositionFromKey(getItem().getSuit().getId()));
319+
suitSpinner.setSelection(this.suitsAdapter.findPositionFromKey(getItem().getSuit().getId()), false);
319320
}
320321

321322
if (getItem().getPcConfig() != null) {
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package mavonie.subterminal;
2+
3+
import android.content.Intent;
4+
import android.net.Uri;
5+
import android.os.Bundle;
6+
import android.support.v4.app.Fragment;
7+
import android.view.LayoutInflater;
8+
import android.view.View;
9+
import android.view.ViewGroup;
10+
import android.widget.EditText;
11+
12+
import butterknife.BindView;
13+
import butterknife.ButterKnife;
14+
import butterknife.OnClick;
15+
import mavonie.subterminal.Utils.Subterminal;
16+
import mavonie.subterminal.Utils.UIHelper;
17+
18+
/**
19+
* Login handling
20+
*/
21+
public class Login extends Fragment {
22+
23+
@BindView(R.id.email_edittext) EditText email;
24+
@BindView(R.id.password_edittext) EditText password;
25+
26+
@OnClick(R.id.facebook_login_button) void facebookDialog() {
27+
UIHelper.facebookDialog();
28+
}
29+
30+
@OnClick(R.id.register_button) void registerButtonPressed() {
31+
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://subterminal.eu/register"));
32+
startActivity(browserIntent);
33+
}
34+
35+
@OnClick(R.id.reset_password_button) void resetPasswordPressed() {
36+
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://subterminal.eu/password/reset"));
37+
startActivity(browserIntent);
38+
}
39+
40+
@OnClick(R.id.sign_in_button) void signInPressed() {
41+
//Make sure email & password have been filed.
42+
if (email.getText().toString().isEmpty()) {
43+
email.setError("Email Required");
44+
return;
45+
}
46+
47+
if (password.getText().toString().isEmpty()) {
48+
password.setError("Password Required");
49+
return;
50+
}
51+
52+
Subterminal.getApi().authenticate(email.getText().toString(), password.getText().toString());
53+
}
54+
55+
@Override
56+
public View onCreateView(LayoutInflater inflater, ViewGroup container,
57+
Bundle savedInstanceState) {
58+
59+
if(Subterminal.getUser().isLoggedIn()) {
60+
UIHelper.goToFragment(R.id.nav_dashboard);
61+
}
62+
63+
View view = inflater.inflate(R.layout.fragment_login, container, false);
64+
65+
if(MainActivity.getActivity().getOptionsMenu() != null)
66+
MainActivity.getActivity().getOptionsMenu().findItem(R.id.action_filter).setVisible(false);
67+
68+
UIHelper.getAddButton().hide();
69+
70+
ButterKnife.bind(this, view);
71+
return view;
72+
}
73+
74+
@Override
75+
public void onResume() {
76+
super.onResume();
77+
MainActivity.getActivity().setTitle("Sign In");
78+
}
79+
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,16 +179,18 @@ public boolean onOptionsItemSelected(MenuItem item) {
179179
@Override
180180
public boolean onNavigationItemSelected(final MenuItem item) {
181181

182+
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
183+
182184
//Checks for items where we dont want the drawer to close
183185
if (item.getItemId() == R.id.nav_login) {
184-
UIHelper.facebookDialog();
186+
UIHelper.replaceFragment(new Login());
187+
drawer.closeDrawer(Gravity.LEFT);
185188
return true;
186189
} else if (item.getItemId() == R.id.nav_mode) {
187190
UIHelper.switchModeDialog();
188191
return true;
189192
}
190193

191-
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
192194
drawer.closeDrawer(Gravity.LEFT);
193195

194196
new Handler().postDelayed(new Runnable() {

app/src/main/java/mavonie/subterminal/Models/Exit.java

Lines changed: 12 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,11 @@ public static List<Exit> getExitsForDelete() {
377377
return new Exit().getItems(params);
378378
}
379379

380+
@Override
381+
public boolean delete() {
382+
return this.delete(true);
383+
}
384+
380385
public boolean delete(boolean updateJumps) {
381386

382387
//We need to update jumps before deleting
@@ -390,54 +395,6 @@ public boolean delete(boolean updateJumps) {
390395
return super.delete();
391396
}
392397

393-
@Override
394-
protected void populateContentValues(ContentValues contentValues) {
395-
396-
if (this._id > 0) {
397-
contentValues.put(_ID, this._id);
398-
}
399-
400-
moveExistingExit();
401-
super.populateContentValues(contentValues);
402-
}
403-
404-
/**
405-
* This method is only used when a remote_id attribute is set.
406-
* We need to check if we already have an exit in this position and shuffle it out to a new unused ID
407-
*/
408-
private void moveExistingExit() {
409-
if (this.remote_id != null) {
410-
//Check if we need to move an existing item out of the way.
411-
Exit existingExit = (Exit) new Exit().getOneById(this.remote_id);
412-
413-
if (existingExit != null) {
414-
//get the newId BEFORE deleting existing exit to prevent overlapping
415-
int newId = new Exit().getNextAutoIncrement();
416-
417-
existingExit.setDeleted(DELETED_TRUE);
418-
existingExit.delete(false);
419-
420-
if (existingExit.getDetails() != null) {
421-
existingExit.getDetails().setExitId(newId);
422-
existingExit.getDetails().save();
423-
}
424-
425-
existingExit._id = newId;
426-
existingExit.markSynced();
427-
}
428-
429-
//Check if we have a global exit with the same incoming name, if we do, remove it
430-
Exit globalExit = (Exit) new Exit().getItem(new Pair<String, String>(COLUMN_NAME_NAME, this.getName()));
431-
if (globalExit != null && globalExit.isGlobal()) {
432-
if (globalExit.getDetails() != null) {
433-
globalExit.getDetails().delete();
434-
}
435-
globalExit.setDeleted(DELETED_TRUE);
436-
globalExit.delete();
437-
}
438-
}
439-
}
440-
441398
/**
442399
* Get the top jumped exits
443400
*
@@ -451,7 +408,13 @@ public static LinkedHashMap<Exit, Integer> getTop3Exits() {
451408

452409
if (cursor.moveToFirst()) {
453410
while (cursor.isAfterLast() == false) {
454-
results.put((Exit) new Exit().getOneById(cursor.getInt(0)), cursor.getInt(1));
411+
int exitId = cursor.getInt(0);
412+
int jumpsFromExit = cursor.getInt(1);
413+
Exit exit = (Exit) new Exit().getOneById(exitId);
414+
415+
if (exitId != 0 && exit != null) {
416+
results.put(exit, jumpsFromExit);
417+
}
455418
cursor.moveToNext();
456419
}
457420
}

app/src/main/java/mavonie/subterminal/Models/Image.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import mavonie.subterminal.R;
2929
import mavonie.subterminal.Utils.Subterminal;
3030
import mavonie.subterminal.Utils.Synchronized;
31+
import mavonie.subterminal.Utils.UIHelper;
3132
import okhttp3.MediaType;
3233
import okhttp3.MultipartBody;
3334
import okhttp3.RequestBody;
@@ -253,6 +254,7 @@ public static Image createFromPath(String originalPath, Model model) {
253254

254255
} catch (IOException e) {
255256
e.printStackTrace();
257+
UIHelper.toast(e.getMessage());
256258
}
257259

258260
return null;

0 commit comments

Comments
 (0)