Merge remote-tracking branch 'origin/master'

This commit is contained in:
jannis 2019-08-19 14:53:35 +02:00
commit 336d0890ea
20 changed files with 201 additions and 28 deletions

View File

@ -16,6 +16,36 @@
See the License for the specific language governing permissions and
limitations under the License.
<https://github.com/mapsforge/mapsforge>
Mapsforge library is under LGPL v3 license, with an important simplification: the constraints mentioned in sections LGPL v3 §4(d) and §4(e) are waived.
The Mapsforge project was jointly founded by Thilo Mühlberg and Jürgen Broß. Both remain owners of the project but have retired as active developers.
Current owners and lead developers are: Ludwig Brinckmann, devemux86
<https://github.com/PhilJay/MPAndroidChart>
Copyright 2019 Philipp Jahoda
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
<https://github.com/Clans/FloatingActionButton>
Copyright 2015 Dmytro Tarianyk
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
<https://github.com/jenetics/jpx>

View File

@ -1,3 +1,29 @@
# FitoTrack
FitoTrack is a mobile app for logging and viewing your workouts. Whether you're running, cycling or hiking FitoTrack will show you give you the most important information with detailed charts and statistics.
It is open-source and completely ad-free.
(download links)
## Screenshots
...
## Implemented Features
- **Track workouts.** Choose your sports type and just start running/cycling/hiking/etc. You can see general information right below the map on the track screen.
- **View your workouts.** View general information like date, time, duration, distance, speed, pace. See your route on a map. Investigate how you performed in the speed diagram.
- **Open-Source.** There is no advertivesment, no tracking and the source code is open and licensed under the GPLv3 .
see [Roadmap](https://bitbucket.org/jannis3/fitotrack/src/master/Roadmap.md) for more planned features
## Installing
...
## License
Copyright (C) 2019 Jannis Scheibe <jannis@tadris.de>
FitoTrack is free software: you can redistribute it and/or modify

19
Roadmap.md Normal file
View File

@ -0,0 +1,19 @@
# Roadmap
## Coming features
- measurement of height using pressure data
- height data in diagram
- measurement of steps using sensor data
## Planned features
- upload workouts as GPX to dropbox
- upload workouts as GPS trace to OpenStreetMap
## Considered features
- voice feedback e.g. speaking every 5/10 minutes the general data
- running "against" other workouts
- offline maps
- something like a comparision to your friends (would be really cool from my pov)

View File

@ -65,6 +65,7 @@ dependencies {
implementation 'com.caverock:androidsvg:1.3'
implementation 'net.sf.kxml:kxml2:2.3.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation 'com.github.clans:fab:1.6.4'
annotationProcessor "androidx.room:room-compiler:$room_version"
implementation 'androidx.recyclerview:recyclerview:1.0.0'
testImplementation 'junit:junit:4.12'

View File

@ -22,7 +22,7 @@ package de.tadris.fitness.activity;
import android.app.Activity;
import android.util.TypedValue;
public class FitoTrackActivity extends Activity {
abstract public class FitoTrackActivity extends Activity {

View File

@ -24,10 +24,14 @@ import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.github.clans.fab.FloatingActionButton;
import com.github.clans.fab.FloatingActionMenu;
import de.tadris.fitness.Instance;
import de.tadris.fitness.R;
import de.tadris.fitness.WorkoutAdapter;
@ -38,6 +42,7 @@ public class ListWorkoutsActivity extends Activity implements WorkoutAdapter.Wor
private RecyclerView listView;
private RecyclerView.Adapter adapter;
private RecyclerView.LayoutManager layoutManager;
private FloatingActionMenu menu;
Workout[] workouts;
@ -52,6 +57,17 @@ public class ListWorkoutsActivity extends Activity implements WorkoutAdapter.Wor
layoutManager= new LinearLayoutManager(this);
listView.setLayoutManager(layoutManager);
menu= findViewById(R.id.workoutListMenu);
findViewById(R.id.workoutListRecordRunning).setOnClickListener(v -> startRecording(Workout.WORKOUT_TYPE_RUNNING));
findViewById(R.id.workoutListRecordHiking) .setOnClickListener(v -> startRecording(Workout.WORKOUT_TYPE_HIKING));
findViewById(R.id.workoutListRecordCycling).setOnClickListener(v -> startRecording(Workout.WORKOUT_TYPE_CYCLING));
}
public void startRecording(String activity){
RecordWorkoutActivity.ACTIVITY= activity;
startActivity(new Intent(this, RecordWorkoutActivity.class));
}
@Override
@ -79,10 +95,7 @@ public class ListWorkoutsActivity extends Activity implements WorkoutAdapter.Wor
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if(id == R.id.action_workout_add){
startActivity(new Intent(this, RecordWorkoutActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}

View File

@ -53,6 +53,7 @@ import de.tadris.fitness.location.WorkoutRecorder;
import de.tadris.fitness.map.MapManager;
import de.tadris.fitness.util.ThemeManager;
import de.tadris.fitness.util.UnitUtils;
import de.tadris.fitness.util.WorkoutTypeCalculator;
public class RecordWorkoutActivity extends FitoTrackActivity implements LocationListener.LocationChangeListener {
@ -76,6 +77,8 @@ public class RecordWorkoutActivity extends FitoTrackActivity implements Location
setTheme(ThemeManager.getThemeByWorkoutType(ACTIVITY));
setContentView(R.layout.activity_record_workout);
setTitle(R.string.recordWorkout);
setupMap();
((ViewGroup)findViewById(R.id.recordMapViewrRoot)).addView(mapView);
@ -132,7 +135,7 @@ public class RecordWorkoutActivity extends FitoTrackActivity implements Location
while (recorder.isActive()){
Thread.sleep(1000);
if(isResumed){
mHandler.post(() -> updateDescription());
mHandler.post(this::updateDescription);
}
}
}catch (InterruptedException e){

View File

@ -64,6 +64,7 @@ import de.tadris.fitness.map.MapManager;
import de.tadris.fitness.map.WorkoutLayer;
import de.tadris.fitness.util.ThemeManager;
import de.tadris.fitness.util.UnitUtils;
import de.tadris.fitness.util.WorkoutTypeCalculator;
public class ShowWorkoutActivity extends FitoTrackActivity {
static Workout selectedWorkout;
@ -86,6 +87,7 @@ public class ShowWorkoutActivity extends FitoTrackActivity {
setContentView(R.layout.activity_show_workout);
getActionBar().setDisplayHomeAsUpEnabled(true);
setTitle(WorkoutTypeCalculator.getType(workout));
theme= getTheme();

View File

@ -28,6 +28,7 @@ public class ThemeManager {
switch (type){
case Workout.WORKOUT_TYPE_RUNNING: return R.style.Running;
case Workout.WORKOUT_TYPE_CYCLING: return R.style.Bicycling;
case Workout.WORKOUT_TYPE_HIKING: return R.style.Hiking;
default: return R.style.AppTheme;
}
}

View File

@ -19,28 +19,28 @@
package de.tadris.fitness.util;
import de.tadris.fitness.R;
import de.tadris.fitness.data.Workout;
public class WorkoutTypeCalculator {
public static String getType(Workout workout){
// TODO: use localisation
public static int getType(Workout workout){
if(workout.workoutType.equals(Workout.WORKOUT_TYPE_RUNNING)){
if(workout.avgSpeed < 7){
return "Walking";
return R.string.workoutTypeWalking;
}else if(workout.avgSpeed < 9.6){
return "Jogging";
return R.string.workoutTypeJogging;
}else{
return "Running";
return R.string.workoutTypeRunning;
}
}
if(workout.workoutType.equals(Workout.WORKOUT_TYPE_CYCLING)){
return "Cycling";
return R.string.workoutTypeCycling;
}
if(workout.workoutType.equals(Workout.WORKOUT_TYPE_HIKING)){
return "Hiking";
return R.string.workoutTypeHiking;
}
return "Unknown";
return R.string.workoutTypeUnknown;
}
}

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#FFFFFF">
<path
android:fillColor="#FF000000"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

View File

@ -18,15 +18,67 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
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">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/workoutList"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</ScrollView>
<com.github.clans.fab.FloatingActionMenu
android:id="@+id/workoutListMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="10dp"
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">
<com.github.clans.fab.FloatingActionButton
android:id="@+id/workoutListRecordRunning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_add_white"
app:fab_colorNormal="@color/colorPrimaryRunning"
app:fab_colorPressed="@color/colorPrimaryDarkRunning"
app:fab_label="@string/workoutTypeRunning"
app:fab_size="mini"/>
<com.github.clans.fab.FloatingActionButton
android:id="@+id/workoutListRecordHiking"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_add_white"
app:fab_colorNormal="@color/colorPrimaryHiking"
app:fab_colorPressed="@color/colorPrimaryDarkHiking"
app:fab_label="@string/workoutTypeHiking"
app:fab_size="mini" />
<com.github.clans.fab.FloatingActionButton
android:id="@+id/workoutListRecordCycling"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_add_white"
app:fab_colorNormal="@color/colorPrimaryBicycling"
app:fab_colorPressed="@color/colorPrimaryDarkBicycling"
app:fab_label="@string/workoutTypeCycling"
app:fab_size="mini"/>
</com.github.clans.fab.FloatingActionMenu>
</FrameLayout>

View File

@ -18,10 +18,4 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_workout_add"
android:showAsAction="always"
android:title="@string/workout_add" />
</menu>
<menu xmlns:android="http://schemas.android.com/apk/res/android"/>

View File

@ -29,6 +29,11 @@
<color name="colorPrimaryDarkBicycling">#462A1D</color>
<color name="colorAccent">#4CAF50</color>
<color name="colorAccentDark">#2E7D32</color>
<color name="colorPrimaryHiking">#009688</color>
<color name="colorPrimaryDarkHiking">#007267</color>
<color name="textLighterBlack">#C8000000</color>
<color name="textColorLight">#C8414141</color>
</resources>

View File

@ -39,6 +39,15 @@
<string name="workoutTotalEnergy">Total Energy</string>
<string name="workoutEnergyConsumption">Energy Consumption</string>
<string name="workoutTypeRunning">Running</string>
<string name="workoutTypeWalking">Walking</string>
<string name="workoutTypeJogging">Jogging</string>
<string name="workoutTypeCycling">Cycling</string>
<string name="workoutTypeHiking">Hiking</string>
<string name="workoutTypeUnknown">Unknown</string>
<string name="recordWorkout">Record Workout</string>
<string name="deleteWorkout">Delete Workout</string>
<string name="deleteWorkoutMessage">Do you really want to delete the workout?</string>

View File

@ -29,7 +29,8 @@
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
<!-- Customize your theme here. -->
<!-- Custom<color name="colorPrimaryBicycling">#523220</color>
<color name="colorPrimaryDarkBicycling">#462A1D</color>ize your theme here. -->
<item name="android:colorPrimary">@color/colorPrimary</item>
<item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="android:colorAccent">@color/colorAccent</item>
@ -50,4 +51,11 @@
<item name="android:colorPrimaryDark">@color/colorPrimaryDarkBicycling</item>
</style>
<!-- Base application theme. -->
<style name="Hiking" parent="AppTheme">
<!-- Customize your theme here. -->
<item name="android:colorPrimary">@color/colorPrimaryHiking</item>
<item name="android:colorPrimaryDark">@color/colorPrimaryDarkHiking</item>
</style>
</resources>