mirror of
https://github.com/russok/FitoTrack.git
synced 2025-10-29 08:42:12 -07:00
choose workout type
This commit is contained in:
parent
f0c23763fa
commit
ac223e762a
15
NOTICE.md
15
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.
|
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>
|
<https://github.com/jenetics/jpx>
|
||||||
|
|
||||||
Copyright 2016-2019 Franz Wilhelmstötter
|
Copyright 2016-2019 Franz Wilhelmstötter
|
||||||
|
|||||||
@ -65,6 +65,7 @@ dependencies {
|
|||||||
implementation 'com.caverock:androidsvg:1.3'
|
implementation 'com.caverock:androidsvg:1.3'
|
||||||
implementation 'net.sf.kxml:kxml2:2.3.0'
|
implementation 'net.sf.kxml:kxml2:2.3.0'
|
||||||
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
|
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
|
||||||
|
implementation 'com.github.clans:fab:1.6.4'
|
||||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.0.0'
|
implementation 'androidx.recyclerview:recyclerview:1.0.0'
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
|
|||||||
@ -24,10 +24,14 @@ import android.content.Intent;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
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.Instance;
|
||||||
import de.tadris.fitness.R;
|
import de.tadris.fitness.R;
|
||||||
import de.tadris.fitness.WorkoutAdapter;
|
import de.tadris.fitness.WorkoutAdapter;
|
||||||
@ -38,6 +42,7 @@ public class ListWorkoutsActivity extends Activity implements WorkoutAdapter.Wor
|
|||||||
private RecyclerView listView;
|
private RecyclerView listView;
|
||||||
private RecyclerView.Adapter adapter;
|
private RecyclerView.Adapter adapter;
|
||||||
private RecyclerView.LayoutManager layoutManager;
|
private RecyclerView.LayoutManager layoutManager;
|
||||||
|
private FloatingActionMenu menu;
|
||||||
Workout[] workouts;
|
Workout[] workouts;
|
||||||
|
|
||||||
|
|
||||||
@ -52,6 +57,17 @@ public class ListWorkoutsActivity extends Activity implements WorkoutAdapter.Wor
|
|||||||
layoutManager= new LinearLayoutManager(this);
|
layoutManager= new LinearLayoutManager(this);
|
||||||
listView.setLayoutManager(layoutManager);
|
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
|
@Override
|
||||||
@ -79,10 +95,7 @@ public class ListWorkoutsActivity extends Activity implements WorkoutAdapter.Wor
|
|||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
if(id == R.id.action_workout_add){
|
|
||||||
startActivity(new Intent(this, RecordWorkoutActivity.class));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ public class ThemeManager {
|
|||||||
switch (type){
|
switch (type){
|
||||||
case Workout.WORKOUT_TYPE_RUNNING: return R.style.Running;
|
case Workout.WORKOUT_TYPE_RUNNING: return R.style.Running;
|
||||||
case Workout.WORKOUT_TYPE_CYCLING: return R.style.Bicycling;
|
case Workout.WORKOUT_TYPE_CYCLING: return R.style.Bicycling;
|
||||||
|
case Workout.WORKOUT_TYPE_HIKING: return R.style.Hiking;
|
||||||
default: return R.style.AppTheme;
|
default: return R.style.AppTheme;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
app/src/main/res/drawable-anydpi/ic_add_white.xml
Normal file
10
app/src/main/res/drawable-anydpi/ic_add_white.xml
Normal 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>
|
||||||
BIN
app/src/main/res/drawable-hdpi/ic_add_white.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_add_white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 144 B |
BIN
app/src/main/res/drawable-mdpi/ic_add_white.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_add_white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 97 B |
BIN
app/src/main/res/drawable-xhdpi/ic_add_white.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_add_white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 120 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_add_white.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_add_white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 156 B |
@ -18,15 +18,67 @@
|
|||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
~ 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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
tools:context=".activity.ListWorkoutsActivity">
|
tools:context=".activity.ListWorkoutsActivity">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/workoutList"
|
android:id="@+id/workoutList"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</ScrollView>
|
</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>
|
||||||
@ -18,10 +18,4 @@
|
|||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<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>
|
|
||||||
@ -29,6 +29,11 @@
|
|||||||
<color name="colorPrimaryDarkBicycling">#462A1D</color>
|
<color name="colorPrimaryDarkBicycling">#462A1D</color>
|
||||||
|
|
||||||
<color name="colorAccent">#4CAF50</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="textLighterBlack">#C8000000</color>
|
||||||
<color name="textColorLight">#C8414141</color>
|
<color name="textColorLight">#C8414141</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@ -29,7 +29,8 @@
|
|||||||
|
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
|
<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:colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
<item name="android:colorAccent">@color/colorAccent</item>
|
<item name="android:colorAccent">@color/colorAccent</item>
|
||||||
@ -50,4 +51,11 @@
|
|||||||
<item name="android:colorPrimaryDark">@color/colorPrimaryDarkBicycling</item>
|
<item name="android:colorPrimaryDark">@color/colorPrimaryDarkBicycling</item>
|
||||||
</style>
|
</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>
|
</resources>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user