Merge branch '3.0'

This commit is contained in:
jannis 2019-12-11 17:44:42 +01:00
commit 5eac86c647
43 changed files with 1048 additions and 291 deletions

View File

@ -24,6 +24,7 @@
Current owners and lead developers are: Ludwig Brinckmann, devemux86
<https://github.com/PhilJay/MPAndroidChart>
Copyright 2019 Philipp Jahoda
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
@ -33,6 +34,7 @@
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
<https://github.com/Clans/FloatingActionButton>
Copyright 2015 Dmytro Tarianyk
Licensed under the Apache License, Version 2.0 (the "License");
@ -47,6 +49,24 @@
See the License for the specific language governing permissions and
limitations under the License.
<https://github.com/westnordost/osmapi>
© 2016-2019 Tobias Zwick. This library is released under the terms of the GNU Lesser General Public License (LGPL).
<https://github.com/mttkay/signpost>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
<https://github.com/FasterXML/jackson-core>
This copy of Jackson JSON processor streaming parser/generator is licensed under the

View File

@ -35,8 +35,8 @@ android {
applicationId "de.tadris.fitness"
minSdkVersion 21
targetSdkVersion 28
versionCode 210
versionName "2.1"
versionCode 300
versionName "3.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
@ -67,15 +67,23 @@ dependencies {
implementation 'org.mapsforge:mapsforge-map-android:0.11.0'
implementation 'com.caverock:androidsvg:1.3'
// Charts
implementation 'net.sf.kxml:kxml2:2.3.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation 'com.github.clans:fab:1.6.4'
// XML
implementation 'stax:stax-api:1.0.1'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.8'
// Android Room
def room_version = "2.2.0-beta01"
// Upload to OSM
implementation ('de.westnordost:osmapi-traces:1.0')
configurations {
compile.exclude group: 'net.sf.kxml', module: 'kxml2' // already included in Android
}
// Android Room Database
def room_version = "2.2.0"
annotationProcessor "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-runtime:$room_version"

View File

@ -62,7 +62,7 @@ import de.tadris.fitness.recording.WorkoutRecorder;
import de.tadris.fitness.util.ThemeManager;
import de.tadris.fitness.util.unit.UnitUtils;
public class RecordWorkoutActivity extends FitoTrackActivity implements LocationListener.LocationChangeListener, WorkoutRecorder.GpsStateChangedListener {
public class RecordWorkoutActivity extends FitoTrackActivity implements LocationListener.LocationChangeListener, WorkoutRecorder.WorkoutRecorderListener {
public static String ACTIVITY= Workout.WORKOUT_TYPE_RUNNING;
@ -379,5 +379,8 @@ public class RecordWorkoutActivity extends FitoTrackActivity implements Location
}
}
@Override
public void onAutoStop() {
finish();
}
}

View File

@ -270,6 +270,8 @@ public class SettingsActivity extends PreferenceActivity {
}
private boolean showWeightPicker() {
UnitUtils.setUnit(this); // Maybe the user changed unit system
final AlertDialog.Builder d = new AlertDialog.Builder(this);
final SharedPreferences preferences= PreferenceManager.getDefaultSharedPreferences(this);
d.setTitle(getString(R.string.pref_weight));
@ -278,7 +280,7 @@ public class SettingsActivity extends PreferenceActivity {
np.setMaxValue((int) UnitUtils.CHOSEN_SYSTEM.getWeightFromKilogram(150));
np.setMinValue((int) UnitUtils.CHOSEN_SYSTEM.getWeightFromKilogram(20));
np.setFormatter(value -> value + " " + UnitUtils.CHOSEN_SYSTEM.getWeightUnit());
np.setValue(preferences.getInt("weight", 80));
np.setValue((int)Math.round(UnitUtils.CHOSEN_SYSTEM.getWeightFromKilogram(preferences.getInt("weight", 80))));
np.setWrapSelectorWheel(false);
d.setView(v);

View File

@ -20,6 +20,8 @@
package de.tadris.fitness.activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Typeface;
import android.net.Uri;
@ -28,21 +30,31 @@ import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.content.FileProvider;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import de.tadris.fitness.Instance;
import de.tadris.fitness.R;
import de.tadris.fitness.data.WorkoutSample;
import de.tadris.fitness.osm.OAuthAuthentication;
import de.tadris.fitness.osm.OsmTraceUploader;
import de.tadris.fitness.util.DialogUtils;
import de.tadris.fitness.util.gpx.GpxExporter;
import de.tadris.fitness.util.unit.UnitUtils;
import de.tadris.fitness.view.ProgressDialogController;
import de.westnordost.osmapi.traces.GpsTraceDetails;
import oauth.signpost.OAuthConsumer;
public class ShowWorkoutActivity extends WorkoutActivity implements DialogUtils.WorkoutDeleter {
@ -211,7 +223,55 @@ public class ShowWorkoutActivity extends WorkoutActivity implements DialogUtils.
}).start();
}
private OAuthConsumer oAuthConsumer= null;
private void prepareUpload(){
OAuthAuthentication authentication= new OAuthAuthentication(mHandler, this, new OAuthAuthentication.OAuthAuthenticationListener() {
@Override
public void authenticationFailed() {
new AlertDialog.Builder(ShowWorkoutActivity.this)
.setTitle(R.string.error)
.setMessage(R.string.authenticationFailed)
.setPositiveButton(R.string.okay, null)
.create().show();
}
@Override
public void authenticationComplete(OAuthConsumer consumer) {
oAuthConsumer= consumer;
showUploadOptions();
}
});
authentication.authenticateIfNecessary();
}
AlertDialog dialog= null;
private void showUploadOptions(){
dialog= new AlertDialog.Builder(this)
.setTitle(R.string.actionUploadToOSM)
.setView(R.layout.dialog_upload_osm)
.setPositiveButton(R.string.upload, (dialogInterface, i) -> {
CheckBox checkBox= dialog.findViewById(R.id.uploadCutting);
Spinner spinner= dialog.findViewById(R.id.uploadVisibility);
EditText descriptionEdit= dialog.findViewById(R.id.uploadDescription);
String description= descriptionEdit.getText().toString().trim();
GpsTraceDetails.Visibility visibility;
switch (spinner.getSelectedItemPosition()){
case 0: visibility= GpsTraceDetails.Visibility.IDENTIFIABLE; break;
default:
case 1: visibility= GpsTraceDetails.Visibility.TRACKABLE; break;
case 2: visibility= GpsTraceDetails.Visibility.PRIVATE; break;
}
uploadToOsm(checkBox.isChecked(), visibility, description);
})
.setNegativeButton(R.string.cancel, null)
.show();
}
private void uploadToOsm(boolean cut, GpsTraceDetails.Visibility visibility, String description){
List<WorkoutSample> samples = new ArrayList<>(this.samples);
new OsmTraceUploader(this, mHandler, workout, samples, visibility, oAuthConsumer, cut, description).upload();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
@ -223,6 +283,9 @@ public class ShowWorkoutActivity extends WorkoutActivity implements DialogUtils.
case R.id.actionExportGpx:
exportToGpx();
return true;
case R.id.actionUploadOSM:
prepareUpload();
return true;
}
return super.onOptionsItemSelected(item);
}

