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
2025-01-14 18:50:07 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
23d0f10c44af7afc7789b48dc43ea377f4d25099
23d0f10c
1 parent
36eca024
changes for cosmote pass part1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
360 additions
and
19 deletions
warply_android_sdk/src/main/AndroidManifest.xml
warply_android_sdk/src/main/java/ly/warp/sdk/activities/MarketPassActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/MyRewardsFragment.java
warply_android_sdk/src/main/res/drawable/background_white_grey_border.xml
warply_android_sdk/src/main/res/layout/activity_market_pass.xml
warply_android_sdk/src/main/res/values/colors.xml
warply_android_sdk/src/main/res/values/strings.xml
warply_android_sdk/src/main/AndroidManifest.xml
View file @
23d0f10
...
...
@@ -14,11 +14,11 @@
tools:node=
"remove"
/>
<uses-permission
android:name=
"com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA"
/>
<uses-permission
android:name=
"android.permission.CHANGE_WIFI_STATE"
/>
<!-- <uses-permission android:name="android.permission.FOREGROUND_SERVICE_HEALTH" />-->
<!-- <uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />-->
<!-- <uses-permission android:name="android.permission.FOREGROUND_SERVICE_HEALTH" />-->
<!-- <uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />-->
<uses-permission
android:name=
"android.permission.POST_NOTIFICATIONS"
/>
<!-- <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />-->
<!-- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />-->
<!-- <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />-->
<!-- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />-->
<application
android:largeHeap=
"true"
>
<!-- <meta-data-->
...
...
@@ -47,6 +47,12 @@
android:theme=
"@style/SDKAppTheme"
/>
<activity
android:name=
".activities.MarketPassActivity"
android:exported=
"false"
android:screenOrientation=
"portrait"
android:theme=
"@style/SDKAppTheme"
/>
<activity
android:name=
".activities.LoyaltyHistoryActivity"
android:exported=
"false"
android:screenOrientation=
"portrait"
...
...
@@ -179,11 +185,11 @@
<!-- android:stopWithTask="false"-->
<!-- android:process=":warplyHealthService"-->
<!-- <service-->
<!-- android:name=".services.WarplyHealthService"-->
<!-- android:exported="false"-->
<!-- android:foregroundServiceType="health"-->
<!-- android:permission="android.permission.FOREGROUND_SERVICE" />-->
<!-- <service-->
<!-- android:name=".services.WarplyHealthService"-->
<!-- android:exported="false"-->
<!-- android:foregroundServiceType="health"-->
<!-- android:permission="android.permission.FOREGROUND_SERVICE" />-->
<service
android:name=
".services.WarplyBeaconsRangingService"
...
...
@@ -237,14 +243,14 @@
android:name=
".receivers.WarplyInAppNotificationReceiver"
android:exported=
"false"
/>
<!-- <receiver-->
<!-- android:name=".receivers.RestartHealthServiceReceiver"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!--<!– <action android:name="android.intent.action.BOOT_COMPLETED" />–>-->
<!-- <action android:name="android.intent.action.RESTART" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- <receiver-->
<!-- android:name=".receivers.RestartHealthServiceReceiver"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!--<!– <action android:name="android.intent.action.BOOT_COMPLETED" />–>-->
<!-- <action android:name="android.intent.action.RESTART" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- <provider-->
<!-- android:name=".utils.WarplyProvider"-->
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/MarketPassActivity.java
0 → 100644
View file @
23d0f10
package
ly
.
warp
.
sdk
.
activities
;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.Color
;
import
android.graphics.Typeface
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.text.SpannableStringBuilder
;
import
android.text.Spanned
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
androidx.appcompat.app.AlertDialog
;
import
androidx.constraintlayout.widget.ConstraintLayout
;
import
androidx.core.content.res.ResourcesCompat
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.common.BitMatrix
;
import
com.google.zxing.oned.EAN13Writer
;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.Subscribe
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
import
java.io.Serializable
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.Locale
;
import
java.util.Set
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.Coupon
;
import
ly.warp.sdk.io.models.CustomTypefaceSpan
;
import
ly.warp.sdk.io.models.UnifiedCoupon
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
import
ly.warp.sdk.utils.managers.WarplyAnalyticsManager
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
import
ly.warp.sdk.views.adapters.ActiveCouponAdapter
;
import
ly.warp.sdk.views.adapters.MarketCouponAdapter
;
public
class
MarketPassActivity
extends
Activity
implements
View
.
OnClickListener
{
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private
ImageView
mIvBack
,
mIvInfo
,
mIvBarcode
;
private
TextView
mFontHeader
,
mPassHeader
,
mPassSubtitle
,
mTvBarcode
,
mTvPassCount
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_market_pass
);
mIvBack
=
findViewById
(
R
.
id
.
iv_coupons_close
);
mFontHeader
=
findViewById
(
R
.
id
.
textView3
);
mIvInfo
=
findViewById
(
R
.
id
.
iv_coupons_info
);
mPassHeader
=
findViewById
(
R
.
id
.
tv_market_header
);
mPassSubtitle
=
findViewById
(
R
.
id
.
tv_market_subtitle
);
mTvBarcode
=
findViewById
(
R
.
id
.
tv_barcode_value
);
mIvBarcode
=
findViewById
(
R
.
id
.
iv_barcode
);
mTvPassCount
=
findViewById
(
R
.
id
.
tv_total_pass_title
);
//TODO: replace with actual value
String
passValue
=
String
.
format
(
Locale
.
GERMAN
,
"%.00f"
,
30
f
);
SpannableStringBuilder
sBuilder
=
new
SpannableStringBuilder
();
sBuilder
.
append
(
String
.
format
(
getString
(
R
.
string
.
cos_market_pass_coupons_title
),
"30"
));
Typeface
typefaceBold
=
ResourcesCompat
.
getFont
(
this
,
R
.
font
.
peridot_bold
);
CustomTypefaceSpan
typefaceBoldSpan
=
new
CustomTypefaceSpan
(
typefaceBold
);
sBuilder
.
setSpan
(
typefaceBoldSpan
,
31
,
31
+
passValue
.
length
()
+
1
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
);
mTvPassCount
.
setText
(
sBuilder
,
TextView
.
BufferType
.
SPANNABLE
);
//TODO: replace with dynmamic barcode
createBarcodeBitmap
(
"4006381333931"
);
WarpUtils
.
renderCustomFont
(
this
,
R
.
font
.
bt_cosmo_bold
,
mFontHeader
,
mPassHeader
);
WarpUtils
.
renderCustomFont
(
this
,
R
.
font
.
peridot_regular
,
mPassSubtitle
,
mTvBarcode
,
mTvPassCount
);
initViews
();
}
@Override
public
void
onResume
()
{
super
.
onResume
();
WarplyAnalyticsManager
.
logTrackersEvent
(
this
,
"screen"
,
"MarketPassScreen"
);
}
@Override
public
void
onClick
(
View
view
)
{
if
(
view
.
getId
()
==
R
.
id
.
iv_coupons_close
)
{
onBackPressed
();
return
;
}
if
(
view
.
getId
()
==
R
.
id
.
iv_coupons_info
)
{
//TODO
}
}
// ===========================================================
// Methods
// ===========================================================
private
void
initViews
()
{
mIvBack
.
setOnClickListener
(
this
);
mIvInfo
.
setOnClickListener
(
this
);
}
private
void
createBarcodeBitmap
(
String
barcodeString
)
{
EAN13Writer
writer
=
new
EAN13Writer
();
try
{
BitMatrix
bitMatrix
=
writer
.
encode
(
barcodeString
,
BarcodeFormat
.
EAN_13
,
1024
,
512
);
int
width
=
bitMatrix
.
getWidth
();
int
height
=
bitMatrix
.
getHeight
();
Bitmap
bmp
=
Bitmap
.
createBitmap
(
width
,
height
,
Bitmap
.
Config
.
RGB_565
);
for
(
int
x
=
0
;
x
<
width
;
x
++)
{
for
(
int
y
=
0
;
y
<
height
;
y
++)
{
bmp
.
setPixel
(
x
,
y
,
bitMatrix
.
get
(
x
,
y
)
?
Color
.
BLACK
:
Color
.
WHITE
);
}
}
mIvBarcode
.
setImageBitmap
(
bmp
);
mTvBarcode
.
setText
(
barcodeString
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/MyRewardsFragment.java
View file @
23d0f10
...
...
@@ -30,10 +30,10 @@ import java.util.Collections;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.activities.ActiveCouponsActivity
;
import
ly.warp.sdk.activities.ActiveUnifiedCouponsActivity
;
import
ly.warp.sdk.activities.LoyaltyAnalysisActivity
;
import
ly.warp.sdk.activities.LoyaltyHistoryActivity
;
import
ly.warp.sdk.activities.LoyaltyMarketAnalysisActivity
;
import
ly.warp.sdk.activities.MarketPassActivity
;
import
ly.warp.sdk.activities.WarpViewActivity
;
import
ly.warp.sdk.io.models.ActiveBoxCouponEventModel
;
import
ly.warp.sdk.io.models.ActiveDFYCouponEventModel
;
...
...
@@ -614,7 +614,7 @@ public class MyRewardsFragment extends Fragment implements View.OnClickListener
analyticsEvent
.
setParameter
(
"screen"
,
"Loyalty Wallet"
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
analyticsEvent
));
Intent
intent
=
new
Intent
(
getContext
(),
ActiveUnifiedCoupon
sActivity
.
class
);
Intent
intent
=
new
Intent
(
getContext
(),
MarketPas
sActivity
.
class
);
startActivity
(
intent
);
}
});
...
...
warply_android_sdk/src/main/res/drawable/background_white_grey_border.xml
0 → 100644
View file @
23d0f10
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/white"
/>
<stroke
android:width=
"2dp"
android:color=
"@color/cos_light_grey4"
/>
<corners
android:radius=
"16dp"
/>
</shape>
\ No newline at end of file
warply_android_sdk/src/main/res/layout/activity_market_pass.xml
0 → 100644
View file @
23d0f10
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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:id=
"@+id/cl_bill_payment"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/cos_light_grey3"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_bill_header"
android:layout_width=
"match_parent"
android:layout_height=
"64dp"
android:background=
"@color/white"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<ImageView
android:id=
"@+id/iv_coupons_close"
android:layout_width=
"48dp"
android:layout_height=
"48dp"
android:layout_marginStart=
"16dp"
android:scaleType=
"centerInside"
android:src=
"@drawable/ic_back"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/textView3"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:text=
"@string/cos_market_title"
android:textColor=
"@color/cos_light_black"
android:textSize=
"19sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<ImageView
android:id=
"@+id/iv_coupons_info"
android:layout_width=
"48dp"
android:layout_height=
"48dp"
android:layout_marginEnd=
"16dp"
android:padding=
"12dp"
android:scaleType=
"centerInside"
android:src=
"@drawable/ic_info"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<ScrollView
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/cl_bill_header"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<androidx.cardview.widget.CardView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"16dp"
android:layout_marginVertical=
"24dp"
app:cardBackgroundColor=
"@android:color/white"
app:cardCornerRadius=
"16dp"
app:cardElevation=
"3dp"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<RelativeLayout
android:id=
"@+id/rl_parent_pass"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/cos_green13"
android:paddingHorizontal=
"24dp"
android:paddingTop=
"24dp"
>
<TextView
android:id=
"@+id/tv_market_header"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:letterSpacing=
"0.032"
android:text=
"@string/cos_market_pass_title"
android:textColor=
"@color/white"
android:textSize=
"20sp"
/>
<TextView
android:id=
"@+id/tv_market_subtitle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_market_header"
android:layout_marginTop=
"16dp"
android:letterSpacing=
"0.04"
android:text=
"@string/cos_market_pass_subtitle"
android:textColor=
"@color/white"
android:textSize=
"16sp"
app:lineHeight=
"22dp"
/>
<LinearLayout
android:id=
"@+id/ll_barcode"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_market_subtitle"
android:layout_marginTop=
"42dp"
android:layout_marginBottom=
"36dp"
android:background=
"@drawable/background_white_grey_border"
android:gravity=
"center"
android:orientation=
"vertical"
android:paddingVertical=
"12dp"
>
<ImageView
android:id=
"@+id/iv_barcode"
android:layout_width=
"match_parent"
android:layout_height=
"82dp"
android:layout_marginHorizontal=
"8dp"
android:layout_marginTop=
"4dp"
android:scaleType=
"fitXY"
tools:srcCompat=
"@tools:sample/avatars"
/>
<TextView
android:id=
"@+id/tv_barcode_value"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"2dp"
android:letterSpacing=
"0.00074"
android:textColor=
"@color/cos_light_black"
android:textSize=
"18sp"
/>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/rl_parent_pass"
android:background=
"@color/cos_green14"
android:gravity=
"center"
android:paddingVertical=
"16dp"
>
<TextView
android:id=
"@+id/tv_total_pass_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:letterSpacing=
"0.04"
android:includeFontPadding=
"false"
android:textColor=
"@color/white"
android:textSize=
"16sp"
app:lineHeight=
"22dp"
/>
</LinearLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
warply_android_sdk/src/main/res/values/colors.xml
View file @
23d0f10
...
...
@@ -81,4 +81,7 @@
<color
name=
"cos_creme"
>
#FEFCF7
</color>
<color
name=
"cos_skyblue5"
>
#F4F8FB
</color>
<color
name=
"cos_skyblue6"
>
#0099CC
</color>
<color
name=
"cos_green13"
>
#36B32B
</color>
<color
name=
"cos_light_grey4"
>
#DADDE4
</color>
<color
name=
"cos_green14"
>
#006D26
</color>
</resources>
\ No newline at end of file
...
...
warply_android_sdk/src/main/res/values/strings.xml
View file @
23d0f10
...
...
@@ -180,6 +180,9 @@
<string
name=
"cos_dlg_no_shops_positive"
>
Δες το eshop
</string>
<string
name=
"cos_profile_preferences_placeholder"
>
Οι προτιμήσεις μου
</string>
<string
name=
"cos_market_title"
>
SUPERMARKET DEALS
</string>
<string
name=
"cos_market_pass_title"
>
SUPERMARKET DEALS CARD
</string>
<string
name=
"cos_market_pass_subtitle"
>
Χρησιμοποίησε τον κωδικό σου και κέρδισε έκπτωση στις αγορές σου!
</string>
<string
name=
"cos_market_pass_coupons_title"
>
Έχεις κουπόνια συνολικής αξίας %1$s€
</string>
<string
name=
"cos_market_subtitle"
>
Δημιούργησε το δικό σου ενιαίο κουπόνι προσφορών, και εξαργύρωσέ το στα supermarket της επιλογής σου γρήγορα και εύκολα με ένα μόνο κωδικό κουπονιού!
</string>
<string
name=
"cos_market_close"
>
Τέλος
</string>
<string
name=
"cos_rewards_title2"
>
COSMOTE Επιβράβευση
</string>
...
...
Please
register
or
login
to post a comment