Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_android_sdk_maven_plugin
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Panagiotis Triantafyllou
2022-09-21 15:13:10 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a9eb43a5a75910ae609d3df5f21c4ecae33ec1e2
a9eb43a5
1 parent
111cc51b
pacing fixes
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
14 deletions
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
warply_android_sdk/src/main/res/layout/activity_loyalty_analysis.xml
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
a9eb43a
...
...
@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public
void
onWarplyReady
()
{
if
(!
WarplyDBHelper
.
getInstance
(
SplashActivity
.
this
).
isTableNotEmpty
(
"auth"
))
{
WarplyManager
.
getCosmoteUser
(
new
WarplyCosmoteUserRequest
()
.
setGuid
(
"
6012049139
"
),
//6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons
.
setGuid
(
"
7000000831
"
),
//6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons
mLoginReceiver
);
}
else
{
startNextActivity
();
...
...
warply_android_sdk/build.gradle
View file @
a9eb43a
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4-cosbeta7
0
'
PUBLISH_VERSION
=
'4.5.4-cosbeta7
1
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.java
View file @
a9eb43a
...
...
@@ -27,12 +27,11 @@ import java.util.Date;
import
java.util.Locale
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.activities.BaseFragmentActivity
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.callbacks.WarplyHealthCallback
;
import
ly.warp.sdk.io.models.CouponsEventModel
;
import
ly.warp.sdk.io.models.HealthEventModel
;
import
ly.warp.sdk.io.models.PacingDetails
;
import
ly.warp.sdk.io.request.PacingCalculateRequest
;
import
ly.warp.sdk.io.request.PacingDetailsRequest
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
...
...
@@ -60,7 +59,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
private
final
int
ACCEL_RING_SIZE
=
50
;
private
final
int
VEL_RING_SIZE
=
10
;
// change this threshold according to your sensitivity preferences
private
final
float
STEP_THRESHOLD
=
1
0
f
;
// default 40, cosmote default 20
private
final
float
STEP_THRESHOLD
=
1
8
f
;
// default 40, cosmote default 20
private
final
int
STEP_DELAY_NS
=
250000000
;
private
int
accelRingCounter
=
0
;
private
float
[]
accelRingX
=
new
float
[
ACCEL_RING_SIZE
];
...
...
@@ -70,6 +69,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
private
float
[]
velRing
=
new
float
[
VEL_RING_SIZE
];
private
long
lastStepTimeNs
=
0
;
private
float
oldVelocityEstimate
=
0
;
private
double
mPacingMeters
=
0.0d
;
// ===========================================================
// Contructors
...
...
@@ -86,7 +86,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
mSensorManager
=
(
SensorManager
)
getSystemService
(
Context
.
SENSOR_SERVICE
);
mSensor
=
mSensorManager
.
getDefaultSensor
(
Sensor
.
TYPE_ACCELEROMETER
);
registerStepSensor
(
);
WarplyManager
.
getPacingDetails
(
new
PacingDetailsRequest
(),
mPacingCallback
);
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
O
)
...
...
@@ -142,6 +142,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
// WarpUtils.setStepsMetersCounter(this, 0.0d);
WarplyManagerHelper
.
mStepsWebview
=
0
;
WarplyManagerHelper
.
mMetersWebview
=
0.0d
;
mPacingMeters
=
0.0d
;
sendSteps
();
}
...
...
@@ -211,14 +212,17 @@ public class WarplyHealthService extends Service implements SensorEventListener
if
(
velocityEstimate
>
STEP_THRESHOLD
&&
oldVelocityEstimate
<=
STEP_THRESHOLD
&&
(
timeNs
-
lastStepTimeNs
>
STEP_DELAY_NS
))
{
WarplyManagerHelper
.
mSteps
++;
WarpUtils
.
setStepsCounter
(
this
,
WarplyManagerHelper
.
mSteps
);
// mStepsAll++;
WarplyManagerHelper
.
mStepsWebview
++;
WarplyManagerHelper
.
mSteps
+=
WarplyManagerHelper
.
mStepsWebview
;
WarpUtils
.
setStepsCounter
(
this
,
WarplyManagerHelper
.
mSteps
);
WarplyManagerHelper
.
mMetersWebview
=
(
WarplyManagerHelper
.
mStepsWebview
*
0.762
);
HealthEventModel
healthSteps
=
new
HealthEventModel
();
// healthSteps.setMeters((mStepsAll * 0.762));
healthSteps
.
setMeters
(
WarplyManagerHelper
.
mMetersWebview
);
// healthSteps.setMeters((mStepsAll * 0.762)); // 16/09/2022
// healthSteps.setMeters(WarplyManagerHelper.mMetersWebview); // 20/09/2022
double
eventMeters
=
0.0d
;
eventMeters
=
mPacingMeters
+
WarplyManagerHelper
.
mMetersWebview
;
healthSteps
.
setMeters
(
eventMeters
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
healthSteps
));
// WarpUtils.setStepsMetersCounter(this, (mStepsAll * 0.762));
...
...
@@ -288,4 +292,17 @@ public class WarplyHealthService extends Service implements SensorEventListener
});
}
}
private
CallbackReceiver
<
PacingDetails
>
mPacingCallback
=
new
CallbackReceiver
<
PacingDetails
>()
{
@Override
public
void
onSuccess
(
PacingDetails
result
)
{
mPacingMeters
=
result
.
getMeters
().
getDay
().
getValue
();
registerStepSensor
();
}
@Override
public
void
onFailure
(
int
errorCode
)
{
registerStepSensor
();
}
};
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
View file @
a9eb43a
...
...
@@ -530,7 +530,7 @@ public class WarpView extends WebView {
});
WarplyManagerHelper
.
mStepsWebview
=
0
;
WarplyManagerHelper
.
mMetersWebview
=
0.0d
;
WarpViewActivity
.
getMetersHandler
().
postDelayed
(
this
,
10
00
);
WarpViewActivity
.
getMetersHandler
().
postDelayed
(
this
,
3
00
);
}
},
1000
);
...
...
warply_android_sdk/src/main/res/layout/activity_loyalty_analysis.xml
View file @
a9eb43a
...
...
@@ -99,7 +99,8 @@
android:layout_below=
"@+id/tv_expired_title"
android:layout_marginHorizontal=
"8dp"
android:layout_marginTop=
"24dp"
android:orientation=
"vertical"
/>
android:orientation=
"vertical"
android:overScrollMode=
"never"
/>
<LinearLayout
android:id=
"@+id/ll_show_more_expired"
...
...
@@ -170,7 +171,8 @@
android:layout_below=
"@+id/tv_shared_title"
android:layout_marginHorizontal=
"8dp"
android:layout_marginTop=
"24dp"
android:orientation=
"vertical"
/>
android:orientation=
"vertical"
android:overScrollMode=
"never"
/>
<LinearLayout
android:id=
"@+id/ll_show_more_shared"
...
...
Please
register
or
login
to post a comment