Showing
5 changed files
with
33 additions
and
14 deletions
... | @@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { | ... | @@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { |
36 | public void onWarplyReady() { | 36 | public void onWarplyReady() { |
37 | if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { | 37 | if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { |
38 | WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() | 38 | WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() |
39 | - .setGuid("6012049139"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons | 39 | + .setGuid("7000000831"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons |
40 | mLoginReceiver); | 40 | mLoginReceiver); |
41 | } else { | 41 | } else { |
42 | startNextActivity(); | 42 | startNextActivity(); | ... | ... |
... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' |
2 | 2 | ||
3 | ext { | 3 | ext { |
4 | PUBLISH_GROUP_ID = 'ly.warp' | 4 | PUBLISH_GROUP_ID = 'ly.warp' |
5 | - PUBLISH_VERSION = '4.5.4-cosbeta70' | 5 | + PUBLISH_VERSION = '4.5.4-cosbeta71' |
6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
7 | } | 7 | } |
8 | 8 | ... | ... |
... | @@ -27,12 +27,11 @@ import java.util.Date; | ... | @@ -27,12 +27,11 @@ import java.util.Date; |
27 | import java.util.Locale; | 27 | import java.util.Locale; |
28 | 28 | ||
29 | import ly.warp.sdk.R; | 29 | import ly.warp.sdk.R; |
30 | -import ly.warp.sdk.activities.BaseFragmentActivity; | ||
31 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 30 | import ly.warp.sdk.io.callbacks.CallbackReceiver; |
32 | -import ly.warp.sdk.io.callbacks.WarplyHealthCallback; | ||
33 | -import ly.warp.sdk.io.models.CouponsEventModel; | ||
34 | import ly.warp.sdk.io.models.HealthEventModel; | 31 | import ly.warp.sdk.io.models.HealthEventModel; |
32 | +import ly.warp.sdk.io.models.PacingDetails; | ||
35 | import ly.warp.sdk.io.request.PacingCalculateRequest; | 33 | import ly.warp.sdk.io.request.PacingCalculateRequest; |
34 | +import ly.warp.sdk.io.request.PacingDetailsRequest; | ||
36 | import ly.warp.sdk.utils.WarpUtils; | 35 | import ly.warp.sdk.utils.WarpUtils; |
37 | import ly.warp.sdk.utils.WarplyManagerHelper; | 36 | import ly.warp.sdk.utils.WarplyManagerHelper; |
38 | import ly.warp.sdk.utils.managers.WarplyEventBusManager; | 37 | import ly.warp.sdk.utils.managers.WarplyEventBusManager; |
... | @@ -60,7 +59,7 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -60,7 +59,7 @@ public class WarplyHealthService extends Service implements SensorEventListener |
60 | private final int ACCEL_RING_SIZE = 50; | 59 | private final int ACCEL_RING_SIZE = 50; |
61 | private final int VEL_RING_SIZE = 10; | 60 | private final int VEL_RING_SIZE = 10; |
62 | // change this threshold according to your sensitivity preferences | 61 | // change this threshold according to your sensitivity preferences |
63 | - private final float STEP_THRESHOLD = 10f; // default 40, cosmote default 20 | 62 | + private final float STEP_THRESHOLD = 18f; // default 40, cosmote default 20 |
64 | private final int STEP_DELAY_NS = 250000000; | 63 | private final int STEP_DELAY_NS = 250000000; |
65 | private int accelRingCounter = 0; | 64 | private int accelRingCounter = 0; |
66 | private float[] accelRingX = new float[ACCEL_RING_SIZE]; | 65 | private float[] accelRingX = new float[ACCEL_RING_SIZE]; |
... | @@ -70,6 +69,7 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -70,6 +69,7 @@ public class WarplyHealthService extends Service implements SensorEventListener |
70 | private float[] velRing = new float[VEL_RING_SIZE]; | 69 | private float[] velRing = new float[VEL_RING_SIZE]; |
71 | private long lastStepTimeNs = 0; | 70 | private long lastStepTimeNs = 0; |
72 | private float oldVelocityEstimate = 0; | 71 | private float oldVelocityEstimate = 0; |
72 | + private double mPacingMeters = 0.0d; | ||
73 | 73 | ||
74 | // =========================================================== | 74 | // =========================================================== |
75 | // Contructors | 75 | // Contructors |
... | @@ -86,7 +86,7 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -86,7 +86,7 @@ public class WarplyHealthService extends Service implements SensorEventListener |
86 | 86 | ||
87 | mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); | 87 | mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); |
88 | mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); | 88 | mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); |
89 | - registerStepSensor(); | 89 | + WarplyManager.getPacingDetails(new PacingDetailsRequest(), mPacingCallback); |
90 | } | 90 | } |
91 | 91 | ||
92 | @RequiresApi(api = Build.VERSION_CODES.O) | 92 | @RequiresApi(api = Build.VERSION_CODES.O) |
... | @@ -142,6 +142,7 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -142,6 +142,7 @@ public class WarplyHealthService extends Service implements SensorEventListener |
142 | // WarpUtils.setStepsMetersCounter(this, 0.0d); | 142 | // WarpUtils.setStepsMetersCounter(this, 0.0d); |
143 | WarplyManagerHelper.mStepsWebview = 0; | 143 | WarplyManagerHelper.mStepsWebview = 0; |
144 | WarplyManagerHelper.mMetersWebview = 0.0d; | 144 | WarplyManagerHelper.mMetersWebview = 0.0d; |
145 | + mPacingMeters = 0.0d; | ||
145 | sendSteps(); | 146 | sendSteps(); |
146 | } | 147 | } |
147 | 148 | ||
... | @@ -211,14 +212,17 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -211,14 +212,17 @@ public class WarplyHealthService extends Service implements SensorEventListener |
211 | if (velocityEstimate > STEP_THRESHOLD | 212 | if (velocityEstimate > STEP_THRESHOLD |
212 | && oldVelocityEstimate <= STEP_THRESHOLD | 213 | && oldVelocityEstimate <= STEP_THRESHOLD |
213 | && (timeNs - lastStepTimeNs > STEP_DELAY_NS)) { | 214 | && (timeNs - lastStepTimeNs > STEP_DELAY_NS)) { |
214 | - WarplyManagerHelper.mSteps++; | ||
215 | - WarpUtils.setStepsCounter(this, WarplyManagerHelper.mSteps); | ||
216 | // mStepsAll++; | 215 | // mStepsAll++; |
217 | WarplyManagerHelper.mStepsWebview++; | 216 | WarplyManagerHelper.mStepsWebview++; |
217 | + WarplyManagerHelper.mSteps += WarplyManagerHelper.mStepsWebview; | ||
218 | + WarpUtils.setStepsCounter(this, WarplyManagerHelper.mSteps); | ||
218 | WarplyManagerHelper.mMetersWebview = (WarplyManagerHelper.mStepsWebview * 0.762); | 219 | WarplyManagerHelper.mMetersWebview = (WarplyManagerHelper.mStepsWebview * 0.762); |
219 | HealthEventModel healthSteps = new HealthEventModel(); | 220 | HealthEventModel healthSteps = new HealthEventModel(); |
220 | -// healthSteps.setMeters((mStepsAll * 0.762)); | 221 | +// healthSteps.setMeters((mStepsAll * 0.762)); // 16/09/2022 |
221 | - healthSteps.setMeters(WarplyManagerHelper.mMetersWebview); | 222 | +// healthSteps.setMeters(WarplyManagerHelper.mMetersWebview); // 20/09/2022 |
223 | + double eventMeters = 0.0d; | ||
224 | + eventMeters = mPacingMeters + WarplyManagerHelper.mMetersWebview; | ||
225 | + healthSteps.setMeters(eventMeters); | ||
222 | EventBus.getDefault().post(new WarplyEventBusManager(healthSteps)); | 226 | EventBus.getDefault().post(new WarplyEventBusManager(healthSteps)); |
223 | // WarpUtils.setStepsMetersCounter(this, (mStepsAll * 0.762)); | 227 | // WarpUtils.setStepsMetersCounter(this, (mStepsAll * 0.762)); |
224 | 228 | ||
... | @@ -288,4 +292,17 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -288,4 +292,17 @@ public class WarplyHealthService extends Service implements SensorEventListener |
288 | }); | 292 | }); |
289 | } | 293 | } |
290 | } | 294 | } |
295 | + | ||
296 | + private CallbackReceiver<PacingDetails> mPacingCallback = new CallbackReceiver<PacingDetails>() { | ||
297 | + @Override | ||
298 | + public void onSuccess(PacingDetails result) { | ||
299 | + mPacingMeters = result.getMeters().getDay().getValue(); | ||
300 | + registerStepSensor(); | ||
301 | + } | ||
302 | + | ||
303 | + @Override | ||
304 | + public void onFailure(int errorCode) { | ||
305 | + registerStepSensor(); | ||
306 | + } | ||
307 | + }; | ||
291 | } | 308 | } | ... | ... |
... | @@ -530,7 +530,7 @@ public class WarpView extends WebView { | ... | @@ -530,7 +530,7 @@ public class WarpView extends WebView { |
530 | }); | 530 | }); |
531 | WarplyManagerHelper.mStepsWebview = 0; | 531 | WarplyManagerHelper.mStepsWebview = 0; |
532 | WarplyManagerHelper.mMetersWebview = 0.0d; | 532 | WarplyManagerHelper.mMetersWebview = 0.0d; |
533 | - WarpViewActivity.getMetersHandler().postDelayed(this, 1000); | 533 | + WarpViewActivity.getMetersHandler().postDelayed(this, 300); |
534 | } | 534 | } |
535 | }, 1000); | 535 | }, 1000); |
536 | 536 | ... | ... |
... | @@ -99,7 +99,8 @@ | ... | @@ -99,7 +99,8 @@ |
99 | android:layout_below="@+id/tv_expired_title" | 99 | android:layout_below="@+id/tv_expired_title" |
100 | android:layout_marginHorizontal="8dp" | 100 | android:layout_marginHorizontal="8dp" |
101 | android:layout_marginTop="24dp" | 101 | android:layout_marginTop="24dp" |
102 | - android:orientation="vertical" /> | 102 | + android:orientation="vertical" |
103 | + android:overScrollMode="never"/> | ||
103 | 104 | ||
104 | <LinearLayout | 105 | <LinearLayout |
105 | android:id="@+id/ll_show_more_expired" | 106 | android:id="@+id/ll_show_more_expired" |
... | @@ -170,7 +171,8 @@ | ... | @@ -170,7 +171,8 @@ |
170 | android:layout_below="@+id/tv_shared_title" | 171 | android:layout_below="@+id/tv_shared_title" |
171 | android:layout_marginHorizontal="8dp" | 172 | android:layout_marginHorizontal="8dp" |
172 | android:layout_marginTop="24dp" | 173 | android:layout_marginTop="24dp" |
173 | - android:orientation="vertical" /> | 174 | + android:orientation="vertical" |
175 | + android:overScrollMode="never"/> | ||
174 | 176 | ||
175 | <LinearLayout | 177 | <LinearLayout |
176 | android:id="@+id/ll_show_more_shared" | 178 | android:id="@+id/ll_show_more_shared" | ... | ... |
-
Please register or login to post a comment