summaryrefslogtreecommitdiff
path: root/GymLog/src/main/java/com/mikemiller/gymlog/Activity.java
diff options
context:
space:
mode:
authormikem <mikem@oliodevices.com>2014-03-30 18:24:58 -0600
committermikem <mikem@oliodevices.com>2014-03-30 18:24:58 -0600
commit99bb04032209271f0ed416bb42ea5ab09de23eb8 (patch)
tree178db047ffd8194998ed81c7cf336ac9fa9ffcbd /GymLog/src/main/java/com/mikemiller/gymlog/Activity.java
downloadGymLog-99bb04032209271f0ed416bb42ea5ab09de23eb8.tar.xz
GymLog-99bb04032209271f0ed416bb42ea5ab09de23eb8.zip
Initial commit. Double tap to increment weight, long press to decrement, fling up/down in increment/decrement reps, swipe left/right to navigate through exercises.
Currently uses a hard-coded list of exercises that vary depending on the day of the week.
Diffstat (limited to 'GymLog/src/main/java/com/mikemiller/gymlog/Activity.java')
-rw-r--r--GymLog/src/main/java/com/mikemiller/gymlog/Activity.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/GymLog/src/main/java/com/mikemiller/gymlog/Activity.java b/GymLog/src/main/java/com/mikemiller/gymlog/Activity.java
new file mode 100644
index 0000000..bce8419
--- /dev/null
+++ b/GymLog/src/main/java/com/mikemiller/gymlog/Activity.java
@@ -0,0 +1,46 @@
+package com.mikemiller.gymlog;
+
+import java.io.Serializable;
+
+/**
+ * Created by Mike on 3/29/14. COPYRIGHT OLIO.
+ */
+public class Activity implements Serializable {
+ private String mName;
+ private int mSets;
+ private int mRepsLow;
+ private int mRepsHigh;
+ private int mWeightDecrement_percent;
+ private int mRepIncrement;
+
+ public Activity (String name, int sets, int repsLow, int repsHigh, int weightDecrement_percent, int repIncrement) {
+ mName = name;
+ mSets = sets;
+ mRepsLow = repsLow;
+ mRepsHigh = repsHigh;
+ mWeightDecrement_percent = weightDecrement_percent;
+ mRepIncrement = repIncrement;
+ }
+
+ public String getName() { return mName; }
+ public int getSets() { return mSets; }
+ public int getRepsLow() { return mRepsLow; }
+ public int getRepsHigh() { return mRepsHigh; }
+ public int getWeightForSet(int set, int setOneWeight) {
+ double val = (int)(setOneWeight - (set - 1) * setOneWeight * (mWeightDecrement_percent / 100.0));
+ return (int) (5*(Math.round(val/5))); // Round to the nearest 5 lbs
+ }
+ public int getRepIncrement() { return mRepIncrement; }
+
+ public String getSummary(int setOneWeight, int currentReps) {
+ String summary = "";
+ String reps = getRepsLow() + (getRepsLow() == getRepsHigh() ? "" : " - " + getRepsHigh());
+ summary += reps + " reps ("+ currentReps + ")\n\n";
+ for (int i = 1; i <= getSets(); i++) {
+ summary += i + ": " + getWeightForSet(i, setOneWeight);
+ if (i > 1 && getRepIncrement() > 0) summary += " (+" + getRepIncrement() + " rep)";
+ if (i < getSets()) summary += "\n";
+ }
+ return summary;
+ }
+}