View File

@ -36,6 +36,7 @@ import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import org.mapsforge.core.graphics.Paint;
import org.mapsforge.core.model.BoundingBox;
import org.mapsforge.core.model.LatLong;
import org.mapsforge.core.model.MapPosition;
import org.mapsforge.core.util.LatLongUtils;
import org.mapsforge.map.android.graphics.AndroidGraphicFactory;
@ -126,10 +127,7 @@ public abstract class WorkoutActivity extends FitoTrackActivity {
@Override
public void onValueSelected(Entry e, Highlight h) {
onNothingSelected();
Paint p= AndroidGraphicFactory.INSTANCE.createPaint();
p.setColor(0xff693cff);
highlightingCircle= new FixedPixelCircle(findSample(converter, e).toLatLong(), 20, p, null);
map.addLayer(highlightingCircle);
onDiagramValueSelected(findSample(converter, e).toLatLong());
}
@Override
@ -147,6 +145,17 @@ public abstract class WorkoutActivity extends FitoTrackActivity {
return chart;
}
protected void onDiagramValueSelected(LatLong latLong){
Paint p= AndroidGraphicFactory.INSTANCE.createPaint();
p.setColor(0xff693cff);
highlightingCircle= new FixedPixelCircle(latLong, 20, p, null);
map.addLayer(highlightingCircle);
if(!map.getBoundingBox().contains(latLong)){
map.getModel().mapViewPosition.animateTo(latLong);
}
}
interface SampleConverter{
void onCreate();
float getValue(WorkoutSample sample);

View File

@ -80,9 +80,13 @@ public class Workout{
if(comment.length() > 2){
return comment;
}else{
return getDateString();
}
}
public String getDateString(){
return SimpleDateFormat.getDateTimeInstance().format(new Date(start));
}
}
}

