Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/res/layout/start.xml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_alignParentTop="true"
android:layout_marginTop="2dp"
android:layout_marginRight="64dp"
tools:ignore="RelativeOverlap" />

</RelativeLayout>
Expand Down
12 changes: 0 additions & 12 deletions app/src/main/org/runnerup/view/MainLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,6 @@ public void handleOnBackPressed() {
return;
}

// If on the first page (StartFragment) and GPS logging is active but not auto-started,
// stop GPS instead of exiting the app.
Fragment fragment = getCurrentFragment();

if (fragment instanceof StartFragment startFragment) {
if (!startFragment.getAutoStartGps() && startFragment.isGpsLogging()) {
startFragment.stopGps();
startFragment.updateView();
return;
}
}

// Temporarily disable this callback to allow the system to handle the next back press
// for exiting the app.
this.setEnabled(false);
Expand Down
29 changes: 13 additions & 16 deletions app/src/main/org/runnerup/view/StartFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,11 @@ private void startWorkout() {

private final OnClickListener gpsEnableClick =
v -> {
if (mGpsStatus.isStarted()) {
stopGps();
updateView();
return;
}
if (checkPermissions(true)) {
// Handle view update etc in permission callback
return;
Expand Down Expand Up @@ -922,23 +927,15 @@ private void updateStartButtonView() {
startButton.setVisibility(View.GONE);
}

private void updateStartGpsButtonView() {
do {
if (mGpsStatus.isStarted()) {
break;
}

//
if (mGpsStatus.isEnabled()) {
gpsEnable.setText(org.runnerup.common.R.string.Start_GPS);
} else {
gpsEnable.setText(org.runnerup.common.R.string.Enable_GPS);
}
gpsEnable.setVisibility(View.VISIBLE);
return;
} while (false);
private int getStartButtonTextResId() {
if (mGpsStatus.isStarted()) return org.runnerup.common.R.string.Stop_GPS;
return mGpsStatus.isEnabled()
? org.runnerup.common.R.string.Start_GPS
: org.runnerup.common.R.string.Enable_GPS;
}

gpsEnable.setVisibility(View.GONE);
private void updateStartGpsButtonView() {
gpsEnable.setText(getStartButtonTextResId());
}

private void updateGPSView() {
Expand Down
1 change: 1 addition & 0 deletions common/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
<string name="GPS_level_acceptable">Acceptable GPS</string>
<string name="GPS_level_good">Good GPS</string>
<string name="Start_GPS">Start GPS</string>
<string name="Stop_GPS">Stop GPS</string>
<string name="Duration">Duration</string>
<string name="Cancel">Cancel</string>
<string name="value">value</string>
Expand Down