Skip to content

Commit

Permalink
Merge pull request #133 from brodeurlv/workout
Browse files Browse the repository at this point in the history
Workout
  • Loading branch information
brodeurlv authored Jun 15, 2020
2 parents f9a8cd0 + 3d8552f commit 4f8c8f8
Show file tree
Hide file tree
Showing 108 changed files with 5,669 additions and 3,525 deletions.
99 changes: 50 additions & 49 deletions app/app.iml

Large diffs are not rendered by default.

24 changes: 13 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
compileSdkVersion 29
buildToolsVersion "28.0.3"

defaultConfig {
applicationId "com.easyfitness"
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 29
versionCode 44
versionName "0.19.1"
versionName "0.19.0"

vectorDrawables.useSupportLibrary = true
}
Expand Down Expand Up @@ -45,12 +45,14 @@ android {
if (rootProject.file('release.properties').exists()) {
signingConfig signingConfigs.release
}
buildConfigField "Boolean", "DEBUG_MODE", "false"
}
debug {
resValue("bool", "FIREBASE_CRASH_ENABLED", "false")
if (rootProject.file('debug.properties').exists()) {
signingConfig signingConfigs.debug
}
buildConfigField "Boolean", "DEBUG_MODE", "true"
}
}

Expand All @@ -75,17 +77,17 @@ dependencies {

// Support
implementation 'androidx.annotation:annotation:1.1.0'
implementation "androidx.constraintlayout:constraintlayout:2.0.0-beta4"
implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
implementation "androidx.constraintlayout:constraintlayout:2.0.0-beta6"
implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.0.0'
implementation 'androidx.core:core:1.0.2'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation 'androidx.core:core:1.3.0'
implementation 'androidx.drawerlayout:drawerlayout:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.0.0'
implementation 'androidx.fragment:fragment:1.0.0'
implementation 'androidx.preference:preference:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.2.0'
implementation 'androidx.fragment:fragment:1.2.4'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.android.material:material:1.1.0'

// Firebase
//implementation 'com.google.firebase:firebase-core:17.0.0'
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
tools:replace="android:icon">
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize"
Expand Down
79 changes: 34 additions & 45 deletions app/src/main/java/com/easyfitness/CountdownDialogbox.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
import android.preference.PreferenceManager;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.easyfitness.DAO.Machine;
import com.easyfitness.enums.ExerciseType;
import com.easyfitness.utils.AlarmReceiver;
import com.easyfitness.utils.UnitConverter;
import com.github.lzyzsd.circleprogress.DonutProgress;
Expand All @@ -26,6 +29,8 @@
public class CountdownDialogbox extends Dialog implements
View.OnClickListener {

private final ExerciseType mExerciseType;
private final Machine mExercise;
public Activity activity;
public Dialog d;
public Button exit;
Expand All @@ -43,40 +48,26 @@ public class CountdownDialogbox extends Dialog implements

@Override
public void onChronometerTick(Chronometer chronometer) {
// Update progressbar
//progressBar = (ProgressBar) findViewById(R.id.progressBarCountdown);

int secElapsed = (int) (chrono.getTimeElapsed() / 1000); //secElapsed is a negative value
//progressBar.setProgress(iRestTime + secElapsed);
progressCircle.setProgress(iRestTime + secElapsed);
/*
if (secElapsed >= -2) { // Vibrate
if (!bFirst) {
activity.getApplicationContext();
Vibrator v = (Vibrator) activity.getApplicationContext().getSystemService(Context.VIBRATOR_SERVICE);
// Vibrate for 500 milliseconds
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
v.vibrate(VibrationEffect.createOneShot(500, VibrationEffect.DEFAULT_AMPLITUDE));
} else {
//deprecated in API 26
v.vibrate(500);
}
} else {
bFirst = false;
}
}
*/

if (secElapsed >= 0) {
chrono.stop();
dismiss();
}
}
};

public CountdownDialogbox(Activity a, int pRestTime) {
public CountdownDialogbox(Activity a, int pRestTime, Machine exercise) {
super(a);
this.activity = a;
iRestTime = pRestTime;

mExercise = exercise;
if(mExercise!=null)
mExerciseType = exercise.getType();
else
mExerciseType = ExerciseType.CARDIO; // The simplest by default
}

public static void registerAlarm(Context context, int uniqueId, long triggerAlarmAt) {
Expand All @@ -99,8 +90,6 @@ public static void unregisterAlarm(Context context, int uniqueId) {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//requestWindowFeature(Window.FEATURE_NO_TITLE);
setTitle(getContext().getResources().getString(R.string.ChronometerLabel)); //ChronometerLabel
setContentView(R.layout.dialog_rest);
this.setCanceledOnTouchOutside(true); // make it not modal

Expand All @@ -110,35 +99,35 @@ protected void onCreate(Bundle savedInstanceState) {
TextView nbSeries = findViewById(R.id.idNbSeries);
TextView totalSession = findViewById(R.id.idTotalSession);
TextView totalMachine = findViewById(R.id.idTotalWeightMachine);
TextView totalOnExercise = findViewById(R.id.totalOnExerciseTitle);
LinearLayout totalExerciseLayout = findViewById(R.id.totalExerciseLayout);
LinearLayout totalWorkoutLayout = findViewById(R.id.totalWorkoutLayout);

progressCircle = findViewById(R.id.donut_progress);

progressCircle = findViewById(R.id.donut_progress);
progressCircle.setMax(iRestTime);

exit.setOnClickListener(this);

// If setting prefShowRestTime is ON
/*
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(c.getBaseContext());
iRestTime = Integer.valueOf(SP.getString("prefRestTimeValue", "60"));
*/
//progressBar.setMax(iRestTime);

SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(getContext());
int defaultUnit = Integer.valueOf(SP.getString("defaultUnit", "0"));

DecimalFormat numberFormat = new DecimalFormat("#.##");

if (defaultUnit == UnitConverter.UNIT_KG) {
totalMachine.setText(numberFormat.format(lTotalMachine) + " " + this.getContext().getResources().getText(R.string.KgUnitLabel));
totalSession.setText(numberFormat.format(lTotalSession) + " " + this.getContext().getResources().getText(R.string.KgUnitLabel));
} else if (defaultUnit == UnitConverter.UNIT_LBS) {
totalMachine.setText(numberFormat.format(UnitConverter.KgtoLbs(lTotalMachine)) + " " + this.getContext().getResources().getText(R.string.LbsUnitLabel));
totalSession.setText(numberFormat.format(UnitConverter.KgtoLbs(lTotalSession)) + " " + this.getContext().getResources().getText(R.string.LbsUnitLabel));
if (mExerciseType!=ExerciseType.CARDIO) {
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(getContext());
int defaultUnit = Integer.valueOf(SP.getString("defaultUnit", "0"));
DecimalFormat numberFormat = new DecimalFormat("#.##");
if (defaultUnit == UnitConverter.UNIT_KG) {
totalMachine.setText(numberFormat.format(lTotalMachine) + " " + this.getContext().getResources().getText(R.string.KgUnitLabel));
totalSession.setText(numberFormat.format(lTotalSession) + " " + this.getContext().getResources().getText(R.string.KgUnitLabel));
} else if (defaultUnit == UnitConverter.UNIT_LBS) {
totalMachine.setText(numberFormat.format(UnitConverter.KgtoLbs(lTotalMachine)) + " " + this.getContext().getResources().getText(R.string.LbsUnitLabel));
totalSession.setText(numberFormat.format(UnitConverter.KgtoLbs(lTotalSession)) + " " + this.getContext().getResources().getText(R.string.LbsUnitLabel));
}
nbSeries.setText(Integer.toString(lNbSerie));
String totalOnExerciseTitle = getContext().getString(R.string.total_on) + " " + mExercise.getName();
totalOnExercise.setText(totalOnExerciseTitle);
} else {
totalExerciseLayout.setVisibility(View.GONE);
totalWorkoutLayout.setVisibility(View.GONE);
}

nbSeries.setText(Integer.toString(lNbSerie));

chrono.setOnChronometerTickListener(onChronometerTick);
chrono.setBase(SystemClock.elapsedRealtime() + (iRestTime + 1) * 1000);
chrono.setPrecision(false);
Expand Down
84 changes: 0 additions & 84 deletions app/src/main/java/com/easyfitness/DAO/ARecord.java

This file was deleted.

Loading

0 comments on commit 4f8c8f8

Please sign in to comment.