Panagiotis Triantafyllou

new version

Showing 23 changed files with 1338 additions and 93 deletions
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta35'
PUBLISH_VERSION = '4.5.4-cosbeta36'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -28,7 +28,7 @@
android:screenOrientation="portrait" />
<activity
android:name="ly.warp.sdk.activities.LoyaltyActivity"
android:name="ly.warp.sdk.activities.LoyaltyAnalysisActivity"
android:exported="false"
android:screenOrientation="portrait" />
......
......@@ -73,6 +73,7 @@ import ly.warp.sdk.io.volley.toolbox.Volley;
import ly.warp.sdk.receivers.WarplyBeaconsApplication;
import ly.warp.sdk.utils.GCMRegistrar;
import ly.warp.sdk.utils.ObjectSerializer;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyDeviceInfoCollector;
import ly.warp.sdk.utils.WarplyInitializer;
......@@ -540,7 +541,7 @@ public enum Warply {
// " \"UACIOfferTrackingCode\": \"51ed.e10.2c006f18.71e96d08\",\n" +
// " \"businessAdditionalId\": \"\",\n" +
// " \"dataCategory\": \"Data\",\n" +
// " \"dataValue\": \"None\",\n" +
// " \"dataValue\": \"233\",\n" +
// " \"discount\": \"None\",\n" +
// " \"eligibleAssets\": [\n" +
// " \"306945218770\",\n" +
......@@ -988,9 +989,24 @@ public enum Warply {
objectSerializer.serialize(result, File.separator + requestSignature);
warplyPreferences.saveInboxLastCachedTimeStamp(requestSignature, System.currentTimeMillis());
CampaignList campaignLoyaltyList = new CampaignList();
campaignLoyaltyList.clear();
for (Campaign camp : result) {
try {
JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
if (extraFields != null) {
if (extraFields.length() == 0 || !extraFields.has("ccms_offer")) {
campaignLoyaltyList.add(camp);
}
}
} catch (Exception exception) {
campaignLoyaltyList.add(camp);
}
}
INSTANCE.mLastReceivedCampaigns = result;
if (receiver != null) {
receiver.onSuccess(result);
receiver.onSuccess(/*result*/campaignLoyaltyList);
}
}
}
......@@ -1950,7 +1966,7 @@ public enum Warply {
url = buildWarplyAuthRequestUrl(path, true);
else if (path.equals("campaigns"))
url = buildWarplyRequestUrl(null);
else if(path.equals("campaignsPersonalized"))
else if (path.equals("campaignsPersonalized"))
url = buildWarplyRequestUrl(null, true);
else
url = buildWarplyAuthRequestUrl(path, false);
......
package ly.warp.sdk.activities;
import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.SharingCoupon;
import ly.warp.sdk.io.models.SharingList;
import ly.warp.sdk.io.request.WarplySharingHistoryRequest;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyManager;
import ly.warp.sdk.views.adapters.ExpiredCouponAdapter;
import ly.warp.sdk.views.adapters.SharedCouponAdapter;
public class LoyaltyAnalysisActivity extends Activity implements View.OnClickListener {
......@@ -19,6 +37,13 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
// ===========================================================
private ImageView mIvBack;
private TextView mTvCouponsValueAll;
private RecyclerView mRvExpiredCoupons, mRvSharedCoupons;
private ExpiredCouponAdapter mAdapterExpiredCoupons;
private SharedCouponAdapter mAdapterSharedCoupons;
private LinearLayout mLlExpiredTab, mLlSharedTab;
private RelativeLayout mRlExpiredView, mRlSharedView;
private SharingList mSharedCoupons = new SharingList();
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -30,6 +55,13 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
setContentView(R.layout.activity_loyalty_analysis);
mIvBack = findViewById(R.id.iv_loyalty_analysis_close);
mTvCouponsValueAll = findViewById(R.id.tv_expired_coupons_title);
mRvExpiredCoupons = findViewById(R.id.rv_expired_coupons);
mLlExpiredTab = findViewById(R.id.cl_tab_coupon_analysis).findViewById(R.id.ll_tab_expired);
mLlSharedTab = findViewById(R.id.cl_tab_coupon_analysis).findViewById(R.id.ll_tab_shared);
mRlExpiredView = findViewById(R.id.rl_expired_view);
mRlSharedView = findViewById(R.id.rl_shared_view);
mRvSharedCoupons = findViewById(R.id.rv_shared_coupons);
initViews();
}
......@@ -37,12 +69,51 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
@Override
public void onResume() {
super.onResume();
mSharedCoupons.clear();
new Thread(() -> {
if (!Thread.currentThread().isInterrupted()) {
WarplyManager.getSharingHistory(new WarplySharingHistoryRequest()
, mSharingHistoryCallback);
}
Thread.currentThread().interrupt();
}).start();
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.iv_loyalty_analysis_close) {
onBackPressed();
return;
}
if (view.getId() == R.id.ll_tab_expired) {
mLlExpiredTab.setBackgroundResource(R.drawable.bottom_border_gradient2);
TextView expiredTab = findViewById(R.id.tv_expired_tab);
expiredTab.setTextColor(ContextCompat.getColor(this, R.color.cos_cyan4));
expiredTab.setTypeface(null, Typeface.BOLD);
mLlSharedTab.setBackgroundResource(R.drawable.bottom_border_transparent);
TextView sharedTab = findViewById(R.id.tv_shared_tab);
sharedTab.setTextColor(ContextCompat.getColor(this, R.color.cos_dark_grey));
sharedTab.setTypeface(null, Typeface.NORMAL);
mRlSharedView.setVisibility(View.GONE);
mRlExpiredView.setVisibility(View.VISIBLE);
return;
}
if (view.getId() == R.id.ll_tab_shared) {
mLlSharedTab.setBackgroundResource(R.drawable.bottom_border_gradient2);
TextView sharedTab = findViewById(R.id.tv_shared_tab);
sharedTab.setTextColor(ContextCompat.getColor(this, R.color.cos_cyan4));
sharedTab.setTypeface(null, Typeface.BOLD);
mLlExpiredTab.setBackgroundResource(R.drawable.bottom_border_transparent);
TextView expiredTab = findViewById(R.id.tv_expired_tab);
expiredTab.setTextColor(ContextCompat.getColor(this, R.color.cos_dark_grey));
expiredTab.setTypeface(null, Typeface.NORMAL);
mRlExpiredView.setVisibility(View.GONE);
mRlSharedView.setVisibility(View.VISIBLE);
}
}
......@@ -52,10 +123,60 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
private void initViews() {
mIvBack.setOnClickListener(this);
mLlExpiredTab.setOnClickListener(this);
mLlSharedTab.setOnClickListener(this);
mTvCouponsValueAll.setText(String.format(getString(R.string.cos_deals_win_title), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue()), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount())));
if (WarplyManagerHelper.getCouponExpiredList() != null && WarplyManagerHelper.getCouponExpiredList().size() > 0) {
mRvExpiredCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterExpiredCoupons = new ExpiredCouponAdapter(this, WarplyManagerHelper.getCouponExpiredList());
mRvExpiredCoupons.setAdapter(mAdapterExpiredCoupons);
// mAdapterCoupons.getPositionClicks()
// .doOnNext(coupon -> {
// Intent intent = new Intent(ActiveCouponsActivity.this, CouponInfoActivity.class);
// intent.putExtra("coupon", (Serializable) coupon);
// startActivity(intent);
// })
// .doOnError(error -> {
// })
// .subscribe();
}
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
private CallbackReceiver<SharingList> mSharingHistoryCallback = new CallbackReceiver<SharingList>() {
@Override
public void onSuccess(SharingList result) {
if (result != null && result.size() > 0) {
if (WarplyManagerHelper.getCouponsets() != null && WarplyManagerHelper.getCouponsets().size() > 0) {
for (SharingCoupon shCoupon : result) {
for (Couponset cpnset : WarplyManagerHelper.getCouponsets()) {
if (shCoupon.getCouponsetUuid().equals(cpnset.getUuid())) {
SharingCoupon newShCoupon = new SharingCoupon();
newShCoupon = shCoupon;
newShCoupon.setName(cpnset.getName());
mSharedCoupons.add(newShCoupon);
break;
}
}
}
}
}
runOnUiThread(() -> {
mRvSharedCoupons.setLayoutManager(new LinearLayoutManager(LoyaltyAnalysisActivity.this, LinearLayoutManager.VERTICAL, false));
mAdapterSharedCoupons = new SharedCouponAdapter(LoyaltyAnalysisActivity.this, mSharedCoupons);
mRvSharedCoupons.setAdapter(mAdapterSharedCoupons);
});
}
@Override
public void onFailure(int errorCode) {
WarpUtils.log("SHARED_COUPONS_ERROR " + String.valueOf(errorCode));
}
};
}
......
......@@ -125,8 +125,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
return;
}
if (view.getId() == R.id.cl_deals_win) {
//TODO: Loyalty history
Intent intent = new Intent(LoyaltyWallet.this, LoyaltyAnalysisActivity.class);
startActivity(intent);
return;
}
if (view.getId() == R.id.cl_mygifts) {
......
......@@ -16,13 +16,17 @@ import androidx.recyclerview.widget.RecyclerView;
import org.json.JSONObject;
import java.io.Serializable;
import ly.warp.sdk.R;
import ly.warp.sdk.activities.GiftsForYouActivity;
import ly.warp.sdk.activities.LoyaltyWallet;
import ly.warp.sdk.activities.MoreForYouActivity;
import ly.warp.sdk.activities.TelcoActivity;
import ly.warp.sdk.activities.WarpViewActivity;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.views.adapters.ProfileCampaignAdapter;
......@@ -103,6 +107,19 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
mRecyclerGifts.setAdapter(mAdapterGifts);
mAdapterGifts.getPositionClicks()
.doOnNext(gift -> {
try {
JSONObject extraFields = WarpJSONParser.getJSONFromString(gift.getExtraFields());
if (extraFields != null) {
if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
WarplyManagerHelper.openTelco(getContext(), gift);
return;
}
}
} catch (Exception exception) {
startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(gift)));
return;
}
if (gift.getType().equals("coupon")) {
WarplyManagerHelper.openCouponset(getContext(), gift);
} else
......@@ -130,6 +147,19 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
mRecyclerMore.setAdapter(mAdapterMore);
mAdapterMore.getPositionClicks()
.doOnNext(more -> {
try {
JSONObject extraFields = WarpJSONParser.getJSONFromString(more.getExtraFields());
if (extraFields != null) {
if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
WarplyManagerHelper.openTelco(getContext(), more);
return;
}
}
} catch (Exception exception) {
startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(more)));
return;
}
if (more.getType().equals("coupon")) {
WarplyManagerHelper.openCouponset(getContext(), more);
} else
......
/*
* 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.callbacks;
import org.json.JSONArray;
import org.json.JSONObject;
import ly.warp.sdk.io.models.SharingList;
/**
* Created by Panagiotis Triantafyllou on 19-July-22.
*/
public class SharingHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<SharingList> mListener;
private final String mRequestSignature;
public SharingHook(CallbackReceiver<SharingList> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
int status = result.optInt("status", 2);
if (status == 1) {
JSONArray jArrayResult = result.optJSONArray("result");
if (jArrayResult == null) {
mListener.onFailure(2);
return;
}
mListener.onSuccess(new SharingList(result, mRequestSignature));
} else
mListener.onFailure(status);
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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;
import android.os.Parcel;
import android.os.Parcelable;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.Serializable;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.constants.WarpConstants;
/**
* Created by Panagiotis Triantafyllou on 19-July-22.
*/
public class SharingCoupon implements Parcelable, Serializable {
private static final long serialVersionUID = -4754964462459705285L;
/* Constants used to export the campaign in JSON formal and vice versa */
private static final String TRANSACTION_METADATA = "transaction_metadata";
private static final String SHARING_TYPE = "sharing_type";
private static final String DISCOUNT = "discount";
private static final String DATE = "date";
private static final String COUPONSET_UUID = "couponset_uuid";
private static final String NAME = "name";
/* Member variables of the Campaign object */
private String transactionMetadata = "";
private String sharingType = "";
private String discount = "";
private String date = "";
private String couponsetUuid = "";
private String name = "";
/**
* Basic constructor used to create an object from a String, representing a
* JSON Object
*
* @param json The String, representing the JSON Object
* @throws JSONException Thrown if the String cannot be converted to JSON
*/
public SharingCoupon(String json) throws JSONException {
this(new JSONObject(json));
}
public SharingCoupon() {
this.transactionMetadata = "";
this.sharingType = "";
this.discount = "";
this.date = "";
this.couponsetUuid = "";
this.name = "";
}
/**
* Constructor used to create an Object from a given JSON Object
*
* @param json JSON Object used to create the Coupon
*/
public SharingCoupon(JSONObject json) {
if (json != null) {
this.discount = json.optString(DISCOUNT);
this.couponsetUuid = json.optString(COUPONSET_UUID);
this.date = json.optString(DATE);
this.sharingType = json.optString(SHARING_TYPE);
this.transactionMetadata = json.optString(TRANSACTION_METADATA);
this.name = json.optString(NAME);
}
}
public SharingCoupon(Parcel source) {
this.discount = source.readString();
this.couponsetUuid = source.readString();
this.date = source.readString();
this.sharingType = source.readString();
this.transactionMetadata = source.readString();
this.name = source.readString();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.discount);
dest.writeString(this.couponsetUuid);
dest.writeString(this.date);
dest.writeString(this.sharingType);
dest.writeString(this.transactionMetadata);
dest.writeString(this.name);
}
/**
* Converts the Coupon into a JSON Object
*
* @return The JSON Object created from this Coupon
*/
public JSONObject toJSONObject() {
JSONObject jObj = new JSONObject();
try {
jObj.putOpt(DISCOUNT, this.discount);
jObj.putOpt(COUPONSET_UUID, this.couponsetUuid);
jObj.putOpt(DATE, this.date);
jObj.putOpt(SHARING_TYPE, this.sharingType);
jObj.putOpt(TRANSACTION_METADATA, this.transactionMetadata);
jObj.putOpt(NAME, this.name);
} catch (JSONException e) {
if (WarpConstants.DEBUG) {
e.printStackTrace();
}
}
return jObj;
}
/**
* String representation of the Coupon, as a JSON object
*
* @return A String representation of JSON object
*/
public String toString() {
if (toJSONObject() != null)
return toJSONObject().toString();
return null;
}
/**
* String representation of the Coupon, as a human readable JSON object
*
* @return A human readable String representation of JSON object
*/
public String toHumanReadableString() {
String humanReadableString = null;
try {
humanReadableString = toJSONObject().toString(2);
} catch (JSONException e) {
WarpUtils.warn("Failed converting Coupon JSON object to String", e);
}
return humanReadableString;
}
// ================================================================================
// Getters
// ================================================================================
public String getTransactionMetadata() {
return transactionMetadata;
}
public void setTransactionMetadata(String transactionMetadata) {
this.transactionMetadata = transactionMetadata;
}
public String getSharingType() {
return sharingType;
}
public void setSharingType(String sharingType) {
this.sharingType = sharingType;
}
public String getDiscount() {
return discount;
}
public void setDiscount(String discount) {
this.discount = discount;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getCouponsetUuid() {
return couponsetUuid;
}
public void setCouponsetUuid(String couponsetUuid) {
this.couponsetUuid = couponsetUuid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<SharingCoupon> CREATOR = new Creator<SharingCoupon>() {
public SharingCoupon createFromParcel(Parcel source) {
return new SharingCoupon(source);
}
public SharingCoupon[] newArray(int size) {
return new SharingCoupon[size];
}
};
}
/*
* 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;
import androidx.annotation.NonNull;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
/**
* Created by Panagiotis Triantafyllou on 19-July-22.
*/
public class SharingList extends ArrayList<SharingCoupon> {
/**
* Generated for serialized class
*/
private static final long serialVersionUID = -188843583823948267L;
private static final String JSON_KEY_RESULT = "result";
private String mRequestSignature = "";
private SharingList(String requestSignature) {
this.mRequestSignature = requestSignature;
}
public SharingList() {
super();
}
/**
* Constructor used to create the CouponList from a JSON Object.
*
* @param couponListJSONObject The JSON Object, used to create the CouponList
*/
public SharingList(JSONObject couponListJSONObject, String requestSignature) {
this(requestSignature);
if (couponListJSONObject == null)
return;
JSONArray jArray = couponListJSONObject.optJSONArray(JSON_KEY_RESULT);
if (jArray != null) {
for (int i = 0, lim = jArray.length(); i < lim; ++i) {
add(new SharingCoupon(jArray.optJSONObject(i)));
}
}
}
@NonNull
public String getRequestSignature() {
return mRequestSignature;
}
}
package ly.warp.sdk.io.request;
import android.util.Base64;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import ly.warp.sdk.utils.constants.WarpConstants;
/**
* Created by Panagiotis Triantafyllou on 19-July-22.
*/
public class WarplySharingHistoryRequest {
// ===========================================================
// Constants
// ===========================================================
private final String KEY_ACTION = "action";
private final String KEY_ACTION_VALUE = "sharing_history";
// ===========================================================
// Fields
// ===========================================================
private HashMap<String, String> mFilters;
private long mCacheUpdateInterval = 0;
// ===========================================================
// Constructor
// ===========================================================
/**
* Default constructor of WarplySharingHistoryRequest, initializes an empty filters HashMap
*/
public WarplySharingHistoryRequest() {
mFilters = new HashMap<>();
}
public WarplySharingHistoryRequest(WarplySharingHistoryRequest copy) {
if (copy != null) {
this.mFilters = copy.mFilters;
this.mCacheUpdateInterval = copy.mCacheUpdateInterval;
}
}
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public boolean equals(Object object) {
if (object instanceof WarplySharingHistoryRequest) {
WarplySharingHistoryRequest other = (WarplySharingHistoryRequest) object;
return other == this || (this.mFilters == other.mFilters || (this.mFilters != null && this.mFilters.equals(other.mFilters)));
}
return false;
}
@Override
public int hashCode() {
return mFilters.hashCode();
}
// ===========================================================
// Methods
// ===========================================================
// ===========================================================
// Getter & Setter
// ===========================================================
/**
* Call this to get how often the cached data will be updated.
*
* @return mCacheUpdateInterval
*/
public long getCacheUpdateInterval() {
return mCacheUpdateInterval;
}
/**
* Call this to set how often the cached data will be updated.
*
* @param updateInterval The time that data will be cached
* @return WarplySharingHistoryRequest
*/
public WarplySharingHistoryRequest setCacheUpdateInterval(long updateInterval) {
this.mCacheUpdateInterval = updateInterval;
if (mCacheUpdateInterval < 0) {
mCacheUpdateInterval = 0;
}
return this;
}
/**
* Call this to check if the Application uses Cache
*
* @return <p>true - the Application is using Cache</p>
* <p>false - the Application is not using Cache</p>
*/
public boolean isUseCache() {
return mCacheUpdateInterval > 0;
}
/**
* Call this to check whether the cached data need to be updated
*
* @param useCache <p>true - the Application is using Cache</p>
* <p>false - the Application is not using Cache</p>
* @return WarplySharingHistoryRequest
*/
public WarplySharingHistoryRequest setUseCache(boolean useCache) {
if (useCache) {
mCacheUpdateInterval = mCacheUpdateInterval > 0 ? mCacheUpdateInterval
: WarpConstants.INBOX_UPDATE_INTERVAL;
} else {
mCacheUpdateInterval = 0;
}
return this;
}
/**
* Call this to build the offers Json object
*
* @return bodyJsonObject
*/
public JSONObject toJson() {
JSONObject bodyJsonObject = new JSONObject();
try {
bodyJsonObject.putOpt(KEY_ACTION, KEY_ACTION_VALUE);
} catch (JSONException e) {
if (WarpConstants.DEBUG)
e.printStackTrace();
}
return bodyJsonObject;
}
public String getSignature() {
String signature = mFilters != null && mFilters.size() > 0 ? String.valueOf(mFilters.hashCode()) : "default_sharing_history_request";
try {
byte[] hash = MessageDigest.getInstance("SHA-256").digest(signature.getBytes("UTF-8"));
signature = Base64.encodeToString(hash, Base64.NO_WRAP);
} catch (NullPointerException | NoSuchAlgorithmException
| UnsupportedEncodingException e) {
e.printStackTrace();
}
return signature;
}
}
......@@ -45,6 +45,7 @@ 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;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
......@@ -85,6 +86,7 @@ public class WarplyManagerHelper {
private static Consumer mConsumer = new Consumer();
private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>();
private static CouponList mCouponList = new CouponList();
private static CouponList mCouponListExpired = new CouponList();
private static CouponsetsList mCouponsetsList = new CouponsetsList();
private static CustomerStateModel mCustomerStateModel = new CustomerStateModel();
private static CampaignList mCampaignList = new CampaignList();
......@@ -423,75 +425,6 @@ public class WarplyManagerHelper {
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventService.class).build();
WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork);
// ContexualEventModel ccmsAdded = new ContexualEventModel();
// EventBus.getDefault().post(new WarplyEventBusManager(ccmsAdded));
// if (list == null || list.size() == 0) {
// CampaignList tempGifts = new CampaignList();
// if (mUniqueCampaignList != null && mUniqueCampaignList.get("gifts_for_you") != null && mUniqueCampaignList.get("gifts_for_you").size() > 0) {
// for (Campaign camp : mUniqueCampaignList.get("gifts_for_you")) {
// try {
// String key = WarpJSONParser.getJSONFromString(camp.getExtraFields()).keys().next();
// if (!TextUtils.isEmpty(key)) {
// String value = WarpJSONParser.getJSONFromString(camp.getExtraFields()).optString(key);
// if (!(key.equals("ccms_offer") && value.equals("true"))) {
// tempGifts.add(camp);
// }
// }
// } catch (Exception exception) {
// tempGifts.add(camp);
// }
// }
//
// Log.v("Got L:{" + String.valueOf(mCampaignList.size()) + "}", " LOYALTY campaigns");
// Log.v("Got C:{0}", " CCMS campaigns");
// Log.v("Matched M:{0}", " CCMS campaigns");
// Log.v("=====================================", "");
// Log.v("TOTAL: Campaigns Sum=" + String.valueOf(mCampaignList.size()), " campaigns to display");
// mUniqueCampaignList.get("gifts_for_you").removeAll(tempGifts);
// }
// return;
// }
//
// CampaignList tempGifts = new CampaignList();
// if (mUniqueCampaignList != null && mUniqueCampaignList.get("gifts_for_you") != null && mUniqueCampaignList.get("gifts_for_you").size() > 0) {
// int ccmsCount = 0;
// int loyaltyCount = 0;
// for (Campaign camp : mUniqueCampaignList.get("gifts_for_you")) {
// try {
// String key = WarpJSONParser.getJSONFromString(camp.getExtraFields()).keys().next();
// if (!TextUtils.isEmpty(key) && key.equals("ccms_offer")) {
// String value = WarpJSONParser.getJSONFromString(camp.getExtraFields()).optString(key);
// if (!TextUtils.isEmpty(value) && value.equals("true")) {
// for (LoyaltyContextualOfferModel ccms : list) {
// if (ccms.getLoyaltyCampaignId().equals(camp.getSessionUUID())) {
// tempGifts.add(camp);
// ccmsCount++;
// break;
// }
// }
// } else {
// tempGifts.add(camp);
// loyaltyCount++;
// }
// } else {
// tempGifts.add(camp);
// loyaltyCount++;
// }
// } catch (Exception exception) {
// tempGifts.add(camp);
// loyaltyCount++;
// }
// }
//
// Log.v("Got L:{" + String.valueOf(mCampaignList.size()) + "}", " LOYALTY campaigns");
// Log.v("Got C:{" + String.valueOf(list.size()) + "}", " CCMS campaigns");
// Log.v("Matched M:{" + String.valueOf(ccmsCount) + "}", " CCMS campaigns");
// Log.v("=====================================", "");
// Log.v("TOTAL: Campaigns Sum=" + String.valueOf(mCampaignList.size() - loyaltyCount + ccmsCount), " campaigns to display");
// mUniqueCampaignList.get("gifts_for_you").retainAll(tempGifts);
// }
}
/**
......@@ -571,6 +504,18 @@ public class WarplyManagerHelper {
}
}
public static void openTelco(Context context, Campaign item) {
for (LoyaltyContextualOfferModel ccms : mCCMSList) {
if (ccms.getLoyaltyCampaignId().equals(item.getSessionUUID())) {
Intent intent = new Intent(context, TelcoActivity.class);
intent.putExtra("ccms", ccms);
intent.putExtra("loyalty", (Serializable) item);
context.startActivity(intent);
break;
}
}
}
/**
* Save if customer is nonTelco and if he/she has accepted the consents,
* And his msisdn list
......@@ -642,6 +587,15 @@ public class WarplyManagerHelper {
return mCouponList;
}
public static CouponList getCouponExpiredList() {
if (mCouponListExpired != null && mCouponListExpired.size() > 0) {
WarpUtils.log("GET_COUPON_EXPIRED_LIST size: " + String.valueOf(mCouponListExpired.size()));
} else {
WarpUtils.log("GET_COUPON_EXPIRED_LIST size: 0");
}
return mCouponListExpired;
}
public static void setConsumer(Consumer consumer) {
mConsumer = consumer;
}
......@@ -699,12 +653,14 @@ public class WarplyManagerHelper {
public static void setCouponList(CouponList couponList) {
LoyaltyBadgeModel badge = new LoyaltyBadgeModel();
CouponList cpnlist = new CouponList();
CouponList cpnlistExpired = new CouponList();
float couponValue = 0.0f;
int couponCount = 0;
for (Coupon coupon : couponList) {
if (coupon.getStatus() == 1) {
cpnlist.add(coupon);
} else if (coupon.getStatus() == 0) {
cpnlistExpired.add(coupon);
try {
couponCount += 1;
couponValue += Float.parseFloat(coupon.getDiscount());
......@@ -718,6 +674,8 @@ public class WarplyManagerHelper {
mLoyaltyBadge = badge;
mCouponList.clear();
mCouponList.addAll(cpnlist);
mCouponListExpired.clear();
mCouponListExpired.addAll(cpnlistExpired);
}
public static LoyaltyBadgeModel getLoyaltyBadge() {
......
......@@ -47,6 +47,7 @@ import ly.warp.sdk.io.callbacks.NewCampaignsHook;
import ly.warp.sdk.io.callbacks.PacingDetailsHook;
import ly.warp.sdk.io.callbacks.PointsHook;
import ly.warp.sdk.io.callbacks.ProductsHook;
import ly.warp.sdk.io.callbacks.SharingHook;
import ly.warp.sdk.io.callbacks.TagsCategoriesHook;
import ly.warp.sdk.io.callbacks.TagsHook;
import ly.warp.sdk.io.callbacks.TransactionsHook;
......@@ -69,6 +70,7 @@ import ly.warp.sdk.io.models.NewCampaignList;
import ly.warp.sdk.io.models.PacingDetails;
import ly.warp.sdk.io.models.PointsList;
import ly.warp.sdk.io.models.ProductList;
import ly.warp.sdk.io.models.SharingList;
import ly.warp.sdk.io.models.TagsCategoriesList;
import ly.warp.sdk.io.models.TagsList;
import ly.warp.sdk.io.models.TransactionsList;
......@@ -106,6 +108,7 @@ import ly.warp.sdk.io.request.WarplyRefreshTokenRequest;
import ly.warp.sdk.io.request.WarplyRegisterRequest;
import ly.warp.sdk.io.request.WarplyRequestOTPRequest;
import ly.warp.sdk.io.request.WarplyResetPasswordRequest;
import ly.warp.sdk.io.request.WarplySharingHistoryRequest;
import ly.warp.sdk.io.request.WarplyTagsCategoriesRequest;
import ly.warp.sdk.io.request.WarplyTagsRequest;
import ly.warp.sdk.io.request.WarplyTokenAuthorizeRequest;
......@@ -2147,7 +2150,14 @@ public class WarplyManager {
}
}
WarplyManagerHelper.setCouponList(mCouponList);
receiver.onSuccess(mCouponList);
CouponList mActiveCouponList = new CouponList();
for (Coupon coupon : mCouponList) {
if (coupon.getStatus() == 1)
mActiveCouponList.add(coupon);
}
receiver.onSuccess(mActiveCouponList);
}
@Override
......@@ -2267,4 +2277,40 @@ public class WarplyManager {
}
});
}
public static void getSharingHistory(WarplySharingHistoryRequest request, final CallbackReceiver<SharingList> receiver) {
WarpUtils.log("************* WARPLY Sharing History Request ********************");
WarpUtils.log("[WARP Trace] WARPLY Sharing History Request is active");
WarpUtils.log("**************************************************");
Warply.postReceiveMicroappData(WarpConstants.MICROAPP_COUPONS, true, "context", request.toJson(), new SharingHook(new CallbackReceiver<SharingList>() {
@Override
public void onSuccess(SharingList response) {
receiver.onSuccess(response);
}
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getSharingHistory(request, receiver);
else
receiver.onFailure(status);
}
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
} else
receiver.onFailure(errorCode);
}
},
request.getSignature()));
}
}
......
package ly.warp.sdk.views.adapters;
import android.content.Context;
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 java.text.ParseException;
import java.text.SimpleDateFormat;
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.Coupon;
import ly.warp.sdk.io.models.CouponList;
public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdapter.ExpiredCouponViewHolder> {
private Context mContext;
private CouponList mCoupons;
private final PublishSubject<Coupon> onClickSubject = PublishSubject.create();
public ExpiredCouponAdapter(Context mContext, CouponList campaignList) {
this.mContext = mContext;
this.mCoupons = campaignList;
}
public class ExpiredCouponViewHolder extends RecyclerView.ViewHolder {
private TextView tvCouponTitle, tvCouponValue, tvCouponDate;
public ExpiredCouponViewHolder(View view) {
super(view);
tvCouponTitle = view.findViewById(R.id.tv_expired_coupons_title);
tvCouponValue = view.findViewById(R.id.tv_expired_coupons_value);
tvCouponDate = view.findViewById(R.id.tv_expired_coupons_date);
}
}
@Override
public int getItemCount() {
if (mCoupons == null)
return 0;
else
return mCoupons.size();
}
public Coupon getItem(int id) {
return mCoupons.get(id);
}
public void updateData(CouponList couponList) {
mCoupons.clear();
mCoupons.addAll(couponList);
notifyDataSetChanged();
}
@Override
public ExpiredCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView;
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.expired_coupon_layout, parent, false);
return new ExpiredCouponViewHolder(itemView);
}
@Override
public void onBindViewHolder(final ExpiredCouponViewHolder holder, int position) {
Coupon couponItem = mCoupons.get(position);
if (couponItem != null) {
holder.tvCouponTitle.setText(couponItem.getName());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(couponItem.getExpiration());
} catch (ParseException e) {
e.printStackTrace();
}
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
holder.tvCouponDate.setText(simpleDateFormat.format(newDate != null ? newDate : ""));
holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
}
}
public Observable<Coupon> getPositionClicks() {
return onClickSubject.cache();
}
private long getDifferenceDays(Date d1, Date d2) {
long diff = d2.getTime() - d1.getTime();
return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
}
}
package ly.warp.sdk.views.adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import org.json.JSONObject;
import java.text.ParseException;
import java.text.SimpleDateFormat;
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.SharingCoupon;
import ly.warp.sdk.io.models.SharingList;
import ly.warp.sdk.utils.WarpJSONParser;
public class SharedCouponAdapter extends RecyclerView.Adapter<SharedCouponAdapter.SharedCouponViewHolder> {
private Context mContext;
private SharingList mCoupons;
private final PublishSubject<SharingCoupon> onClickSubject = PublishSubject.create();
public SharedCouponAdapter(Context mContext, SharingList campaignList) {
this.mContext = mContext;
this.mCoupons = campaignList;
}
public class SharedCouponViewHolder extends RecyclerView.ViewHolder {
private TextView tvCouponTitle, tvCouponValue, tvCouponDate, tvCouponLabel, tvCouponPhone;
public SharedCouponViewHolder(View view) {
super(view);
tvCouponTitle = view.findViewById(R.id.tv_shared_coupons_title);
tvCouponValue = view.findViewById(R.id.tv_shared_coupons_value);
tvCouponDate = view.findViewById(R.id.tv_shared_coupons_date);
tvCouponLabel = view.findViewById(R.id.tv_shared_coupons_label);
tvCouponPhone = view.findViewById(R.id.tv_shared_coupons_phone);
}
}
@Override
public int getItemCount() {
if (mCoupons == null)
return 0;
else
return mCoupons.size();
}
public SharingCoupon getItem(int id) {
return mCoupons.get(id);
}
public void updateData(SharingList couponList) {
mCoupons.clear();
mCoupons.addAll(couponList);
notifyDataSetChanged();
}
@Override
public SharedCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView;
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.shared_coupon_layout, parent, false);
return new SharedCouponViewHolder(itemView);
}
@Override
public void onBindViewHolder(final SharedCouponViewHolder holder, int position) {
SharingCoupon couponItem = mCoupons.get(position);
if (couponItem != null) {
JSONObject extraFields = WarpJSONParser.getJSONFromString(couponItem.getTransactionMetadata());
holder.tvCouponTitle.setText(couponItem.getName());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(couponItem.getDate());
} catch (ParseException e) {
e.printStackTrace();
}
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
holder.tvCouponDate.setText(simpleDateFormat.format(newDate != null ? newDate : ""));
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"));
}
} 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.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
}
}
public Observable<SharingCoupon> getPositionClicks() {
return onClickSubject.cache();
}
private long getDifferenceDays(Date d1, Date d2) {
long diff = d2.getTime() - d1.getTime();
return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:angle="180"
android:endColor="@color/cos_cyan2"
android:startColor="@color/cos_green7" />
<corners android:radius="4dp" />
</shape>
</item>
<item
android:bottom="1dp"
android:end="1dp"
android:start="1dp"
android:top="1dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners android:radius="4dp" />
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:angle="180"
android:endColor="@color/cos_cyan2"
android:startColor="@color/cos_green7" />
</shape>
</item>
<item android:bottom="2dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white" />
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/cl_bill_payment"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rl_analysis_payment"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@android:color/white">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_bill_header"
android:id="@+id/cl_loyalty_analysis_header"
android:layout_width="match_parent"
android:layout_height="80dp"
app:layout_constraintTop_toTopOf="parent"
android:layout_height="50dp"
android:background="@android:color/white">
<ImageView
android:id="@+id/iv_loyalty_analysis_close"
android:layout_width="21dp"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginStart="24dp"
android:layout_marginTop="4dp"
android:layout_marginStart="16dp"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView3"
android:layout_width="206dp"
android:layout_height="32dp"
android:gravity="center"
android:text="@string/cos_loyalty_analysis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_analysis"
android:textColor="@color/grey"
android:textSize="17sp"
android:textStyle="bold"
......@@ -37,4 +35,98 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<include
android:id="@+id/cl_tab_coupon_analysis"
layout="@layout/tab_coupon_analysis"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/cl_loyalty_analysis_header"
android:layout_marginHorizontal="12dp"
android:layout_marginVertical="24dp" />
<ImageView
android:id="@+id/iv_gift_circle_logo"
android:layout_width="140dp"
android:layout_height="140dp"
android:layout_below="@+id/cl_tab_coupon_analysis"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_gift_circle" />
<RelativeLayout
android:id="@+id/rl_expired_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_gift_circle_logo"
android:layout_marginTop="32dp"
tools:visibility="gone">
<LinearLayout
android:id="@+id/ll_expired_coupons_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp"
android:background="@drawable/banner_border_gradient">
<TextView
android:id="@+id/tv_expired_coupons_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="32dp"
android:layout_marginVertical="8dp"
android:gravity="center"
android:textColor="@color/cos_blue_dark"
android:textSize="16sp"
tools:text="@string/cos_deals_win_title" />
</LinearLayout>
<TextView
android:id="@+id/tv_expired_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_expired_coupons_title"
android:layout_centerHorizontal="true"
android:layout_marginTop="32dp"
android:text="@string/cos_analysis2"
android:textColor="@color/cos_blue_dark"
android:textSize="16sp"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_expired_coupons"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/tv_expired_title"
android:layout_marginHorizontal="8dp"
android:layout_marginTop="24dp"
android:orientation="vertical" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_shared_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_gift_circle_logo"
android:layout_marginTop="32dp"
android:visibility="gone">
<TextView
android:id="@+id/tv_shared_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="@string/cos_analysis2"
android:textColor="@color/cos_blue_dark"
android:textSize="16sp"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_shared_coupons"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/tv_shared_title"
android:layout_marginHorizontal="8dp"
android:layout_marginTop="24dp"
android:orientation="vertical" />
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp">
<TextView
android:id="@+id/tv_expired_coupons_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_blue_dark2"
android:textSize="13sp"
android:textStyle="bold"
tools:text="05/05/2022" />
<LinearLayout
android:id="@+id/ll_expired_info_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_expired_coupons_date"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:id="@+id/tv_expired_coupons_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:maxLines="2"
android:textColor="@color/cos_blue_dark2"
android:textFontWeight="600"
android:textSize="16sp"
tools:text="Box" />
<TextView
android:id="@+id/tv_expired_coupons_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="end"
android:textColor="@color/cos_blue_dark2"
android:textSize="16sp"
android:textStyle="bold"
tools:text="4$" />
</LinearLayout>
<TextView
android:id="@+id/tv_expired_coupons_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_expired_info_view"
android:text="@string/cos_expired_coupon_label"
android:textColor="@color/cos_light_grey2"
android:textSize="16sp" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp">
<TextView
android:id="@+id/tv_shared_coupons_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_blue_dark2"
android:textSize="13sp"
android:textStyle="bold"
tools:text="05/05/2022" />
<LinearLayout
android:id="@+id/ll_expired_info_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_shared_coupons_date"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:id="@+id/tv_shared_coupons_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:maxLines="2"
android:textColor="@color/cos_blue_dark2"
android:textFontWeight="600"
android:textSize="16sp"
tools:text="Box" />
<TextView
android:id="@+id/tv_shared_coupons_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="end"
android:textColor="@color/cos_blue_dark2"
android:textSize="16sp"
android:textStyle="bold"
tools:text="4$" />
</LinearLayout>
<TextView
android:id="@+id/tv_shared_coupons_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_expired_info_view"
android:textColor="@color/cos_light_grey2"
android:textSize="16sp"
tools:text="@string/cos_expired_coupon_label" />
<TextView
android:id="@+id/tv_shared_coupons_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_shared_coupons_label"
android:textColor="@color/cos_light_grey2"
android:textSize="16sp"
tools:text="@string/cos_expired_coupon_label" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<LinearLayout
android:id="@+id/ll_tab_expired"
android:layout_width="wrap_content"
android:layout_height="32dp"
android:layout_weight="0.2"
android:background="@drawable/bottom_border_gradient2"
android:gravity="center_horizontal">
<TextView
android:id="@+id/tv_expired_tab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_redeemed_coupons_tab"
android:textColor="@color/cos_cyan4"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_tab_shared"
android:layout_width="wrap_content"
android:layout_height="32dp"
android:layout_weight="0.2"
android:background="@drawable/bottom_border_transparent"
android:gravity="center_horizontal">
<TextView
android:id="@+id/tv_shared_tab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_shared_gifts_tab"
android:textColor="@color/cos_dark_grey"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -50,4 +50,9 @@
<color name="cos_grey_tr">#00000029</color>
<color name="cos_grey7">#C0C7CD</color>
<color name="cos_grey8">#AEAEAE</color>
<color name="cos_blue_dark">#3C4F5E</color>
<color name="cos_blue_dark2">#435563</color>
<color name="cos_light_grey2">#8B97A3</color>
<color name="cos_cyan4">#2EAFB9</color>
<color name="cos_dark_grey">#394A5B</color>
</resources>
\ No newline at end of file
......
......@@ -54,7 +54,7 @@
<string name="cos_monthly">Μηνιαία</string>
<string name="cos_six_months">6Μηνο</string>
<string name="cos_annual">12Μηνο</string>
<string name="cos_analysis2">Αναλυτικά</string>
<string name="cos_analysis2">Αναλυτικά:</string>
<string name="euro"></string>
<string name="cos_profile_questionnaire">Ερωτηματολόγιο</string>
<string name="cos_active_all_coupons">Ενεργά κουπόνια</string>
......@@ -108,6 +108,11 @@
<string name="cos_dlg_activate_telco_subtitle">Θέλετε να γίνει ενεργοποίηση στο Κινητό μου;</string>
<string name="cos_dlg_activate_success_title">Το αίτημά σου ολοκληρώθηκε επιτυχώς!</string>
<string name="cos_dlg_activate_success_subtitle">Θα ενημερωθείς άμεσα για την ενεργοποίηση του πακέτου σου.</string>
<string name="cos_expired_coupon_label">Εκπτωτικό κουπόνι</string>
<string name="cos_redeemed_coupons_tab">Εξαργυρωμένα</string>
<string name="cos_shared_gifts_tab">Μοιρασμένα δώρα</string>
<string name="cos_shared_coupon_receiver">Εκπτωτικό κουπόνι προς</string>
<string name="cos_shared_coupon_sender">Έκπτωτικό κουπόνι από</string>
<string-array name="coupons_array">
<item>Κουπόνια</item>
......