diff --git a/NOTICE.md b/NOTICE.md index 20dfe00..2d26e07 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -32,6 +32,21 @@ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + + Copyright 2015 Dmytro Tarianyk + + Licensed under the Apache License, Version 2.0 (the "License"); + 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. + Copyright 2016-2019 Franz Wilhelmstötter diff --git a/app/build.gradle b/app/build.gradle index b6f37d6..3801110 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' diff --git a/app/src/main/java/de/tadris/fitness/activity/ListWorkoutsActivity.java b/app/src/main/java/de/tadris/fitness/activity/ListWorkoutsActivity.java index dd39942..cde5791 100644 --- a/app/src/main/java/de/tadris/fitness/activity/ListWorkoutsActivity.java +++ b/app/src/main/java/de/tadris/fitness/activity/ListWorkoutsActivity.java @@ -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); } diff --git a/app/src/main/java/de/tadris/fitness/util/ThemeManager.java b/app/src/main/java/de/tadris/fitness/util/ThemeManager.java index 82e8188..19f00bf 100644 --- a/app/src/main/java/de/tadris/fitness/util/ThemeManager.java +++ b/app/src/main/java/de/tadris/fitness/util/ThemeManager.java @@ -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; } } diff --git a/app/src/main/res/drawable-anydpi/ic_add_white.xml b/app/src/main/res/drawable-anydpi/ic_add_white.xml new file mode 100644 index 0000000..89208a9 --- /dev/null +++ b/app/src/main/res/drawable-anydpi/ic_add_white.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable-hdpi/ic_add_white.png b/app/src/main/res/drawable-hdpi/ic_add_white.png new file mode 100644 index 0000000..d702a21 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_add_white.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_add_white.png b/app/src/main/res/drawable-mdpi/ic_add_white.png new file mode 100644 index 0000000..b2d14f3 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_add_white.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_add_white.png b/app/src/main/res/drawable-xhdpi/ic_add_white.png new file mode 100644 index 0000000..bcd24f2 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_add_white.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_add_white.png b/app/src/main/res/drawable-xxhdpi/ic_add_white.png new file mode 100644 index 0000000..9478911 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_add_white.png differ diff --git a/app/src/main/res/layout/activity_list_workouts.xml b/app/src/main/res/layout/activity_list_workouts.xml index ce1cc41..40bed42 100644 --- a/app/src/main/res/layout/activity_list_workouts.xml +++ b/app/src/main/res/layout/activity_list_workouts.xml @@ -18,15 +18,67 @@ ~ along with this program. If not, see . --> - - - - \ No newline at end of file + android:layout_height="match_parent"> + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/list_workout_menu.xml b/app/src/main/res/menu/list_workout_menu.xml index 39c66ac..da3e740 100644 --- a/app/src/main/res/menu/list_workout_menu.xml +++ b/app/src/main/res/menu/list_workout_menu.xml @@ -18,10 +18,4 @@ ~ along with this program. If not, see . --> - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 2df259c..391beba 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -29,6 +29,11 @@ #462A1D #4CAF50 + #2E7D32 + + #009688 + #007267 + #C8000000 #C8414141 diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index a56d984..1e81eef 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -29,7 +29,8 @@ + + +