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-05-10 15:54:05 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1b469e4e17d4ec48ab3c66880bc3929a3a969bfa
1b469e4e
1 parent
c9e3b583
active coupons redesign, gifts for you redesign
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
292 additions
and
5 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/MergedGifts.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarpUtils.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MergedGiftsAdapter.java
warply_android_sdk/src/main/res/drawable-xhdpi/ic_close_white.png
warply_android_sdk/src/main/res/drawable-xhdpi/ic_gifts_for_you_white.png
warply_android_sdk/src/main/res/drawable/shape_cos_gradient5.xml
warply_android_sdk/src/main/res/drawable/shape_cos_loyalty.xml
warply_android_sdk/src/main/res/layout/activity_gifts_for_you.xml
warply_android_sdk/src/main/res/layout/fragment_loyalty.xml
warply_android_sdk/src/main/res/layout/item_merged_gifts_recycler.xml
warply_android_sdk/src/main/res/values/colors.xml
warply_android_sdk/src/main/res/values/strings.xml
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
View file @
1b469e4
This diff is collapsed. Click to expand it.
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/MergedGifts.java
0 → 100644
View file @
1b469e4
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package
ly
.
warp
.
sdk
.
io
.
models
;
/**
* Created by Panagiotis Triantafyllou on 10-May-22.
*/
public
class
MergedGifts
{
private
int
dataType
=
0
;
private
Couponset
couponset
;
private
Campaign
campaign
;
public
void
setDataType
(
int
dataType
)
{
this
.
dataType
=
dataType
;
}
public
void
setCouponset
(
Couponset
couponset
)
{
this
.
couponset
=
couponset
;
}
public
void
setCampaign
(
Campaign
campaign
)
{
this
.
campaign
=
campaign
;
}
public
int
getDataType
()
{
return
dataType
;
}
public
Couponset
getCouponset
()
{
return
couponset
;
}
public
Campaign
getCampaign
()
{
return
campaign
;
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarpUtils.java
View file @
1b469e4
...
...
@@ -127,6 +127,10 @@ public class WarpUtils {
+
"device_info_data"
;
private
static
final
String
PREFERENCES_KEY_LIFECYCLE_ANALYTICS_ENABLED
=
PREFERENCES_PREFIX
+
"lifecycle_analytics_enabled"
;
private
static
final
String
PREFERENCES_KEY_GIFTS_POPUP
=
PREFERENCES_PREFIX
+
"gifts_popup"
;
private
static
final
String
PREFERENCES_KEY_MORE_POPUP
=
PREFERENCES_PREFIX
+
"more_popup"
;
private
static
SharedPreferences
_prefs
;
...
...
@@ -180,6 +184,28 @@ public class WarpUtils {
editor
.
apply
();
}
public
static
boolean
getGiftsPopup
(
Context
context
)
{
SharedPreferences
prefs
=
getPreferences
(
context
);
return
prefs
.
getBoolean
(
PREFERENCES_KEY_GIFTS_POPUP
,
true
);
}
public
static
void
setGiftsPopup
(
Context
context
,
boolean
visible
)
{
SharedPreferences
.
Editor
editor
=
getPreferences
(
context
).
edit
();
editor
.
putBoolean
(
PREFERENCES_KEY_GIFTS_POPUP
,
visible
);
editor
.
apply
();
}
public
static
boolean
getMorePopup
(
Context
context
)
{
SharedPreferences
prefs
=
getPreferences
(
context
);
return
prefs
.
getBoolean
(
PREFERENCES_KEY_MORE_POPUP
,
true
);
}
public
static
void
setMorePopup
(
Context
context
,
boolean
visible
)
{
SharedPreferences
.
Editor
editor
=
getPreferences
(
context
).
edit
();
editor
.
putBoolean
(
PREFERENCES_KEY_MORE_POPUP
,
visible
);
editor
.
apply
();
}
static
boolean
isRegisteredGCMOrWaiting
(
Context
context
)
{
return
isRegisteredGCM
(
context
)
||
isWaitingGCM
(
context
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MergedGiftsAdapter.java
0 → 100644
View file @
1b469e4
package
ly
.
warp
.
sdk
.
views
.
adapters
;
import
android.content.Context
;
import
android.text.TextUtils
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
import
com.bumptech.glide.load.resource.bitmap.CenterCrop
;
import
com.bumptech.glide.load.resource.bitmap.RoundedCorners
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.concurrent.TimeUnit
;
import
io.reactivex.Observable
;
import
io.reactivex.subjects.PublishSubject
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.models.MergedGifts
;
public
class
MergedGiftsAdapter
extends
RecyclerView
.
Adapter
<
MergedGiftsAdapter
.
MergedGiftsViewHolder
>
{
private
Context
mContext
;
private
ArrayList
<
MergedGifts
>
mMergedGifts
;
private
final
PublishSubject
<
MergedGifts
>
onClickSubject
=
PublishSubject
.
create
();
public
MergedGiftsAdapter
(
Context
mContext
,
ArrayList
<
MergedGifts
>
mergedgifts
)
{
this
.
mContext
=
mContext
;
this
.
mMergedGifts
=
mergedgifts
;
}
public
class
MergedGiftsViewHolder
extends
RecyclerView
.
ViewHolder
{
private
ImageView
ivMergedGiftsLogo
;
private
TextView
tvMergedGiftsTitle
;
public
MergedGiftsViewHolder
(
View
view
)
{
super
(
view
);
ivMergedGiftsLogo
=
view
.
findViewById
(
R
.
id
.
iv_campaign_logo
);
tvMergedGiftsTitle
=
view
.
findViewById
(
R
.
id
.
tv_campaign_title
);
}
}
@Override
public
int
getItemCount
()
{
if
(
mMergedGifts
==
null
)
return
0
;
else
return
mMergedGifts
.
size
();
}
public
MergedGifts
getItem
(
int
id
)
{
return
mMergedGifts
.
get
(
id
);
}
public
void
updateData
(
ArrayList
<
MergedGifts
>
mergedgifts
)
{
mMergedGifts
.
clear
();
mMergedGifts
.
addAll
(
mergedgifts
);
notifyDataSetChanged
();
}
@Override
public
MergedGiftsViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
View
itemView
;
itemView
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
item_merged_gifts_recycler
,
parent
,
false
);
return
new
MergedGiftsViewHolder
(
itemView
);
}
@Override
public
void
onBindViewHolder
(
final
MergedGiftsViewHolder
holder
,
int
position
)
{
MergedGifts
mergedgiftsItem
=
mMergedGifts
.
get
(
position
);
if
(
mergedgiftsItem
!=
null
&&
mergedgiftsItem
.
getDataType
()
==
1
)
{
if
(!
TextUtils
.
isEmpty
(
mergedgiftsItem
.
getCampaign
().
getLogoUrl
()))
{
Glide
.
with
(
mContext
)
.
load
(
mergedgiftsItem
.
getCampaign
().
getLogoUrl
())
.
transform
(
new
CenterCrop
(),
new
RoundedCorners
(
4
))
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
holder
.
ivMergedGiftsLogo
);
}
else
{
Glide
.
with
(
mContext
)
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
holder
.
ivMergedGiftsLogo
);
}
holder
.
tvMergedGiftsTitle
.
setText
(
mergedgiftsItem
.
getCampaign
().
getTitle
());
}
else
if
(
mergedgiftsItem
!=
null
&&
mergedgiftsItem
.
getDataType
()
==
2
)
{
if
(!
TextUtils
.
isEmpty
(
mergedgiftsItem
.
getCouponset
().
getImgPreview
()))
{
Glide
.
with
(
mContext
)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.
load
(
mergedgiftsItem
.
getCouponset
().
getImgPreview
())
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
holder
.
ivMergedGiftsLogo
);
}
else
{
Glide
.
with
(
mContext
)
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
holder
.
ivMergedGiftsLogo
);
}
holder
.
tvMergedGiftsTitle
.
setText
(
mergedgiftsItem
.
getCouponset
().
getName
());
// holder.tvMergedGiftsTitle.setText(Html.fromHtml(mergedgiftsItem.getCouponset().getDescription()));
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
// Date newDate = new Date();
// try {
// newDate = simpleDateFormat.parse(mergedgiftsItem.getExpiration());
// } catch (ParseException e) {
// e.printStackTrace();
// }
// simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
// holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
//
// holder.tvCouponValue.setText(mergedgiftsItem.getDiscount());
}
holder
.
itemView
.
setOnClickListener
(
v
->
onClickSubject
.
onNext
(
mergedgiftsItem
));
}
public
Observable
<
MergedGifts
>
getPositionClicks
()
{
return
onClickSubject
.
cache
();
}
private
long
getDifferenceDays
(
Date
d1
,
Date
d2
)
{
long
diff
=
d2
.
getTime
()
-
d1
.
getTime
();
return
TimeUnit
.
DAYS
.
convert
(
diff
,
TimeUnit
.
MILLISECONDS
);
}
}
warply_android_sdk/src/main/res/drawable-xhdpi/ic_close_white.png
0 → 100644
View file @
1b469e4
486 Bytes
warply_android_sdk/src/main/res/drawable-xhdpi/ic_gifts_for_you_white.png
0 → 100644
View file @
1b469e4
3.73 KB
warply_android_sdk/src/main/res/drawable/shape_cos_gradient5.xml
0 → 100644
View file @
1b469e4
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<gradient
android:startColor=
"@color/cos_blue3"
android:endColor=
"@color/cos_green8"
android:type=
"linear"
/>
<corners
android:radius=
"8dp"
/>
</shape>
\ No newline at end of file
warply_android_sdk/src/main/res/drawable/shape_cos_loyalty.xml
View file @
1b469e4
...
...
@@ -25,7 +25,7 @@
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:topLeftRadius=
"30dp"
/>
<solid
android:color=
"@color/
grey_light
"
/>
<solid
android:color=
"@color/
cos_grey5
"
/>
<!-- <stroke-->
<!-- android:width="1dp"-->
...
...
warply_android_sdk/src/main/res/layout/activity_gifts_for_you.xml
View file @
1b469e4
This diff is collapsed. Click to expand it.
warply_android_sdk/src/main/res/layout/fragment_loyalty.xml
View file @
1b469e4
...
...
@@ -93,7 +93,7 @@
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/shape_cos_
profile_gradient
"
android:background=
"@drawable/shape_cos_
loyalty
"
android:orientation=
"vertical"
android:paddingBottom=
"24dp"
>
...
...
warply_android_sdk/src/main/res/layout/item_merged_gifts_recycler.xml
0 → 100644
View file @
1b469e4
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
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=
"150dp"
android:layout_marginHorizontal=
"16dp"
android:layout_marginBottom=
"24dp"
app:cardCornerRadius=
"4dp"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/selector_cos_campaign"
>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/gl_vertical_60_percent"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_constraintGuide_percent=
"0.6"
/>
<ImageView
android:id=
"@+id/iv_campaign_logo"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:scaleType=
"centerCrop"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@+id/gl_vertical_60_percent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.0"
tools:src=
"@drawable/ic_cosmote_logo_horizontal_grey"
/>
<TextView
android:id=
"@+id/tv_campaign_title"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"12dp"
android:gravity=
"center"
android:maxLines=
"4"
android:textColor=
"@color/grey"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toRightOf=
"@+id/gl_vertical_60_percent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:text=
"-10% in all products from IKEA"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
warply_android_sdk/src/main/res/values/colors.xml
View file @
1b469e4
...
...
@@ -40,4 +40,7 @@
<color
name=
"cos_dark_blue"
>
#355168
</color>
<color
name=
"cos_grey4"
>
#617181
</color>
<color
name=
"grey_light3"
>
#E3E3E3
</color>
<color
name=
"cos_grey5"
>
#385267
</color>
<color
name=
"cos_blue3"
>
#03A1D6
</color>
<color
name=
"cos_green8"
>
#3AB588
</color>
</resources>
\ No newline at end of file
...
...
warply_android_sdk/src/main/res/values/strings.xml
View file @
1b469e4
...
...
@@ -14,8 +14,8 @@
<string
name=
"cos_profile_title"
>
My Loyalty Wallet
</string>
<string
name=
"cos_deals_title"
>
Deals for You
</string>
<string
name=
"cos_profile_more"
>
Δες περισσότερα
</string>
<string
name=
"cos_gifts_title"
>
G
ifts for You
</string>
<string
name=
"cos_more_title"
>
M
ore for You
</string>
<string
name=
"cos_gifts_title"
>
G
IFTS for YOU
</string>
<string
name=
"cos_more_title"
>
M
ORE for YOU
</string>
<string
name=
"menu_home"
>
Αρχική
</string>
<string
name=
"menu_explore"
>
Ανακάλυψε
</string>
<string
name=
"menu_shop"
>
Shop
</string>
...
...
@@ -55,12 +55,14 @@
<string
name=
"cos_analysis2"
>
Αναλυτικά
</string>
<string
name=
"euro"
>
€
</string>
<string
name=
"cos_profile_questionnaire"
>
+ Ερωτηματολόγιο
</string>
<string
name=
"cos_active_all_coupons"
>
Όλα τα κουπόνια μου
</string>
<string
name=
"cos_active_all_coupons"
>
Ενεργά κουπόνια
</string>
<string
name=
"cos_active_all_rewards"
>
Όλα τα δώρα μου
</string>
<string
name=
"cos_no_active_coupons"
>
Δεν υπάρχουν κουπόνια
</string>
<string
name=
"cos_no_active_rewards"
>
Δεν υπάρχουν δώρα
</string>
<string
name=
"cos_past_all_coupons"
>
Παλαιότερα κουπόνια
</string>
<string
name=
"cos_coupon_expired_date"
>
Εξαργυρώθηκε την %1$s
</string>
<string
name=
"cos_popup_gifts_title"
>
COSMOTE GIFTS FOR YOU
</string>
<string
name=
"cos_popup_gifts_subtitle"
>
Εδώ μπορείς να βρεις τα διαθέσιμα\nδώρα και προσφορές!
</string>
<string-array
name=
"coupons_array"
>
<item>
Κουπόνια
</item>
...
...
Please
register
or
login
to post a comment