mirror of
https://github.com/russok/FitoTrack.git
synced 2025-10-28 16:22:12 -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
|
||||
*
|
||||
@ -77,7 +77,7 @@ dependencies {
|
||||
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.8'
|
||||
|
||||
// Upload to OSM
|
||||
implementation ('de.westnordost:osmapi-traces:1.0')
|
||||
implementation('de.westnordost:osmapi-traces:1.0')
|
||||
configurations {
|
||||
compile.exclude group: 'net.sf.kxml', module: 'kxml2' // already included in Android
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
@ -32,17 +31,20 @@
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:appCategory="productivity"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
android:appCategory="productivity"
|
||||
tools:ignore="GoogleAppIndexingWarning">
|
||||
<activity android:name=".activity.ShowWorkoutMapActivity"
|
||||
android:screenOrientation="portrait"></activity>
|
||||
<activity android:name=".activity.ShowWorkoutMapDiagramActivity"
|
||||
android:screenOrientation="portrait"></activity>
|
||||
|
||||
<activity
|
||||
android:name=".activity.ShowWorkoutMapActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.ShowWorkoutMapDiagramActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity android:name=".activity.SettingsActivity" />
|
||||
<activity
|
||||
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
|
||||
*
|
||||
@ -36,7 +36,7 @@ import de.tadris.fitness.util.unit.UnitUtils;
|
||||
|
||||
public class Instance {
|
||||
|
||||
public static final String DATABASE_NAME= "fito-track";
|
||||
private static final String DATABASE_NAME = "fito-track";
|
||||
|
||||
private static Instance instance;
|
||||
|
||||
@ -47,9 +47,9 @@ public class Instance {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public AppDatabase db;
|
||||
public List<LocationListener.LocationChangeListener> locationChangeListeners= new ArrayList<>();
|
||||
public UserPreferences userPreferences;
|
||||
public final AppDatabase db;
|
||||
public final List<LocationListener.LocationChangeListener> locationChangeListeners = new ArrayList<>();
|
||||
public final UserPreferences userPreferences;
|
||||
|
||||
public boolean pressureAvailable= false;
|
||||
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
|
||||
*
|
||||
@ -36,14 +36,13 @@ import de.tadris.fitness.R;
|
||||
abstract public class FitoTrackActivity extends Activity {
|
||||
|
||||
|
||||
|
||||
protected int getThemePrimaryColor() {
|
||||
int getThemePrimaryColor() {
|
||||
final TypedValue value = new TypedValue ();
|
||||
getTheme().resolveAttribute (android.R.attr.colorPrimary, value, true);
|
||||
return value.data;
|
||||
}
|
||||
|
||||
protected void shareFile(Uri uri){
|
||||
void shareFile(Uri uri) {
|
||||
Intent intentShareFile = new Intent(Intent.ACTION_SEND);
|
||||
intentShareFile.setDataAndType(uri, getContentResolver().getType(uri));
|
||||
intentShareFile.putExtra(Intent.EXTRA_STREAM, uri);
|
||||
@ -56,11 +55,11 @@ abstract public class FitoTrackActivity extends Activity {
|
||||
try {
|
||||
Log.d("Export", new BufferedInputStream(getContentResolver().openInputStream(uri)).toString());
|
||||
} 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)
|
||||
.setTitle(title)
|
||||
.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
|
||||
*
|
||||
@ -42,12 +42,12 @@ public class LauncherActivity extends Activity {
|
||||
new Handler().postDelayed(this::init, 100);
|
||||
}
|
||||
|
||||
void init(){
|
||||
private void init() {
|
||||
Instance.getInstance(this);
|
||||
start();
|
||||
}
|
||||
|
||||
void start(){
|
||||
private void start() {
|
||||
startActivity(new Intent(this, ListWorkoutsActivity.class));
|
||||
finish();
|
||||
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
|
||||
*
|
||||
@ -46,7 +46,7 @@ public class ListWorkoutsActivity extends Activity implements WorkoutAdapter.Wor
|
||||
private RecyclerView.Adapter adapter;
|
||||
private RecyclerView.LayoutManager layoutManager;
|
||||
private FloatingActionMenu menu;
|
||||
Workout[] workouts;
|
||||
private Workout[] workouts;
|
||||
|
||||
|
||||
@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);
|
||||
RecordWorkoutActivity.ACTIVITY= activity;
|
||||
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) {
|
||||
int id = item.getItemId();
|
||||
|
||||
switch (id){
|
||||
case R.id.actionOpenSettings:
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
return true;
|
||||
if (id == R.id.actionOpenSettings) {
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
return true;
|
||||
}
|
||||
|
||||
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
|
||||
*
|
||||
@ -66,20 +66,21 @@ public class RecordWorkoutActivity extends FitoTrackActivity implements Location
|
||||
|
||||
public static String ACTIVITY= Workout.WORKOUT_TYPE_RUNNING;
|
||||
|
||||
MapView mapView;
|
||||
TileDownloadLayer downloadLayer;
|
||||
WorkoutRecorder recorder;
|
||||
Polyline polyline;
|
||||
List<LatLong> latLongList= new ArrayList<>();
|
||||
InfoViewHolder[] infoViews= new InfoViewHolder[4];
|
||||
TextView timeView, gpsStatusView;
|
||||
View waitingForGPSOverlay;
|
||||
boolean gpsFound= false;
|
||||
boolean isResumed= false;
|
||||
private Handler mHandler= new Handler();
|
||||
PowerManager.WakeLock wakeLock;
|
||||
Intent locationListener;
|
||||
Intent pressureService;
|
||||
private MapView mapView;
|
||||
private TileDownloadLayer downloadLayer;
|
||||
private WorkoutRecorder recorder;
|
||||
private Polyline polyline;
|
||||
private final List<LatLong> latLongList = new ArrayList<>();
|
||||
private final InfoViewHolder[] infoViews = new InfoViewHolder[4];
|
||||
private TextView timeView;
|
||||
private TextView gpsStatusView;
|
||||
private View waitingForGPSOverlay;
|
||||
private boolean gpsFound = false;
|
||||
private boolean isResumed = false;
|
||||
private final Handler mHandler = new Handler();
|
||||
private PowerManager.WakeLock wakeLock;
|
||||
private Intent locationListener;
|
||||
private Intent pressureService;
|
||||
private boolean saved= false;
|
||||
|
||||
@Override
|
||||
@ -92,7 +93,7 @@ public class RecordWorkoutActivity extends FitoTrackActivity implements Location
|
||||
|
||||
setupMap();
|
||||
|
||||
((ViewGroup)findViewById(R.id.recordMapViewrRoot)).addView(mapView);
|
||||
((ViewGroup) findViewById(R.id.recordMapViewerRoot)).addView(mapView);
|
||||
waitingForGPSOverlay= findViewById(R.id.recorderWaitingOverlay);
|
||||
waitingForGPSOverlay.setVisibility(View.VISIBLE);
|
||||
|
||||
@ -178,7 +179,7 @@ public class RecordWorkoutActivity extends FitoTrackActivity implements Location
|
||||
}).start();
|
||||
}
|
||||
|
||||
int i= 0;
|
||||
private int i = 0;
|
||||
|
||||
private void updateDescription(){
|
||||
i++;
|
||||
@ -235,14 +236,14 @@ public class RecordWorkoutActivity extends FitoTrackActivity implements Location
|
||||
.create().show();
|
||||
}
|
||||
|
||||
void checkPermissions(){
|
||||
private void checkPermissions() {
|
||||
if (!hasPermission()) {
|
||||
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_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
|
||||
|| 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(pressureService);
|
||||
}
|
||||
|
||||
public void startListener(){
|
||||
private void startListener() {
|
||||
if(locationListener == null){
|
||||
locationListener= new Intent(this, LocationListener.class);
|
||||
pressureService= new Intent(this, PressureService.class);
|
||||
@ -365,10 +366,11 @@ public class RecordWorkoutActivity extends FitoTrackActivity implements Location
|
||||
});
|
||||
}
|
||||
|
||||
public static class InfoViewHolder{
|
||||
TextView titleView, valueView;
|
||||
static class InfoViewHolder {
|
||||
final TextView titleView;
|
||||
final TextView valueView;
|
||||
|
||||
public InfoViewHolder(TextView titleView, TextView valueView) {
|
||||
InfoViewHolder(TextView titleView, TextView valueView) {
|
||||
this.titleView = titleView;
|
||||
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
|
||||
*
|
||||
@ -48,6 +48,7 @@ import androidx.core.content.FileProvider;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
import de.tadris.fitness.R;
|
||||
import de.tadris.fitness.export.BackupController;
|
||||
@ -58,7 +59,7 @@ import de.tadris.fitness.view.ProgressDialogController;
|
||||
public class SettingsActivity extends PreferenceActivity {
|
||||
|
||||
|
||||
protected void shareFile(Uri uri){
|
||||
private void shareFile(Uri uri) {
|
||||
Intent intentShareFile = new Intent(Intent.ACTION_SEND);
|
||||
intentShareFile.setDataAndType(uri, getContentResolver().getType(uri));
|
||||
intentShareFile.putExtra(Intent.EXTRA_STREAM, uri);
|
||||
@ -71,7 +72,7 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
try {
|
||||
Log.d("Export", new BufferedInputStream(getContentResolver().openInputStream(uri)).toString());
|
||||
} 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
|
||||
* to reflect its new value.
|
||||
*/
|
||||
private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = (preference, value) -> {
|
||||
private static final Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = (preference, value) -> {
|
||||
String stringValue = value.toString();
|
||||
|
||||
if (preference instanceof ListPreference) {
|
||||
@ -146,7 +147,7 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
.getString(preference.getKey(), ""));
|
||||
}
|
||||
|
||||
private Handler mHandler= new Handler();
|
||||
private final Handler mHandler = new Handler();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -160,21 +161,27 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
bindPreferenceSummaryToValue(findPreference("unitSystem"));
|
||||
bindPreferenceSummaryToValue(findPreference("mapStyle"));
|
||||
|
||||
findPreference("weight").setOnPreferenceClickListener(preference -> showWeightPicker());
|
||||
findPreference("import").setOnPreferenceClickListener(preference -> showImportDialog());
|
||||
findPreference("export").setOnPreferenceClickListener(preference -> showExportDialog());
|
||||
findPreference("weight").setOnPreferenceClickListener(preference -> {
|
||||
showWeightPicker();
|
||||
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)
|
||||
.setTitle(R.string.exportData)
|
||||
.setMessage(R.string.exportDataSummary)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.setPositiveButton(R.string.backup, (dialog, which) -> {
|
||||
exportBackup();
|
||||
}).create().show();
|
||||
return true;
|
||||
.setPositiveButton(R.string.backup, (dialog, which) -> exportBackup()).create().show();
|
||||
}
|
||||
|
||||
private void exportBackup(){
|
||||
@ -183,7 +190,9 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
new Thread(() -> {
|
||||
try{
|
||||
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));
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
private boolean showImportDialog(){
|
||||
private void showImportDialog() {
|
||||
if(!hasPermission()){
|
||||
requestPermissions();
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.importBackup)
|
||||
.setMessage(R.string.importBackupMessage)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.setPositiveButton(R.string.restore, (dialog, which) -> {
|
||||
importBackup();
|
||||
}).create().show();
|
||||
return true;
|
||||
.setPositiveButton(R.string.restore, (dialog, which) -> importBackup()).create().show();
|
||||
}
|
||||
|
||||
void requestPermissions(){
|
||||
private void requestPermissions() {
|
||||
if (!hasPermission()) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -240,12 +246,10 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
switch (requestCode) {
|
||||
case FILE_SELECT_CODE:
|
||||
if (resultCode == RESULT_OK){
|
||||
importBackup(data.getData());
|
||||
}
|
||||
break;
|
||||
if (requestCode == FILE_SELECT_CODE) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
importBackup(data.getData());
|
||||
}
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
@ -270,7 +274,7 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
}).start();
|
||||
}
|
||||
|
||||
private boolean showWeightPicker() {
|
||||
private void showWeightPicker() {
|
||||
UnitUtils.setUnit(this); // Maybe the user changed unit system
|
||||
|
||||
final AlertDialog.Builder d = new AlertDialog.Builder(this);
|
||||
@ -294,8 +298,6 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
});
|
||||
|
||||
d.create().show();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -309,11 +311,6 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void 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
|
||||
*
|
||||
@ -20,8 +20,6 @@
|
||||
package de.tadris.fitness.activity;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
@ -34,11 +32,11 @@ import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
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;
|
||||
startActivity(new Intent(ShowWorkoutActivity.this, ShowWorkoutMapDiagramActivity.class));
|
||||
}
|
||||
|
||||
|
||||
void openEditCommentDialog(final TextView change){
|
||||
private void openEditCommentDialog(final TextView change) {
|
||||
final EditText editText= new EditText(this);
|
||||
editText.setText(workout.comment);
|
||||
editText.setSingleLine(true);
|
||||
@ -132,18 +130,18 @@ public class ShowWorkoutActivity extends WorkoutActivity implements DialogUtils.
|
||||
.setView(editText).create().show();
|
||||
}
|
||||
|
||||
void changeComment(String comment, TextView onChange){
|
||||
private void changeComment(String comment, TextView onChange) {
|
||||
workout.comment= comment;
|
||||
Instance.getInstance(this).db.workoutDao().updateWorkout(workout);
|
||||
onChange.setText(getString(R.string.comment) + ": " + workout.comment);
|
||||
}
|
||||
|
||||
String getDate(){
|
||||
private String getDate() {
|
||||
return SimpleDateFormat.getDateInstance().format(new Date(workout.start));
|
||||
}
|
||||
|
||||
|
||||
void addTitle(String title){
|
||||
private void addTitle(String title) {
|
||||
TextView textView= new TextView(this);
|
||||
textView.setText(title);
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
|
||||
@ -155,7 +153,7 @@ public class ShowWorkoutActivity extends WorkoutActivity implements DialogUtils.
|
||||
root.addView(textView);
|
||||
}
|
||||
|
||||
TextView addText(String text){
|
||||
private TextView addText(String text) {
|
||||
TextView textView= new TextView(this);
|
||||
textView.setText(text);
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
|
||||
@ -167,11 +165,11 @@ public class ShowWorkoutActivity extends WorkoutActivity implements DialogUtils.
|
||||
return textView;
|
||||
}
|
||||
|
||||
void addKeyValue(String key1, String value1){
|
||||
private void addKeyValue(String key1, String 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);
|
||||
|
||||
TextView title1= v.findViewById(R.id.v1title);
|
||||
@ -211,13 +209,16 @@ public class ShowWorkoutActivity extends WorkoutActivity implements DialogUtils.
|
||||
new Thread(() -> {
|
||||
try{
|
||||
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));
|
||||
|
||||
GpxExporter.exportWorkout(getBaseContext(), workout, new File(file));
|
||||
dialogController.cancel();
|
||||
mHandler.post(() -> shareFile(uri));
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
mHandler.post(() -> showErrorDialog(e, R.string.error, R.string.errorGpxExportFailed));
|
||||
}
|
||||
}).start();
|
||||
@ -245,7 +246,7 @@ public class ShowWorkoutActivity extends WorkoutActivity implements DialogUtils.
|
||||
authentication.authenticateIfNecessary();
|
||||
}
|
||||
|
||||
AlertDialog dialog= null;
|
||||
private AlertDialog dialog = null;
|
||||
private void showUploadOptions(){
|
||||
dialog= new AlertDialog.Builder(this)
|
||||
.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
|
||||
*
|
||||
@ -64,37 +64,40 @@ public abstract class WorkoutActivity extends FitoTrackActivity {
|
||||
|
||||
public static Workout selectedWorkout;
|
||||
|
||||
protected List<WorkoutSample> samples;
|
||||
protected Workout workout;
|
||||
protected ViewGroup root;
|
||||
protected Resources.Theme theme;
|
||||
protected MapView map;
|
||||
protected TileDownloadLayer downloadLayer;
|
||||
protected FixedPixelCircle highlightingCircle;
|
||||
protected Handler mHandler= new Handler();
|
||||
List<WorkoutSample> samples;
|
||||
Workout workout;
|
||||
ViewGroup root;
|
||||
private Resources.Theme theme;
|
||||
MapView map;
|
||||
private TileDownloadLayer downloadLayer;
|
||||
private FixedPixelCircle highlightingCircle;
|
||||
final Handler mHandler = new Handler();
|
||||
|
||||
protected LineChart speedDiagram, heightDiagram;
|
||||
LineChart speedDiagram;
|
||||
LineChart heightDiagram;
|
||||
|
||||
protected void initBeforeContent(){
|
||||
void initBeforeContent() {
|
||||
workout= selectedWorkout;
|
||||
samples= Arrays.asList(Instance.getInstance(this).db.workoutDao().getAllSamplesOfWorkout(workout.id));
|
||||
setTheme(ThemeManager.getThemeByWorkout(workout));
|
||||
}
|
||||
|
||||
protected void initAfterContent(){
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
void initAfterContent() {
|
||||
if (getActionBar() != null) {
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
setTitle(WorkoutTypeCalculator.getType(workout));
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
protected boolean diagramsInteractive= false;
|
||||
boolean diagramsInteractive = false;
|
||||
|
||||
LineChart getDiagram(SampleConverter converter){
|
||||
private LineChart getDiagram(SampleConverter converter) {
|
||||
LineChart chart= new LineChart(this);
|
||||
|
||||
converter.onCreate();
|
||||
@ -145,7 +148,7 @@ public abstract class WorkoutActivity extends FitoTrackActivity {
|
||||
return chart;
|
||||
}
|
||||
|
||||
protected void onDiagramValueSelected(LatLong latLong){
|
||||
private void onDiagramValueSelected(LatLong latLong) {
|
||||
Paint p= AndroidGraphicFactory.INSTANCE.createPaint();
|
||||
p.setColor(0xff693cff);
|
||||
highlightingCircle= new FixedPixelCircle(latLong, 20, p, null);
|
||||
@ -166,7 +169,7 @@ public abstract class WorkoutActivity extends FitoTrackActivity {
|
||||
void afterAdd(LineChart chart);
|
||||
}
|
||||
|
||||
WorkoutSample findSample(SampleConverter converter, Entry entry){
|
||||
private WorkoutSample findSample(SampleConverter converter, Entry entry) {
|
||||
for(WorkoutSample sample : samples){
|
||||
if(converter.compare(sample, entry)){
|
||||
return sample;
|
||||
@ -251,8 +254,8 @@ public abstract class WorkoutActivity extends FitoTrackActivity {
|
||||
});
|
||||
}
|
||||
|
||||
protected boolean fullScreenItems = false;
|
||||
protected LinearLayout mapRoot;
|
||||
boolean fullScreenItems = false;
|
||||
LinearLayout mapRoot;
|
||||
|
||||
void addMap(){
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -25,7 +25,7 @@ import android.preference.PreferenceManager;
|
||||
|
||||
public class UserPreferences {
|
||||
|
||||
private SharedPreferences preferences;
|
||||
private final SharedPreferences preferences;
|
||||
|
||||
public UserPreferences(Context 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;
|
||||
|
||||
import android.content.Context;
|
||||
@ -17,11 +36,11 @@ import de.tadris.fitness.util.unit.UnitUtils;
|
||||
|
||||
public class BackupController {
|
||||
|
||||
public static final int VERSION= 1;
|
||||
private static final int VERSION = 1;
|
||||
|
||||
private Context context;
|
||||
private File output;
|
||||
private ExportStatusListener listener;
|
||||
private final Context context;
|
||||
private final File output;
|
||||
private final ExportStatusListener listener;
|
||||
private UserPreferences preferences;
|
||||
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
|
||||
*
|
||||
@ -29,7 +29,7 @@ import de.tadris.fitness.data.WorkoutSample;
|
||||
|
||||
@JacksonXmlRootElement(localName = "fito-track")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class FitoTrackDataContainer {
|
||||
class FitoTrackDataContainer {
|
||||
|
||||
int version;
|
||||
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;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
@ -18,11 +37,11 @@ import de.tadris.fitness.data.WorkoutSample;
|
||||
|
||||
public class RestoreController {
|
||||
|
||||
private Context context;
|
||||
private Uri input;
|
||||
private ImportStatusListener listener;
|
||||
private final Context context;
|
||||
private final Uri input;
|
||||
private final ImportStatusListener listener;
|
||||
private FitoTrackDataContainer dataContainer;
|
||||
private AppDatabase database;
|
||||
private final AppDatabase database;
|
||||
|
||||
public RestoreController(Context context, Uri input, ImportStatusListener listener) {
|
||||
this.context = context;
|
||||
@ -98,8 +117,8 @@ public class RestoreController {
|
||||
void onStatusChanged(int progress, String action);
|
||||
}
|
||||
|
||||
public static class UnsupportedVersionException extends Exception{
|
||||
public UnsupportedVersionException(String message) {
|
||||
static class UnsupportedVersionException extends Exception {
|
||||
UnsupportedVersionException(String 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
|
||||
*
|
||||
@ -30,7 +30,7 @@ import de.tadris.fitness.data.WorkoutSample;
|
||||
|
||||
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.setStyle(Style.STROKE);
|
||||
paint.setColor(color);
|
||||
@ -38,13 +38,13 @@ public class WorkoutLayer extends Polyline {
|
||||
return paint;
|
||||
}
|
||||
|
||||
List<WorkoutSample> samples;
|
||||
private final List<WorkoutSample> samples;
|
||||
|
||||
public WorkoutLayer(List<WorkoutSample> samples, int color) {
|
||||
this(getDEFAULT_PAINT_STROKE(color), samples);
|
||||
}
|
||||
|
||||
public WorkoutLayer(Paint paintStroke, List<WorkoutSample> samples) {
|
||||
private WorkoutLayer(Paint paintStroke, List<WorkoutSample> samples) {
|
||||
super(paintStroke, AndroidGraphicFactory.INSTANCE);
|
||||
this.samples = samples;
|
||||
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
|
||||
*
|
||||
@ -23,7 +23,7 @@ import org.mapsforge.map.layer.download.tilesource.AbstractTileSource;
|
||||
|
||||
public abstract class FitoTrackTileSource extends AbstractTileSource {
|
||||
|
||||
public FitoTrackTileSource(String[] hostNames, int port) {
|
||||
FitoTrackTileSource(String[] hostNames, int port) {
|
||||
super(hostNames, port);
|
||||
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
|
||||
*
|
||||
@ -26,7 +26,7 @@ import java.net.URL;
|
||||
|
||||
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 String PROTOCOL = "https";
|
||||
@ -34,7 +34,7 @@ public class HumanitarianTileSource extends FitoTrackTileSource {
|
||||
private static final int ZOOM_LEVEL_MIN = 0;
|
||||
private static final String NAME = "Humanitarian";
|
||||
|
||||
public HumanitarianTileSource(String[] hostNames, int port) {
|
||||
private HumanitarianTileSource(String[] hostNames, int 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
|
||||
*
|
||||
@ -34,7 +34,7 @@ public class MapnikTileSource extends FitoTrackTileSource {
|
||||
private static final int ZOOM_LEVEL_MIN = 0;
|
||||
private static final String NAME = "OSM Mapnik";
|
||||
|
||||
public MapnikTileSource(String[] hostNames, int port) {
|
||||
private MapnikTileSource(String[] hostNames, int 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
|
||||
*
|
||||
@ -26,7 +26,7 @@ import java.net.URL;
|
||||
|
||||
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 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_MIN = 0;
|
||||
|
||||
private String mapName;
|
||||
private String name;
|
||||
private final String mapName;
|
||||
private final String name;
|
||||
|
||||
public ThunderforestTileSource(String mapName, String name) {
|
||||
private ThunderforestTileSource(String mapName, String name) {
|
||||
super(new String[]{"tile.thunderforest.com"}, 443);
|
||||
this.mapName = mapName;
|
||||
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
|
||||
*
|
||||
@ -22,12 +22,12 @@ package de.tadris.fitness.osm;
|
||||
import de.tadris.fitness.data.WorkoutSample;
|
||||
import de.westnordost.osmapi.map.data.LatLon;
|
||||
|
||||
public class GpsTraceLatLong implements LatLon {
|
||||
class GpsTraceLatLong implements LatLon {
|
||||
|
||||
private final double latitude;
|
||||
private final double longitude;
|
||||
|
||||
public GpsTraceLatLong(double latitude, double longitude) {
|
||||
private GpsTraceLatLong(double latitude, double longitude) {
|
||||
this.latitude = latitude;
|
||||
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
|
||||
*
|
||||
@ -39,14 +39,14 @@ import oauth.signpost.exception.OAuthException;
|
||||
|
||||
public class OAuthAuthentication {
|
||||
|
||||
private OAuthConsumer oAuthConsumer= OAuthUrlProvider.getDefaultConsumer();
|
||||
private OAuthProvider oAuthProvider= OAuthUrlProvider.getDefaultProvider();
|
||||
private final OAuthConsumer oAuthConsumer = OAuthUrlProvider.getDefaultConsumer();
|
||||
private final OAuthProvider oAuthProvider = OAuthUrlProvider.getDefaultProvider();
|
||||
|
||||
private Handler handler;
|
||||
private Activity activity;
|
||||
private ProgressDialogController dialogController;
|
||||
private SharedPreferences preferences;
|
||||
private OAuthAuthenticationListener listener;
|
||||
private final Handler handler;
|
||||
private final Activity activity;
|
||||
private final ProgressDialogController dialogController;
|
||||
private final SharedPreferences preferences;
|
||||
private final OAuthAuthenticationListener listener;
|
||||
|
||||
public OAuthAuthentication(Handler handler, Activity activity, OAuthAuthenticationListener listener) {
|
||||
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
|
||||
*
|
||||
@ -24,7 +24,7 @@ import oauth.signpost.OAuthProvider;
|
||||
import oauth.signpost.basic.DefaultOAuthConsumer;
|
||||
import oauth.signpost.basic.DefaultOAuthProvider;
|
||||
|
||||
public class OAuthUrlProvider {
|
||||
class OAuthUrlProvider {
|
||||
|
||||
static private final String CONSUMER_KEY= "jFL9grFmAo5ZS720YDDRXdSOb7F0IZQf9lnY1PHq";
|
||||
static private final String CONSUMER_SECRET= "oH969vYW60fZLco6E09UQl3uFXqjl4siQbOL0q9q";
|
||||
|
||||
@ -46,15 +46,15 @@ public class OsmTraceUploader {
|
||||
|
||||
private static final int CUT_DISTANCE= 300;
|
||||
|
||||
private Activity activity;
|
||||
private Handler handler;
|
||||
private Workout workout;
|
||||
private List<WorkoutSample> samples;
|
||||
private GpsTraceDetails.Visibility visibility;
|
||||
private OAuthConsumer consumer;
|
||||
private boolean cut;
|
||||
private ProgressDialogController dialogController;
|
||||
private String description;
|
||||
private final Activity activity;
|
||||
private final Handler handler;
|
||||
private final Workout workout;
|
||||
private final List<WorkoutSample> samples;
|
||||
private final GpsTraceDetails.Visibility visibility;
|
||||
private final OAuthConsumer consumer;
|
||||
private final boolean cut;
|
||||
private final ProgressDialogController dialogController;
|
||||
private final 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;
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -51,9 +51,9 @@ public class LocationListener extends Service {
|
||||
private static final int LOCATION_INTERVAL = 1000;
|
||||
|
||||
private class LocationChangedListener implements android.location.LocationListener {
|
||||
Location mLastLocation;
|
||||
final Location mLastLocation;
|
||||
|
||||
public LocationChangedListener(String provider) {
|
||||
LocationChangedListener(String provider) {
|
||||
Log.i(TAG, "LocationListener " + 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
|
||||
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 Context context;
|
||||
private Workout workout;
|
||||
private final Context context;
|
||||
private final Workout workout;
|
||||
private RecordingState state;
|
||||
private final List<WorkoutSample> samples= new ArrayList<>();
|
||||
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 int SIGNAL_LOST_THRESHOLD= 10000; // In milliseconds
|
||||
private Location lastFix= null;
|
||||
private WorkoutRecorderListener workoutRecorderListener;
|
||||
private final WorkoutRecorderListener workoutRecorderListener;
|
||||
private GpsState gpsState= GpsState.SIGNAL_LOST;
|
||||
|
||||
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){
|
||||
Log.i("Recorder", "Pause");
|
||||
state= RecordingState.PAUSED;
|
||||
@ -319,7 +319,7 @@ public class WorkoutRecorder implements LocationListener.LocationChangeListener
|
||||
SIGNAL_OKAY(Color.GREEN),
|
||||
SIGNAL_BAD(Color.YELLOW);
|
||||
|
||||
public int color;
|
||||
public final int color;
|
||||
|
||||
GpsState(int color) {
|
||||
this.color = color;
|
||||
|
||||
@ -31,12 +31,12 @@ import de.tadris.fitness.data.Workout;
|
||||
import de.tadris.fitness.data.WorkoutSample;
|
||||
import de.tadris.fitness.util.CalorieCalculator;
|
||||
|
||||
public class WorkoutSaver {
|
||||
class WorkoutSaver {
|
||||
|
||||
private Context context;
|
||||
private Workout workout;
|
||||
private List<WorkoutSample> samples;
|
||||
private AppDatabase db;
|
||||
private final Context context;
|
||||
private final Workout workout;
|
||||
private final List<WorkoutSample> samples;
|
||||
private final AppDatabase db;
|
||||
|
||||
public WorkoutSaver(Context context, Workout workout, List<WorkoutSample> samples) {
|
||||
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
|
||||
*
|
||||
@ -43,11 +43,9 @@ public class CalorieCalculator {
|
||||
* workoutType and avgSpeed of workout have to be set
|
||||
*
|
||||
* Calculation currently ignores height.
|
||||
*
|
||||
* @param workout
|
||||
* @return MET
|
||||
*/
|
||||
public static double getMET(Workout workout){
|
||||
private static double getMET(Workout workout) {
|
||||
double speedInKmh= workout.avgSpeed * 3.6;
|
||||
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
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -28,7 +28,7 @@ import de.tadris.fitness.R;
|
||||
|
||||
public class NotificationHelper {
|
||||
|
||||
public static String CHANNEL_WORKOUT= "workout";
|
||||
public static final String CHANNEL_WORKOUT = "workout";
|
||||
|
||||
public static void createChannels(Context context){
|
||||
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
|
||||
*
|
||||
@ -37,7 +37,7 @@ public class Gpx {
|
||||
Metadata metadata;
|
||||
|
||||
String name;
|
||||
String desc;
|
||||
private String desc;
|
||||
|
||||
@JacksonXmlElementWrapper(useWrapping = false)
|
||||
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
|
||||
*
|
||||
@ -19,6 +19,7 @@
|
||||
|
||||
package de.tadris.fitness.util.gpx;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
@ -40,7 +41,7 @@ public class GpxExporter {
|
||||
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.name= workout.toString();
|
||||
gpx.version= "1.1";
|
||||
@ -52,7 +53,7 @@ public class GpxExporter {
|
||||
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);
|
||||
Track track= new Track();
|
||||
track.number= number;
|
||||
@ -77,13 +78,14 @@ public class GpxExporter {
|
||||
return track;
|
||||
}
|
||||
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
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));
|
||||
}
|
||||
|
||||
public static String getDateTime(Date date){
|
||||
private static String getDateTime(Date 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
|
||||
*
|
||||
@ -21,9 +21,9 @@ package de.tadris.fitness.util.gpx;
|
||||
|
||||
public class Metadata {
|
||||
|
||||
String name;
|
||||
String desc;
|
||||
String time;
|
||||
private String name;
|
||||
private String desc;
|
||||
private String time;
|
||||
|
||||
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
|
||||
*
|
||||
@ -21,21 +21,23 @@ package de.tadris.fitness.util.gpx;
|
||||
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
|
||||
public class TrackPoint {
|
||||
class TrackPoint {
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true)
|
||||
private
|
||||
double lat;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true)
|
||||
private
|
||||
double lon;
|
||||
|
||||
double ele;
|
||||
private double ele;
|
||||
|
||||
String time;
|
||||
private String time;
|
||||
|
||||
String fix;
|
||||
private String fix;
|
||||
|
||||
TrackPointExtension extensions;
|
||||
private TrackPointExtension extensions;
|
||||
|
||||
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
|
||||
*
|
||||
@ -21,7 +21,7 @@ package de.tadris.fitness.util.gpx;
|
||||
|
||||
public class TrackPointExtension {
|
||||
|
||||
double speed;
|
||||
private double speed;
|
||||
|
||||
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
|
||||
*
|
||||
@ -23,7 +23,7 @@ import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TrackSegment {
|
||||
class TrackSegment {
|
||||
|
||||
@JacksonXmlElementWrapper(useWrapping = false)
|
||||
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
|
||||
*
|
||||
@ -24,22 +24,23 @@ import android.preference.PreferenceManager;
|
||||
|
||||
public class UnitUtils {
|
||||
|
||||
public static final Unit UNITS_METRIC= new Metric();
|
||||
public static final Unit UNITS_METRIC_PHYSICAL= new MetricPhysical();
|
||||
public static final Unit UNITS_IMPERIAL_YARDS= new Imperial();
|
||||
public static final Unit UNITS_IMPERIAL_METERS= new ImperialWithMeters();
|
||||
public static final Unit[] supportedUnits= new Unit[] {
|
||||
private static final Unit UNITS_METRIC = new Metric();
|
||||
private static final Unit UNITS_METRIC_PHYSICAL = new MetricPhysical();
|
||||
private static final Unit UNITS_IMPERIAL_YARDS = new Imperial();
|
||||
private static final Unit UNITS_IMPERIAL_METERS = new ImperialWithMeters();
|
||||
private static final Unit[] supportedUnits = new Unit[]{
|
||||
UNITS_METRIC, UNITS_METRIC_PHYSICAL, UNITS_IMPERIAL_YARDS, UNITS_IMPERIAL_METERS
|
||||
};
|
||||
|
||||
public static Unit CHOSEN_SYSTEM= UNITS_METRIC;
|
||||
|
||||
public static void setUnit(Context context){
|
||||
int id= Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(context).getString("unitSystem", String.valueOf(UnitUtils.UNITS_METRIC.getId())));
|
||||
setUnit(id);
|
||||
String id = PreferenceManager.getDefaultSharedPreferences(context).getString("unitSystem", String.valueOf(UnitUtils.UNITS_METRIC.getId()));
|
||||
assert id != null;
|
||||
setUnit(Integer.parseInt(id));
|
||||
}
|
||||
|
||||
public static void setUnit(int id){
|
||||
private static void setUnit(int id) {
|
||||
CHOSEN_SYSTEM= UNITS_METRIC;
|
||||
for(Unit unit : supportedUnits){
|
||||
if(id == unit.getId()){
|
||||
@ -62,13 +63,13 @@ public class UnitUtils {
|
||||
}
|
||||
|
||||
public static String getHourMinuteSecondTime(long time){
|
||||
long totalSeks= time / 1000;
|
||||
long totalMins= totalSeks / 60;
|
||||
long totalSecs = time / 1000;
|
||||
long totalMins = totalSecs / 60;
|
||||
long hours= totalMins / 60;
|
||||
long mins= totalMins % 60;
|
||||
long seks= totalSeks % 60;
|
||||
long secs = totalSecs % 60;
|
||||
String minStr= (mins < 10 ? "0" : "") + mins;
|
||||
String sekStr= (seks < 10 ? "0" : "") + seks;
|
||||
String sekStr = (secs < 10 ? "0" : "") + secs;
|
||||
return hours + ":" + minStr + ":" + sekStr;
|
||||
}
|
||||
|
||||
@ -85,7 +86,6 @@ public class UnitUtils {
|
||||
/**
|
||||
*CHOSEN_SYSTEM.getLongDistanceUnit()
|
||||
* @param consumption consumption in kcal/km
|
||||
* @return
|
||||
*/
|
||||
public static String getRelativeEnergyConsumption(double consumption){
|
||||
double one= CHOSEN_SYSTEM.getDistanceFromKilometers(1);
|
||||
@ -115,7 +115,7 @@ public class UnitUtils {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
@ -28,8 +28,8 @@ import de.tadris.fitness.R;
|
||||
|
||||
public class ProgressDialogController {
|
||||
|
||||
private Activity context;
|
||||
private Dialog dialog;
|
||||
private final Activity context;
|
||||
private final Dialog dialog;
|
||||
private TextView infoView;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
@ -38,7 +38,7 @@ public class ProgressDialogController {
|
||||
setTitle(title);
|
||||
}
|
||||
|
||||
public ProgressDialogController(Activity context) {
|
||||
private ProgressDialogController(Activity context) {
|
||||
this.context = context;
|
||||
this.dialog= new Dialog(context);
|
||||
initDialog();
|
||||
@ -51,7 +51,7 @@ public class ProgressDialogController {
|
||||
progressBar= dialog.findViewById(R.id.dialogProgressBar);
|
||||
}
|
||||
|
||||
public void setTitle(String title){
|
||||
private void setTitle(String 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
|
||||
*
|
||||
@ -40,10 +40,14 @@ public class WorkoutAdapter extends RecyclerView.Adapter<WorkoutAdapter.WorkoutV
|
||||
|
||||
public static class WorkoutViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
View root;
|
||||
TextView lengthText, timeText, dateText, typeText, commentText;
|
||||
final View root;
|
||||
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);
|
||||
this.root= itemView;
|
||||
lengthText= itemView.findViewById(R.id.workoutLength);
|
||||
@ -54,8 +58,8 @@ public class WorkoutAdapter extends RecyclerView.Adapter<WorkoutAdapter.WorkoutV
|
||||
}
|
||||
}
|
||||
|
||||
Workout[] workouts;
|
||||
WorkoutAdapterListener listener;
|
||||
private final Workout[] workouts;
|
||||
private final WorkoutAdapterListener listener;
|
||||
|
||||
public WorkoutAdapter(Workout[] workouts, WorkoutAdapterListener listener) {
|
||||
this.workouts = workouts;
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
@ -20,5 +19,7 @@
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="300">
|
||||
<alpha android:fromAlpha="0" android:toAlpha="1"/>
|
||||
<alpha
|
||||
android:fromAlpha="0"
|
||||
android:toAlpha="1" />
|
||||
</set>
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ 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
|
||||
~
|
||||
@ -20,10 +20,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#FFFFFF"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="#FFFFFF">
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
|
||||
</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
|
||||
~
|
||||
@ -20,11 +20,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:alpha="0.8"
|
||||
android:tint="#FFFFFF"
|
||||
android:alpha="0.8">
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
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>
|
||||
|
||||
@ -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
|
||||
~
|
||||
@ -18,11 +18,11 @@
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<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>
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
@ -19,10 +18,10 @@
|
||||
-->
|
||||
|
||||
<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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context=".activity.ListWorkoutsActivity">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
@ -36,12 +35,12 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|right"
|
||||
android:layout_margin="10dp"
|
||||
app:menu_animationDelayPerItem="50"
|
||||
app:menu_colorNormal="@color/colorPrimary"
|
||||
app:menu_colorPressed="@color/colorPrimaryDark"
|
||||
app:menu_animationDelayPerItem="50"
|
||||
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
|
||||
android:id="@+id/workoutListRecordRunning"
|
||||
@ -51,7 +50,7 @@
|
||||
app:fab_colorNormal="@color/colorPrimaryRunning"
|
||||
app:fab_colorPressed="@color/colorPrimaryDarkRunning"
|
||||
app:fab_label="@string/workoutTypeRunning"
|
||||
app:fab_size="normal"/>
|
||||
app:fab_size="normal" />
|
||||
|
||||
<com.github.clans.fab.FloatingActionButton
|
||||
android:id="@+id/workoutListRecordHiking"
|
||||
@ -71,7 +70,7 @@
|
||||
app:fab_colorNormal="@color/colorPrimaryBicycling"
|
||||
app:fab_colorPressed="@color/colorPrimaryDarkBicycling"
|
||||
app:fab_label="@string/workoutTypeCycling"
|
||||
app:fab_size="normal"/>
|
||||
app:fab_size="normal" />
|
||||
|
||||
</com.github.clans.fab.FloatingActionMenu>
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
@ -32,7 +31,7 @@
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/recordMapViewrRoot"
|
||||
android:id="@+id/recordMapViewerRoot"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
@ -65,8 +64,8 @@
|
||||
android:layout_height="200dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:padding="10dp"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/recordTime"
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
@ -35,7 +34,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp"></LinearLayout>
|
||||
android:padding="20dp" />
|
||||
|
||||
</ScrollView>
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
@ -25,7 +24,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".activity.ShowWorkoutMapActivity" >
|
||||
tools:context=".activity.ShowWorkoutMapActivity">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline4"
|
||||
@ -58,6 +57,6 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/guideline4"></LinearLayout>
|
||||
app:layout_constraintTop_toTopOf="@+id/guideline4" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
@ -29,11 +28,12 @@
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:labelFor="@id/uploadDescription"
|
||||
android:text="@string/description" />
|
||||
|
||||
<EditText
|
||||
@ -48,7 +48,7 @@
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@ -64,13 +64,6 @@
|
||||
android:spinnerMode="dropdown" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</TableLayout>
|
||||
|
||||
<CheckBox
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
@ -20,7 +19,7 @@
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<NumberPicker
|
||||
android:id="@+id/weightPicker"
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
@ -21,8 +20,8 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="?android:selectableItemBackground">
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -90,6 +89,6 @@
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@android:color/darker_gray"/>
|
||||
android:background="@android:color/darker_gray" />
|
||||
|
||||
</LinearLayout>
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
@ -107,4 +106,5 @@
|
||||
<string name="waiting_gps">Warte auf GPS</string>
|
||||
<string name="uploadFailed">Upload fehlgeschlagen</string>
|
||||
<string name="uploadSuccessful">Upload erfolgreich</string>
|
||||
<string name="uploadFailedOsmNotAuthorized">Nicht autorisiert, nocheinmal versuchen</string>
|
||||
</resources>
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
@ -19,5 +18,7 @@
|
||||
-->
|
||||
|
||||
<paths>
|
||||
<files-path path="shared/" name="share" />
|
||||
<files-path
|
||||
name="share"
|
||||
path="shared/" />
|
||||
</paths>
|
||||
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
|
||||
~
|
||||
~ This file is part of FitoTrack
|
||||
~
|
||||
@ -21,11 +20,11 @@
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="1"
|
||||
android:entries="@array/pref_unit_systems"
|
||||
android:entryValues="@array/pref_unit_system_values"
|
||||
android:key="unitSystem"
|
||||
android:title="@string/pref_unit_system"
|
||||
android:defaultValue="1" />
|
||||
android:title="@string/pref_unit_system" />
|
||||
|
||||
<Preference
|
||||
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
|
||||
*
|
||||
@ -28,12 +28,12 @@ import de.tadris.fitness.util.CalorieCalculator;
|
||||
public class CalorieCalculatorTest {
|
||||
|
||||
@Test
|
||||
public void testCalculation(){
|
||||
Workout workout= new Workout();
|
||||
workout.avgSpeed= 2.7d;
|
||||
workout.workoutType= Workout.WORKOUT_TYPE_RUNNING;
|
||||
workout.duration= 1000L * 60 * 10;
|
||||
int calorie= CalorieCalculator.calculateCalories(workout, 80);
|
||||
public void testCalculation() {
|
||||
Workout workout = new Workout();
|
||||
workout.avgSpeed = 2.7d;
|
||||
workout.workoutType = Workout.WORKOUT_TYPE_RUNNING;
|
||||
workout.duration = 1000L * 60 * 10;
|
||||
int calorie = CalorieCalculator.calculateCalories(workout, 80);
|
||||
System.out.println("Calories: " + calorie);
|
||||
Assert.assertEquals(120, calorie, 50);
|
||||
}
|
||||
|
||||
@ -3,4 +3,4 @@ FitoTrack is a mobile app for logging and viewing your workouts. Whether you’r
|
||||
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.
|
||||
* 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