Panagiotis Triantafyllou

uat changes 10_08_2022

......@@ -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
.setGuid("6012049321"), //6012049321, 6012049322, 6012049323
mLoginReceiver);
} else {
startNextActivity();
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta44'
PUBLISH_VERSION = '4.5.4-cosbeta45'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -58,7 +58,8 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
private LinearLayout mLlShareButton;
private String mSender = "";
private EditText mEdtReceiver;
private AlertDialog mAlertDialogSuccessSharing, mAlertDialogErrorSharing, mAlertDialogCouponAskSharing;
private AlertDialog mAlertDialogSuccessSharing, mAlertDialogErrorSharing,
mAlertDialogCouponAskSharing, mAlertDialogWrongNumberSharing;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -205,6 +206,16 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
.show();
}
private void wrongNumberDialog(String message) {
mAlertDialogWrongNumberSharing = new AlertDialog.Builder(this)
.setTitle(R.string.cos_dlg_error_title)
.setMessage(message)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
})
.show();
}
private void errorSharingDialog2() {
mAlertDialogErrorSharing = new AlertDialog.Builder(this)
.setTitle(R.string.cos_dlg_error_title)
......@@ -253,9 +264,12 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
String message = result.optString("msg", "");
runOnUiThread(() -> {
if (status == 1)
acceptSharingDialog();
else if (status == 4)
wrongNumberDialog(message);
else
errorSharingDialog();
});
......
......@@ -29,11 +29,13 @@ import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
import ly.warp.sdk.io.request.WarplyGetCampaignsRequest;
import ly.warp.sdk.io.request.WarplyRedeemCouponRequest;
import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
import ly.warp.sdk.services.EventCampaignService;
import ly.warp.sdk.services.EventService;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyManager;
......@@ -56,6 +58,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
private boolean mIsTermsPressed = false;
private AlertDialog mAlertDialogCouponset;
private Campaign mLoyalty;
private LoyaltyContextualOfferModel mCcms = null;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -68,6 +71,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
mCouponset = (Couponset) getIntent().getSerializableExtra("couponset");
mLoyalty = (Campaign) getIntent().getSerializableExtra("loyalty");
mCcms = (LoyaltyContextualOfferModel) getIntent().getSerializableExtra("ccms");
mIvBack = findViewById(R.id.iv_couponset_info_back);
mTvTerms = findViewById(R.id.tv_terms);
......@@ -96,9 +100,37 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
}
if (view.getId() == R.id.ll_get_gift) {
mPbLoading.setVisibility(View.VISIBLE);
WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest()
.setCouponsetUuid(mCouponset.getUuid())
.setCommunicationUuid(mLoyalty.getSessionUUID()), mRedeemCouponCallback);
if (mCcms == null) {
WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest()
.setCouponsetUuid(mCouponset.getUuid())
.setCommunicationUuid(mLoyalty.getSessionUUID()), mRedeemCouponCallback);
} else {
WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest()
.setCouponsetUuid(mCouponset.getUuid())
.setCommunicationUuid(mLoyalty.getSessionUUID())
.setHasContextualOffer(true)
.setUserMsisdn(WarplyManagerHelper.getConsumer().getMsisdn())
.setBusinessService(mCcms.getBusinessService())
.setOfferName(mCcms.getOfferName())
.setProductType(mCcms.getProductType())
.setProvDuration(mCcms.getProvDuration())
.setNoOfRecurrance(mCcms.getNoOfRecurrance())
.setPrice(mCcms.getPrice())
.setDiscount(mCcms.getDiscount())
.setVoiceCategory(mCcms.getVoiceCategory())
.setDataCategory(mCcms.getDataCategory())
.setMinsValue(mCcms.getMinsValue())
.setDataValue(mCcms.getDataValue())
.setProvStepValueMins(mCcms.getProvStepValueMins())
.setOfferAudienceLevel(mCcms.getOfferAudienceLevel())
.setUACIOfferTrackingCode(mCcms.getUACIOfferTrackingCode())
.setOfferCode1(mCcms.getOfferCode1())
.setScore(mCcms.getScore())
.setZone(mCcms.getZone())
.setWave(mCcms.getWave())
.setValidity(mCcms.getValidity())
.setTreatmentCode(mCcms.getTreatmentCode()), mRedeemCouponCallback);
}
return;
}
if (view.getId() == R.id.ll_terms_inner) {
......
......@@ -483,6 +483,138 @@ public class Consumer implements Parcelable, Serializable {
return sms_segmentation;
}
public void setAckOptin(boolean ackOptin) {
this.ackOptin = ackOptin;
}
public void setBillingInfo(JSONObject billingInfo) {
this.billingInfo = billingInfo;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public void setBurntPoints(double burntPoints) {
this.burntPoints = burntPoints;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public void setConsumerMetadata(JSONObject consumerMetadata) {
this.consumerMetadata = consumerMetadata;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public void setEmail(String email) {
this.email = email;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public void setGender(String gender) {
this.gender = gender;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public void setLanguage(String language) {
this.language = language;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public void setLoyaltyId(String loyaltyId) {
this.loyaltyId = loyaltyId;
}
public void setMsisdn(String msisdn) {
this.msisdn = msisdn;
}
public void setNameday(String nameday) {
this.nameday = nameday;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public void setOptin(JSONObject optin) {
this.optin = optin;
}
public void setPasswordSet(boolean passwordSet) {
this.passwordSet = passwordSet;
}
public void setProfileMetadata(String profileMetadata) {
this.profileMetadata = profileMetadata;
}
public void setRedeemedPoints(double redeemedPoints) {
this.redeemedPoints = redeemedPoints;
}
public void setRetrievedPoints(double retrievedPoints) {
this.retrievedPoints = retrievedPoints;
}
public void setSalutation(String salutation) {
this.salutation = salutation;
}
public void setSubscribe(boolean subscribe) {
this.subscribe = subscribe;
}
public void setTags(JSONObject tags) {
this.tags = tags;
}
public void setTaxId(String taxId) {
this.taxId = taxId;
}
public void setUserPoints(double userPoints) {
this.userPoints = userPoints;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public void setVerified(boolean verified) {
this.verified = verified;
}
public void setNewsletter(boolean newsletter) {
this.newsletter = newsletter;
}
public void setSms(boolean sms) {
this.sms = sms;
}
public void setSegmentation(boolean segmentation) {
this.segmentation = segmentation;
}
public void setSms_segmentation(boolean sms_segmentation) {
this.sms_segmentation = sms_segmentation;
}
@Override
public int describeContents() {
return 0;
......
......@@ -33,12 +33,12 @@ public class MergedGifts {
private int dataType = 0;
private LoyaltyGiftsForYouPackage seasonalList;
private Campaign campaign;
private LoyaltyContextualOfferModel ccms;
public void setDataType(int dataType) {
this.dataType = dataType;
}
public void setCampaign(Campaign campaign) {
this.campaign = campaign;
}
......@@ -58,4 +58,12 @@ public class MergedGifts {
public Campaign getCampaign() {
return campaign;
}
public void setCCMS(LoyaltyContextualOfferModel ccmsItem) {
this.ccms = ccmsItem;
}
public LoyaltyContextualOfferModel getCCMS() {
return ccms;
}
}
......
/*
* 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-Aug-22.
*/
public class MergedMore {
private int dataType = 0;
private Campaign campaign;
private LoyaltyContextualOfferModel ccms;
public void setDataType(int dataType) {
this.dataType = dataType;
}
public void setCampaign(Campaign campaign) {
this.campaign = campaign;
}
public int getDataType() {
return dataType;
}
public Campaign getCampaign() {
return campaign;
}
public void setCCMS(LoyaltyContextualOfferModel ccmsItem) {
this.ccms = ccmsItem;
}
public LoyaltyContextualOfferModel getCCMS() {
return ccms;
}
}
......@@ -30,7 +30,7 @@ public class EventQuestionnaireService extends Worker {
WarplyManager.getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() {
@Override
public void onSuccess(Consumer result) {
WarplyManagerHelper.setConsumer(result);
WarplyManagerHelper.setConsumerInternal(result);
WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() {
@Override
......
......@@ -45,6 +45,7 @@ import java.util.HashMap;
import ly.warp.sdk.R;
import ly.warp.sdk.Warply;
import ly.warp.sdk.activities.CouponsetInfoActivity;
import ly.warp.sdk.activities.GiftsForYouActivity;
import ly.warp.sdk.activities.TelcoActivity;
import ly.warp.sdk.activities.WarpViewActivity;
import ly.warp.sdk.db.WarplyDBHelper;
......@@ -83,6 +84,7 @@ public class WarplyManagerHelper {
// ===========================================================
private static Consumer mConsumer = new Consumer();
private static Consumer mConsumerInternal = new Consumer();
private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>();
private static CouponList mCouponList = new CouponList();
private static CouponList mCouponListExpired = new CouponList();
......@@ -94,7 +96,7 @@ public class WarplyManagerHelper {
private static ArrayList<LoyaltyGiftsForYouPackage> mSeasonalList = new ArrayList<>();
private static ArrayList<LoyaltyContextualOfferModel> mCCMSList = new ArrayList<>();
private static AlertDialog mAlertDialogSharing, mAlertDialogAcceptSharing, mAlertDialogRejectSharing,
mAlertDialogReturnSharing, mAlertDialogErrorSharing;
mAlertDialogReturnSharing, mAlertDialogErrorSharing, mAlertDialogErrorUsedSharing, mAlertDialogErrorExpiredSharing;
private static LoyaltyBadgeModel mLoyaltyBadge = new LoyaltyBadgeModel();
private static float mDealsSum = 0.0f;
private static MerchantList mMerchantList = new MerchantList();
......@@ -165,6 +167,10 @@ public class WarplyManagerHelper {
returnSharingDialog(context, modalText);
}
}
} else if (status == 4) {
errorExpiredDialog(context);
} else if (status == 5) {
errorUsedDialog(context);
} else
errorSharingDialog(context);
}
......@@ -295,6 +301,32 @@ public class WarplyManagerHelper {
}
/**
* Expired dialog
*/
private static void errorExpiredDialog(Context context) {
mAlertDialogErrorExpiredSharing = new AlertDialog.Builder(context)
.setTitle(R.string.cos_dlg_error_title)
.setMessage(R.string.cos_dlg_error_expired)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
})
.show();
}
/**
* Used dialog
*/
private static void errorUsedDialog(Context context) {
mAlertDialogErrorUsedSharing = new AlertDialog.Builder(context)
.setTitle(R.string.cos_dlg_error_title)
.setMessage(R.string.cos_dlg_error_used)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
})
.show();
}
/**
* Open CCMS campaign
*/
public static String constructCcmsUrl(Campaign item, LoyaltyContextualOfferModel ccmsItem) {
......@@ -606,6 +638,43 @@ public class WarplyManagerHelper {
public static void handleLoyaltyCampaigns(Context context, Campaign item) {
if (item != null) {
if (item.getType().equals("coupon")) {
if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) {
LoyaltyContextualOfferModel ccmsItem = null;
for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
if (ccms.getLoyaltyCampaignId().equals(item.getSessionUUID())) {
ccmsItem = ccms;
break;
}
}
if (ccmsItem != null) {
try {
JSONObject campaignSettings = WarpJSONParser.getJSONFromString(item.getCampaignTypeSettings());
if (campaignSettings != null) {
if (campaignSettings.has("couponset")) {
String cpnUuid = campaignSettings.optString("couponset");
for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
if (cpns.getUuid().equals(cpnUuid)) {
Intent intent = new Intent(context, CouponsetInfoActivity.class);
intent.putExtra("couponset", (Serializable) cpns);
intent.putExtra("loyalty", (Serializable) item);
intent.putExtra("ccms", ccmsItem);
context.startActivity(intent);
break;
}
}
} else {
context.startActivity(WarpViewActivity.createIntentFromURL(context, WarplyManagerHelper.constructCampaignUrl(item)));
}
}
} catch (Exception exception) {
exception.printStackTrace();
}
return;
}
}
try {
JSONObject campaignSettings = WarpJSONParser.getJSONFromString(item.getCampaignTypeSettings());
if (campaignSettings != null) {
......@@ -790,10 +859,22 @@ public class WarplyManagerHelper {
return mDfyCoupons;
}
public static Consumer getConsumerInternal() {
return mConsumerInternal;
}
public static void setConsumerInternal(Consumer consumer) {
mConsumerInternal = consumer;
}
public static Consumer getConsumer() {
return mConsumer;
}
public static void setConsumer(Consumer consumer) {
mConsumer = consumer;
}
public static HashMap<String, CampaignList> getUniqueCampaignList() {
return mUniqueCampaignList;
}
......@@ -816,10 +897,6 @@ public class WarplyManagerHelper {
return mCouponListExpired;
}
public static void setConsumer(Consumer consumer) {
mConsumer = consumer;
}
public static void setUniqueCampaignList(CampaignList campaignList) {
mCampaignList.clear();
mCampaignList.addAll(campaignList);
......
......@@ -802,7 +802,7 @@ public class WarplyManager {
getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() {
@Override
public void onSuccess(Consumer result) {
WarplyManagerHelper.setConsumer(result);
WarplyManagerHelper.setConsumerInternal(result);
if (result != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata());
if (profMetadata != null) {
......@@ -1383,8 +1383,8 @@ public class WarplyManager {
campaignLoyaltyList.clear();
for (Campaign camp : mNewCampaignList) {
if (camp.getOfferCategory().equals("questionnaire")) {
if (WarplyManagerHelper.getConsumer() != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumer().getProfileMetadata());
if (WarplyManagerHelper.getConsumerInternal() != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata());
if (profMetadata != null) {
if (!profMetadata.has("answered")) {
try {
......@@ -2278,7 +2278,7 @@ public class WarplyManager {
getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() {
@Override
public void onSuccess(Consumer result) {
WarplyManagerHelper.setConsumer(result);
WarplyManagerHelper.setConsumerInternal(result);
if (result != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata());
if (profMetadata != null) {
......
......@@ -126,6 +126,23 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.
// holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
//
// holder.tvCouponValue.setText(mergedgiftsItem.getDiscount());
} else if (mergedgiftsItem != null && mergedgiftsItem.getDataType() == 3) {
if (!TextUtils.isEmpty(mergedgiftsItem.getCCMS().getImageUrl())) {
Glide.with(mContext)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(mergedgiftsItem.getCCMS().getImageUrl())
.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.getCCMS().getTitle());
}
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(mergedgiftsItem));
}
......
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.MergedMore;
public class MergedMoreAdapter extends RecyclerView.Adapter<MergedMoreAdapter.MergedMoreViewHolder> {
private Context mContext;
private ArrayList<MergedMore> mMergedMore;
private final PublishSubject<MergedMore> onClickSubject = PublishSubject.create();
public MergedMoreAdapter(Context mContext, ArrayList<MergedMore> mergedmore) {
this.mContext = mContext;
this.mMergedMore = mergedmore;
}
public class MergedMoreViewHolder extends RecyclerView.ViewHolder {
private ImageView ivCampaignTitle, ivIsNew;
private TextView tvCampaignTitle, tvCampaignSubtitle, tvCampaignMessage;
public MergedMoreViewHolder(View view) {
super(view);
ivCampaignTitle = view.findViewById(R.id.iv_campaign_logo);
tvCampaignTitle = view.findViewById(R.id.tv_campaign_title);
ivIsNew = view.findViewById(R.id.iv_campaign_new);
tvCampaignSubtitle = view.findViewById(R.id.tv_campaign_subtitle);
tvCampaignMessage = view.findViewById(R.id.tv_campaign_message);
}
}
@Override
public int getItemCount() {
if (mMergedMore == null)
return 0;
else
return mMergedMore.size();
}
public MergedMore getItem(int id) {
return mMergedMore.get(id);
}
public void updateData(ArrayList<MergedMore> mergedmore) {
mMergedMore.clear();
mMergedMore.addAll(mergedmore);
notifyDataSetChanged();
}
@Override
public MergedMoreViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView;
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_profile_recycler_vertical, parent, false);
return new MergedMoreViewHolder(itemView);
}
@Override
public void onBindViewHolder(final MergedMoreViewHolder holder, int position) {
MergedMore mergedmoreItem = mMergedMore.get(position);
if (mergedmoreItem != null && mergedmoreItem.getDataType() == 1) {
if (!TextUtils.isEmpty(mergedmoreItem.getCampaign().getLogoUrl())) {
Glide.with(mContext)
.load(mergedmoreItem.getCampaign().getLogoUrl())
.transform(new CenterCrop(), new RoundedCorners(4))
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(holder.ivCampaignTitle);
} else {
Glide.with(mContext)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(holder.ivCampaignTitle);
}
holder.tvCampaignTitle.setText(mergedmoreItem.getCampaign().getTitle());
holder.tvCampaignSubtitle.setText(mergedmoreItem.getCampaign().getSubtitle());
holder.tvCampaignMessage.setText(mergedmoreItem.getCampaign().getMessage());
if (mergedmoreItem.getCampaign().getIsNew())
holder.ivIsNew.setVisibility(View.VISIBLE);
else
holder.ivIsNew.setVisibility(View.GONE);
} else if (mergedmoreItem != null && mergedmoreItem.getDataType() == 2) {
if (!TextUtils.isEmpty(mergedmoreItem.getCCMS().getImageUrl())) {
Glide.with(mContext)
.load(mergedmoreItem.getCCMS().getImageUrl())
.transform(new CenterCrop(), new RoundedCorners(4))
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(holder.ivCampaignTitle);
} else {
Glide.with(mContext)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(holder.ivCampaignTitle);
}
holder.tvCampaignTitle.setText(mergedmoreItem.getCCMS().getTitle());
holder.tvCampaignSubtitle.setText(mergedmoreItem.getCCMS().getSubtitle());
holder.tvCampaignMessage.setText(mergedmoreItem.getCCMS().getMessage());
holder.ivIsNew.setVisibility(View.GONE);
}
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(mergedmoreItem));
}
public Observable<MergedMore> getPositionClicks() {
return onClickSubject.cache();
}
private long getDifferenceDays(Date d1, Date d2) {
long diff = d2.getTime() - d1.getTime();
return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
}
}
......@@ -95,12 +95,12 @@ public class SharedCouponAdapter extends RecyclerView.Adapter<SharedCouponAdapte
if (couponItem.getSharingType().equals("sent")) {
holder.tvCouponLabel.setText(R.string.cos_shared_coupon_receiver);
if (extraFields != null && extraFields.has("receiver_msisdn")) {
holder.tvCouponLabel.setText(extraFields.optString("receiver_msisdn"));
holder.tvCouponPhone.setText(extraFields.optString("receiver_msisdn"));
}
} else if (couponItem.getSharingType().equals("received")) {
holder.tvCouponLabel.setText(R.string.cos_shared_coupon_sender);
if (extraFields != null && extraFields.has("sender_msisdn")) {
holder.tvCouponLabel.setText(extraFields.optString("sender_msisdn"));
holder.tvCouponPhone.setText(extraFields.optString("sender_msisdn"));
}
}
......
......@@ -413,6 +413,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="24dp"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
......
......@@ -123,6 +123,9 @@
<string name="cos_value2">%1$s</string>
<string name="cos_show_barcode">Εμφάνιση barcode</string>
<string name="cos_hide_barcode">Απόκρυψη barcode</string>
<string name="cos_wrong_number_dlg">Το κινητό που καταχώρησες δεν είναι COSMOTE. Παρακαλούμε καταχώρησε το COSMOTE τηλέφωνο του φίλου σου.</string>
<string name="cos_dlg_error_expired">Το δώρο έχει λήξει</string>
<string name="cos_dlg_error_used">Το δώρο έχει ήδη χρησιμοποιηθεί</string>
<string-array name="coupons_array">
<item>Κουπόνια</item>
......