View File

@ -0,0 +1,48 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness.osm;
import de.tadris.fitness.data.WorkoutSample;
import de.westnordost.osmapi.map.data.LatLon;
public class GpsTraceLatLong implements LatLon {
private final double latitude;
private final double longitude;
public GpsTraceLatLong(double latitude, double longitude) {
this.latitude = latitude;
this.longitude = longitude;
}
public GpsTraceLatLong(WorkoutSample sample) {
this(sample.lat, sample.lon);
}
@Override
public double getLatitude() {
return latitude;
}
@Override
public double getLongitude() {
return longitude;
}
}

View File

@ -0,0 +1,151 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness.osm;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Handler;
import android.provider.Browser;
import android.text.InputType;
import android.widget.EditText;
import de.tadris.fitness.R;
import de.tadris.fitness.view.ProgressDialogController;
import oauth.signpost.OAuth;
import oauth.signpost.OAuthConsumer;
import oauth.signpost.OAuthProvider;
import oauth.signpost.exception.OAuthException;
public class OAuthAuthentication {
private OAuthConsumer oAuthConsumer= OAuthUrlProvider.getDefaultConsumer();
private OAuthProvider oAuthProvider= OAuthUrlProvider.getDefaultProvider();
private Handler handler;
private Activity activity;
private ProgressDialogController dialogController;
private SharedPreferences preferences;
private OAuthAuthenticationListener listener;
public OAuthAuthentication(Handler handler, Activity activity, OAuthAuthenticationListener listener) {
this.handler = handler;
this.activity = activity;
dialogController= new ProgressDialogController(activity, activity.getString(R.string.uploading));
this.preferences= activity.getSharedPreferences("osm_oauth", Context.MODE_PRIVATE);
this.listener= listener;
}
public void authenticateIfNecessary(){
if(isAuthenticated()){
loadAccessToken();
listener.authenticationComplete(oAuthConsumer);
}else{
retrieveRequestToken();
}
}
private boolean isAuthenticated(){
return preferences.getBoolean("authenticated", false);
}
private void retrieveRequestToken(){
dialogController.show();
dialogController.setIndeterminate(true);
new Thread(() -> {
try {
String authUrl = oAuthProvider.retrieveRequestToken(oAuthConsumer, OAuth.OUT_OF_BAND);
handler.post(() -> {
Intent intent= new Intent(Intent.ACTION_VIEW, Uri.parse(authUrl));
intent.putExtra(Browser.EXTRA_APPLICATION_ID, activity.getPackageName());
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_SINGLE_TOP);
activity.startActivity(intent);
showEnterVerificationCodeDialog();
dialogController.cancel();
});
} catch (OAuthException e) {
e.printStackTrace();
handler.post(() -> {
dialogController.cancel();
listener.authenticationFailed();
});
}
}).start();
}
private void showEnterVerificationCodeDialog(){
EditText editText= new EditText(activity);
editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
editText.setSingleLine(true);
AlertDialog dialog= new AlertDialog.Builder(activity)
.setTitle(R.string.enterVerificationCode).setView(editText).setPositiveButton(R.string.okay, (dialogInterface, i) -> {
new Thread(() -> retrieveAccessToken(editText.getText().toString().trim())).start();
dialogInterface.cancel();
}).setNegativeButton(R.string.cancel, null).setCancelable(false).create();
dialog.show();
}
private void loadAccessToken(){
oAuthConsumer.setTokenWithSecret(preferences.getString("accessToken", ""),
preferences.getString("tokenSecret", ""));
}
private void saveAccessToken(){
preferences.edit()
.putString("accessToken", oAuthConsumer.getToken())
.putString("tokenSecret", oAuthConsumer.getTokenSecret())
.putBoolean("authenticated", true).apply();
}
public void clearAccessToken(){
preferences.edit().putBoolean("authenticated", false).apply();
}
private void retrieveAccessToken(String verificationCode){
handler.post(() -> dialogController.show());
try{
oAuthProvider.retrieveAccessToken(oAuthConsumer, verificationCode);
handler.post(() -> {
dialogController.cancel();
saveAccessToken();
listener.authenticationComplete(oAuthConsumer);
});
}catch (OAuthException e){
handler.post(() -> {
dialogController.cancel();
listener.authenticationFailed();
});
e.printStackTrace();
}
}
public interface OAuthAuthenticationListener{
void authenticationFailed();
void authenticationComplete(OAuthConsumer consumer);
}
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness.osm;
import oauth.signpost.OAuthConsumer;
import oauth.signpost.OAuthProvider;
import oauth.signpost.basic.DefaultOAuthConsumer;
import oauth.signpost.basic.DefaultOAuthProvider;
public class OAuthUrlProvider {
static private final String CONSUMER_KEY= "jFL9grFmAo5ZS720YDDRXdSOb7F0IZQf9lnY1PHq";
static private final String CONSUMER_SECRET= "oH969vYW60fZLco6E09UQl3uFXqjl4siQbOL0q9q";
static OAuthConsumer getDefaultConsumer(){
return new DefaultOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
}
static OAuthProvider getDefaultProvider(){
return new DefaultOAuthProvider(URL_TOKEN_REQUEST, URL_TOKEN_ACCESS, URL_AUTHORIZE);
}
static private final String URL_TOKEN_REQUEST= "https://www.openstreetmap.org/oauth/request_token";
static private final String URL_TOKEN_ACCESS= "https://www.openstreetmap.org/oauth/access_token";
static private final String URL_AUTHORIZE= "https://www.openstreetmap.org/oauth/authorize";
}

