mirror of
https://github.com/russok/FitoTrack.git
synced 2025-10-29 00:32:11 -07:00
Code cleanup
This commit is contained in:
parent
3a0c38fdb4
commit
2df035ef78
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -77,7 +77,7 @@ dependencies {
|
|||||||
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.8'
|
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.8'
|
||||||
|
|
||||||
// Upload to OSM
|
// Upload to OSM
|
||||||
implementation ('de.westnordost:osmapi-traces:1.0')
|
implementation('de.westnordost:osmapi-traces:1.0')
|
||||||
configurations {
|
configurations {
|
||||||
compile.exclude group: 'net.sf.kxml', module: 'kxml2' // already included in Android
|
compile.exclude group: 'net.sf.kxml', module: 'kxml2' // already included in Android
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
@ -32,17 +31,20 @@
|
|||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
android:appCategory="productivity"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:appCategory="productivity"
|
|
||||||
tools:ignore="GoogleAppIndexingWarning">
|
tools:ignore="GoogleAppIndexingWarning">
|
||||||
<activity android:name=".activity.ShowWorkoutMapActivity"
|
|
||||||
android:screenOrientation="portrait"></activity>
|
<activity
|
||||||
<activity android:name=".activity.ShowWorkoutMapDiagramActivity"
|
android:name=".activity.ShowWorkoutMapActivity"
|
||||||
android:screenOrientation="portrait"></activity>
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".activity.ShowWorkoutMapDiagramActivity"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
<activity android:name=".activity.SettingsActivity" />
|
<activity android:name=".activity.SettingsActivity" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.ShowWorkoutActivity"
|
android:name=".activity.ShowWorkoutActivity"
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -36,7 +36,7 @@ import de.tadris.fitness.util.unit.UnitUtils;
|
|||||||
|
|
||||||
public class Instance {
|
public class Instance {
|
||||||
|
|
||||||
public static final String DATABASE_NAME= "fito-track";
|
private static final String DATABASE_NAME = "fito-track";
|
||||||
|
|
||||||
private static Instance instance;
|
private static Instance instance;
|
||||||
|
|
||||||
@ -47,9 +47,9 @@ public class Instance {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AppDatabase db;
|
public final AppDatabase db;
|
||||||
public List<LocationListener.LocationChangeListener> locationChangeListeners= new ArrayList<>();
|
public final List<LocationListener.LocationChangeListener> locationChangeListeners = new ArrayList<>();
|
||||||
public UserPreferences userPreferences;
|
public final UserPreferences userPreferences;
|
||||||
|
|
||||||
public boolean pressureAvailable= false;
|
public boolean pressureAvailable= false;
|
||||||
public float lastPressure= 0;
|
public float lastPressure= 0;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -36,14 +36,13 @@ import de.tadris.fitness.R;
|
|||||||
abstract public class FitoTrackActivity extends Activity {
|
abstract public class FitoTrackActivity extends Activity {
|
||||||
|
|
||||||
|
|
||||||
|
int getThemePrimaryColor() {
|
||||||
protected int getThemePrimaryColor() {
|
|
||||||
final TypedValue value = new TypedValue ();
|
final TypedValue value = new TypedValue ();
|
||||||
getTheme().resolveAttribute (android.R.attr.colorPrimary, value, true);
|
getTheme().resolveAttribute (android.R.attr.colorPrimary, value, true);
|
||||||
return value.data;
|
return value.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void shareFile(Uri uri){
|
void shareFile(Uri uri) {
|
||||||
Intent intentShareFile = new Intent(Intent.ACTION_SEND);
|
Intent intentShareFile = new Intent(Intent.ACTION_SEND);
|
||||||
intentShareFile.setDataAndType(uri, getContentResolver().getType(uri));
|
intentShareFile.setDataAndType(uri, getContentResolver().getType(uri));
|
||||||
intentShareFile.putExtra(Intent.EXTRA_STREAM, uri);
|
intentShareFile.putExtra(Intent.EXTRA_STREAM, uri);
|
||||||
@ -56,11 +55,11 @@ abstract public class FitoTrackActivity extends Activity {
|
|||||||
try {
|
try {
|
||||||
Log.d("Export", new BufferedInputStream(getContentResolver().openInputStream(uri)).toString());
|
Log.d("Export", new BufferedInputStream(getContentResolver().openInputStream(uri)).toString());
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void showErrorDialog(Exception e, @StringRes int title, @StringRes int message){
|
void showErrorDialog(Exception e, @StringRes int title, @StringRes int message) {
|
||||||
new AlertDialog.Builder(this)
|
new AlertDialog.Builder(this)
|
||||||
.setTitle(title)
|
.setTitle(title)
|
||||||
.setMessage(getString(message) + "\n\n" + e.getMessage())
|
.setMessage(getString(message) + "\n\n" + e.getMessage())
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -42,12 +42,12 @@ public class LauncherActivity extends Activity {
|
|||||||
new Handler().postDelayed(this::init, 100);
|
new Handler().postDelayed(this::init, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(){
|
private void init() {
|
||||||
Instance.getInstance(this);
|
Instance.getInstance(this);
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void start(){
|
private void start() {
|
||||||
startActivity(new Intent(this, ListWorkoutsActivity.class));
|
startActivity(new Intent(this, ListWorkoutsActivity.class));
|
||||||
finish();
|
finish();
|
||||||
overridePendingTransition(R.anim.fade_in, R.anim.stay);
|
overridePendingTransition(R.anim.fade_in, R.anim.stay);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -46,7 +46,7 @@ public class ListWorkoutsActivity extends Activity implements WorkoutAdapter.Wor
|
|||||||
private RecyclerView.Adapter adapter;
|
private RecyclerView.Adapter adapter;
|
||||||
private RecyclerView.LayoutManager layoutManager;
|
private RecyclerView.LayoutManager layoutManager;
|
||||||
private FloatingActionMenu menu;
|
private FloatingActionMenu menu;
|
||||||
Workout[] workouts;
|
private Workout[] workouts;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -95,7 +95,7 @@ public class ListWorkoutsActivity extends Activity implements WorkoutAdapter.Wor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startRecording(String activity){
|
private void startRecording(String activity) {
|
||||||
menu.close(true);
|
menu.close(true);
|
||||||
RecordWorkoutActivity.ACTIVITY= activity;
|
RecordWorkoutActivity.ACTIVITY= activity;
|
||||||
final Intent intent= new Intent(this, RecordWorkoutActivity.class);
|
final Intent intent= new Intent(this, RecordWorkoutActivity.class);
|
||||||
@ -148,10 +148,9 @@ public class ListWorkoutsActivity extends Activity implements WorkoutAdapter.Wor
|
|||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
|
|
||||||
switch (id){
|
if (id == R.id.actionOpenSettings) {
|
||||||
case R.id.actionOpenSettings:
|
startActivity(new Intent(this, SettingsActivity.class));
|
||||||
startActivity(new Intent(this, SettingsActivity.class));
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -66,20 +66,21 @@ public class RecordWorkoutActivity extends FitoTrackActivity implements Location
|
|||||||
|
|
||||||
public static String ACTIVITY= Workout.WORKOUT_TYPE_RUNNING;
|
public static String ACTIVITY= Workout.WORKOUT_TYPE_RUNNING;
|
||||||
|
|
||||||
MapView mapView;
|
private MapView mapView;
|
||||||
TileDownloadLayer downloadLayer;
|
private TileDownloadLayer downloadLayer;
|
||||||
WorkoutRecorder recorder;
|
private WorkoutRecorder recorder;
|
||||||
Polyline polyline;
|
private Polyline polyline;
|
||||||
List<LatLong> latLongList= new ArrayList<>();
|
private final List<LatLong> latLongList = new ArrayList<>();
|
||||||
InfoViewHolder[] infoViews= new InfoViewHolder[4];
|
private final InfoViewHolder[] infoViews = new InfoViewHolder[4];
|
||||||
TextView timeView, gpsStatusView;
|
private TextView timeView;
|
||||||
View waitingForGPSOverlay;
|
private TextView gpsStatusView;
|
||||||
boolean gpsFound= false;
|
private View waitingForGPSOverlay;
|
||||||
boolean isResumed= false;
|
private boolean gpsFound = false;
|
||||||
private Handler mHandler= new Handler();
|
private boolean isResumed = false;
|
||||||
PowerManager.WakeLock wakeLock;
|
private final Handler mHandler = new Handler();
|
||||||
Intent locationListener;
|
private PowerManager.WakeLock wakeLock;
|
||||||
Intent pressureService;
|
private Intent locationListener;
|
||||||
|
private Intent pressureService;
|
||||||
private boolean saved= false;
|
private boolean saved= false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -92,7 +93,7 @@ public class RecordWorkoutActivity extends FitoTrackActivity implements Location
|
|||||||
|
|
||||||
setupMap();
|
setupMap();
|
||||||
|
|
||||||
((ViewGroup)findViewById(R.id.recordMapViewrRoot)).addView(mapView);
|
((ViewGroup) findViewById(R.id.recordMapViewerRoot)).addView(mapView);
|
||||||
waitingForGPSOverlay= findViewById(R.id.recorderWaitingOverlay);
|
waitingForGPSOverlay= findViewById(R.id.recorderWaitingOverlay);
|
||||||
waitingForGPSOverlay.setVisibility(View.VISIBLE);
|
waitingForGPSOverlay.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
@ -178,7 +179,7 @@ public class RecordWorkoutActivity extends FitoTrackActivity implements Location
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
int i= 0;
|
private int i = 0;
|
||||||
|
|
||||||
private void updateDescription(){
|
private void updateDescription(){
|
||||||
i++;
|
i++;
|
||||||
@ -235,14 +236,14 @@ public class RecordWorkoutActivity extends FitoTrackActivity implements Location
|
|||||||
.create().show();
|
.create().show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkPermissions(){
|
private void checkPermissions() {
|
||||||
if (!hasPermission()) {
|
if (!hasPermission()) {
|
||||||
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 10);
|
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 10);
|
||||||
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 10);
|
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPermission(){
|
private boolean hasPermission() {
|
||||||
return ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
return ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||||
|| ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED;
|
|| ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED;
|
||||||
}
|
}
|
||||||
@ -253,12 +254,12 @@ public class RecordWorkoutActivity extends FitoTrackActivity implements Location
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopListener(){
|
private void stopListener() {
|
||||||
stopService(locationListener);
|
stopService(locationListener);
|
||||||
stopService(pressureService);
|
stopService(pressureService);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startListener(){
|
private void startListener() {
|
||||||
if(locationListener == null){
|
if(locationListener == null){
|
||||||
locationListener= new Intent(this, LocationListener.class);
|
locationListener= new Intent(this, LocationListener.class);
|
||||||
pressureService= new Intent(this, PressureService.class);
|
pressureService= new Intent(this, PressureService.class);
|
||||||
@ -365,10 +366,11 @@ public class RecordWorkoutActivity extends FitoTrackActivity implements Location
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class InfoViewHolder{
|
static class InfoViewHolder {
|
||||||
TextView titleView, valueView;
|
final TextView titleView;
|
||||||
|
final TextView valueView;
|
||||||
|
|
||||||
public InfoViewHolder(TextView titleView, TextView valueView) {
|
InfoViewHolder(TextView titleView, TextView valueView) {
|
||||||
this.titleView = titleView;
|
this.titleView = titleView;
|
||||||
this.valueView = valueView;
|
this.valueView = valueView;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -48,6 +48,7 @@ import androidx.core.content.FileProvider;
|
|||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import de.tadris.fitness.R;
|
import de.tadris.fitness.R;
|
||||||
import de.tadris.fitness.export.BackupController;
|
import de.tadris.fitness.export.BackupController;
|
||||||
@ -58,7 +59,7 @@ import de.tadris.fitness.view.ProgressDialogController;
|
|||||||
public class SettingsActivity extends PreferenceActivity {
|
public class SettingsActivity extends PreferenceActivity {
|
||||||
|
|
||||||
|
|
||||||
protected void shareFile(Uri uri){
|
private void shareFile(Uri uri) {
|
||||||
Intent intentShareFile = new Intent(Intent.ACTION_SEND);
|
Intent intentShareFile = new Intent(Intent.ACTION_SEND);
|
||||||
intentShareFile.setDataAndType(uri, getContentResolver().getType(uri));
|
intentShareFile.setDataAndType(uri, getContentResolver().getType(uri));
|
||||||
intentShareFile.putExtra(Intent.EXTRA_STREAM, uri);
|
intentShareFile.putExtra(Intent.EXTRA_STREAM, uri);
|
||||||
@ -71,7 +72,7 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
try {
|
try {
|
||||||
Log.d("Export", new BufferedInputStream(getContentResolver().openInputStream(uri)).toString());
|
Log.d("Export", new BufferedInputStream(getContentResolver().openInputStream(uri)).toString());
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +90,7 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
* A preference value change listener that updates the preference's summary
|
* A preference value change listener that updates the preference's summary
|
||||||
* to reflect its new value.
|
* to reflect its new value.
|
||||||
*/
|
*/
|
||||||
private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = (preference, value) -> {
|
private static final Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = (preference, value) -> {
|
||||||
String stringValue = value.toString();
|
String stringValue = value.toString();
|
||||||
|
|
||||||
if (preference instanceof ListPreference) {
|
if (preference instanceof ListPreference) {
|
||||||
@ -146,7 +147,7 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
.getString(preference.getKey(), ""));
|
.getString(preference.getKey(), ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Handler mHandler= new Handler();
|
private final Handler mHandler = new Handler();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -160,21 +161,27 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
bindPreferenceSummaryToValue(findPreference("unitSystem"));
|
bindPreferenceSummaryToValue(findPreference("unitSystem"));
|
||||||
bindPreferenceSummaryToValue(findPreference("mapStyle"));
|
bindPreferenceSummaryToValue(findPreference("mapStyle"));
|
||||||
|
|
||||||
findPreference("weight").setOnPreferenceClickListener(preference -> showWeightPicker());
|
findPreference("weight").setOnPreferenceClickListener(preference -> {
|
||||||
findPreference("import").setOnPreferenceClickListener(preference -> showImportDialog());
|
showWeightPicker();
|
||||||
findPreference("export").setOnPreferenceClickListener(preference -> showExportDialog());
|
return true;
|
||||||
|
});
|
||||||
|
findPreference("import").setOnPreferenceClickListener(preference -> {
|
||||||
|
showImportDialog();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
findPreference("export").setOnPreferenceClickListener(preference -> {
|
||||||
|
showExportDialog();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean showExportDialog(){
|
private void showExportDialog() {
|
||||||
new AlertDialog.Builder(this)
|
new AlertDialog.Builder(this)
|
||||||
.setTitle(R.string.exportData)
|
.setTitle(R.string.exportData)
|
||||||
.setMessage(R.string.exportDataSummary)
|
.setMessage(R.string.exportDataSummary)
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(R.string.cancel, null)
|
||||||
.setPositiveButton(R.string.backup, (dialog, which) -> {
|
.setPositiveButton(R.string.backup, (dialog, which) -> exportBackup()).create().show();
|
||||||
exportBackup();
|
|
||||||
}).create().show();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exportBackup(){
|
private void exportBackup(){
|
||||||
@ -183,7 +190,9 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try{
|
try{
|
||||||
String file= getFilesDir().getAbsolutePath() + "/shared/backup.ftb";
|
String file= getFilesDir().getAbsolutePath() + "/shared/backup.ftb";
|
||||||
new File(file).getParentFile().mkdirs();
|
if (!new File(file).getParentFile().mkdirs()) {
|
||||||
|
throw new IOException("Cannot write");
|
||||||
|
}
|
||||||
Uri uri= FileProvider.getUriForFile(getBaseContext(), "de.tadris.fitness.fileprovider", new File(file));
|
Uri uri= FileProvider.getUriForFile(getBaseContext(), "de.tadris.fitness.fileprovider", new File(file));
|
||||||
|
|
||||||
BackupController backupController= new BackupController(getBaseContext(), new File(file), (progress, action) -> mHandler.post(() -> dialogController.setProgress(progress, action)));
|
BackupController backupController= new BackupController(getBaseContext(), new File(file), (progress, action) -> mHandler.post(() -> dialogController.setProgress(progress, action)));
|
||||||
@ -203,28 +212,25 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean showImportDialog(){
|
private void showImportDialog() {
|
||||||
if(!hasPermission()){
|
if(!hasPermission()){
|
||||||
requestPermissions();
|
requestPermissions();
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
new AlertDialog.Builder(this)
|
new AlertDialog.Builder(this)
|
||||||
.setTitle(R.string.importBackup)
|
.setTitle(R.string.importBackup)
|
||||||
.setMessage(R.string.importBackupMessage)
|
.setMessage(R.string.importBackupMessage)
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(R.string.cancel, null)
|
||||||
.setPositiveButton(R.string.restore, (dialog, which) -> {
|
.setPositiveButton(R.string.restore, (dialog, which) -> importBackup()).create().show();
|
||||||
importBackup();
|
|
||||||
}).create().show();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void requestPermissions(){
|
private void requestPermissions() {
|
||||||
if (!hasPermission()) {
|
if (!hasPermission()) {
|
||||||
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 10);
|
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPermission(){
|
private boolean hasPermission() {
|
||||||
return ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
|
return ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,12 +246,10 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
switch (requestCode) {
|
if (requestCode == FILE_SELECT_CODE) {
|
||||||
case FILE_SELECT_CODE:
|
if (resultCode == RESULT_OK) {
|
||||||
if (resultCode == RESULT_OK){
|
importBackup(data.getData());
|
||||||
importBackup(data.getData());
|
}
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
}
|
}
|
||||||
@ -270,7 +274,7 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean showWeightPicker() {
|
private void showWeightPicker() {
|
||||||
UnitUtils.setUnit(this); // Maybe the user changed unit system
|
UnitUtils.setUnit(this); // Maybe the user changed unit system
|
||||||
|
|
||||||
final AlertDialog.Builder d = new AlertDialog.Builder(this);
|
final AlertDialog.Builder d = new AlertDialog.Builder(this);
|
||||||
@ -294,8 +298,6 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
d.create().show();
|
d.create().show();
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -309,11 +311,6 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPause() {
|
|
||||||
super.onPause();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -20,8 +20,6 @@
|
|||||||
package de.tadris.fitness.activity;
|
package de.tadris.fitness.activity;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@ -34,11 +32,11 @@ import android.widget.CheckBox;
|
|||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.core.content.FileProvider;
|
import androidx.core.content.FileProvider;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -116,13 +114,13 @@ public class ShowWorkoutActivity extends WorkoutActivity implements DialogUtils.
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void startDiagramActivity(String diagramType){
|
private void startDiagramActivity(String diagramType) {
|
||||||
ShowWorkoutMapDiagramActivity.DIAGRAM_TYPE= diagramType;
|
ShowWorkoutMapDiagramActivity.DIAGRAM_TYPE= diagramType;
|
||||||
startActivity(new Intent(ShowWorkoutActivity.this, ShowWorkoutMapDiagramActivity.class));
|
startActivity(new Intent(ShowWorkoutActivity.this, ShowWorkoutMapDiagramActivity.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void openEditCommentDialog(final TextView change){
|
private void openEditCommentDialog(final TextView change) {
|
||||||
final EditText editText= new EditText(this);
|
final EditText editText= new EditText(this);
|
||||||
editText.setText(workout.comment);
|
editText.setText(workout.comment);
|
||||||
editText.setSingleLine(true);
|
editText.setSingleLine(true);
|
||||||
@ -132,18 +130,18 @@ public class ShowWorkoutActivity extends WorkoutActivity implements DialogUtils.
|
|||||||
.setView(editText).create().show();
|
.setView(editText).create().show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void changeComment(String comment, TextView onChange){
|
private void changeComment(String comment, TextView onChange) {
|
||||||
workout.comment= comment;
|
workout.comment= comment;
|
||||||
Instance.getInstance(this).db.workoutDao().updateWorkout(workout);
|
Instance.getInstance(this).db.workoutDao().updateWorkout(workout);
|
||||||
onChange.setText(getString(R.string.comment) + ": " + workout.comment);
|
onChange.setText(getString(R.string.comment) + ": " + workout.comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
String getDate(){
|
private String getDate() {
|
||||||
return SimpleDateFormat.getDateInstance().format(new Date(workout.start));
|
return SimpleDateFormat.getDateInstance().format(new Date(workout.start));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void addTitle(String title){
|
private void addTitle(String title) {
|
||||||
TextView textView= new TextView(this);
|
TextView textView= new TextView(this);
|
||||||
textView.setText(title);
|
textView.setText(title);
|
||||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
|
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
|
||||||
@ -155,7 +153,7 @@ public class ShowWorkoutActivity extends WorkoutActivity implements DialogUtils.
|
|||||||
root.addView(textView);
|
root.addView(textView);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView addText(String text){
|
private TextView addText(String text) {
|
||||||
TextView textView= new TextView(this);
|
TextView textView= new TextView(this);
|
||||||
textView.setText(text);
|
textView.setText(text);
|
||||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
|
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
|
||||||
@ -167,11 +165,11 @@ public class ShowWorkoutActivity extends WorkoutActivity implements DialogUtils.
|
|||||||
return textView;
|
return textView;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addKeyValue(String key1, String value1){
|
private void addKeyValue(String key1, String value1) {
|
||||||
addKeyValue(key1, value1, "", "");
|
addKeyValue(key1, value1, "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void addKeyValue(String key1, String value1, String key2, String value2){
|
private void addKeyValue(String key1, String value1, String key2, String value2) {
|
||||||
View v= getLayoutInflater().inflate(R.layout.show_entry, root, false);
|
View v= getLayoutInflater().inflate(R.layout.show_entry, root, false);
|
||||||
|
|
||||||
TextView title1= v.findViewById(R.id.v1title);
|
TextView title1= v.findViewById(R.id.v1title);
|
||||||
@ -211,13 +209,16 @@ public class ShowWorkoutActivity extends WorkoutActivity implements DialogUtils.
|
|||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try{
|
try{
|
||||||
String file= getFilesDir().getAbsolutePath() + "/shared/workout.gpx";
|
String file= getFilesDir().getAbsolutePath() + "/shared/workout.gpx";
|
||||||
new File(file).getParentFile().mkdirs();
|
if (!new File(file).getParentFile().mkdirs()) {
|
||||||
|
throw new IOException("Cannot write to " + file);
|
||||||
|
}
|
||||||
Uri uri= FileProvider.getUriForFile(getBaseContext(), "de.tadris.fitness.fileprovider", new File(file));
|
Uri uri= FileProvider.getUriForFile(getBaseContext(), "de.tadris.fitness.fileprovider", new File(file));
|
||||||
|
|
||||||
GpxExporter.exportWorkout(getBaseContext(), workout, new File(file));
|
GpxExporter.exportWorkout(getBaseContext(), workout, new File(file));
|
||||||
dialogController.cancel();
|
dialogController.cancel();
|
||||||
mHandler.post(() -> shareFile(uri));
|
mHandler.post(() -> shareFile(uri));
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
mHandler.post(() -> showErrorDialog(e, R.string.error, R.string.errorGpxExportFailed));
|
mHandler.post(() -> showErrorDialog(e, R.string.error, R.string.errorGpxExportFailed));
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
@ -245,7 +246,7 @@ public class ShowWorkoutActivity extends WorkoutActivity implements DialogUtils.
|
|||||||
authentication.authenticateIfNecessary();
|
authentication.authenticateIfNecessary();
|
||||||
}
|
}
|
||||||
|
|
||||||
AlertDialog dialog= null;
|
private AlertDialog dialog = null;
|
||||||
private void showUploadOptions(){
|
private void showUploadOptions(){
|
||||||
dialog= new AlertDialog.Builder(this)
|
dialog= new AlertDialog.Builder(this)
|
||||||
.setTitle(R.string.actionUploadToOSM)
|
.setTitle(R.string.actionUploadToOSM)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -64,37 +64,40 @@ public abstract class WorkoutActivity extends FitoTrackActivity {
|
|||||||
|
|
||||||
public static Workout selectedWorkout;
|
public static Workout selectedWorkout;
|
||||||
|
|
||||||
protected List<WorkoutSample> samples;
|
List<WorkoutSample> samples;
|
||||||
protected Workout workout;
|
Workout workout;
|
||||||
protected ViewGroup root;
|
ViewGroup root;
|
||||||
protected Resources.Theme theme;
|
private Resources.Theme theme;
|
||||||
protected MapView map;
|
MapView map;
|
||||||
protected TileDownloadLayer downloadLayer;
|
private TileDownloadLayer downloadLayer;
|
||||||
protected FixedPixelCircle highlightingCircle;
|
private FixedPixelCircle highlightingCircle;
|
||||||
protected Handler mHandler= new Handler();
|
final Handler mHandler = new Handler();
|
||||||
|
|
||||||
protected LineChart speedDiagram, heightDiagram;
|
LineChart speedDiagram;
|
||||||
|
LineChart heightDiagram;
|
||||||
|
|
||||||
protected void initBeforeContent(){
|
void initBeforeContent() {
|
||||||
workout= selectedWorkout;
|
workout= selectedWorkout;
|
||||||
samples= Arrays.asList(Instance.getInstance(this).db.workoutDao().getAllSamplesOfWorkout(workout.id));
|
samples= Arrays.asList(Instance.getInstance(this).db.workoutDao().getAllSamplesOfWorkout(workout.id));
|
||||||
setTheme(ThemeManager.getThemeByWorkout(workout));
|
setTheme(ThemeManager.getThemeByWorkout(workout));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initAfterContent(){
|
void initAfterContent() {
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
if (getActionBar() != null) {
|
||||||
|
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
}
|
||||||
setTitle(WorkoutTypeCalculator.getType(workout));
|
setTitle(WorkoutTypeCalculator.getType(workout));
|
||||||
|
|
||||||
theme= getTheme();
|
theme= getTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
void addDiagram(SampleConverter converter){
|
private void addDiagram(SampleConverter converter) {
|
||||||
root.addView(getDiagram(converter), new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, fullScreenItems ? ViewGroup.LayoutParams.MATCH_PARENT : getWindowManager().getDefaultDisplay().getWidth()*3/4));
|
root.addView(getDiagram(converter), new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, fullScreenItems ? ViewGroup.LayoutParams.MATCH_PARENT : getWindowManager().getDefaultDisplay().getWidth()*3/4));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean diagramsInteractive= false;
|
boolean diagramsInteractive = false;
|
||||||
|
|
||||||
LineChart getDiagram(SampleConverter converter){
|
private LineChart getDiagram(SampleConverter converter) {
|
||||||
LineChart chart= new LineChart(this);
|
LineChart chart= new LineChart(this);
|
||||||
|
|
||||||
converter.onCreate();
|
converter.onCreate();
|
||||||
@ -145,7 +148,7 @@ public abstract class WorkoutActivity extends FitoTrackActivity {
|
|||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onDiagramValueSelected(LatLong latLong){
|
private void onDiagramValueSelected(LatLong latLong) {
|
||||||
Paint p= AndroidGraphicFactory.INSTANCE.createPaint();
|
Paint p= AndroidGraphicFactory.INSTANCE.createPaint();
|
||||||
p.setColor(0xff693cff);
|
p.setColor(0xff693cff);
|
||||||
highlightingCircle= new FixedPixelCircle(latLong, 20, p, null);
|
highlightingCircle= new FixedPixelCircle(latLong, 20, p, null);
|
||||||
@ -166,7 +169,7 @@ public abstract class WorkoutActivity extends FitoTrackActivity {
|
|||||||
void afterAdd(LineChart chart);
|
void afterAdd(LineChart chart);
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkoutSample findSample(SampleConverter converter, Entry entry){
|
private WorkoutSample findSample(SampleConverter converter, Entry entry) {
|
||||||
for(WorkoutSample sample : samples){
|
for(WorkoutSample sample : samples){
|
||||||
if(converter.compare(sample, entry)){
|
if(converter.compare(sample, entry)){
|
||||||
return sample;
|
return sample;
|
||||||
@ -251,8 +254,8 @@ public abstract class WorkoutActivity extends FitoTrackActivity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean fullScreenItems = false;
|
boolean fullScreenItems = false;
|
||||||
protected LinearLayout mapRoot;
|
LinearLayout mapRoot;
|
||||||
|
|
||||||
void addMap(){
|
void addMap(){
|
||||||
map= new MapView(this);
|
map= new MapView(this);
|
||||||
@ -290,7 +293,7 @@ public abstract class WorkoutActivity extends FitoTrackActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int getMapHeight(){
|
private int getMapHeight() {
|
||||||
return getWindowManager().getDefaultDisplay().getWidth()*3/4;
|
return getWindowManager().getDefaultDisplay().getWidth()*3/4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -25,7 +25,7 @@ import android.preference.PreferenceManager;
|
|||||||
|
|
||||||
public class UserPreferences {
|
public class UserPreferences {
|
||||||
|
|
||||||
private SharedPreferences preferences;
|
private final SharedPreferences preferences;
|
||||||
|
|
||||||
public UserPreferences(Context context) {
|
public UserPreferences(Context context) {
|
||||||
this.preferences= PreferenceManager.getDefaultSharedPreferences(context);
|
this.preferences= PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
|||||||
@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020 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.export;
|
package de.tadris.fitness.export;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -17,11 +36,11 @@ import de.tadris.fitness.util.unit.UnitUtils;
|
|||||||
|
|
||||||
public class BackupController {
|
public class BackupController {
|
||||||
|
|
||||||
public static final int VERSION= 1;
|
private static final int VERSION = 1;
|
||||||
|
|
||||||
private Context context;
|
private final Context context;
|
||||||
private File output;
|
private final File output;
|
||||||
private ExportStatusListener listener;
|
private final ExportStatusListener listener;
|
||||||
private UserPreferences preferences;
|
private UserPreferences preferences;
|
||||||
private AppDatabase database;
|
private AppDatabase database;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -29,7 +29,7 @@ import de.tadris.fitness.data.WorkoutSample;
|
|||||||
|
|
||||||
@JacksonXmlRootElement(localName = "fito-track")
|
@JacksonXmlRootElement(localName = "fito-track")
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class FitoTrackDataContainer {
|
class FitoTrackDataContainer {
|
||||||
|
|
||||||
int version;
|
int version;
|
||||||
List<Workout> workouts;
|
List<Workout> workouts;
|
||||||
|
|||||||
@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020 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.export;
|
package de.tadris.fitness.export;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
@ -18,11 +37,11 @@ import de.tadris.fitness.data.WorkoutSample;
|
|||||||
|
|
||||||
public class RestoreController {
|
public class RestoreController {
|
||||||
|
|
||||||
private Context context;
|
private final Context context;
|
||||||
private Uri input;
|
private final Uri input;
|
||||||
private ImportStatusListener listener;
|
private final ImportStatusListener listener;
|
||||||
private FitoTrackDataContainer dataContainer;
|
private FitoTrackDataContainer dataContainer;
|
||||||
private AppDatabase database;
|
private final AppDatabase database;
|
||||||
|
|
||||||
public RestoreController(Context context, Uri input, ImportStatusListener listener) {
|
public RestoreController(Context context, Uri input, ImportStatusListener listener) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
@ -98,8 +117,8 @@ public class RestoreController {
|
|||||||
void onStatusChanged(int progress, String action);
|
void onStatusChanged(int progress, String action);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class UnsupportedVersionException extends Exception{
|
static class UnsupportedVersionException extends Exception {
|
||||||
public UnsupportedVersionException(String message) {
|
UnsupportedVersionException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -30,7 +30,7 @@ import de.tadris.fitness.data.WorkoutSample;
|
|||||||
|
|
||||||
public class WorkoutLayer extends Polyline {
|
public class WorkoutLayer extends Polyline {
|
||||||
|
|
||||||
public static Paint getDEFAULT_PAINT_STROKE(int color){
|
private static Paint getDEFAULT_PAINT_STROKE(int color) {
|
||||||
Paint paint= AndroidGraphicFactory.INSTANCE.createPaint();
|
Paint paint= AndroidGraphicFactory.INSTANCE.createPaint();
|
||||||
paint.setStyle(Style.STROKE);
|
paint.setStyle(Style.STROKE);
|
||||||
paint.setColor(color);
|
paint.setColor(color);
|
||||||
@ -38,13 +38,13 @@ public class WorkoutLayer extends Polyline {
|
|||||||
return paint;
|
return paint;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<WorkoutSample> samples;
|
private final List<WorkoutSample> samples;
|
||||||
|
|
||||||
public WorkoutLayer(List<WorkoutSample> samples, int color) {
|
public WorkoutLayer(List<WorkoutSample> samples, int color) {
|
||||||
this(getDEFAULT_PAINT_STROKE(color), samples);
|
this(getDEFAULT_PAINT_STROKE(color), samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorkoutLayer(Paint paintStroke, List<WorkoutSample> samples) {
|
private WorkoutLayer(Paint paintStroke, List<WorkoutSample> samples) {
|
||||||
super(paintStroke, AndroidGraphicFactory.INSTANCE);
|
super(paintStroke, AndroidGraphicFactory.INSTANCE);
|
||||||
this.samples = samples;
|
this.samples = samples;
|
||||||
init();
|
init();
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -23,7 +23,7 @@ import org.mapsforge.map.layer.download.tilesource.AbstractTileSource;
|
|||||||
|
|
||||||
public abstract class FitoTrackTileSource extends AbstractTileSource {
|
public abstract class FitoTrackTileSource extends AbstractTileSource {
|
||||||
|
|
||||||
public FitoTrackTileSource(String[] hostNames, int port) {
|
FitoTrackTileSource(String[] hostNames, int port) {
|
||||||
super(hostNames, port);
|
super(hostNames, port);
|
||||||
defaultTimeToLive = 8279000;
|
defaultTimeToLive = 8279000;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -26,7 +26,7 @@ import java.net.URL;
|
|||||||
|
|
||||||
public class HumanitarianTileSource extends FitoTrackTileSource {
|
public class HumanitarianTileSource extends FitoTrackTileSource {
|
||||||
|
|
||||||
public static HumanitarianTileSource INSTANCE= new HumanitarianTileSource(new String[]{"tile-a.openstreetmap.fr", "tile-b.openstreetmap.fr", "tile-c.openstreetmap.fr"}, 443);
|
public static final HumanitarianTileSource INSTANCE = new HumanitarianTileSource(new String[]{"tile-a.openstreetmap.fr", "tile-b.openstreetmap.fr", "tile-c.openstreetmap.fr"}, 443);
|
||||||
|
|
||||||
private static final int PARALLEL_REQUESTS_LIMIT = 8;
|
private static final int PARALLEL_REQUESTS_LIMIT = 8;
|
||||||
private static final String PROTOCOL = "https";
|
private static final String PROTOCOL = "https";
|
||||||
@ -34,7 +34,7 @@ public class HumanitarianTileSource extends FitoTrackTileSource {
|
|||||||
private static final int ZOOM_LEVEL_MIN = 0;
|
private static final int ZOOM_LEVEL_MIN = 0;
|
||||||
private static final String NAME = "Humanitarian";
|
private static final String NAME = "Humanitarian";
|
||||||
|
|
||||||
public HumanitarianTileSource(String[] hostNames, int port) {
|
private HumanitarianTileSource(String[] hostNames, int port) {
|
||||||
super(hostNames, port);
|
super(hostNames, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -34,7 +34,7 @@ public class MapnikTileSource extends FitoTrackTileSource {
|
|||||||
private static final int ZOOM_LEVEL_MIN = 0;
|
private static final int ZOOM_LEVEL_MIN = 0;
|
||||||
private static final String NAME = "OSM Mapnik";
|
private static final String NAME = "OSM Mapnik";
|
||||||
|
|
||||||
public MapnikTileSource(String[] hostNames, int port) {
|
private MapnikTileSource(String[] hostNames, int port) {
|
||||||
super(hostNames, port);
|
super(hostNames, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -26,7 +26,7 @@ import java.net.URL;
|
|||||||
|
|
||||||
public class ThunderforestTileSource extends FitoTrackTileSource{
|
public class ThunderforestTileSource extends FitoTrackTileSource{
|
||||||
|
|
||||||
public static final String API_KEY= "87b07337e42c405db6d8d39b1c0c179e";
|
private static final String API_KEY = "87b07337e42c405db6d8d39b1c0c179e";
|
||||||
|
|
||||||
public static final ThunderforestTileSource OUTDOORS = new ThunderforestTileSource("outdoors", "Outdoor");
|
public static final ThunderforestTileSource OUTDOORS = new ThunderforestTileSource("outdoors", "Outdoor");
|
||||||
public static final ThunderforestTileSource CYLE_MAP = new ThunderforestTileSource("cycle", "Cycle Map");
|
public static final ThunderforestTileSource CYLE_MAP = new ThunderforestTileSource("cycle", "Cycle Map");
|
||||||
@ -35,10 +35,10 @@ public class ThunderforestTileSource extends FitoTrackTileSource{
|
|||||||
private static final int ZOOM_LEVEL_MAX = 22;
|
private static final int ZOOM_LEVEL_MAX = 22;
|
||||||
private static final int ZOOM_LEVEL_MIN = 0;
|
private static final int ZOOM_LEVEL_MIN = 0;
|
||||||
|
|
||||||
private String mapName;
|
private final String mapName;
|
||||||
private String name;
|
private final String name;
|
||||||
|
|
||||||
public ThunderforestTileSource(String mapName, String name) {
|
private ThunderforestTileSource(String mapName, String name) {
|
||||||
super(new String[]{"tile.thunderforest.com"}, 443);
|
super(new String[]{"tile.thunderforest.com"}, 443);
|
||||||
this.mapName = mapName;
|
this.mapName = mapName;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -22,12 +22,12 @@ package de.tadris.fitness.osm;
|
|||||||
import de.tadris.fitness.data.WorkoutSample;
|
import de.tadris.fitness.data.WorkoutSample;
|
||||||
import de.westnordost.osmapi.map.data.LatLon;
|
import de.westnordost.osmapi.map.data.LatLon;
|
||||||
|
|
||||||
public class GpsTraceLatLong implements LatLon {
|
class GpsTraceLatLong implements LatLon {
|
||||||
|
|
||||||
private final double latitude;
|
private final double latitude;
|
||||||
private final double longitude;
|
private final double longitude;
|
||||||
|
|
||||||
public GpsTraceLatLong(double latitude, double longitude) {
|
private GpsTraceLatLong(double latitude, double longitude) {
|
||||||
this.latitude = latitude;
|
this.latitude = latitude;
|
||||||
this.longitude = longitude;
|
this.longitude = longitude;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -39,14 +39,14 @@ import oauth.signpost.exception.OAuthException;
|
|||||||
|
|
||||||
public class OAuthAuthentication {
|
public class OAuthAuthentication {
|
||||||
|
|
||||||
private OAuthConsumer oAuthConsumer= OAuthUrlProvider.getDefaultConsumer();
|
private final OAuthConsumer oAuthConsumer = OAuthUrlProvider.getDefaultConsumer();
|
||||||
private OAuthProvider oAuthProvider= OAuthUrlProvider.getDefaultProvider();
|
private final OAuthProvider oAuthProvider = OAuthUrlProvider.getDefaultProvider();
|
||||||
|
|
||||||
private Handler handler;
|
private final Handler handler;
|
||||||
private Activity activity;
|
private final Activity activity;
|
||||||
private ProgressDialogController dialogController;
|
private final ProgressDialogController dialogController;
|
||||||
private SharedPreferences preferences;
|
private final SharedPreferences preferences;
|
||||||
private OAuthAuthenticationListener listener;
|
private final OAuthAuthenticationListener listener;
|
||||||
|
|
||||||
public OAuthAuthentication(Handler handler, Activity activity, OAuthAuthenticationListener listener) {
|
public OAuthAuthentication(Handler handler, Activity activity, OAuthAuthenticationListener listener) {
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -24,7 +24,7 @@ import oauth.signpost.OAuthProvider;
|
|||||||
import oauth.signpost.basic.DefaultOAuthConsumer;
|
import oauth.signpost.basic.DefaultOAuthConsumer;
|
||||||
import oauth.signpost.basic.DefaultOAuthProvider;
|
import oauth.signpost.basic.DefaultOAuthProvider;
|
||||||
|
|
||||||
public class OAuthUrlProvider {
|
class OAuthUrlProvider {
|
||||||
|
|
||||||
static private final String CONSUMER_KEY= "jFL9grFmAo5ZS720YDDRXdSOb7F0IZQf9lnY1PHq";
|
static private final String CONSUMER_KEY= "jFL9grFmAo5ZS720YDDRXdSOb7F0IZQf9lnY1PHq";
|
||||||
static private final String CONSUMER_SECRET= "oH969vYW60fZLco6E09UQl3uFXqjl4siQbOL0q9q";
|
static private final String CONSUMER_SECRET= "oH969vYW60fZLco6E09UQl3uFXqjl4siQbOL0q9q";
|
||||||
|
|||||||
@ -46,15 +46,15 @@ public class OsmTraceUploader {
|
|||||||
|
|
||||||
private static final int CUT_DISTANCE= 300;
|
private static final int CUT_DISTANCE= 300;
|
||||||
|
|
||||||
private Activity activity;
|
private final Activity activity;
|
||||||
private Handler handler;
|
private final Handler handler;
|
||||||
private Workout workout;
|
private final Workout workout;
|
||||||
private List<WorkoutSample> samples;
|
private final List<WorkoutSample> samples;
|
||||||
private GpsTraceDetails.Visibility visibility;
|
private final GpsTraceDetails.Visibility visibility;
|
||||||
private OAuthConsumer consumer;
|
private final OAuthConsumer consumer;
|
||||||
private boolean cut;
|
private final boolean cut;
|
||||||
private ProgressDialogController dialogController;
|
private final ProgressDialogController dialogController;
|
||||||
private String description;
|
private final String description;
|
||||||
|
|
||||||
public OsmTraceUploader(Activity activity, Handler handler, Workout workout, List<WorkoutSample> samples, GpsTraceDetails.Visibility visibility, OAuthConsumer consumer, boolean cut, 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.activity = activity;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -51,9 +51,9 @@ public class LocationListener extends Service {
|
|||||||
private static final int LOCATION_INTERVAL = 1000;
|
private static final int LOCATION_INTERVAL = 1000;
|
||||||
|
|
||||||
private class LocationChangedListener implements android.location.LocationListener {
|
private class LocationChangedListener implements android.location.LocationListener {
|
||||||
Location mLastLocation;
|
final Location mLastLocation;
|
||||||
|
|
||||||
public LocationChangedListener(String provider) {
|
LocationChangedListener(String provider) {
|
||||||
Log.i(TAG, "LocationListener " + provider);
|
Log.i(TAG, "LocationListener " + provider);
|
||||||
mLastLocation = new Location(provider);
|
mLastLocation = new Location(provider);
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ public class LocationListener extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LocationChangedListener gpsListener= new LocationChangedListener(LocationManager.GPS_PROVIDER);
|
private final LocationChangedListener gpsListener = new LocationChangedListener(LocationManager.GPS_PROVIDER);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBinder onBind(Intent arg0) {
|
public IBinder onBind(Intent arg0) {
|
||||||
|
|||||||
@ -54,8 +54,8 @@ public class WorkoutRecorder implements LocationListener.LocationChangeListener
|
|||||||
*/
|
*/
|
||||||
private static final int AUTO_STOP_TIMEOUT= 1000*60*60*20; // 20 minutes
|
private static final int AUTO_STOP_TIMEOUT= 1000*60*60*20; // 20 minutes
|
||||||
|
|
||||||
private Context context;
|
private final Context context;
|
||||||
private Workout workout;
|
private final Workout workout;
|
||||||
private RecordingState state;
|
private RecordingState state;
|
||||||
private final List<WorkoutSample> samples= new ArrayList<>();
|
private final List<WorkoutSample> samples= new ArrayList<>();
|
||||||
private long time= 0;
|
private long time= 0;
|
||||||
@ -69,7 +69,7 @@ public class WorkoutRecorder implements LocationListener.LocationChangeListener
|
|||||||
private static final double SIGNAL_BAD_THRESHOLD= 20; // In meters
|
private static final double SIGNAL_BAD_THRESHOLD= 20; // In meters
|
||||||
private static final int SIGNAL_LOST_THRESHOLD= 10000; // In milliseconds
|
private static final int SIGNAL_LOST_THRESHOLD= 10000; // In milliseconds
|
||||||
private Location lastFix= null;
|
private Location lastFix= null;
|
||||||
private WorkoutRecorderListener workoutRecorderListener;
|
private final WorkoutRecorderListener workoutRecorderListener;
|
||||||
private GpsState gpsState= GpsState.SIGNAL_LOST;
|
private GpsState gpsState= GpsState.SIGNAL_LOST;
|
||||||
|
|
||||||
public WorkoutRecorder(Context context, String workoutType, WorkoutRecorderListener workoutRecorderListener) {
|
public WorkoutRecorder(Context context, String workoutType, WorkoutRecorderListener workoutRecorderListener) {
|
||||||
@ -164,7 +164,7 @@ public class WorkoutRecorder implements LocationListener.LocationChangeListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pause(){
|
private void pause() {
|
||||||
if(state == RecordingState.RUNNING){
|
if(state == RecordingState.RUNNING){
|
||||||
Log.i("Recorder", "Pause");
|
Log.i("Recorder", "Pause");
|
||||||
state= RecordingState.PAUSED;
|
state= RecordingState.PAUSED;
|
||||||
@ -319,7 +319,7 @@ public class WorkoutRecorder implements LocationListener.LocationChangeListener
|
|||||||
SIGNAL_OKAY(Color.GREEN),
|
SIGNAL_OKAY(Color.GREEN),
|
||||||
SIGNAL_BAD(Color.YELLOW);
|
SIGNAL_BAD(Color.YELLOW);
|
||||||
|
|
||||||
public int color;
|
public final int color;
|
||||||
|
|
||||||
GpsState(int color) {
|
GpsState(int color) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
|||||||
@ -31,12 +31,12 @@ import de.tadris.fitness.data.Workout;
|
|||||||
import de.tadris.fitness.data.WorkoutSample;
|
import de.tadris.fitness.data.WorkoutSample;
|
||||||
import de.tadris.fitness.util.CalorieCalculator;
|
import de.tadris.fitness.util.CalorieCalculator;
|
||||||
|
|
||||||
public class WorkoutSaver {
|
class WorkoutSaver {
|
||||||
|
|
||||||
private Context context;
|
private final Context context;
|
||||||
private Workout workout;
|
private final Workout workout;
|
||||||
private List<WorkoutSample> samples;
|
private final List<WorkoutSample> samples;
|
||||||
private AppDatabase db;
|
private final AppDatabase db;
|
||||||
|
|
||||||
public WorkoutSaver(Context context, Workout workout, List<WorkoutSample> samples) {
|
public WorkoutSaver(Context context, Workout workout, List<WorkoutSample> samples) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -43,11 +43,9 @@ public class CalorieCalculator {
|
|||||||
* workoutType and avgSpeed of workout have to be set
|
* workoutType and avgSpeed of workout have to be set
|
||||||
*
|
*
|
||||||
* Calculation currently ignores height.
|
* Calculation currently ignores height.
|
||||||
*
|
|
||||||
* @param workout
|
|
||||||
* @return MET
|
* @return MET
|
||||||
*/
|
*/
|
||||||
public static double getMET(Workout workout){
|
private static double getMET(Workout workout) {
|
||||||
double speedInKmh= workout.avgSpeed * 3.6;
|
double speedInKmh= workout.avgSpeed * 3.6;
|
||||||
if(workout.workoutType.equals(Workout.WORKOUT_TYPE_RUNNING) || workout.workoutType.equals(Workout.WORKOUT_TYPE_HIKING)){
|
if(workout.workoutType.equals(Workout.WORKOUT_TYPE_RUNNING) || workout.workoutType.equals(Workout.WORKOUT_TYPE_HIKING)){
|
||||||
// This is a linear graph based on the website linked above
|
// This is a linear graph based on the website linked above
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -28,7 +28,7 @@ import de.tadris.fitness.R;
|
|||||||
|
|
||||||
public class NotificationHelper {
|
public class NotificationHelper {
|
||||||
|
|
||||||
public static String CHANNEL_WORKOUT= "workout";
|
public static final String CHANNEL_WORKOUT = "workout";
|
||||||
|
|
||||||
public static void createChannels(Context context){
|
public static void createChannels(Context context){
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -37,7 +37,7 @@ public class Gpx {
|
|||||||
Metadata metadata;
|
Metadata metadata;
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
String desc;
|
private String desc;
|
||||||
|
|
||||||
@JacksonXmlElementWrapper(useWrapping = false)
|
@JacksonXmlElementWrapper(useWrapping = false)
|
||||||
List<Track> trk;
|
List<Track> trk;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package de.tadris.fitness.util.gpx;
|
package de.tadris.fitness.util.gpx;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||||
@ -40,7 +41,7 @@ public class GpxExporter {
|
|||||||
mapper.writeValue(file, getGpxFromWorkout(context, workout));
|
mapper.writeValue(file, getGpxFromWorkout(context, workout));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Gpx getGpxFromWorkout(Context context, Workout workout){
|
private static Gpx getGpxFromWorkout(Context context, Workout workout) {
|
||||||
Gpx gpx= new Gpx();
|
Gpx gpx= new Gpx();
|
||||||
gpx.name= workout.toString();
|
gpx.name= workout.toString();
|
||||||
gpx.version= "1.1";
|
gpx.version= "1.1";
|
||||||
@ -52,7 +53,7 @@ public class GpxExporter {
|
|||||||
return gpx;
|
return gpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Track getTrackFromWorkout(Context context, Workout workout, int number){
|
private static Track getTrackFromWorkout(Context context, Workout workout, int number) {
|
||||||
WorkoutSample[] samples= Instance.getInstance(context).db.workoutDao().getAllSamplesOfWorkout(workout.id);
|
WorkoutSample[] samples= Instance.getInstance(context).db.workoutDao().getAllSamplesOfWorkout(workout.id);
|
||||||
Track track= new Track();
|
Track track= new Track();
|
||||||
track.number= number;
|
track.number= number;
|
||||||
@ -77,13 +78,14 @@ public class GpxExporter {
|
|||||||
return track;
|
return track;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SimpleDateFormat")
|
||||||
private static final SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
|
private static final SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
|
||||||
|
|
||||||
public static String getDateTime(long time){
|
private static String getDateTime(long time) {
|
||||||
return getDateTime(new Date(time));
|
return getDateTime(new Date(time));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getDateTime(Date date){
|
private static String getDateTime(Date date) {
|
||||||
return formatter.format(date);
|
return formatter.format(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -21,9 +21,9 @@ package de.tadris.fitness.util.gpx;
|
|||||||
|
|
||||||
public class Metadata {
|
public class Metadata {
|
||||||
|
|
||||||
String name;
|
private String name;
|
||||||
String desc;
|
private String desc;
|
||||||
String time;
|
private String time;
|
||||||
|
|
||||||
public Metadata() {
|
public Metadata() {
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -21,21 +21,23 @@ package de.tadris.fitness.util.gpx;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||||
|
|
||||||
public class TrackPoint {
|
class TrackPoint {
|
||||||
|
|
||||||
@JacksonXmlProperty(isAttribute = true)
|
@JacksonXmlProperty(isAttribute = true)
|
||||||
|
private
|
||||||
double lat;
|
double lat;
|
||||||
|
|
||||||
@JacksonXmlProperty(isAttribute = true)
|
@JacksonXmlProperty(isAttribute = true)
|
||||||
|
private
|
||||||
double lon;
|
double lon;
|
||||||
|
|
||||||
double ele;
|
private double ele;
|
||||||
|
|
||||||
String time;
|
private String time;
|
||||||
|
|
||||||
String fix;
|
private String fix;
|
||||||
|
|
||||||
TrackPointExtension extensions;
|
private TrackPointExtension extensions;
|
||||||
|
|
||||||
public TrackPoint(){}
|
public TrackPoint(){}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -21,7 +21,7 @@ package de.tadris.fitness.util.gpx;
|
|||||||
|
|
||||||
public class TrackPointExtension {
|
public class TrackPointExtension {
|
||||||
|
|
||||||
double speed;
|
private double speed;
|
||||||
|
|
||||||
public TrackPointExtension(){}
|
public TrackPointExtension(){}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -23,7 +23,7 @@ import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TrackSegment {
|
class TrackSegment {
|
||||||
|
|
||||||
@JacksonXmlElementWrapper(useWrapping = false)
|
@JacksonXmlElementWrapper(useWrapping = false)
|
||||||
List<TrackPoint> trkpt;
|
List<TrackPoint> trkpt;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -24,22 +24,23 @@ import android.preference.PreferenceManager;
|
|||||||
|
|
||||||
public class UnitUtils {
|
public class UnitUtils {
|
||||||
|
|
||||||
public static final Unit UNITS_METRIC= new Metric();
|
private static final Unit UNITS_METRIC = new Metric();
|
||||||
public static final Unit UNITS_METRIC_PHYSICAL= new MetricPhysical();
|
private static final Unit UNITS_METRIC_PHYSICAL = new MetricPhysical();
|
||||||
public static final Unit UNITS_IMPERIAL_YARDS= new Imperial();
|
private static final Unit UNITS_IMPERIAL_YARDS = new Imperial();
|
||||||
public static final Unit UNITS_IMPERIAL_METERS= new ImperialWithMeters();
|
private static final Unit UNITS_IMPERIAL_METERS = new ImperialWithMeters();
|
||||||
public static final Unit[] supportedUnits= new Unit[] {
|
private static final Unit[] supportedUnits = new Unit[]{
|
||||||
UNITS_METRIC, UNITS_METRIC_PHYSICAL, UNITS_IMPERIAL_YARDS, UNITS_IMPERIAL_METERS
|
UNITS_METRIC, UNITS_METRIC_PHYSICAL, UNITS_IMPERIAL_YARDS, UNITS_IMPERIAL_METERS
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Unit CHOSEN_SYSTEM= UNITS_METRIC;
|
public static Unit CHOSEN_SYSTEM= UNITS_METRIC;
|
||||||
|
|
||||||
public static void setUnit(Context context){
|
public static void setUnit(Context context){
|
||||||
int id= Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(context).getString("unitSystem", String.valueOf(UnitUtils.UNITS_METRIC.getId())));
|
String id = PreferenceManager.getDefaultSharedPreferences(context).getString("unitSystem", String.valueOf(UnitUtils.UNITS_METRIC.getId()));
|
||||||
setUnit(id);
|
assert id != null;
|
||||||
|
setUnit(Integer.parseInt(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setUnit(int id){
|
private static void setUnit(int id) {
|
||||||
CHOSEN_SYSTEM= UNITS_METRIC;
|
CHOSEN_SYSTEM= UNITS_METRIC;
|
||||||
for(Unit unit : supportedUnits){
|
for(Unit unit : supportedUnits){
|
||||||
if(id == unit.getId()){
|
if(id == unit.getId()){
|
||||||
@ -62,13 +63,13 @@ public class UnitUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getHourMinuteSecondTime(long time){
|
public static String getHourMinuteSecondTime(long time){
|
||||||
long totalSeks= time / 1000;
|
long totalSecs = time / 1000;
|
||||||
long totalMins= totalSeks / 60;
|
long totalMins = totalSecs / 60;
|
||||||
long hours= totalMins / 60;
|
long hours= totalMins / 60;
|
||||||
long mins= totalMins % 60;
|
long mins= totalMins % 60;
|
||||||
long seks= totalSeks % 60;
|
long secs = totalSecs % 60;
|
||||||
String minStr= (mins < 10 ? "0" : "") + mins;
|
String minStr= (mins < 10 ? "0" : "") + mins;
|
||||||
String sekStr= (seks < 10 ? "0" : "") + seks;
|
String sekStr = (secs < 10 ? "0" : "") + secs;
|
||||||
return hours + ":" + minStr + ":" + sekStr;
|
return hours + ":" + minStr + ":" + sekStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +86,6 @@ public class UnitUtils {
|
|||||||
/**
|
/**
|
||||||
*CHOSEN_SYSTEM.getLongDistanceUnit()
|
*CHOSEN_SYSTEM.getLongDistanceUnit()
|
||||||
* @param consumption consumption in kcal/km
|
* @param consumption consumption in kcal/km
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static String getRelativeEnergyConsumption(double consumption){
|
public static String getRelativeEnergyConsumption(double consumption){
|
||||||
double one= CHOSEN_SYSTEM.getDistanceFromKilometers(1);
|
double one= CHOSEN_SYSTEM.getDistanceFromKilometers(1);
|
||||||
@ -115,7 +115,7 @@ public class UnitUtils {
|
|||||||
return round(CHOSEN_SYSTEM.getSpeedFromMeterPerSecond(speed), 1) + " " + CHOSEN_SYSTEM.getSpeedUnit();
|
return round(CHOSEN_SYSTEM.getSpeedFromMeterPerSecond(speed), 1) + " " + CHOSEN_SYSTEM.getSpeedUnit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double round(double d, int count){
|
private static double round(double d, int count) {
|
||||||
return (double)Math.round(d * Math.pow(10, count)) / Math.pow(10, count);
|
return (double)Math.round(d * Math.pow(10, count)) / Math.pow(10, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -28,8 +28,8 @@ import de.tadris.fitness.R;
|
|||||||
|
|
||||||
public class ProgressDialogController {
|
public class ProgressDialogController {
|
||||||
|
|
||||||
private Activity context;
|
private final Activity context;
|
||||||
private Dialog dialog;
|
private final Dialog dialog;
|
||||||
private TextView infoView;
|
private TextView infoView;
|
||||||
private ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ public class ProgressDialogController {
|
|||||||
setTitle(title);
|
setTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProgressDialogController(Activity context) {
|
private ProgressDialogController(Activity context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.dialog= new Dialog(context);
|
this.dialog= new Dialog(context);
|
||||||
initDialog();
|
initDialog();
|
||||||
@ -51,7 +51,7 @@ public class ProgressDialogController {
|
|||||||
progressBar= dialog.findViewById(R.id.dialogProgressBar);
|
progressBar= dialog.findViewById(R.id.dialogProgressBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String title){
|
private void setTitle(String title) {
|
||||||
dialog.setTitle(title);
|
dialog.setTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -40,10 +40,14 @@ public class WorkoutAdapter extends RecyclerView.Adapter<WorkoutAdapter.WorkoutV
|
|||||||
|
|
||||||
public static class WorkoutViewHolder extends RecyclerView.ViewHolder{
|
public static class WorkoutViewHolder extends RecyclerView.ViewHolder{
|
||||||
|
|
||||||
View root;
|
final View root;
|
||||||
TextView lengthText, timeText, dateText, typeText, commentText;
|
final TextView lengthText;
|
||||||
|
final TextView timeText;
|
||||||
|
final TextView dateText;
|
||||||
|
final TextView typeText;
|
||||||
|
final TextView commentText;
|
||||||
|
|
||||||
public WorkoutViewHolder(@NonNull View itemView) {
|
WorkoutViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
this.root= itemView;
|
this.root= itemView;
|
||||||
lengthText= itemView.findViewById(R.id.workoutLength);
|
lengthText= itemView.findViewById(R.id.workoutLength);
|
||||||
@ -54,8 +58,8 @@ public class WorkoutAdapter extends RecyclerView.Adapter<WorkoutAdapter.WorkoutV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Workout[] workouts;
|
private final Workout[] workouts;
|
||||||
WorkoutAdapterListener listener;
|
private final WorkoutAdapterListener listener;
|
||||||
|
|
||||||
public WorkoutAdapter(Workout[] workouts, WorkoutAdapterListener listener) {
|
public WorkoutAdapter(Workout[] workouts, WorkoutAdapterListener listener) {
|
||||||
this.workouts = workouts;
|
this.workouts = workouts;
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
@ -20,5 +19,7 @@
|
|||||||
|
|
||||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:duration="300">
|
android:duration="300">
|
||||||
<alpha android:fromAlpha="0" android:toAlpha="1"/>
|
<alpha
|
||||||
|
android:fromAlpha="0"
|
||||||
|
android:toAlpha="1" />
|
||||||
</set>
|
</set>
|
||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
@ -20,10 +20,10 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
|
android:tint="#FFFFFF"
|
||||||
android:viewportWidth="24"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="24"
|
android:viewportHeight="24">
|
||||||
android:tint="#FFFFFF">
|
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FF000000"
|
android:fillColor="#FF000000"
|
||||||
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
@ -20,11 +20,11 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24"
|
android:alpha="0.8"
|
||||||
android:viewportHeight="24"
|
|
||||||
android:tint="#FFFFFF"
|
android:tint="#FFFFFF"
|
||||||
android:alpha="0.8">
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FF000000"
|
android:fillColor="#FF000000"
|
||||||
android:pathData="M20.94,11c-0.46,-4.17 -3.77,-7.48 -7.94,-7.94V1h-2v2.06C6.83,3.52 3.52,6.83 3.06,11H1v2h2.06c0.46,4.17 3.77,7.48 7.94,7.94V23h2v-2.06c4.17,-0.46 7.48,-3.77 7.94,-7.94H23v-2h-2.06zM12,19c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7z"/>
|
android:pathData="M20.94,11c-0.46,-4.17 -3.77,-7.48 -7.94,-7.94V1h-2v2.06C6.83,3.52 3.52,6.83 3.06,11H1v2h2.06c0.46,4.17 3.77,7.48 7.94,7.94V23h2v-2.06c4.17,-0.46 7.48,-3.77 7.94,-7.94H23v-2h-2.06zM12,19c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7z" />
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
@ -18,11 +18,11 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24.0"
|
||||||
android:viewportHeight="24.0">
|
android:viewportHeight="24.0">
|
||||||
<path
|
<path
|
||||||
android:pathData="M12,12m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0"
|
android:fillColor="@android:color/white"
|
||||||
android:fillColor="@android:color/white"/>
|
android:pathData="M12,12m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0" />
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
@ -19,10 +18,10 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
tools:context=".activity.ListWorkoutsActivity">
|
tools:context=".activity.ListWorkoutsActivity">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
@ -36,12 +35,12 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom|right"
|
android:layout_gravity="bottom|right"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
|
app:menu_animationDelayPerItem="50"
|
||||||
app:menu_colorNormal="@color/colorPrimary"
|
app:menu_colorNormal="@color/colorPrimary"
|
||||||
app:menu_colorPressed="@color/colorPrimaryDark"
|
app:menu_colorPressed="@color/colorPrimaryDark"
|
||||||
app:menu_animationDelayPerItem="50"
|
|
||||||
app:menu_icon="@drawable/fab_add"
|
app:menu_icon="@drawable/fab_add"
|
||||||
app:menu_labels_showAnimation="@anim/fab_slide_in_from_right"
|
app:menu_labels_hideAnimation="@anim/fab_slide_out_to_right"
|
||||||
app:menu_labels_hideAnimation="@anim/fab_slide_out_to_right">
|
app:menu_labels_showAnimation="@anim/fab_slide_in_from_right">
|
||||||
|
|
||||||
<com.github.clans.fab.FloatingActionButton
|
<com.github.clans.fab.FloatingActionButton
|
||||||
android:id="@+id/workoutListRecordRunning"
|
android:id="@+id/workoutListRecordRunning"
|
||||||
@ -51,7 +50,7 @@
|
|||||||
app:fab_colorNormal="@color/colorPrimaryRunning"
|
app:fab_colorNormal="@color/colorPrimaryRunning"
|
||||||
app:fab_colorPressed="@color/colorPrimaryDarkRunning"
|
app:fab_colorPressed="@color/colorPrimaryDarkRunning"
|
||||||
app:fab_label="@string/workoutTypeRunning"
|
app:fab_label="@string/workoutTypeRunning"
|
||||||
app:fab_size="normal"/>
|
app:fab_size="normal" />
|
||||||
|
|
||||||
<com.github.clans.fab.FloatingActionButton
|
<com.github.clans.fab.FloatingActionButton
|
||||||
android:id="@+id/workoutListRecordHiking"
|
android:id="@+id/workoutListRecordHiking"
|
||||||
@ -71,7 +70,7 @@
|
|||||||
app:fab_colorNormal="@color/colorPrimaryBicycling"
|
app:fab_colorNormal="@color/colorPrimaryBicycling"
|
||||||
app:fab_colorPressed="@color/colorPrimaryDarkBicycling"
|
app:fab_colorPressed="@color/colorPrimaryDarkBicycling"
|
||||||
app:fab_label="@string/workoutTypeCycling"
|
app:fab_label="@string/workoutTypeCycling"
|
||||||
app:fab_size="normal"/>
|
app:fab_size="normal" />
|
||||||
|
|
||||||
</com.github.clans.fab.FloatingActionMenu>
|
</com.github.clans.fab.FloatingActionMenu>
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
@ -32,7 +31,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/recordMapViewrRoot"
|
android:id="@+id/recordMapViewerRoot"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@ -65,8 +64,8 @@
|
|||||||
android:layout_height="200dp"
|
android:layout_height="200dp"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_marginBottom="0dp"
|
android:layout_marginBottom="0dp"
|
||||||
android:padding="10dp"
|
android:orientation="vertical"
|
||||||
android:orientation="vertical">
|
android:padding="10dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/recordTime"
|
android:id="@+id/recordTime"
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
@ -35,7 +34,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="20dp"></LinearLayout>
|
android:padding="20dp" />
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
@ -25,7 +24,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".activity.ShowWorkoutMapActivity" >
|
tools:context=".activity.ShowWorkoutMapActivity">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Guideline
|
<androidx.constraintlayout.widget.Guideline
|
||||||
android:id="@+id/guideline4"
|
android:id="@+id/guideline4"
|
||||||
@ -58,6 +57,6 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@+id/guideline4"></LinearLayout>
|
app:layout_constraintTop_toTopOf="@+id/guideline4" />
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
</android.support.constraint.ConstraintLayout>
|
||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
@ -29,11 +28,12 @@
|
|||||||
|
|
||||||
<TableRow
|
<TableRow
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:labelFor="@id/uploadDescription"
|
||||||
android:text="@string/description" />
|
android:text="@string/description" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
<TableRow
|
<TableRow
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -64,13 +64,6 @@
|
|||||||
android:spinnerMode="dropdown" />
|
android:spinnerMode="dropdown" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
|
|
||||||
<TableRow
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
@ -20,7 +19,7 @@
|
|||||||
|
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent" >
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
<NumberPicker
|
<NumberPicker
|
||||||
android:id="@+id/weightPicker"
|
android:id="@+id/weightPicker"
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
@ -21,8 +20,8 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:background="?android:selectableItemBackground"
|
||||||
android:background="?android:selectableItemBackground">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -90,6 +89,6 @@
|
|||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:background="@android:color/darker_gray"/>
|
android:background="@android:color/darker_gray" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
@ -107,4 +106,5 @@
|
|||||||
<string name="waiting_gps">Warte auf GPS</string>
|
<string name="waiting_gps">Warte auf GPS</string>
|
||||||
<string name="uploadFailed">Upload fehlgeschlagen</string>
|
<string name="uploadFailed">Upload fehlgeschlagen</string>
|
||||||
<string name="uploadSuccessful">Upload erfolgreich</string>
|
<string name="uploadSuccessful">Upload erfolgreich</string>
|
||||||
|
<string name="uploadFailedOsmNotAuthorized">Nicht autorisiert, nocheinmal versuchen</string>
|
||||||
</resources>
|
</resources>
|
||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
@ -19,5 +18,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<paths>
|
<paths>
|
||||||
<files-path path="shared/" name="share" />
|
<files-path
|
||||||
|
name="share"
|
||||||
|
path="shared/" />
|
||||||
</paths>
|
</paths>
|
||||||
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
|
||||||
~
|
~
|
||||||
~ This file is part of FitoTrack
|
~ This file is part of FitoTrack
|
||||||
~
|
~
|
||||||
@ -21,11 +20,11 @@
|
|||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
|
android:defaultValue="1"
|
||||||
android:entries="@array/pref_unit_systems"
|
android:entries="@array/pref_unit_systems"
|
||||||
android:entryValues="@array/pref_unit_system_values"
|
android:entryValues="@array/pref_unit_system_values"
|
||||||
android:key="unitSystem"
|
android:key="unitSystem"
|
||||||
android:title="@string/pref_unit_system"
|
android:title="@string/pref_unit_system" />
|
||||||
android:defaultValue="1" />
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="weight"
|
android:key="weight"
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
* Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||||
*
|
*
|
||||||
* This file is part of FitoTrack
|
* This file is part of FitoTrack
|
||||||
*
|
*
|
||||||
@ -28,12 +28,12 @@ import de.tadris.fitness.util.CalorieCalculator;
|
|||||||
public class CalorieCalculatorTest {
|
public class CalorieCalculatorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCalculation(){
|
public void testCalculation() {
|
||||||
Workout workout= new Workout();
|
Workout workout = new Workout();
|
||||||
workout.avgSpeed= 2.7d;
|
workout.avgSpeed = 2.7d;
|
||||||
workout.workoutType= Workout.WORKOUT_TYPE_RUNNING;
|
workout.workoutType = Workout.WORKOUT_TYPE_RUNNING;
|
||||||
workout.duration= 1000L * 60 * 10;
|
workout.duration = 1000L * 60 * 10;
|
||||||
int calorie= CalorieCalculator.calculateCalories(workout, 80);
|
int calorie = CalorieCalculator.calculateCalories(workout, 80);
|
||||||
System.out.println("Calories: " + calorie);
|
System.out.println("Calories: " + calorie);
|
||||||
Assert.assertEquals(120, calorie, 50);
|
Assert.assertEquals(120, calorie, 50);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,4 +3,4 @@ FitoTrack is a mobile app for logging and viewing your workouts. Whether you’r
|
|||||||
Features:
|
Features:
|
||||||
* Track workouts. Choose the type of sport you would like to track and just start running, cycling or hiking, for example. You can see the general information right below the map on the tracking screen.
|
* Track workouts. Choose the type of sport you would like to track and just start running, cycling or hiking, for example. You can see the general information right below the map on the tracking screen.
|
||||||
* View your workouts. View general information such as date, time, duration, distance, speed and pace. See your route on a map. Work out your level of performance from the speed diagram.
|
* View your workouts. View general information such as date, time, duration, distance, speed and pace. See your route on a map. Work out your level of performance from the speed diagram.
|
||||||
* Open-Source. There is neither advertivesment nor tracking, and the source code is open and licensed under the GPLv3.
|
* Open-Source. There is neither advertisement nor tracking, and the source code is open and licensed under the GPLv3.
|
||||||
Loading…
x
Reference in New Issue
Block a user