getList(){
24 | return readConfig();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trainerdb/trainerandroid/train/LapControl.java:
--------------------------------------------------------------------------------
1 | package com.trainerdb.trainerandroid.train;
2 |
3 | import com.trainerdb.trainerandroid.TrainApplication;
4 | import java.io.Serializable;
5 |
6 | /**
7 | * Created by Daniel on 30/06/2016.
8 | */
9 |
10 | public class LapControl implements Serializable {
11 | private int count;
12 | private double sumHr, sumWatts, sumCadence, sumSpeed;
13 | private double wattsMin, wattsMax, hrMin, hrMax, cadenceMin, cadenceMax, speedMin, speedMax;
14 | private double distanceStart, distanceEnd;
15 | private int lapNum;
16 | private String name;
17 | private long start, end;
18 | private boolean isEmptyDistance;
19 | private NormalizedPower npLap;
20 | private int ftp = TrainApplication.getFTP();
21 | private int recPerSec;
22 |
23 | public LapControl() {
24 | clear();
25 | }
26 |
27 | public LapControl(int recPerSec, int lapNum, String name, long start, long end) {
28 | super();
29 | this.lapNum = lapNum;
30 | this.name = name;
31 | this.start = start;
32 | this.end = end;
33 | this.recPerSec = recPerSec;
34 | npLap = new NormalizedPower(ftp, recPerSec);
35 | }
36 |
37 | public void clear() {
38 | count = lapNum = 0;
39 | start = end = 0;
40 | name = "";
41 | sumHr = sumWatts = sumCadence = sumSpeed = 0;
42 | wattsMax = hrMax = cadenceMax = speedMax = 0;
43 | distanceEnd = distanceStart = 0;
44 | cadenceMin = Double.MAX_VALUE;
45 | speedMin = Double.MAX_VALUE;
46 | wattsMin = Double.MAX_VALUE;
47 | hrMin = Double.MAX_VALUE;
48 | isEmptyDistance = true;
49 | }
50 |
51 | public void add() {
52 | count++;
53 | }
54 |
55 | public void setHr(double value) {
56 | sumHr += value;
57 | if (value > hrMax) hrMax = value;
58 | else if (value < hrMin) hrMin = value;
59 | }
60 |
61 | public void setWatts(double value) {
62 | sumWatts += value;
63 | if (value > wattsMax) wattsMax = value;
64 | else if (value < wattsMin) wattsMin = value;
65 |
66 | this.npLap.set(value);
67 | }
68 |
69 | public void setCadence(double value) {
70 | sumCadence += value;
71 | if (value > cadenceMax) cadenceMax = value;
72 | else if (value < cadenceMin) cadenceMin = value;
73 | }
74 |
75 | public void setSpeed(double value) {
76 | sumSpeed += value;
77 | if (value > speedMax) speedMax = value;
78 | else if (value < speedMin) speedMin = value;
79 | }
80 |
81 | public double getHr() {
82 | return sumHr / count;
83 | }
84 |
85 | public double getCadence() {
86 | return sumCadence / count;
87 | }
88 |
89 | public double getSpeed() {
90 | return sumSpeed / count;
91 | }
92 |
93 | public double getWatts() {
94 | return sumWatts / count;
95 | }
96 |
97 | public double getHrMin() {
98 | return hrMin;
99 | }
100 |
101 | public double getHrMax() {
102 | return hrMax;
103 | }
104 |
105 | public double getCadenceMax() {
106 | return cadenceMax;
107 | }
108 |
109 | public double getCadenceMin() {
110 | return cadenceMin;
111 | }
112 |
113 | public double getSpeedMax() {
114 | return speedMax;
115 | }
116 |
117 | public double getSpeedMin() {
118 | return speedMin;
119 | }
120 |
121 | public double getWattsMax() {
122 | return wattsMax;
123 | }
124 |
125 | public double getWattsMin() {
126 | return wattsMin;
127 | }
128 |
129 | public void setDistance(double distance) {
130 | if (isEmptyDistance) {
131 | distanceStart = distance;
132 | isEmptyDistance = false;
133 | }
134 | distanceEnd = distance;
135 | }
136 |
137 | public int getCount() {
138 | return count;
139 | }
140 |
141 | public double getDistance() {
142 | return distanceEnd - distanceStart;
143 | }
144 |
145 | public boolean isRunning(long now) {
146 | return start <= now && end >= now ? true : false;
147 | }
148 |
149 | public long getEnd() {
150 | return end;
151 | }
152 |
153 | public void setEnd(long end) {
154 | this.end = end;
155 | }
156 |
157 | public int getLapNum() {
158 | return lapNum;
159 | }
160 |
161 | public void setLapNum(int lapNum) {
162 | this.lapNum = lapNum;
163 | }
164 |
165 | public String getName() {
166 | return name;
167 | }
168 |
169 | public void setName(String name) {
170 | this.name = name;
171 | }
172 |
173 | public long getStart() {
174 | return start;
175 | }
176 |
177 | public void setStart(long start) {
178 | this.start = start;
179 | }
180 |
181 | public NormalizedPower getNp() {
182 | return npLap;
183 | }
184 |
185 | public double getKj() {
186 | return sumWatts / (recPerSec * 1000);
187 | }
188 | }
189 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trainerdb/trainerandroid/train/NormalizedPower.java:
--------------------------------------------------------------------------------
1 | package com.trainerdb.trainerandroid.train;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by dcotrim on 12/07/2016.
7 | */
8 | public class NormalizedPower implements Serializable {
9 | Rolling watts30;
10 | private int count = 0;
11 | private double rollingSum, ftp = 0;
12 | private int recPerSec;
13 |
14 | public NormalizedPower(double ftp, int recPerSec) {
15 | this.recPerSec = recPerSec;
16 | this.ftp = ftp;
17 | watts30 = new Rolling(recPerSec * 30);
18 | }
19 |
20 | public void clear() {
21 | watts30.clear();
22 | count = 0;
23 | rollingSum = 0;
24 | }
25 |
26 | public void set(double watts) {
27 | watts30.add(watts);
28 | count++;
29 | rollingSum += Math.pow(watts30.getAverage(), 4);
30 | }
31 |
32 | public double getNp() {
33 | if (count == 0)
34 | return 0;
35 | return Math.pow(rollingSum / count, 0.25);
36 | }
37 |
38 | public double getIntensityFactor() {
39 | return getNp() / ftp;
40 | }
41 |
42 | public double getTss() {
43 | double normWork = getNp() * (count / recPerSec);
44 | double rawTSS = normWork * getIntensityFactor();
45 | double workInAnHourAtCP = ftp * 3600;
46 | return rawTSS / workInAnHourAtCP * 100.0;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trainerdb/trainerandroid/train/NullController.java:
--------------------------------------------------------------------------------
1 | package com.trainerdb.trainerandroid.train;
2 |
3 | import com.trainerdb.trainerandroid.data.RealtimeController;
4 |
5 | /**
6 | * Created by dcotrim on 22/06/2016.
7 | */
8 | public class NullController extends RealtimeController {
9 | private int count = 0;
10 | double load;
11 |
12 | public NullController(DeviceConfiguration device){
13 | super(device);
14 | }
15 |
16 | @Override
17 | public void getRealtimeData(RealtimeData rtData) {
18 | rtData.setName("Null");
19 | rtData.setWatts(load + randomWithRange(0, 10) - 5);
20 | rtData.setSpeed(25 + randomWithRange(0, 4) - 2);
21 | rtData.setCadence(85 + randomWithRange(0, 9) - 5);
22 | rtData.setHr(145 + randomWithRange(0, 2) - 2);
23 | rtData.setLoad(load);
24 | //processRealTimeData(rtData);
25 |
26 | count++;
27 | }
28 |
29 | @Override
30 | public void setLoad(double load) {
31 | this.load = load;
32 | }
33 |
34 | @Override
35 | public void start() {
36 |
37 | }
38 |
39 | @Override
40 | public void stop() {
41 |
42 | }
43 |
44 | int randomWithRange(int min, int max) {
45 | int range = (max - min) + 1;
46 | return (int) (Math.random() * range) + min;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trainerdb/trainerandroid/train/RealtimeData.java:
--------------------------------------------------------------------------------
1 | package com.trainerdb.trainerandroid.train;
2 |
3 | /**
4 | * Created by dcotrim on 22/06/2016.
5 | */
6 | public class RealtimeData {
7 | private String name;
8 | private double hr;
9 | private double watts;
10 | private double speed;
11 | private double cadence;
12 | private double distance;
13 | private long msecs;
14 | private long lapMsecs;
15 | private long lapMsecsRemaining;
16 | private double load;
17 | private String deviceStatus;
18 | private int lap;
19 |
20 | public String getName() {
21 | return name;
22 | }
23 |
24 | public void setName(String name) {
25 | this.name = name;
26 | }
27 |
28 | public double getHr() {
29 | return hr;
30 | }
31 |
32 | public void setHr(double hr) {
33 | this.hr = hr;
34 | }
35 |
36 | public double getWatts() {
37 | return watts;
38 | }
39 |
40 | public void setWatts(double watts) {
41 | this.watts = watts;
42 | }
43 |
44 | public double getSpeed() {
45 | return speed;
46 | }
47 |
48 | public void setSpeed(double speed) {
49 | this.speed = speed;
50 | }
51 |
52 | public double getCadence() {
53 | return cadence;
54 | }
55 |
56 | public void setCadence(double cadence) {
57 | this.cadence = cadence;
58 | }
59 |
60 | public double getDistance() {
61 | return distance;
62 | }
63 |
64 | public void setDistance(double distance) {
65 | this.distance = distance;
66 | }
67 |
68 | public long getMsecs() {
69 | return msecs;
70 | }
71 |
72 | public void setMsecs(long msecs) {
73 | this.msecs = msecs;
74 | }
75 |
76 | public long getLapMsecs() {
77 | return lapMsecs;
78 | }
79 |
80 | public void setLapMsecs(long lapMsecs) {
81 | this.lapMsecs = lapMsecs;
82 | }
83 |
84 | public long getLapMsecsRemaining() {
85 | return lapMsecsRemaining;
86 | }
87 |
88 | public void setLapMsecsRemaining(long lapMsecsRemaining) {
89 | this.lapMsecsRemaining = lapMsecsRemaining;
90 | }
91 |
92 | public double getLoad() {
93 | return load;
94 | }
95 |
96 | public void setLoad(double load) {
97 | this.load = load;
98 | }
99 |
100 | public String getDeviceStatus() {
101 | return deviceStatus;
102 | }
103 |
104 | public void setDeviceStatus(String deviceStatus) {
105 | this.deviceStatus = deviceStatus;
106 | }
107 |
108 | public int getLap() {
109 | return lap;
110 | }
111 |
112 | public void setLap(int lap) {
113 | this.lap = lap;
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trainerdb/trainerandroid/train/Rolling.java:
--------------------------------------------------------------------------------
1 | package com.trainerdb.trainerandroid.train;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import java.io.Serializable;
7 |
8 | /**
9 | * Created by Daniel on 30/06/2016.
10 | */
11 | public class Rolling implements Serializable {
12 |
13 | private int size;
14 | private double total = 0d;
15 | private int index = 0;
16 | private double samples[];
17 |
18 | public Rolling(int size) {
19 | this.size = size;
20 | samples = new double[size];
21 | for (int i = 0; i < size; i++) samples[i] = 0d;
22 | }
23 |
24 | public void clear() {
25 | total = 0;
26 | for (int i = 0; i < size; i++) samples[i] = 0d;
27 | }
28 |
29 | public void add(double x) {
30 | total -= samples[index];
31 | samples[index] = x;
32 | total += x;
33 | if (++index == size) index = 0; // cheaper than modulus
34 | }
35 |
36 | public double getAverage() {
37 | return total / size;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trainerdb/trainerandroid/train/StopWatch.java:
--------------------------------------------------------------------------------
1 | package com.trainerdb.trainerandroid.train;
2 |
3 | import com.trainerdb.trainerandroid.TrainApplication;
4 |
5 | /**
6 | * Created by Daniel on 23/06/2016.
7 | */
8 | public class StopWatch {
9 |
10 | /**
11 | * The start time.
12 | */
13 | private long startTime = -1;
14 | /**
15 | * The stop time.
16 | */
17 | private long stopTime = -1;
18 |
19 | /**
20 | * Constructor.
21 | */
22 | public StopWatch() {
23 | }
24 |
25 | /**
26 | * Start the stopwatch.
27 | *
28 | * This method starts a new timing session, clearing any previous values.
29 | */
30 | public void start() {
31 | stopTime = -1;
32 | startTime = System.currentTimeMillis();
33 | }
34 |
35 |
36 | public long restart() {
37 | long elapsed = elapsed();
38 | start();
39 | return elapsed;
40 | }
41 |
42 | /**
43 | * Stop the stopwatch.
44 | *
45 | * This method ends a new timing session, allowing the time to be retrieved.
46 | */
47 | public void stop() {
48 | stopTime = System.currentTimeMillis();
49 | }
50 |
51 | /**
52 | * Reset the stopwatch.
53 | *
54 | * This method clears the internal values to allow the object to be reused.
55 | */
56 | public void reset() {
57 | startTime = -1;
58 | stopTime = -1;
59 | }
60 |
61 | /**
62 | * Split the time.
63 | *
64 | * This method sets the stop time of the watch to allow a time to be extracted.
65 | * The start time is unaffected, enabling {@link #unsplit()} to contine the
66 | * timing from the original start point.
67 | */
68 | public void split() {
69 | stopTime = System.currentTimeMillis();
70 | }
71 |
72 | /**
73 | * Remove a split.
74 | *
75 | * This method clears the stop time. The start time is unaffected, enabling
76 | * timing from the original start point to continue.
77 | */
78 | public void unsplit() {
79 | stopTime = -1;
80 | }
81 |
82 | /**
83 | * Suspend the stopwatch for later resumption.
84 | *
85 | * This method suspends the watch until it is resumed. The watch will not include
86 | * time between the suspend and resume calls in the total time.
87 | */
88 | public void suspend() {
89 | stopTime = System.currentTimeMillis();
90 | }
91 |
92 | /**
93 | * Resume the stopwatch after a suspend.
94 | *
95 | * This method resumes the watch after it was suspended. The watch will not include
96 | * time between the suspend and resume calls in the total time.
97 | */
98 | public void resume() {
99 | startTime += (System.currentTimeMillis() - stopTime);
100 | stopTime = -1;
101 | }
102 |
103 | /**
104 | * Get the time on the stopwatch.
105 | *
106 | * This is either the time between start and latest split, between start
107 | * and stop, or the time between the start and the moment this method is called.
108 | *
109 | * @return the time in milliseconds
110 | */
111 | public long elapsed() {
112 | if (stopTime == -1) {
113 | if (startTime == -1) {
114 | return 0;
115 | }
116 | return (System.currentTimeMillis() - this.startTime);
117 | }
118 | return (this.stopTime - this.startTime);
119 | }
120 |
121 | /**
122 | * Gets a summary of the time that the stopwatch recorded as a string.
123 | *
124 | * The format used is ISO8601-like,
125 | * hours:minutes:seconds.milliseconds.
126 | *
127 | * @return the time as a String
128 | */
129 | public String toString() {
130 | return TrainApplication.formatTime(elapsed());
131 | }
132 |
133 |
134 |
135 | }
136 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trainerdb/trainerandroid/train/TelemetryEnum.java:
--------------------------------------------------------------------------------
1 | package com.trainerdb.trainerandroid.train;
2 |
3 | /**
4 | * Created by Daniel on 07/07/2016.
5 | */
6 | public enum TelemetryEnum {
7 | POWER,
8 | CADENCE,
9 | HR,
10 | SPEED,
11 |
12 | TARGET,
13 | KM,
14 | KJ,
15 |
16 | AVG_POWER,
17 | AVG_SPEED,
18 | AVG_CAD,
19 | AVG_HR,
20 |
21 | MAX_POWER,
22 | MAX_SPEED,
23 | MAX_CAD,
24 | MAX_HR,
25 |
26 | LAP,
27 | LP_POWER,
28 | LP_SPEED,
29 | LP_CAD,
30 | LP_HR,
31 |
32 | LP_NP,
33 | LP_TSS,
34 | LP_IF,
35 | LP_KM,
36 | LP_KJ,
37 |
38 | POWER_30S,
39 |
40 | NP,
41 | TSS,
42 | IF,
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trainerdb/trainerandroid/train/TelemetryListener.java:
--------------------------------------------------------------------------------
1 | package com.trainerdb.trainerandroid.train;
2 |
3 |
4 | import com.trainerdb.trainerandroid.data.WorkoutData;
5 |
6 | import java.io.File;
7 |
8 | /**
9 | * Created by Daniel on 23/06/2016.
10 | */
11 | public interface TelemetryListener {
12 | void telemetryUpdate(RealtimeData rtData);
13 | void setNow(long msecs);
14 | void lapComplete(long now, int lapNum);
15 | void newText(long now, String text);
16 | void workoutComplete(WorkoutData workout, File recordFile, long startTime, long totalTicks);
17 | void telemetryStart(WorkoutData workout, File recordFile, long startTime);
18 | void telemetryStop();
19 | void telemetryResume();
20 | void telemetryPause();
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trainerdb/trainerandroid/train/TelemetryView.java:
--------------------------------------------------------------------------------
1 | package com.trainerdb.trainerandroid.train;
2 |
3 | import android.content.Context;
4 | import android.support.v4.content.ContextCompat;
5 | import android.util.AttributeSet;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.LinearLayout;
10 | import android.widget.TextView;
11 |
12 | import com.trainerdb.trainerandroid.AutoResizeTextView;
13 | import com.trainerdb.trainerandroid.R;
14 |
15 | /**
16 | * Created by Daniel on 07/07/2016.
17 | */
18 | public class TelemetryView extends LinearLayout {
19 | private TextView header;
20 | private AutoResizeTextView data;
21 | private TelemetryEnum type;
22 |
23 | public TelemetryView(Context context, AttributeSet attrs) {
24 | super(context, attrs);
25 |
26 | LayoutInflater inflater = (LayoutInflater) context
27 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
28 |
29 | inflater.inflate(R.layout.view_telemetry, this, true);
30 |
31 | header = (TextView) getChildAt(0);
32 |
33 | data = (AutoResizeTextView) getChildAt(1);
34 | }
35 |
36 | public TelemetryView(Context context) {
37 | this(context, null);
38 | }
39 |
40 | public void setType(TelemetryEnum type) {
41 | this.type = type;
42 | this.header.setText(type.toString());
43 |
44 | switch (type) {
45 | case CADENCE:
46 | data.setTextColor(ContextCompat.getColor(this.getContext(), R.color.trainCadence));
47 | break;
48 | case LP_CAD:
49 | data.setTextColor(ContextCompat.getColor(this.getContext(), R.color.trainCadence));
50 | break;
51 | case KM:
52 | data.setTextColor(ContextCompat.getColor(this.getContext(), R.color.trainDistance));
53 | break;
54 | case HR:
55 | data.setTextColor(ContextCompat.getColor(this.getContext(), R.color.trainHearRate));
56 | break;
57 | case IF:
58 | data.setTextColor(ContextCompat.getColor(this.getContext(), R.color.trainPower));
59 | break;
60 | case LAP:
61 | data.setTextColor(ContextCompat.getColor(this.getContext(), R.color.trainLap));
62 | break;
63 | case LP_HR:
64 | data.setTextColor(ContextCompat.getColor(this.getContext(), R.color.trainLapHr));
65 | break;
66 | case LP_POWER:
67 | data.setTextColor(ContextCompat.getColor(this.getContext(), R.color.trainLapPower));
68 | break;
69 | case NP:
70 | data.setTextColor(ContextCompat.getColor(this.getContext(), R.color.trainPower));
71 | break;
72 | case POWER:
73 | data.setTextColor(ContextCompat.getColor(this.getContext(), R.color.trainPower));
74 | break;
75 | case POWER_30S:
76 | data.setTextColor(ContextCompat.getColor(this.getContext(), R.color.trainPower));
77 | break;
78 | case SPEED:
79 | data.setTextColor(ContextCompat.getColor(this.getContext(), R.color.trainSpeed));
80 | break;
81 | case TARGET:
82 | data.setTextColor(ContextCompat.getColor(this.getContext(), R.color.trainTarget));
83 | break;
84 | case TSS:
85 | data.setTextColor(ContextCompat.getColor(this.getContext(), R.color.trainPower));
86 | break;
87 | }
88 | }
89 |
90 | public void setValue(String text) {
91 | this.data.setText(text);
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trainerdb/trainerandroid/train/TrainFile.java:
--------------------------------------------------------------------------------
1 | package com.trainerdb.trainerandroid.train;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.net.Uri;
7 | import android.support.v4.content.FileProvider;
8 | import java.io.File;
9 |
10 | /**
11 | * Created by dcotrim on 29/06/2016.
12 | */
13 | public class TrainFile {
14 | private File file;
15 | private boolean selected = false;
16 |
17 | public TrainFile(File file) {
18 | this.file = file;
19 | }
20 |
21 | public File getFile() {
22 | return file;
23 | }
24 |
25 | public void setFile(File file) {
26 | this.file = file;
27 | }
28 |
29 | public void setSelected(boolean selected) {
30 | this.selected = selected;
31 | }
32 |
33 | public boolean isSelected() {
34 | return selected;
35 | }
36 |
37 | public String getName() {
38 | return file.getName();
39 | }
40 |
41 | public void shareFile(Activity context) {
42 | Intent shareIntent = new Intent();
43 | shareIntent.setAction(Intent.ACTION_SEND);
44 | shareIntent.setType("application/xml");
45 |
46 | Uri fileUri = FileProvider.getUriForFile(context, "com.trainerandroid.fileprovider", file);
47 | shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
48 | shareIntent.setDataAndType(fileUri, context.getContentResolver().getType(fileUri));
49 |
50 | // Set the result
51 | context.setResult(Activity.RESULT_OK, shareIntent);
52 |
53 | shareIntent.putExtra(Intent.EXTRA_STREAM, fileUri);
54 | context.startActivity(Intent.createChooser(shareIntent, "Share"));
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trainerdb/trainerandroid/train/TrainState.java:
--------------------------------------------------------------------------------
1 | package com.trainerdb.trainerandroid.train;
2 |
3 | import android.net.Uri;
4 | import android.support.v4.content.FileProvider;
5 | import com.trainerdb.trainerandroid.TrainApplication;
6 | import com.trainerdb.trainerandroid.data.LapPoint;
7 | import com.trainerdb.trainerandroid.data.WorkoutData;
8 |
9 | import java.io.File;
10 | import java.io.Serializable;
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | /**
15 | * Created by Daniel on 11/07/2016.
16 | */
17 | public class TrainState implements Serializable {
18 | public WorkoutData workout;
19 | //public WorkoutRecord record;
20 |
21 | public double wattsSum, cadenceSum, speedSum, hrSum;
22 | public double distance;
23 | public double ftp = TrainApplication.getFTP();
24 | public int hertz, count;
25 |
26 | public int hrMax;
27 | public int speedMax;
28 | public int cadenceMax;
29 |
30 | public int lapBeep, lap;
31 | public boolean recording = false, cancelCalled = false;
32 | public boolean isNewLap = false;
33 | public long now = 0;
34 |
35 | public List lapsControl= new ArrayList<>();
36 |
37 | public ArrayList watts = new ArrayList<>(); // 1s samples [watts]
38 | public ArrayList hr = new ArrayList<>(); // 1s samples [bpm]
39 | public ArrayList speed = new ArrayList<>(); // 1s samples [km/h]
40 | public ArrayList cadence = new ArrayList<>(); // 1s samples [rpm]
41 |
42 | public Rolling watts30;
43 | private int recPerSec;
44 |
45 | public TrainState(WorkoutData workout, int recPerSec) {
46 | this.recPerSec = recPerSec;
47 | this.workout = workout;
48 | watts30 = new Rolling(recPerSec * 30);
49 | clear();
50 | }
51 |
52 | public void clear() {
53 | hertz = count = 0;
54 | wattsSum = hrSum = speedSum = cadenceSum = 0;
55 | distance = 0;
56 |
57 | // set initial
58 | cadenceMax = 600;
59 | hrMax = 220;
60 | speedMax = 50;
61 | lapBeep = 0;
62 |
63 | watts30.clear();
64 | watts.clear();
65 | hr.clear();
66 | speed.clear();
67 | cadence.clear();
68 |
69 | lapsControl.clear();
70 |
71 | for (LapPoint lap : workout.getErg().getLapPoints()) {
72 | lapsControl.add(new LapControl(recPerSec, lap.lapNum, lap.name, lap.x, lap.y));
73 | }
74 | }
75 |
76 | private void newLapInfo(long now, double hr, double cad, double watts, double speed, double distance) {
77 | for (LapControl lap : this.lapsControl) {
78 | if (lap.isRunning(now)) {
79 | lap.add();
80 | lap.setCadence(cad);
81 | lap.setHr(hr);
82 | lap.setWatts(watts);
83 | lap.setSpeed(speed);
84 | lap.setDistance(distance);
85 | }
86 | }
87 | }
88 |
89 | public LapControl getMainLap() {
90 | return lapsControl.get(0);
91 | }
92 |
93 | public LapControl getCurrentLap() {
94 | return this.lapsControl.get(lap);
95 | }
96 |
97 | public void workoutStart(File recordFile, long startTime) {
98 | }
99 |
100 | private void createInterval(LapControl avgLap) {
101 | }
102 |
103 | public void workoutComplete(File recordFile, long totalTicks,
104 | byte[] bitmap, byte[] bitmapMin) {
105 | LapControl workoutLap = this.lapsControl.get(0);
106 |
107 | for (LapControl lap : this.lapsControl) {
108 | if (lap.getCount() > 0)
109 | createInterval(lap);
110 | }
111 |
112 | Uri fileUri = FileProvider.getUriForFile(TrainApplication.getAppContext(),
113 | "com.trainerandroid.fileprovider", recordFile);
114 |
115 | }
116 |
117 | public void updateRealtimeData(RealtimeData rt) {
118 | count++;
119 | now = rt.getMsecs();
120 | distance = rt.getDistance();
121 | lap = rt.getLap();
122 |
123 | if (isNewLap) isNewLap = false;
124 |
125 | this.newLapInfo(now, rt.getHr(), rt.getCadence(), rt.getWatts(),
126 | rt.getSpeed(), rt.getDistance());
127 |
128 | watts30.add(rt.getWatts());
129 |
130 | //wbalSum += rt.getWbal();
131 | wattsSum += rt.getWatts();
132 | hrSum += rt.getHr();
133 | cadenceSum += rt.getCadence();
134 | speedSum += rt.getSpeed();
135 |
136 | hertz++;
137 |
138 | // did we get 5 samples (5hz refresh rate) ?
139 | if (hertz == recPerSec) {
140 | //int b = wbalSum / 5.0f;
141 | //wbal << b;
142 | int w = (int) (wattsSum / recPerSec);
143 | watts.add(w);
144 | int h = (int) (hrSum / recPerSec);
145 | hr.add(h);
146 | double s = (speedSum / recPerSec);
147 | speed.add(s);
148 | int c = (int) (cadenceSum / recPerSec);
149 | cadence.add(c);
150 |
151 | // clear for next time
152 | hertz = 0;
153 | wattsSum = hrSum = speedSum = cadenceSum = 0;
154 | }
155 | }
156 |
157 |
158 | }
159 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/drawable-hdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/drawable-hdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/drawable-hdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/drawable-mdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/drawable-mdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/drawable-mdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_info_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_gallery.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_manage.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_send.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_slideshow.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_notifications_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_sync_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/drawable-xhdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/drawable-xhdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/drawable-xhdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/drawable-xxhdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/drawable-xxhdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/drawable-xxhdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/drawable-xxxhdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/drawable-xxxhdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/drawable-xxxhdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/side_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
3 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout-land/view_telemetry.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
13 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout-w900dp/workout_list.xml:
--------------------------------------------------------------------------------
1 |
13 |
14 |
19 |
20 |
31 |
32 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_train_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_train_file_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
21 |
22 |
23 |
24 |
29 |
30 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_workout_detail.xml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
16 |
17 |
28 |
29 |
37 |
38 |
45 |
46 |
47 |
48 |
49 |
50 |
55 |
56 |
57 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_workout_filter.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
21 |
22 |
23 |
24 |
30 |
31 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_workout_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
21 |
22 |
23 |
24 |
29 |
30 |
31 |
32 |
33 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_bar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
20 |
21 |
27 |
28 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/train_file_list_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_telemetry.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/workout_detail.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
13 |
14 |
24 |
25 |
29 |
30 |
35 |
36 |
45 |
46 |
56 |
57 |
58 |
63 |
64 |
73 |
74 |
84 |
85 |
86 |
91 |
92 |
101 |
102 |
112 |
113 |
114 |
115 |
116 |
125 |
126 |
134 |
135 |
144 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/workout_filter_group.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/workout_filter_list_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
17 |
18 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/workout_filter_sort_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
20 |
21 |
26 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/workout_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/workout_list_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
19 |
20 |
21 |
22 |
23 |
31 |
32 |
36 |
37 |
42 |
43 |
50 |
51 |
59 |
60 |
61 |
66 |
67 |
74 |
75 |
83 |
84 |
85 |
90 |
91 |
98 |
99 |
107 |
108 |
112 |
113 |
124 |
125 |
126 |
127 |
128 |
129 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_main_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_train_file_list.xml:
--------------------------------------------------------------------------------
1 |
5 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/toolbar_files.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/toolbar_filter.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/toolbar_train.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/toolbar_workout_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 | #FFFF00
8 | #FFFF00
9 | #FFFF00
10 | #FF0000
11 | #FF0000
12 | #FF0000
13 | #00ff00
14 | #9AF0FF
15 | #9AF0FF
16 |
17 | #FF00FF
18 | #2A00FF
19 | #00AAFF
20 | #00FF80
21 | #55FF00
22 | #FFD500
23 | #ff0000
24 | #555555
25 | #555555
26 | #555555
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 180dp
5 | 200dp
6 | 16dp
7 |
8 | 16dp
9 | 16dp
10 |
11 | 16dp
12 | 160dp
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values/drawables.xml:
--------------------------------------------------------------------------------
1 |
2 | - @android:drawable/ic_menu_camera
3 | - @android:drawable/ic_menu_gallery
4 | - @android:drawable/ic_menu_slideshow
5 | - @android:drawable/ic_menu_manage
6 | - @android:drawable/ic_menu_share
7 | - @android:drawable/ic_menu_send
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/favorite_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/filepaths.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/pref_data_sync.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/pref_general.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
20 |
21 |
30 |
31 |
40 |
41 |
43 |
44 |
52 |
53 |
61 |
69 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/pref_headers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/pref_notification.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
9 |
10 |
11 |
12 |
13 |
19 |
20 |
21 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/test/java/com/trainerdb/trainerandroid/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.trainerdb.trainerandroid;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.0'
9 | classpath 'com.google.gms:google-services:3.0.0'
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrainerDb/TrainerAndroid/9a3e8c4de16b3021148de00e9f4df872d3179133/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Sep 20 15:36:05 BRT 2016
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------