View File

@ -0,0 +1,129 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness.osm;
import android.app.Activity;
import android.os.Handler;
import android.util.Log;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import de.tadris.fitness.R;
import de.tadris.fitness.data.Workout;
import de.tadris.fitness.data.WorkoutSample;
import de.tadris.fitness.view.ProgressDialogController;
import de.westnordost.osmapi.OsmConnection;
import de.westnordost.osmapi.traces.GpsTraceDetails;
import de.westnordost.osmapi.traces.GpsTracesDao;
import de.westnordost.osmapi.traces.GpsTrackpoint;
import oauth.signpost.OAuthConsumer;
public class OsmTraceUploader {
private static final int CUT_DISTANCE= 300;
private Activity activity;
private Handler handler;
private Workout workout;
private List<WorkoutSample> samples;
private GpsTraceDetails.Visibility visibility;
private OAuthConsumer consumer;
private boolean cut;
private ProgressDialogController dialogController;
private String description;
public OsmTraceUploader(Activity activity, Handler handler, Workout workout, List<WorkoutSample> samples, GpsTraceDetails.Visibility visibility, OAuthConsumer consumer, boolean cut, String description) {
this.activity = activity;
this.handler = handler;
this.workout = workout;
this.samples = samples;
this.visibility = visibility;
this.consumer = consumer;
this.cut = cut;
this.description= description;
this.dialogController= new ProgressDialogController(activity, activity.getString(R.string.uploading));
}
private void cut(){
cut(false);
cut(true);
}
private void cut(boolean last){
double distance= 0;
int count= 0;
WorkoutSample lastSample= samples.remove(last ? samples.size()-1 : 0);
while(distance < CUT_DISTANCE){
WorkoutSample currentSample= samples.remove(last ? samples.size()-1 : 0);
distance+= lastSample.toLatLong().sphericalDistance(currentSample.toLatLong());
count++;
lastSample= currentSample;
}
Log.d("Uploader", "Cutted " + (last ? "last" : "first") + " " + count + " Samples (" + distance + " meters)");
}
public void upload(){
new Thread(() -> {
try{
executeTask();
}catch (Exception e){
e.printStackTrace();
handler.post(() -> {
Toast.makeText(activity, R.string.uploadFailed, Toast.LENGTH_LONG).show();
dialogController.cancel();
});
}
}).start();
}
private void executeTask(){
handler.post(() -> dialogController.show());
setProgress(0);
if(cut){ cut(); }
setProgress(20);
OsmConnection osm = new OsmConnection(
"https://api.openstreetmap.org/api/0.6/", "FitoTrack", consumer);
List<GpsTrackpoint> trackpoints= new ArrayList<>();
for(WorkoutSample sample : samples){
GpsTrackpoint trackpoint= new GpsTrackpoint(new GpsTraceLatLong(sample));
trackpoint.time= new Date(sample.absoluteTime);
trackpoint.elevation= (float)sample.elevation;
trackpoints.add(trackpoint);
}
setProgress(25);
new GpsTracesDao(osm).create(workout.getDateString(), visibility, description, Collections.singletonList("FitoTrack"), trackpoints);
setProgress(100);
handler.post(() -> {
Toast.makeText(activity, R.string.uploadSuccessful, Toast.LENGTH_LONG).show();
dialogController.cancel();
});
}
private void setProgress(int progress){
handler.post(() -> dialogController.setProgress(progress));
}
}

View File

@ -50,6 +50,11 @@ public class WorkoutRecorder implements LocationListener.LocationChangeListener
private static final int PAUSE_TIME= 10000;
/**
* Time after which the workout is stopped and saved automatically because there is no activity anymore
*/
private static final int AUTO_STOP_TIMEOUT= 1000*60*60*20;
private Context context;
private Workout workout;
private RecordingState state;
@ -65,13 +70,13 @@ public class WorkoutRecorder implements LocationListener.LocationChangeListener
private static final double SIGNAL_BAD_THRESHOLD= 20; // In meters
private static final int SIGNAL_LOST_THRESHOLD= 10000; // In milliseconds
private Location lastFix= null;
private GpsStateChangedListener gpsStateChangedListener;
private WorkoutRecorderListener workoutRecorderListener;
private GpsState gpsState= GpsState.SIGNAL_LOST;
public WorkoutRecorder(Context context, String workoutType, GpsStateChangedListener gpsStateChangedListener) {
public WorkoutRecorder(Context context, String workoutType, WorkoutRecorderListener workoutRecorderListener) {
this.context= context;
this.state= RecordingState.IDLE;
this.gpsStateChangedListener= gpsStateChangedListener;
this.workoutRecorderListener = workoutRecorderListener;
this.workout= new Workout();
@ -107,7 +112,14 @@ public class WorkoutRecorder implements LocationListener.LocationChangeListener
synchronized (samples){
if(samples.size() > 2){
WorkoutSample lastSample= samples.get(samples.size()-1);
if(System.currentTimeMillis() - lastSampleTime > PAUSE_TIME){
long timeDiff= System.currentTimeMillis() - lastSampleTime;
if(timeDiff > AUTO_STOP_TIMEOUT){
if(isActive()){
stop();
save();
workoutRecorderListener.onAutoStop();
}
}else if(timeDiff > PAUSE_TIME){
if(state == RecordingState.RUNNING){
pause();
}
@ -139,7 +151,7 @@ public class WorkoutRecorder implements LocationListener.LocationChangeListener
state= GpsState.SIGNAL_OKAY;
}
if(state != gpsState){
gpsStateChangedListener.onGPSStateChanged(gpsState, state);
workoutRecorderListener.onGPSStateChanged(gpsState, state);
gpsState= state;
}
}
@ -307,8 +319,9 @@ public class WorkoutRecorder implements LocationListener.LocationChangeListener
}
}
public interface GpsStateChangedListener{
public interface WorkoutRecorderListener {
void onGPSStateChanged(GpsState oldState, GpsState state);
void onAutoStop();
}
}

View File

@ -33,7 +33,8 @@ public class CalorieCalculator {
*/
public static int calculateCalories(Workout workout, double weight){
double mins= (double)(workout.duration / 1000) / 60;
return (int)(mins * (getMET(workout) * 3.5 * weight) / 200);
int ascent= (int)workout.ascent; // 1 calorie per meter
return (int)(mins * (getMET(workout) * 3.5 * weight) / 200) + ascent;
}
/**

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness.util;
import android.app.AlertDialog;

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness.util.gpx;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness.util.gpx;
public class Metadata {

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness.util.gpx;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness.util.gpx;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness.util.gpx;
public class TrackPointExtension {

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness.util.gpx;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness.util.unit;
public class Imperial implements Unit {

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness.util.unit;
public class ImperialWithMeters extends Imperial {

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness.util.unit;
public class Metric implements Unit{

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness.util.unit;
public class MetricPhysical extends Metric{

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness.util.unit;
public interface Unit {

View File

@ -1,3 +1,22 @@
<!--
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
~
~ This file is part of FitoTrack
~
~ FitoTrack is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ FitoTrack is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"

View File

@ -1,3 +1,22 @@
<!--
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
~
~ This file is part of FitoTrack
~
~ FitoTrack is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ FitoTrack is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"

View File

@ -1,4 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
~
~ This file is part of FitoTrack
~
~ FitoTrack is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ FitoTrack is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
~
~ This file is part of FitoTrack
~
~ FitoTrack is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ FitoTrack is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/description" />
<EditText
android:id="@+id/uploadDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="textShortMessage|textAutoComplete"
android:singleLine="true" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/trackVisibilityPref" />
<Spinner
android:id="@+id/uploadVisibility"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:dropDownWidth="match_parent"
android:entries="@array/osm_track_visibility"
android:spinnerMode="dropdown" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" />
</TableLayout>
<CheckBox
android:id="@+id/uploadCutting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/cut" />
</LinearLayout>

View File

@ -1,4 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
~
~ This file is part of FitoTrack
~
~ FitoTrack is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ FitoTrack is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

View File

@ -23,6 +23,9 @@
<item
android:id="@+id/actionExportGpx"
android:title="@string/exportAsGpxFile" />
<item
android:id="@+id/actionUploadOSM"
android:title="@string/actionUploadToOSM" />
<item
android:id="@+id/actionDeleteWorkout"
android:title="@string/delete" />

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
~
~ This file is part of FitoTrack
~
~ FitoTrack is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ FitoTrack is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<string-array name="osm_track_visibility">
<item>Identifizierbar</item>
<item>Verfolgbar</item>
<item>Privat</item>
</string-array>
</resources>

View File

@ -96,4 +96,15 @@
<string name="workoutDescent">Abstieg</string>
<string name="data">Daten</string>
<string name="mapStyle">Kartenstil</string>
<string name="actionUploadToOSM">Auf OSM hochladen</string>
<string name="authenticationFailed">Authentifizierung fehlgeschlagen.</string>
<string name="cut">Die ersten/letzten 300 m abschneiden</string>
<string name="description">Beschreibung</string>
<string name="enterVerificationCode">Gebe den Verifizierungscode ein</string>
<string name="trackVisibilityPref">Spur Sichtbarkeit</string>
<string name="upload">Hochladen</string>
<string name="uploading">Hochladen</string>
<string name="waiting_gps">Warte auf GPS</string>
<string name="uploadFailed">Upload fehlgeschlagen</string>
<string name="uploadSuccessful">Upload erfolgreich</string>
</resources>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
~
~ This file is part of FitoTrack
~
~ FitoTrack is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ FitoTrack is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<string-array name="osm_track_visibility">
<item>Identifiable</item>
<item>Trackable</item>
<item>Private</item>
</string-array>
</resources>

View File

@ -62,6 +62,12 @@
<string name="workoutBurnedEnergy">Burned Energy</string>
<string name="workoutTotalEnergy">Total Energy</string>
<string name="workoutEnergyConsumption">Energy Consumption</string>
<string name="uploading">Uploading</string>
<string name="enterVerificationCode">Enter Verification Code</string>
<string name="authenticationFailed">Authentication failed.</string>
<string name="upload">Upload</string>
<string name="uploadSuccessful">Upload Successful</string>
<string name="uploadFailed">Upload Failed</string>
<string name="workoutAscent">Ascent</string>
<string name="workoutDescent">Descent</string>
@ -115,4 +121,8 @@
<string name="data">Data</string>
<string name="mapStyle">Map Style</string>
<string name="waiting_gps">Waiting for GPS</string>
<string name="actionUploadToOSM">Upload to OSM</string>
<string name="cut">Cut the first/last 300 Meters</string>
<string name="trackVisibilityPref">Track Visibility</string>
<string name="description">Description</string>
</resources>

View File

@ -1,4 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
~
~ This file is part of FitoTrack
~
~ FitoTrack is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ FitoTrack is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<paths>
<files-path path="shared/" name="share" />
</paths>

View File

@ -1,3 +1,22 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tadris.fitness;
import org.junit.Assert;

View File

@ -26,7 +26,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:3.5.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@ -1,15 +0,0 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

172
gradlew vendored
View File

@ -1,172 +0,0 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
gradlew.bat vendored
View File

@ -1,84 +0,0 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -0,0 +1,10 @@
**3.0:**
New:
- Upload workouts as GPS-Tracks to OpenStreetMap (#24)
- Automatic Workout Stop (#23)
Improvements:
- Fix Imperial Weight (#26)
- Better behaviour of map in analyse screens
- Better calorie calculation

View File

@ -1 +1,20 @@
/*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
*
* This file is part of FitoTrack
*
* FitoTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FitoTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
include ':app'