From c4b3c3d2e27fbdfab083faf62737daced1946eb9 Mon Sep 17 00:00:00 2001 From: jannis Date: Sun, 3 Nov 2019 17:40:11 +0100 Subject: [PATCH 01/14] Updated Gradle version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index eaaf0bf..c6086b8 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:3.5.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files From 02a5cf8bb8cffb3e37e173fff1a57dc3b6933343 Mon Sep 17 00:00:00 2001 From: jannis Date: Sun, 3 Nov 2019 18:12:29 +0100 Subject: [PATCH 02/14] Height/Speed analyse screen: go with the position if not on map --- .../fitness/activity/WorkoutActivity.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/de/tadris/fitness/activity/WorkoutActivity.java b/app/src/main/java/de/tadris/fitness/activity/WorkoutActivity.java index 4914a1d..6d14cfe 100644 --- a/app/src/main/java/de/tadris/fitness/activity/WorkoutActivity.java +++ b/app/src/main/java/de/tadris/fitness/activity/WorkoutActivity.java @@ -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); From a0429133811937baf0d01d0b604bd986ead6d018 Mon Sep 17 00:00:00 2001 From: jannis Date: Sun, 3 Nov 2019 18:13:57 +0100 Subject: [PATCH 03/14] Delete local files --- gradle.properties | 15 ---- gradlew | 172 ---------------------------------------------- gradlew.bat | 84 ---------------------- 3 files changed, 271 deletions(-) delete mode 100644 gradle.properties delete mode 100755 gradlew delete mode 100644 gradlew.bat diff --git a/gradle.properties b/gradle.properties deleted file mode 100644 index 82618ce..0000000 --- a/gradle.properties +++ /dev/null @@ -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 - - diff --git a/gradlew b/gradlew deleted file mode 100755 index cccdd3d..0000000 --- a/gradlew +++ /dev/null @@ -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" "$@" diff --git a/gradlew.bat b/gradlew.bat deleted file mode 100644 index f955316..0000000 --- a/gradlew.bat +++ /dev/null @@ -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 From b4afba8a9c07165f4aa6fddd9f823b5d59c66155 Mon Sep 17 00:00:00 2001 From: jannis Date: Wed, 4 Dec 2019 21:47:15 +0100 Subject: [PATCH 04/14] Better calorie calculation --- .../main/java/de/tadris/fitness/util/CalorieCalculator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/de/tadris/fitness/util/CalorieCalculator.java b/app/src/main/java/de/tadris/fitness/util/CalorieCalculator.java index 3a50270..388c5d9 100644 --- a/app/src/main/java/de/tadris/fitness/util/CalorieCalculator.java +++ b/app/src/main/java/de/tadris/fitness/util/CalorieCalculator.java @@ -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; } /** From a2354e57254c31efd40477d307d62bdd93b919f6 Mon Sep 17 00:00:00 2001 From: jannis Date: Wed, 4 Dec 2019 21:58:36 +0100 Subject: [PATCH 05/14] #26 Imperial weight isn't calculated correctly --- .../java/de/tadris/fitness/activity/SettingsActivity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/de/tadris/fitness/activity/SettingsActivity.java b/app/src/main/java/de/tadris/fitness/activity/SettingsActivity.java index 567789d..1537f5f 100644 --- a/app/src/main/java/de/tadris/fitness/activity/SettingsActivity.java +++ b/app/src/main/java/de/tadris/fitness/activity/SettingsActivity.java @@ -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); From 7a61b94696c3c1d9b177de663a3ef2d875817277 Mon Sep 17 00:00:00 2001 From: jannis Date: Wed, 4 Dec 2019 22:05:48 +0100 Subject: [PATCH 06/14] #23 Automatic Timeout Stop --- .../activity/RecordWorkoutActivity.java | 7 ++++-- .../fitness/recording/WorkoutRecorder.java | 25 ++++++++++++++----- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/de/tadris/fitness/activity/RecordWorkoutActivity.java b/app/src/main/java/de/tadris/fitness/activity/RecordWorkoutActivity.java index fa4d3f4..84b7993 100644 --- a/app/src/main/java/de/tadris/fitness/activity/RecordWorkoutActivity.java +++ b/app/src/main/java/de/tadris/fitness/activity/RecordWorkoutActivity.java @@ -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(); + } } diff --git a/app/src/main/java/de/tadris/fitness/recording/WorkoutRecorder.java b/app/src/main/java/de/tadris/fitness/recording/WorkoutRecorder.java index a99bac7..1346033 100644 --- a/app/src/main/java/de/tadris/fitness/recording/WorkoutRecorder.java +++ b/app/src/main/java/de/tadris/fitness/recording/WorkoutRecorder.java @@ -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(); } } From d35c8a74281ac8b27e77c4a6450f8d841a0719f2 Mon Sep 17 00:00:00 2001 From: jannis Date: Sun, 8 Dec 2019 12:00:38 +0100 Subject: [PATCH 07/14] #24 Upload workouts to OpenStreetMap as GPS-Trace --- app/build.gradle | 8 +- .../fitness/activity/ShowWorkoutActivity.java | 63 +++++++++ .../java/de/tadris/fitness/data/Workout.java | 6 +- .../tadris/fitness/osm/GpsTraceLatLong.java | 29 ++++ .../fitness/osm/OAuthAuthentication.java | 132 ++++++++++++++++++ .../tadris/fitness/osm/OAuthUrlProvider.java | 26 ++++ .../tadris/fitness/osm/OsmTraceUploader.java | 116 +++++++++++++++ app/src/main/res/layout/dialog_upload_osm.xml | 64 +++++++++ app/src/main/res/menu/show_workout_menu.xml | 3 + .../main/res/values/osm_track_visibility.xml | 8 ++ app/src/main/res/values/strings.xml | 10 ++ 11 files changed, 463 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/de/tadris/fitness/osm/GpsTraceLatLong.java create mode 100644 app/src/main/java/de/tadris/fitness/osm/OAuthAuthentication.java create mode 100644 app/src/main/java/de/tadris/fitness/osm/OAuthUrlProvider.java create mode 100644 app/src/main/java/de/tadris/fitness/osm/OsmTraceUploader.java create mode 100644 app/src/main/res/layout/dialog_upload_osm.xml create mode 100644 app/src/main/res/values/osm_track_visibility.xml diff --git a/app/build.gradle b/app/build.gradle index 9980cf3..6e874c8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -74,8 +74,14 @@ dependencies { implementation 'stax:stax-api:1.0.1' implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.8' + implementation ('de.westnordost:osmapi-traces:1.0') + configurations { + compile.exclude group: 'net.sf.kxml', module: 'kxml2' // already included in Android + } + implementation 'oauth.signpost:signpost-commonshttp4:1.2.1.2' + // Android Room - def room_version = "2.2.0-beta01" + def room_version = "2.2.0" annotationProcessor "androidx.room:room-compiler:$room_version" implementation "androidx.room:room-runtime:$room_version" diff --git a/app/src/main/java/de/tadris/fitness/activity/ShowWorkoutActivity.java b/app/src/main/java/de/tadris/fitness/activity/ShowWorkoutActivity.java index 0036a13..b9a6c02 100644 --- a/app/src/main/java/de/tadris/fitness/activity/ShowWorkoutActivity.java +++ b/app/src/main/java/de/tadris/fitness/activity/ShowWorkoutActivity.java @@ -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 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); } diff --git a/app/src/main/java/de/tadris/fitness/data/Workout.java b/app/src/main/java/de/tadris/fitness/data/Workout.java index 159ac91..0e9f1d2 100644 --- a/app/src/main/java/de/tadris/fitness/data/Workout.java +++ b/app/src/main/java/de/tadris/fitness/data/Workout.java @@ -80,9 +80,13 @@ public class Workout{ if(comment.length() > 2){ return comment; }else{ - return SimpleDateFormat.getDateTimeInstance().format(new Date(start)); + return getDateString(); } } + public String getDateString(){ + return SimpleDateFormat.getDateTimeInstance().format(new Date(start)); + } + } \ No newline at end of file diff --git a/app/src/main/java/de/tadris/fitness/osm/GpsTraceLatLong.java b/app/src/main/java/de/tadris/fitness/osm/GpsTraceLatLong.java new file mode 100644 index 0000000..2a292ea --- /dev/null +++ b/app/src/main/java/de/tadris/fitness/osm/GpsTraceLatLong.java @@ -0,0 +1,29 @@ +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; + } +} diff --git a/app/src/main/java/de/tadris/fitness/osm/OAuthAuthentication.java b/app/src/main/java/de/tadris/fitness/osm/OAuthAuthentication.java new file mode 100644 index 0000000..bde83ff --- /dev/null +++ b/app/src/main/java/de/tadris/fitness/osm/OAuthAuthentication.java @@ -0,0 +1,132 @@ +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); + + } + +} diff --git a/app/src/main/java/de/tadris/fitness/osm/OAuthUrlProvider.java b/app/src/main/java/de/tadris/fitness/osm/OAuthUrlProvider.java new file mode 100644 index 0000000..c76d1d2 --- /dev/null +++ b/app/src/main/java/de/tadris/fitness/osm/OAuthUrlProvider.java @@ -0,0 +1,26 @@ +package de.tadris.fitness.osm; + +import oauth.signpost.OAuthConsumer; +import oauth.signpost.OAuthProvider; +import oauth.signpost.commonshttp.CommonsHttpOAuthConsumer; +import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; + +public class OAuthUrlProvider { + + static private final String CONSUMER_KEY= "jFL9grFmAo5ZS720YDDRXdSOb7F0IZQf9lnY1PHq"; + static private final String CONSUMER_SECRET= "oH969vYW60fZLco6E09UQl3uFXqjl4siQbOL0q9q"; + + static OAuthConsumer getDefaultConsumer(){ + return new CommonsHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET); + } + + static OAuthProvider getDefaultProvider(){ + return new CommonsHttpOAuthProvider(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"; + + +} diff --git a/app/src/main/java/de/tadris/fitness/osm/OsmTraceUploader.java b/app/src/main/java/de/tadris/fitness/osm/OsmTraceUploader.java new file mode 100644 index 0000000..fc02141 --- /dev/null +++ b/app/src/main/java/de/tadris/fitness/osm/OsmTraceUploader.java @@ -0,0 +1,116 @@ +package de.tadris.fitness.osm; + +import android.app.Activity; +import android.content.Intent; +import android.net.Uri; +import android.os.Handler; +import android.util.Log; +import android.widget.Toast; + +import androidx.annotation.StringRes; + +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.Arrays; +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 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 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 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)); + } + +} diff --git a/app/src/main/res/layout/dialog_upload_osm.xml b/app/src/main/res/layout/dialog_upload_osm.xml new file mode 100644 index 0000000..0a9d176 --- /dev/null +++ b/app/src/main/res/layout/dialog_upload_osm.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/show_workout_menu.xml b/app/src/main/res/menu/show_workout_menu.xml index 9124cf6..fe5e260 100644 --- a/app/src/main/res/menu/show_workout_menu.xml +++ b/app/src/main/res/menu/show_workout_menu.xml @@ -23,6 +23,9 @@ + diff --git a/app/src/main/res/values/osm_track_visibility.xml b/app/src/main/res/values/osm_track_visibility.xml new file mode 100644 index 0000000..a3b286d --- /dev/null +++ b/app/src/main/res/values/osm_track_visibility.xml @@ -0,0 +1,8 @@ + + + + Identifiable + Trackable + Private + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 924d17e..bd74019 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -62,6 +62,12 @@ Burned Energy Total Energy Energy Consumption + Uploading + Enter Verification Code + Authentication failed. + Upload + Upload Successful + Upload Failed Ascent Descent @@ -115,4 +121,8 @@ Data Map Style Waiting for GPS + Upload to OSM + Cut the first/last 300 Meters + Track Visibility + Description From 4d8f5e53c8d3af4454a1805da6fee881d8cb1324 Mon Sep 17 00:00:00 2001 From: jannis Date: Sun, 8 Dec 2019 12:01:05 +0100 Subject: [PATCH 08/14] Update Gradle version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index c6086b8..795a6ec 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.5.1' + 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 From a186308ba8e1ad75c32ee7d7af7bdc526246f37a Mon Sep 17 00:00:00 2001 From: jannis Date: Sun, 8 Dec 2019 12:43:46 +0100 Subject: [PATCH 09/14] Update copyright notices --- NOTICE.md | 20 ++++++++++++++++++++ app/build.gradle | 5 ++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/NOTICE.md b/NOTICE.md index 2aa36ff..3300714 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -24,6 +24,7 @@ Current owners and lead developers are: Ludwig Brinckmann, devemux86 + 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. + 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. + + + © 2016-2019 Tobias Zwick. This library is released under the terms of the GNU Lesser General Public License (LGPL). + + + + 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. + This copy of Jackson JSON processor streaming parser/generator is licensed under the diff --git a/app/build.gradle b/app/build.gradle index 6e874c8..4388224 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -67,20 +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' + // Upload to OSM implementation ('de.westnordost:osmapi-traces:1.0') configurations { compile.exclude group: 'net.sf.kxml', module: 'kxml2' // already included in Android } implementation 'oauth.signpost:signpost-commonshttp4:1.2.1.2' - // Android Room + // Android Room Database def room_version = "2.2.0" annotationProcessor "androidx.room:room-compiler:$room_version" implementation "androidx.room:room-runtime:$room_version" From b494868f831869a409f2b4bdf52ca29ac0b6b5c2 Mon Sep 17 00:00:00 2001 From: jannis Date: Sun, 8 Dec 2019 13:05:01 +0100 Subject: [PATCH 10/14] Update copyright --- .../tadris/fitness/osm/GpsTraceLatLong.java | 19 ++++++++++++++ .../fitness/osm/OAuthAuthentication.java | 19 ++++++++++++++ .../tadris/fitness/osm/OAuthUrlProvider.java | 19 ++++++++++++++ .../tadris/fitness/osm/OsmTraceUploader.java | 25 ++++++++++++++----- .../de/tadris/fitness/util/DialogUtils.java | 19 ++++++++++++++ .../java/de/tadris/fitness/util/gpx/Gpx.java | 19 ++++++++++++++ .../de/tadris/fitness/util/gpx/Metadata.java | 19 ++++++++++++++ .../de/tadris/fitness/util/gpx/Track.java | 19 ++++++++++++++ .../tadris/fitness/util/gpx/TrackPoint.java | 19 ++++++++++++++ .../fitness/util/gpx/TrackPointExtension.java | 19 ++++++++++++++ .../tadris/fitness/util/gpx/TrackSegment.java | 19 ++++++++++++++ .../de/tadris/fitness/util/unit/Imperial.java | 19 ++++++++++++++ .../fitness/util/unit/ImperialWithMeters.java | 19 ++++++++++++++ .../de/tadris/fitness/util/unit/Metric.java | 19 ++++++++++++++ .../fitness/util/unit/MetricPhysical.java | 19 ++++++++++++++ .../de/tadris/fitness/util/unit/Unit.java | 19 ++++++++++++++ .../main/res/drawable-anydpi/ic_add_white.xml | 19 ++++++++++++++ .../res/drawable-anydpi/ic_gps_no_fix.xml | 19 ++++++++++++++ app/src/main/res/layout/dialog_progress.xml | 19 ++++++++++++++ app/src/main/res/layout/dialog_upload_osm.xml | 19 ++++++++++++++ .../main/res/layout/dialog_weight_picker.xml | 19 ++++++++++++++ app/src/main/res/xml/filepaths.xml | 19 ++++++++++++++ .../tadris/fitness/CalorieCalculatorTest.java | 19 ++++++++++++++ settings.gradle | 19 ++++++++++++++ 24 files changed, 456 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/de/tadris/fitness/osm/GpsTraceLatLong.java b/app/src/main/java/de/tadris/fitness/osm/GpsTraceLatLong.java index 2a292ea..a16bff4 100644 --- a/app/src/main/java/de/tadris/fitness/osm/GpsTraceLatLong.java +++ b/app/src/main/java/de/tadris/fitness/osm/GpsTraceLatLong.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness.osm; import de.tadris.fitness.data.WorkoutSample; diff --git a/app/src/main/java/de/tadris/fitness/osm/OAuthAuthentication.java b/app/src/main/java/de/tadris/fitness/osm/OAuthAuthentication.java index bde83ff..2150ed6 100644 --- a/app/src/main/java/de/tadris/fitness/osm/OAuthAuthentication.java +++ b/app/src/main/java/de/tadris/fitness/osm/OAuthAuthentication.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness.osm; import android.app.Activity; diff --git a/app/src/main/java/de/tadris/fitness/osm/OAuthUrlProvider.java b/app/src/main/java/de/tadris/fitness/osm/OAuthUrlProvider.java index c76d1d2..430c280 100644 --- a/app/src/main/java/de/tadris/fitness/osm/OAuthUrlProvider.java +++ b/app/src/main/java/de/tadris/fitness/osm/OAuthUrlProvider.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness.osm; import oauth.signpost.OAuthConsumer; diff --git a/app/src/main/java/de/tadris/fitness/osm/OsmTraceUploader.java b/app/src/main/java/de/tadris/fitness/osm/OsmTraceUploader.java index fc02141..e1b8e54 100644 --- a/app/src/main/java/de/tadris/fitness/osm/OsmTraceUploader.java +++ b/app/src/main/java/de/tadris/fitness/osm/OsmTraceUploader.java @@ -1,17 +1,30 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness.osm; import android.app.Activity; -import android.content.Intent; -import android.net.Uri; import android.os.Handler; import android.util.Log; import android.widget.Toast; -import androidx.annotation.StringRes; - -import java.lang.reflect.Array; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.List; diff --git a/app/src/main/java/de/tadris/fitness/util/DialogUtils.java b/app/src/main/java/de/tadris/fitness/util/DialogUtils.java index 9aa8d53..1a45b4b 100644 --- a/app/src/main/java/de/tadris/fitness/util/DialogUtils.java +++ b/app/src/main/java/de/tadris/fitness/util/DialogUtils.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness.util; import android.app.AlertDialog; diff --git a/app/src/main/java/de/tadris/fitness/util/gpx/Gpx.java b/app/src/main/java/de/tadris/fitness/util/gpx/Gpx.java index fb92f46..3c39f2b 100644 --- a/app/src/main/java/de/tadris/fitness/util/gpx/Gpx.java +++ b/app/src/main/java/de/tadris/fitness/util/gpx/Gpx.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness.util.gpx; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; diff --git a/app/src/main/java/de/tadris/fitness/util/gpx/Metadata.java b/app/src/main/java/de/tadris/fitness/util/gpx/Metadata.java index 93e6bac..8087da6 100644 --- a/app/src/main/java/de/tadris/fitness/util/gpx/Metadata.java +++ b/app/src/main/java/de/tadris/fitness/util/gpx/Metadata.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness.util.gpx; public class Metadata { diff --git a/app/src/main/java/de/tadris/fitness/util/gpx/Track.java b/app/src/main/java/de/tadris/fitness/util/gpx/Track.java index 11f130e..ce9d822 100644 --- a/app/src/main/java/de/tadris/fitness/util/gpx/Track.java +++ b/app/src/main/java/de/tadris/fitness/util/gpx/Track.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness.util.gpx; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; diff --git a/app/src/main/java/de/tadris/fitness/util/gpx/TrackPoint.java b/app/src/main/java/de/tadris/fitness/util/gpx/TrackPoint.java index b9d3031..ba8deac 100644 --- a/app/src/main/java/de/tadris/fitness/util/gpx/TrackPoint.java +++ b/app/src/main/java/de/tadris/fitness/util/gpx/TrackPoint.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness.util.gpx; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; diff --git a/app/src/main/java/de/tadris/fitness/util/gpx/TrackPointExtension.java b/app/src/main/java/de/tadris/fitness/util/gpx/TrackPointExtension.java index 17ddca0..88f3046 100644 --- a/app/src/main/java/de/tadris/fitness/util/gpx/TrackPointExtension.java +++ b/app/src/main/java/de/tadris/fitness/util/gpx/TrackPointExtension.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness.util.gpx; public class TrackPointExtension { diff --git a/app/src/main/java/de/tadris/fitness/util/gpx/TrackSegment.java b/app/src/main/java/de/tadris/fitness/util/gpx/TrackSegment.java index 10605c2..324cb24 100644 --- a/app/src/main/java/de/tadris/fitness/util/gpx/TrackSegment.java +++ b/app/src/main/java/de/tadris/fitness/util/gpx/TrackSegment.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness.util.gpx; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; diff --git a/app/src/main/java/de/tadris/fitness/util/unit/Imperial.java b/app/src/main/java/de/tadris/fitness/util/unit/Imperial.java index f4e3c85..a5f8239 100644 --- a/app/src/main/java/de/tadris/fitness/util/unit/Imperial.java +++ b/app/src/main/java/de/tadris/fitness/util/unit/Imperial.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness.util.unit; public class Imperial implements Unit { diff --git a/app/src/main/java/de/tadris/fitness/util/unit/ImperialWithMeters.java b/app/src/main/java/de/tadris/fitness/util/unit/ImperialWithMeters.java index 406e767..c5b82dc 100644 --- a/app/src/main/java/de/tadris/fitness/util/unit/ImperialWithMeters.java +++ b/app/src/main/java/de/tadris/fitness/util/unit/ImperialWithMeters.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness.util.unit; public class ImperialWithMeters extends Imperial { diff --git a/app/src/main/java/de/tadris/fitness/util/unit/Metric.java b/app/src/main/java/de/tadris/fitness/util/unit/Metric.java index 8dba963..37c7a3b 100644 --- a/app/src/main/java/de/tadris/fitness/util/unit/Metric.java +++ b/app/src/main/java/de/tadris/fitness/util/unit/Metric.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness.util.unit; public class Metric implements Unit{ diff --git a/app/src/main/java/de/tadris/fitness/util/unit/MetricPhysical.java b/app/src/main/java/de/tadris/fitness/util/unit/MetricPhysical.java index af979a4..908526f 100644 --- a/app/src/main/java/de/tadris/fitness/util/unit/MetricPhysical.java +++ b/app/src/main/java/de/tadris/fitness/util/unit/MetricPhysical.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness.util.unit; public class MetricPhysical extends Metric{ diff --git a/app/src/main/java/de/tadris/fitness/util/unit/Unit.java b/app/src/main/java/de/tadris/fitness/util/unit/Unit.java index f0817d0..bbfd5a1 100644 --- a/app/src/main/java/de/tadris/fitness/util/unit/Unit.java +++ b/app/src/main/java/de/tadris/fitness/util/unit/Unit.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness.util.unit; public interface Unit { diff --git a/app/src/main/res/drawable-anydpi/ic_add_white.xml b/app/src/main/res/drawable-anydpi/ic_add_white.xml index 89208a9..fbd7bd1 100644 --- a/app/src/main/res/drawable-anydpi/ic_add_white.xml +++ b/app/src/main/res/drawable-anydpi/ic_add_white.xml @@ -1,3 +1,22 @@ + + + ~ + ~ 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 . + --> + + + + + + + diff --git a/app/src/main/res/xml/filepaths.xml b/app/src/main/res/xml/filepaths.xml index b31e1c3..31ab022 100644 --- a/app/src/main/res/xml/filepaths.xml +++ b/app/src/main/res/xml/filepaths.xml @@ -1,4 +1,23 @@ + + \ No newline at end of file diff --git a/app/src/test/java/de/tadris/fitness/CalorieCalculatorTest.java b/app/src/test/java/de/tadris/fitness/CalorieCalculatorTest.java index 4c40451..5b91824 100644 --- a/app/src/test/java/de/tadris/fitness/CalorieCalculatorTest.java +++ b/app/src/test/java/de/tadris/fitness/CalorieCalculatorTest.java @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + package de.tadris.fitness; import org.junit.Assert; diff --git a/settings.gradle b/settings.gradle index e7b4def..4a6ab16 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,20 @@ +/* + * Copyright (c) 2019 Jannis Scheibe + * + * 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 . + */ + include ':app' From b7c535c03a1133198c0dc484f83fb1db870a1feb Mon Sep 17 00:00:00 2001 From: jannis Date: Sun, 8 Dec 2019 13:05:27 +0100 Subject: [PATCH 11/14] Localisation --- .../res/values-de/osm_track_visibility.xml | 27 +++++++++++++++++++ app/src/main/res/values-de/strings.xml | 11 ++++++++ .../main/res/values/osm_track_visibility.xml | 19 +++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 app/src/main/res/values-de/osm_track_visibility.xml diff --git a/app/src/main/res/values-de/osm_track_visibility.xml b/app/src/main/res/values-de/osm_track_visibility.xml new file mode 100644 index 0000000..795c516 --- /dev/null +++ b/app/src/main/res/values-de/osm_track_visibility.xml @@ -0,0 +1,27 @@ + + + + + + Identifizierbar + Verfolgbar + Privat + + \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index ccdc23e..921785d 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -96,4 +96,15 @@ Abstieg Daten Kartenstil + Auf OSM hochladen + Authentifizierung fehlgeschlagen. + Die ersten/letzten 300 m abschneiden + Beschreibung + Gebe den Verifizierungscode ein + Spur Sichtbarkeit + Hochladen + Hochladen + Warte auf GPS + Upload fehlgeschlagen + Upload erfolgreich \ No newline at end of file diff --git a/app/src/main/res/values/osm_track_visibility.xml b/app/src/main/res/values/osm_track_visibility.xml index a3b286d..cb78226 100644 --- a/app/src/main/res/values/osm_track_visibility.xml +++ b/app/src/main/res/values/osm_track_visibility.xml @@ -1,4 +1,23 @@ + + Identifiable From 5fda41149ff6b4e051c990b73228aa3f4ccbbc5d Mon Sep 17 00:00:00 2001 From: jannis Date: Sun, 8 Dec 2019 13:05:50 +0100 Subject: [PATCH 12/14] Version code 3.0 --- app/build.gradle | 4 ++-- metadata/en-US/changelogs/300.txt | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 metadata/en-US/changelogs/300.txt diff --git a/app/build.gradle b/app/build.gradle index 4388224..1e9a076 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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 { diff --git a/metadata/en-US/changelogs/300.txt b/metadata/en-US/changelogs/300.txt new file mode 100644 index 0000000..bfd6ea0 --- /dev/null +++ b/metadata/en-US/changelogs/300.txt @@ -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 \ No newline at end of file From 285b76c5d8f84020ac51c7f9881fb9bf98864cce Mon Sep 17 00:00:00 2001 From: jannis Date: Wed, 11 Dec 2019 17:24:48 +0100 Subject: [PATCH 13/14] Fix Build Issues --- app/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/app/build.gradle b/app/build.gradle index 1e9a076..8b8608a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -80,6 +80,7 @@ dependencies { implementation ('de.westnordost:osmapi-traces:1.0') configurations { compile.exclude group: 'net.sf.kxml', module: 'kxml2' // already included in Android + compile.exclude module: 'httpclient' } implementation 'oauth.signpost:signpost-commonshttp4:1.2.1.2' From a06a9ec30ab4a26bfda8d6c44c33412aaa70359f Mon Sep 17 00:00:00 2001 From: jannis Date: Wed, 11 Dec 2019 17:38:53 +0100 Subject: [PATCH 14/14] Fix Build Issues --- app/build.gradle | 2 -- .../main/java/de/tadris/fitness/osm/OAuthUrlProvider.java | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 8b8608a..7b89c50 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -80,9 +80,7 @@ dependencies { implementation ('de.westnordost:osmapi-traces:1.0') configurations { compile.exclude group: 'net.sf.kxml', module: 'kxml2' // already included in Android - compile.exclude module: 'httpclient' } - implementation 'oauth.signpost:signpost-commonshttp4:1.2.1.2' // Android Room Database def room_version = "2.2.0" diff --git a/app/src/main/java/de/tadris/fitness/osm/OAuthUrlProvider.java b/app/src/main/java/de/tadris/fitness/osm/OAuthUrlProvider.java index 430c280..83a6401 100644 --- a/app/src/main/java/de/tadris/fitness/osm/OAuthUrlProvider.java +++ b/app/src/main/java/de/tadris/fitness/osm/OAuthUrlProvider.java @@ -21,8 +21,8 @@ package de.tadris.fitness.osm; import oauth.signpost.OAuthConsumer; import oauth.signpost.OAuthProvider; -import oauth.signpost.commonshttp.CommonsHttpOAuthConsumer; -import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; +import oauth.signpost.basic.DefaultOAuthConsumer; +import oauth.signpost.basic.DefaultOAuthProvider; public class OAuthUrlProvider { @@ -30,11 +30,11 @@ public class OAuthUrlProvider { static private final String CONSUMER_SECRET= "oH969vYW60fZLco6E09UQl3uFXqjl4siQbOL0q9q"; static OAuthConsumer getDefaultConsumer(){ - return new CommonsHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET); + return new DefaultOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET); } static OAuthProvider getDefaultProvider(){ - return new CommonsHttpOAuthProvider(URL_TOKEN_REQUEST, URL_TOKEN_ACCESS, URL_AUTHORIZE); + 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";