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-10-03 19:23:46 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
59332a28444ec12056656cc42f3126911271e5db
59332a28
1 parent
4a8f9bbc
new keys
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
81 additions
and
42 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/activities/BaseFragmentActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/MoreForYouActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/callbacks/NewCampaignsHook.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventCampaignCouponService.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventQuestionnaireService.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MergedGiftsAdapter.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MoreCampaignAdapter.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MoreContextualAdapter.java
warply_android_sdk/src/main/res/layout/activity_gifts_for_you.xml
warply_android_sdk/src/main/res/layout/activity_more_for_you.xml
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
59332a2
...
...
@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public
void
onWarplyReady
()
{
if
(!
WarplyDBHelper
.
getInstance
(
SplashActivity
.
this
).
isTableNotEmpty
(
"auth"
))
{
WarplyManager
.
getCosmoteUser
(
new
WarplyCosmoteUserRequest
()
.
setGuid
(
"700000
0831
"
),
//6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons
.
setGuid
(
"700000
1315
"
),
//6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons
mLoginReceiver
);
}
else
{
startNextActivity
();
...
...
warply_android_sdk/build.gradle
View file @
59332a2
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4-cosbeta8
0
'
PUBLISH_VERSION
=
'4.5.4-cosbeta8
1
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/BaseFragmentActivity.java
View file @
59332a2
...
...
@@ -15,6 +15,7 @@ import androidx.fragment.app.FragmentActivity;
import
com.google.android.material.bottomnavigation.BottomNavigationView
;
import
com.google.android.material.navigation.NavigationBarView
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
ly.warp.sdk.R
;
...
...
@@ -183,9 +184,9 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
}
};
private
CallbackReceiver
<
CampaignList
>
mCampaignsCallback
=
new
CallbackReceiver
<
CampaignList
>()
{
private
CallbackReceiver
<
ArrayList
<
Campaign
>>
mCampaignsCallback
=
new
CallbackReceiver
<
ArrayList
<
Campaign
>
>()
{
@Override
public
void
onSuccess
(
CampaignList
result
)
{
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
WarplyManager
.
getUserCouponsWithCouponsets
(
new
WarplyUserCouponsRequest
(),
mUserCouponsReceiver
);
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
View file @
59332a2
...
...
@@ -21,6 +21,8 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
import
org.greenrobot.eventbus.EventBus
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
io.github.inflationx.viewpump.ViewPumpContextWrapper
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
...
...
@@ -290,9 +292,9 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
}
};
private
CallbackReceiver
<
CampaignList
>
mCampaignsCallback
=
new
CallbackReceiver
<
CampaignList
>()
{
private
CallbackReceiver
<
ArrayList
<
Campaign
>>
mCampaignsCallback
=
new
CallbackReceiver
<
ArrayList
<
Campaign
>
>()
{
@Override
public
void
onSuccess
(
CampaignList
result
)
{
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventCampaignService
.
class
).
build
();
WorkManager
.
getInstance
(
CouponsetInfoActivity
.
this
).
enqueue
(
mywork
);
// Thread.currentThread().interrupt();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
View file @
59332a2
This diff is collapsed. Click to expand it.
warply_android_sdk/src/main/java/ly/warp/sdk/activities/MoreForYouActivity.java
View file @
59332a2
This diff is collapsed. Click to expand it.
warply_android_sdk/src/main/java/ly/warp/sdk/io/callbacks/NewCampaignsHook.java
View file @
59332a2
...
...
@@ -27,6 +27,8 @@ package ly.warp.sdk.io.callbacks;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.CampaignList
;
import
ly.warp.sdk.io.models.NewCampaign
;
...
...
@@ -38,10 +40,10 @@ import ly.warp.sdk.io.models.NewCampaignList;
public
class
NewCampaignsHook
implements
CallbackReceiver
<
JSONObject
>
{
private
final
CallbackReceiver
<
CampaignList
>
mListener
;
private
final
CallbackReceiver
<
ArrayList
<
Campaign
>
>
mListener
;
private
final
String
mRequestSignature
;
public
NewCampaignsHook
(
CallbackReceiver
<
CampaignList
>
listener
,
String
requestSignature
)
{
public
NewCampaignsHook
(
CallbackReceiver
<
ArrayList
<
Campaign
>
>
listener
,
String
requestSignature
)
{
this
.
mListener
=
listener
;
this
.
mRequestSignature
=
requestSignature
;
}
...
...
@@ -52,7 +54,7 @@ public class NewCampaignsHook implements CallbackReceiver<JSONObject> {
int
status
=
result
.
optInt
(
"status"
,
2
);
if
(
status
==
1
)
{
NewCampaignList
cmpList
=
new
NewCampaignList
(
result
,
mRequestSignature
);
CampaignList
tempCampaigns
=
new
CampaignList
();
ArrayList
<
Campaign
>
tempCampaigns
=
new
ArrayList
<>
();
for
(
NewCampaign
newCamp
:
cmpList
)
{
Campaign
camp
=
new
Campaign
();
camp
.
setIndexUrl
(
newCamp
.
getIndexUrl
());
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventCampaignCouponService.java
View file @
59332a2
...
...
@@ -10,9 +10,12 @@ import androidx.work.WorkerParameters;
import
org.greenrobot.eventbus.EventBus
;
import
java.util.ArrayList
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.activities.CouponsetInfoActivity
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.CampaignList
;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.io.models.CouponsEventModel
;
...
...
@@ -55,9 +58,9 @@ public class EventCampaignCouponService extends Worker {
}
};
private
CallbackReceiver
<
CampaignList
>
mCampaignsCallback
=
new
CallbackReceiver
<
CampaignList
>()
{
private
CallbackReceiver
<
ArrayList
<
Campaign
>>
mCampaignsCallback
=
new
CallbackReceiver
<
ArrayList
<
Campaign
>
>()
{
@Override
public
void
onSuccess
(
CampaignList
result
)
{
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
LoyaltyEventModel
campaignsAdded
=
new
LoyaltyEventModel
();
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
campaignsAdded
));
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventQuestionnaireService.java
View file @
59332a2
...
...
@@ -8,8 +8,11 @@ import androidx.work.WorkerParameters;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.CampaignList
;
import
ly.warp.sdk.io.models.Consumer
;
import
ly.warp.sdk.io.request.WarplyConsumerRequest
;
...
...
@@ -45,9 +48,9 @@ public class EventQuestionnaireService extends Worker {
}
}
WarplyManager
.
getCampaigns
(
new
WarplyGetCampaignsRequest
().
setLanguage
(
"en"
),
new
CallbackReceiver
<
CampaignList
>()
{
WarplyManager
.
getCampaigns
(
new
WarplyGetCampaignsRequest
().
setLanguage
(
"en"
),
new
CallbackReceiver
<
ArrayList
<
Campaign
>
>()
{
@Override
public
void
onSuccess
(
CampaignList
result
)
{
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
WarpUtils
.
log
(
"SUCCESS_QUESTIONNAIRE_EVENT"
);
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.java
View file @
59332a2
...
...
@@ -67,7 +67,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
eventMeters
=
0.0d
;
private
double
eventMeters
=
0.0d
,
pacingMeters
=
0.0d
;
private
int
sumSteps
=
0
;
// ===========================================================
...
...
@@ -85,10 +85,11 @@ public class WarplyHealthService extends Service implements SensorEventListener
mSensorManager
=
(
SensorManager
)
getSystemService
(
Context
.
SENSOR_SERVICE
);
mSensor
=
mSensorManager
.
getDefaultSensor
(
Sensor
.
TYPE_ACCELEROMETER
);
registerStepSensor
();
// registerStepSensor();
WarplyManager
.
getPacingDetails
(
new
PacingDetailsRequest
(),
mPacingCallback
);
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
O
)
//
@RequiresApi(api = Build.VERSION_CODES.O)
@Override
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
NotificationManager
notificationManager
=
(
NotificationManager
)
getSystemService
(
NOTIFICATION_SERVICE
);
...
...
@@ -141,6 +142,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
WarplyManagerHelper
.
mStepsWebview
=
0
;
WarplyManagerHelper
.
mMetersWebview
=
0.0d
;
eventMeters
=
0.0d
;
pacingMeters
=
0.0d
;
sumSteps
=
0
;
sendSteps
();
}
...
...
@@ -222,8 +224,8 @@ public class WarplyHealthService extends Service implements SensorEventListener
// healthSteps.setMeters((mStepsAll * 0.762)); // 16/09/2022
// healthSteps.setMeters(WarplyManagerHelper.mMetersWebview); // 20/09/2022
eventMeters
=
(
sumSteps
*
0.762
);
WarpUtils
.
log
(
"WIDGET_METERS: "
+
String
.
valueOf
(
eventMeters
));
healthSteps
.
setMeters
(
eventMeters
);
WarpUtils
.
log
(
"WIDGET_METERS: "
+
String
.
valueOf
(
pacingMeters
+
eventMeters
));
healthSteps
.
setMeters
(
pacingMeters
+
eventMeters
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
healthSteps
));
lastStepTimeNs
=
timeNs
;
...
...
@@ -292,4 +294,17 @@ public class WarplyHealthService extends Service implements SensorEventListener
});
}
}
private
CallbackReceiver
<
PacingDetails
>
mPacingCallback
=
new
CallbackReceiver
<
PacingDetails
>()
{
@Override
public
void
onSuccess
(
PacingDetails
result
)
{
pacingMeters
=
result
.
getMeters
().
getDay
().
getValue
();
registerStepSensor
();
}
@Override
public
void
onFailure
(
int
errorCode
)
{
}
};
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MergedGiftsAdapter.java
View file @
59332a2
...
...
@@ -36,12 +36,13 @@ import ly.warp.sdk.utils.WarplyManagerHelper;
public
class
MergedGiftsAdapter
extends
RecyclerView
.
Adapter
<
MergedGiftsAdapter
.
MergedGiftsViewHolder
>
{
private
Context
mContext
;
private
ArrayList
<
MergedGifts
>
mMergedGifts
;
private
ArrayList
<
MergedGifts
>
mMergedGifts
=
new
ArrayList
<>()
;
private
final
PublishSubject
<
MergedGifts
>
onClickSubject
=
PublishSubject
.
create
();
public
MergedGiftsAdapter
(
Context
mContext
,
ArrayList
<
MergedGifts
>
mergedgifts
)
{
this
.
mContext
=
mContext
;
this
.
mMergedGifts
=
mergedgifts
;
this
.
mMergedGifts
.
clear
();
this
.
mMergedGifts
.
addAll
(
mergedgifts
);
}
public
class
MergedGiftsViewHolder
extends
RecyclerView
.
ViewHolder
{
...
...
@@ -64,6 +65,11 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.
return
mMergedGifts
.
size
();
}
@Override
public
long
getItemId
(
int
position
)
{
// return super.getItemId(position);
return
Double
.
valueOf
(
Math
.
random
()).
longValue
();
}
public
MergedGifts
getItem
(
int
id
)
{
return
mMergedGifts
.
get
(
id
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MoreCampaignAdapter.java
View file @
59332a2
...
...
@@ -25,12 +25,13 @@ import ly.warp.sdk.io.models.Campaign;
public
class
MoreCampaignAdapter
extends
RecyclerView
.
Adapter
<
MoreCampaignAdapter
.
MoreCampaignViewHolder
>
{
private
Context
mContext
;
private
ArrayList
<
Campaign
>
mCampaigns
;
private
ArrayList
<
Campaign
>
mCampaigns
=
new
ArrayList
<>()
;
private
final
PublishSubject
<
Campaign
>
onClickSubject
=
PublishSubject
.
create
();
public
MoreCampaignAdapter
(
Context
mContext
,
ArrayList
<
Campaign
>
campaignList
)
{
this
.
mContext
=
mContext
;
this
.
mCampaigns
=
campaignList
;
this
.
mCampaigns
.
clear
();
this
.
mCampaigns
.
addAll
(
campaignList
);
}
public
class
MoreCampaignViewHolder
extends
RecyclerView
.
ViewHolder
{
...
...
@@ -67,6 +68,12 @@ public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapte
}
@Override
public
long
getItemId
(
int
position
)
{
// return super.getItemId(position);
return
Double
.
valueOf
(
Math
.
random
()).
longValue
();
}
@Override
public
MoreCampaignViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
View
itemView
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MoreContextualAdapter.java
View file @
59332a2
...
...
@@ -26,12 +26,13 @@ import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
public
class
MoreContextualAdapter
extends
RecyclerView
.
Adapter
<
MoreContextualAdapter
.
MoreContextualViewHolder
>
{
private
Context
mContext
;
private
ArrayList
<
LoyaltyContextualOfferModel
>
mCampaigns
;
private
ArrayList
<
LoyaltyContextualOfferModel
>
mCampaigns
=
new
ArrayList
<>()
;
private
final
PublishSubject
<
LoyaltyContextualOfferModel
>
onClickSubject
=
PublishSubject
.
create
();
public
MoreContextualAdapter
(
Context
mContext
,
ArrayList
<
LoyaltyContextualOfferModel
>
campaignList
)
{
this
.
mContext
=
mContext
;
this
.
mCampaigns
=
campaignList
;
this
.
mCampaigns
.
clear
();
this
.
mCampaigns
.
addAll
(
campaignList
);
}
public
class
MoreContextualViewHolder
extends
RecyclerView
.
ViewHolder
{
...
...
@@ -56,6 +57,11 @@ public class MoreContextualAdapter extends RecyclerView.Adapter<MoreContextualAd
return
mCampaigns
.
size
();
}
@Override
public
long
getItemId
(
int
position
)
{
// return super.getItemId(position);
return
Double
.
valueOf
(
Math
.
random
()).
longValue
();
}
public
LoyaltyContextualOfferModel
getItem
(
int
id
)
{
return
mCampaigns
.
get
(
id
);
...
...
warply_android_sdk/src/main/res/layout/activity_gifts_for_you.xml
View file @
59332a2
...
...
@@ -40,7 +40,7 @@
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<
Relative
Layout
<
Linear
Layout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/shape_cos_loyalty_no_border"
...
...
@@ -97,7 +97,6 @@
android:id=
"@+id/rv_merged_gifts"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_gifts_popup"
android:layout_marginTop=
"4dp"
android:clipToPadding=
"false"
android:orientation=
"vertical"
...
...
@@ -213,5 +212,5 @@
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/tv_coupons_title" />-->
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
</
Relative
Layout>
</
Linear
Layout>
</LinearLayout>
\ No newline at end of file
...
...
warply_android_sdk/src/main/res/layout/activity_more_for_you.xml
View file @
59332a2
<?xml version="1.0" encoding="utf-8"?>
<
Relative
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
Linear
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/white"
android:fillViewport=
"true"
>
android:fillViewport=
"true"
android:orientation=
"vertical"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_more_header"
...
...
@@ -39,10 +40,9 @@
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<
Relative
Layout
<
Linear
Layout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_below=
"@+id/cl_more_header"
android:background=
"@drawable/shape_cos_loyalty_no_border"
android:orientation=
"vertical"
>
...
...
@@ -52,7 +52,7 @@
android:fillViewport=
"true"
android:overScrollMode=
"never"
>
<
Relative
Layout
<
Linear
Layout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
...
...
@@ -107,21 +107,19 @@
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_more_items"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_below=
"@+id/ll_more_popup"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"4dp"
android:clipToPadding=
"false"
android:orientation=
"vertical"
android:overScrollMode=
"never"
android:paddingTop=
"44dp"
android:paddingBottom=
"24dp"
android:overScrollMode=
"never"
android:visibility=
"gone"
/>
<LinearLayout
android:id=
"@+id/ll_research_items"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_more_popup"
android:orientation=
"vertical"
android:paddingTop=
"44dp"
android:visibility=
"gone"
>
...
...
@@ -151,7 +149,6 @@
android:id=
"@+id/ll_exclusive_items"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_research_items"
android:orientation=
"vertical"
android:visibility=
"gone"
>
...
...
@@ -180,7 +177,6 @@
android:id=
"@+id/ll_contest_items"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_exclusive_items"
android:orientation=
"vertical"
android:visibility=
"gone"
>
...
...
@@ -209,7 +205,6 @@
android:id=
"@+id/ll_contextual_items"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_contest_items"
android:orientation=
"vertical"
android:visibility=
"gone"
>
...
...
@@ -233,7 +228,7 @@
android:overScrollMode=
"never"
android:paddingBottom=
"4dp"
/>
</LinearLayout>
</
Relative
Layout>
</
Linear
Layout>
</ScrollView>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
</LinearLayout>
</LinearLayout>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment