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
2024-10-31 12:46:36 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
05e7e370725509f4ad3e6cdb5903bbb644c4361c
05e7e370
1 parent
f8874e30
minor addition and fix
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
4 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ContextualActivity.java
warply_android_sdk/src/main/res/layout/activity_contextual.xml
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ContextualActivity.java
View file @
05e7e37
...
...
@@ -10,6 +10,7 @@ import android.view.View;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
androidx.appcompat.app.AlertDialog
;
...
...
@@ -61,11 +62,12 @@ public class ContextualActivity extends Activity implements View.OnClickListener
private
LoyaltyContextualOfferModel
mCCMS
=
new
LoyaltyContextualOfferModel
();
private
LinearLayout
mLlActivateOffer
,
mLlTerms
;
private
Consumer
mConsumer
;
private
boolean
mIsTermsPressed
=
false
;
private
boolean
mIsTermsPressed
=
false
,
mIsActivatePressed
=
false
;
private
String
mSender
=
""
;
private
AlertDialog
mAlertDialogAskActivate
,
mAlertDialogErrorActivating
,
mAlertDialogSuccessActivating
;
private
Campaign
mLoyalty
;
private
RelativeLayout
mPbLoading
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -98,6 +100,8 @@ public class ContextualActivity extends Activity implements View.OnClickListener
mTvTermsValue
=
findViewById
(
R
.
id
.
tv_terms_value
);
mFontHeader
=
findViewById
(
R
.
id
.
textView3
);
mFontActivateButton
=
findViewById
(
R
.
id
.
tv_activate_button
);
mPbLoading
=
findViewById
(
R
.
id
.
pb_loading
);
mPbLoading
.
setOnTouchListener
((
v
,
event
)
->
true
);
WarpUtils
.
renderCustomFont
(
this
,
R
.
font
.
bt_cosmo_bold
,
mFontHeader
,
mTvCampaignTitle
);
WarpUtils
.
renderCustomFont
(
this
,
R
.
font
.
peridot_regular
,
mTvCampaignSubtitle
,
mTvTermsValue
);
WarpUtils
.
renderCustomFont
(
this
,
R
.
font
.
peridot_semi_bold
,
mFontActivateButton
);
...
...
@@ -109,6 +113,7 @@ public class ContextualActivity extends Activity implements View.OnClickListener
@Override
public
void
onResume
()
{
super
.
onResume
();
mIsActivatePressed
=
false
;
WarplyAnalyticsManager
.
logTrackersEvent
(
this
,
"screen"
,
"ContextualScreen"
);
// new Thread(() -> {
...
...
@@ -127,7 +132,11 @@ public class ContextualActivity extends Activity implements View.OnClickListener
return
;
}
if
(
view
.
getId
()
==
R
.
id
.
ll_activate_button
)
{
showActivationDialog
();
if
(!
mIsActivatePressed
)
{
mIsActivatePressed
=
true
;
showActivationDialog
();
}
return
;
}
if
(
view
.
getId
()
==
R
.
id
.
ll_terms_inner
)
{
...
...
@@ -255,9 +264,11 @@ public class ContextualActivity extends Activity implements View.OnClickListener
.
setTitle
(
R
.
string
.
cos_dlg_activate_telco_title
)
.
setMessage
(
String
.
format
(
getString
(
R
.
string
.
cos_dlg_activate_telco_subtitle2
),
msisdn
))
.
setPositiveButton
(
R
.
string
.
cos_dlg_positive_button
,
(
dialogPositive
,
whichPositive
)
->
{
mPbLoading
.
setVisibility
(
View
.
VISIBLE
);
activateGift
();
})
.
setNegativeButton
(
R
.
string
.
cos_dlg_negative_button2
,
(
dialogNegative
,
whichNegative
)
->
{
mIsActivatePressed
=
false
;
dialogNegative
.
dismiss
();
})
.
show
();
...
...
@@ -277,6 +288,7 @@ public class ContextualActivity extends Activity implements View.OnClickListener
.
setTitle
(
R
.
string
.
cos_dlg_error_title
)
.
setMessage
(
R
.
string
.
cos_dlg_error_subtitle
)
.
setPositiveButton
(
R
.
string
.
cos_dlg_positive_button2
,
(
dialogPositive
,
whichPositive
)
->
{
mIsActivatePressed
=
false
;
dialogPositive
.
dismiss
();
})
.
show
();
...
...
@@ -301,6 +313,7 @@ public class ContextualActivity extends Activity implements View.OnClickListener
.
setMessage
(
R
.
string
.
cos_dlg_activate_success_subtitle
)
.
setPositiveButton
(
R
.
string
.
cos_dlg_positive_button2
,
(
dialogPositive
,
whichPositive
)
->
{
if
(!
isFinishing
())
{
mIsActivatePressed
=
false
;
dialogPositive
.
dismiss
();
onBackPressed
();
}
...
...
@@ -335,16 +348,22 @@ public class ContextualActivity extends Activity implements View.OnClickListener
int
status
=
result
.
optInt
(
"status"
,
2
);
runOnUiThread
(()
->
{
mPbLoading
.
setVisibility
(
View
.
GONE
);
if
(
status
==
1
)
{
successActivatingDialog
();
}
else
}
else
{
errorActivatingDialog
();
}
});
}
@Override
public
void
onFailure
(
int
errorCode
)
{
runOnUiThread
(()
->
errorActivatingDialog
());
mIsActivatePressed
=
false
;
runOnUiThread
(()
->
{
mPbLoading
.
setVisibility
(
View
.
GONE
);
errorActivatingDialog
();
});
// errorActivatingDialog();
}
};
...
...
warply_android_sdk/src/main/res/layout/activity_contextual.xml
View file @
05e7e37
...
...
@@ -169,4 +169,25 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<RelativeLayout
android:id=
"@+id/pb_loading"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/transparent"
android:visibility=
"gone"
tools:visibility=
"visible"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
>
<ProgressBar
android:layout_width=
"48dp"
android:layout_height=
"48dp"
android:layout_centerInParent=
"true"
android:indeterminate=
"true"
android:indeterminateTint=
"@color/cos_green5"
android:indeterminateTintMode=
"src_atop"
/>
</RelativeLayout>
</RelativeLayout>
...
...
Please
register
or
login
to post a comment