Panagiotis Triantafyllou

more screens and changes

Showing 37 changed files with 1630 additions and 245 deletions
......@@ -10,6 +10,7 @@ import java.util.TimerTask;
import ly.warp.sdk.Warply;
import ly.warp.sdk.activities.BaseFragmentActivity;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.callbacks.SimpleCallbackReceiver;
import ly.warp.sdk.io.callbacks.WarplyReadyCallback;
......@@ -31,11 +32,15 @@ public class SplashActivity extends BaseActivity {
mWarplyInitializer = Warply.getInitializer(this, new WarplyReadyCallback() {
@Override
public void onWarplyReady() {
if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
WarplyManager.login(new WarplyLoginRequest()
.setId("6981234567")
.setPassword("123456"),
mLoginReceiver
);
} else {
startNextActivity();
}
}
@Override
......
......@@ -46,7 +46,7 @@ dependencies {
api 'com.google.android.material:material:1.5.0'
api group: 'com.google.zxing', name: 'core', version: '3.4.1'
api group: 'com.google.zxing', name: 'javase', version: '3.4.1'
api 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
//------------------------------ Firebase -----------------------------//
......
......@@ -47,6 +47,21 @@
android:screenOrientation="portrait" />
<activity
android:name="ly.warp.sdk.activities.ActiveCouponsActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name="ly.warp.sdk.activities.ListForYouActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name="ly.warp.sdk.activities.CouponsetInfoActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name="ly.warp.sdk.dexter.PermissionsActivity"
android:exported="false"
android:launchMode="singleInstance"
......
package ly.warp.sdk.activities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.io.Serializable;
import ly.warp.sdk.R;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.views.adapters.mix.ActiveCouponAdapter;
public class ActiveCouponsActivity extends Activity implements View.OnClickListener {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private ImageView mIvBack;
private RecyclerView mRecyclerCoupons;
private ActiveCouponAdapter mAdapterCoupons;
private CouponList mCouponList = new CouponList();
private TextView mTvEmptyCoupons;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_active_coupons);
if (getIntent().getExtras() != null && getIntent().getSerializableExtra("couponlist") != null) {
mCouponList = new CouponList(getIntent().getSerializableExtra("couponlist").toString(), true);
}
mIvBack = findViewById(R.id.iv_coupons_close);
mTvEmptyCoupons = findViewById(R.id.tv_no_coupons);
if (mCouponList != null) {
mRecyclerCoupons = findViewById(R.id.rv_active_coupons);
mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterCoupons = new ActiveCouponAdapter(this, mCouponList);
mRecyclerCoupons.setAdapter(mAdapterCoupons);
mAdapterCoupons.getPositionClicks()
.doOnNext(coupon -> {
Intent intent = new Intent(ActiveCouponsActivity.this, CouponInfoActivity.class);
intent.putExtra("coupon", (Serializable) coupon);
startActivity(intent);
})
.doOnError(error -> {
})
.subscribe();
} else {
mTvEmptyCoupons.setVisibility(View.VISIBLE);
}
initViews();
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.iv_coupons_close) {
onBackPressed();
}
}
// ===========================================================
// Methods
// ===========================================================
private void initViews() {
mIvBack.setOnClickListener(this);
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
......@@ -37,6 +37,7 @@ import ly.warp.sdk.io.request.WarplyGetCouponsetsRequest;
import ly.warp.sdk.io.request.WarplyInboxRequest;
import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.WarplyProperty;
import ly.warp.sdk.utils.managers.WarplyManager;
import ly.warp.sdk.utils.managers.WarplySessionManager;
......@@ -55,7 +56,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
private Fragment mFragmentToSet = null;
private static Consumer mConsumer;
private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>();
private static CouponList mCouponList = new CouponList();
private CouponsetsList mCouponsetsList;
// ===========================================================
......@@ -147,17 +147,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
mLlRedeem.setOnClickListener(view -> {
if (mUniqueCampaignList != null && !mUniqueCampaignList.isEmpty()) {
if (mUniqueCampaignList.containsKey("lucky_draw") && mUniqueCampaignList.get("lucky_draw").size() > 0) {
String tempUrl = mUniqueCampaignList.get("lucky_draw").get(0).getIndexUrl();
tempUrl = tempUrl
+ "?web_id=" + WarpUtils.getWebId(this)
+ "&app_uuid=" + WarplyProperty.getAppUuid(this)
+ "&api_key=" + WarpUtils.getApiKey(this)
+ "&session_uuid=" + mUniqueCampaignList.get("lucky_draw").get(0).getSessionUUID()
+ "&access_token=" + WarplyDBHelper.getInstance(this).getAuthValue("access_token")
+ "&refresh_token=" + WarplyDBHelper.getInstance(this).getAuthValue("refresh_token")
+ "&client_id=" + WarplyDBHelper.getInstance(this).getClientValue("client_id")
+ "&client_secret=" + WarplyDBHelper.getInstance(this).getClientValue("client_secret");
String tempUrl = WarplyManagerHelper.constructCampaignUrl(mUniqueCampaignList.get("lucky_draw").get(0));
if (mConsumer != null)
tempUrl = tempUrl + "&auth_token=" + (mConsumer.getUuid());
......@@ -171,18 +161,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
});
}
public static Consumer getConsumer() {
return mConsumer;
}
public static HashMap<String, CampaignList> getUniqueCampaignList() {
return mUniqueCampaignList;
}
public static CouponList getCouponList() {
return mCouponList;
}
private void initViews() {
handleIntent(getIntent());
mBottomNavigationView.setOnItemSelectedListener(this);
......@@ -199,6 +177,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
@Override
public void onSuccess(Consumer result) {
mConsumer = result;
WarplyManagerHelper.setConsumer(result);
// Thread.currentThread().interrupt();
Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver);
}
......@@ -224,6 +203,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
}
}
WarplyManagerHelper.setUniqueCampaignList(mUniqueCampaignList);
// Thread.currentThread().interrupt();
WarplyManager.getCouponsets(new WarplyGetCouponsetsRequest()
......@@ -241,6 +222,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
@Override
public void onSuccess(CouponsetsList result) {
mCouponsetsList = result;
WarplyManagerHelper.setCouponsets(result);
WarplyManager.getUserCoupons(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
}
......@@ -254,6 +236,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
@Override
public void onSuccess(CouponList result) {
CouponList mCouponList = new CouponList();
for (Coupon coupon : result) {
for (Couponset couponset : mCouponsetsList) {
if (coupon.getCouponsetUuid().equals(couponset.getUuid())) {
......@@ -265,6 +248,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
}
}
WarplyManagerHelper.setCouponList(mCouponList);
Thread.currentThread().interrupt();
new Handler(Looper.getMainLooper()).post(() -> {
initViews();
......
......@@ -8,10 +8,8 @@ import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.BitmapFactory;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
......@@ -29,9 +27,7 @@ import android.widget.TextView;
import androidx.core.app.NotificationCompat;
import ly.warp.sdk.R;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyProperty;
import ly.warp.sdk.utils.WarplyManagerHelper;
public class BillPaymentActivity extends Activity implements View.OnClickListener {
......@@ -71,20 +67,10 @@ public class BillPaymentActivity extends Activity implements View.OnClickListene
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (intent.hasExtra("channel")) {
String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl();
tempUrl = tempUrl
+ "?web_id=" + WarpUtils.getWebId(this)
+ "&app_uuid=" + WarplyProperty.getAppUuid(this)
+ "&api_key=" + WarpUtils.getApiKey(this)
+ "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID()
+ "&access_token=" + WarplyDBHelper.getInstance(this).getAuthValue("access_token")
+ "&refresh_token=" + WarplyDBHelper.getInstance(this).getAuthValue("refresh_token")
+ "&client_id=" + WarplyDBHelper.getInstance(this).getClientValue("client_id")
+ "&client_secret=" + WarplyDBHelper.getInstance(this).getClientValue("client_secret");
if (BaseFragmentActivity.getConsumer() != null)
tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
String tempUrl = WarplyManagerHelper.constructCampaignUrl(WarplyManagerHelper.getUniqueCampaignList().get("lucky_draw").get(0));
if (WarplyManagerHelper.getConsumer() != null)
tempUrl = tempUrl + "&auth_token=" + (WarplyManagerHelper.getConsumer().getUuid());
else
tempUrl = tempUrl + "&auth_token=";
......@@ -180,22 +166,12 @@ public class BillPaymentActivity extends Activity implements View.OnClickListene
mTvLuckyDraw.setText(builder, TextView.BufferType.SPANNABLE);
mClLuckyDraw.setOnClickListener(view -> {
if (BaseFragmentActivity.getUniqueCampaignList() != null && !BaseFragmentActivity.getUniqueCampaignList().isEmpty()) {
if (BaseFragmentActivity.getUniqueCampaignList().containsKey("lucky_draw") && BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").size() > 0) {
String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl();
tempUrl = tempUrl
+ "?web_id=" + WarpUtils.getWebId(this)
+ "&app_uuid=" + WarplyProperty.getAppUuid(this)
+ "&api_key=" + WarpUtils.getApiKey(this)
+ "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID()
+ "&access_token=" + WarplyDBHelper.getInstance(this).getAuthValue("access_token")
+ "&refresh_token=" + WarplyDBHelper.getInstance(this).getAuthValue("refresh_token")
+ "&client_id=" + WarplyDBHelper.getInstance(this).getClientValue("client_id")
+ "&client_secret=" + WarplyDBHelper.getInstance(this).getClientValue("client_secret");
if (BaseFragmentActivity.getConsumer() != null)
tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
if (WarplyManagerHelper.getUniqueCampaignList() != null && !WarplyManagerHelper.getUniqueCampaignList().isEmpty()) {
if (WarplyManagerHelper.getUniqueCampaignList().containsKey("lucky_draw") && WarplyManagerHelper.getUniqueCampaignList().get("lucky_draw").size() > 0) {
String tempUrl = WarplyManagerHelper.constructCampaignUrl(WarplyManagerHelper.getUniqueCampaignList().get("lucky_draw").get(0));
if (WarplyManagerHelper.getConsumer() != null)
tempUrl = tempUrl + "&auth_token=" + (WarplyManagerHelper.getConsumer().getUuid());
else
tempUrl = tempUrl + "&auth_token=";
......
package ly.warp.sdk.activities;
import android.app.Activity;
import android.app.Dialog;
import android.graphics.Paint;
import android.os.Bundle;
import android.text.Html;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import org.json.JSONObject;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.request.WarplyRedeemCouponRequest;
import ly.warp.sdk.utils.managers.WarplyManager;
public class CouponsetInfoActivity extends Activity implements View.OnClickListener {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private ImageView mIvBack, mIvCouponsetPhoto;
private TextView mTvTerms, mTvCouponsetTitle, mTvCouponsetSubtitle;
private Couponset mCouponset;
private LinearLayout mLlRedeem;
private ProgressBar mPbLoading;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_couponset_info);
mCouponset = (Couponset) getIntent().getSerializableExtra("couponset");
mIvBack = findViewById(R.id.iv_couponset_info_back);
mTvTerms = findViewById(R.id.tv_terms);
mTvCouponsetTitle = findViewById(R.id.textView13);
mTvCouponsetSubtitle = findViewById(R.id.textView14);
mIvCouponsetPhoto = findViewById(R.id.imageView6);
mLlRedeem = findViewById(R.id.ll_get_gift);
mPbLoading = findViewById(R.id.pb_loading);
initViews();
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.iv_couponset_info_back) {
onBackPressed();
return;
}
if (view.getId() == R.id.ll_get_gift) {
mPbLoading.setVisibility(View.VISIBLE);
WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest().setCouponsetUuid(mCouponset.getUuid()), mRedeemCouponCallback);
}
}
// ===========================================================
// Methods
// ===========================================================
private void initViews() {
mTvCouponsetTitle.setText(mCouponset.getName());
mTvCouponsetSubtitle.setText(Html.fromHtml(mCouponset.getDescription()));
if (!TextUtils.isEmpty(mCouponset.getImgPreview())) {
Glide.with(this)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(mCouponset.getImgPreview())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(mIvCouponsetPhoto);
} else {
Glide.with(this)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(mIvCouponsetPhoto);
}
mIvBack.setOnClickListener(this);
mLlRedeem.setOnClickListener(this);
mTvTerms.setPaintFlags(mTvTerms.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
}
private final CallbackReceiver<JSONObject> mRedeemCouponCallback = new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
mPbLoading.setVisibility(View.GONE);
showDialog(true, 1);
}
@Override
public void onFailure(int errorCode) {
mPbLoading.setVisibility(View.GONE);
showDialog(false, errorCode);
}
};
private void showDialog(boolean success, int status) {
Dialog dialog = new Dialog(this, R.style.PopUpDialog);
dialog.setContentView(R.layout.dlg_success);
dialog.getWindow().setBackgroundDrawableResource(R.drawable.banner_border_white);
dialog.show();
LinearLayout mLlButton = dialog.findViewById(R.id.ll_dl_redeem);
TextView tvTitle = dialog.findViewById(R.id.tv_dl_title);
TextView tvSubtitle = dialog.findViewById(R.id.tv_dl_subtitle);
if (success) {
tvTitle.setText(getString(R.string.cos_dlg_success_title));
tvSubtitle.setText(getString(R.string.cos_dlg_success_subtitle));
} else {
if (status == 3) {
tvTitle.setText(getString(R.string.cos_dlg_error_title));
tvSubtitle.setText(getString(R.string.cos_dlg_error_subtitle_non_buyable));
} else if (status == 5) {
tvTitle.setText(getString(R.string.cos_dlg_error_title));
tvSubtitle.setText(getString(R.string.cos_dlg_error_subtitle_no_points));
} else {
tvTitle.setText(getString(R.string.cos_dlg_error_title));
tvSubtitle.setText(getString(R.string.cos_dlg_error_subtitle));
}
}
mLlButton.setOnClickListener(view -> {
dialog.dismiss();
if (success) {
//TODO: go to coupon
}
});
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
package ly.warp.sdk.activities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.Serializable;
import java.util.HashMap;
import ly.warp.sdk.R;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.views.adapters.CouponsetsAdapter;
import ly.warp.sdk.views.adapters.ProfileCampaignAdapter;
public class ListForYouActivity extends Activity implements View.OnClickListener {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private ImageView mIvBack;
private RecyclerView mRecyclerGifts, mRecyclerRewards, mRecyclerCoupons;
private TextView mTvTitle;
private ProfileCampaignAdapter mAdapterGifts, mAdapterRewards;
private CouponsetsAdapter mAdapterCoupons;
private ConstraintLayout mClGiftsOuter, mClRewardsOuter, mClCouponsOuter;
private HashMap<String, CampaignList> mUniqueGiftsList = new HashMap<String, CampaignList>();
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_for_you);
getCampaignsBySubcategory();
mIvBack = findViewById(R.id.iv_list_close);
mTvTitle = findViewById(R.id.textView3);
mClGiftsOuter = findViewById(R.id.cl_recycler_inner);
mRecyclerGifts = findViewById(R.id.rv_gifts);
mClRewardsOuter = findViewById(R.id.cl_recycler_inner2);
mRecyclerRewards = findViewById(R.id.rv_rewards);
mClCouponsOuter = findViewById(R.id.cl_recycler_inner3);
mRecyclerCoupons = findViewById(R.id.rv_coupons);
initViews();
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.iv_list_close) {
onBackPressed();
}
}
// ===========================================================
// Methods
// ===========================================================
private void initViews() {
mIvBack.setOnClickListener(this);
mTvTitle.setText(getIntent().getStringExtra("title"));
if (mUniqueGiftsList.get("gifts") != null && mUniqueGiftsList.get("gifts").size() > 0) {
mRecyclerGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
mAdapterGifts = new ProfileCampaignAdapter(this, mUniqueGiftsList.get("gifts"));
mRecyclerGifts.setAdapter(mAdapterGifts);
mAdapterGifts.getPositionClicks()
.doOnNext(gift -> {
String tempUrl = WarplyManagerHelper.constructCampaignUrl(gift);
if (WarplyManagerHelper.getConsumer() != null)
tempUrl = tempUrl + "&auth_token=" + (WarplyManagerHelper.getConsumer().getUuid());
else
tempUrl = tempUrl + "&auth_token=";
startActivity(WarpViewActivity.createIntentFromURL(this, tempUrl));
})
.doOnError(error -> {
})
.subscribe();
} else {
mClGiftsOuter.setVisibility(View.GONE);
}
if (mUniqueGiftsList.get("rewards") != null && mUniqueGiftsList.get("rewards").size() > 0) {
mRecyclerRewards.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
mAdapterRewards = new ProfileCampaignAdapter(this, mUniqueGiftsList.get("rewards"));
mRecyclerRewards.setAdapter(mAdapterRewards);
mAdapterRewards.getPositionClicks()
.doOnNext(reward -> {
String tempUrl = WarplyManagerHelper.constructCampaignUrl(reward);
if (WarplyManagerHelper.getConsumer() != null)
tempUrl = tempUrl + "&auth_token=" + (WarplyManagerHelper.getConsumer().getUuid());
else
tempUrl = tempUrl + "&auth_token=";
startActivity(WarpViewActivity.createIntentFromURL(this, tempUrl));
})
.doOnError(error -> {
})
.subscribe();
} else {
mClRewardsOuter.setVisibility(View.GONE);
}
if (WarplyManagerHelper.getCouponsets() != null && WarplyManagerHelper.getCouponsets().size() > 0) {
mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
mAdapterCoupons = new CouponsetsAdapter(this, WarplyManagerHelper.getCouponsets());
mRecyclerCoupons.setAdapter(mAdapterCoupons);
mAdapterCoupons.getPositionClicks()
.doOnNext(couponset -> {
// Intent intent = new Intent(ListForYouActivity.this, CouponInfoActivity.class);
// intent.putExtra("coupon", (Serializable) coupon);
// startActivity(intent);
Intent intent = new Intent(ListForYouActivity.this, CouponsetInfoActivity.class);
intent.putExtra("couponset", (Serializable) couponset);
startActivity(intent);
})
.doOnError(error -> {
})
.subscribe();
} else {
mClCouponsOuter.setVisibility(View.GONE);
}
}
private void getCampaignsBySubcategory() {
if (WarplyManagerHelper.getUniqueCampaignList().get("gifts_for_you") != null && WarplyManagerHelper.getUniqueCampaignList().get("gifts_for_you").size() > 0) {
for (Campaign campaign : WarplyManagerHelper.getUniqueCampaignList().get("gifts_for_you")) {
JSONObject campaignExtra = null;
try {
campaignExtra = new JSONObject(campaign.getExtraFields());
} catch (JSONException e) {
e.printStackTrace();
}
if (campaignExtra != null) {
if (mUniqueGiftsList.containsKey(campaignExtra.optString("subcategory").trim())) {
CampaignList tempCampaignList = mUniqueGiftsList.get(campaignExtra.optString("subcategory").trim());
tempCampaignList.add(campaign);
mUniqueGiftsList.put(campaignExtra.optString("subcategory").trim(), tempCampaignList);
} else {
CampaignList tempCampaignList = new CampaignList();
tempCampaignList.add(campaign);
mUniqueGiftsList.put(campaignExtra.optString("subcategory").trim(), tempCampaignList);
}
}
}
}
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
......@@ -2,7 +2,6 @@ package ly.warp.sdk.activities;
import android.app.Activity;
import android.content.Intent;
import android.media.Image;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
......@@ -17,11 +16,9 @@ import androidx.recyclerview.widget.RecyclerView;
import java.io.Serializable;
import ly.warp.sdk.R;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyProperty;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.views.adapters.HomeCouponAdapter;
......@@ -81,7 +78,7 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener,
return;
}
if (view.getId() == R.id.tv_questionnaire) {
CampaignList cl = BaseFragmentActivity.getUniqueCampaignList().get("more");
CampaignList cl = WarplyManagerHelper.getUniqueCampaignList().get("more");
Campaign camp = null;
if (cl != null) {
for (Campaign cn : cl) {
......@@ -95,20 +92,10 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener,
if (camp == null)
return;
String tempUrl = camp.getIndexUrl();
String tempUrl = WarplyManagerHelper.constructCampaignUrl(camp);
tempUrl = tempUrl
+ "?web_id=" + WarpUtils.getWebId(this)
+ "&app_uuid=" + WarplyProperty.getAppUuid(this)
+ "&api_key=" + WarpUtils.getApiKey(this)
+ "&session_uuid=" + camp.getSessionUUID()
+ "&access_token=" + WarplyDBHelper.getInstance(this).getAuthValue("access_token")
+ "&refresh_token=" + WarplyDBHelper.getInstance(this).getAuthValue("refresh_token")
+ "&client_id=" + WarplyDBHelper.getInstance(this).getClientValue("client_id")
+ "&client_secret=" + WarplyDBHelper.getInstance(this).getClientValue("client_secret");
if (BaseFragmentActivity.getConsumer() != null)
tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
if (WarplyManagerHelper.getConsumer() != null)
tempUrl = tempUrl + "&auth_token=" + (WarplyManagerHelper.getConsumer().getUuid());
else
tempUrl = tempUrl + "&auth_token=";
......@@ -155,15 +142,15 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener,
// ===========================================================
private void initViews() {
if (BaseFragmentActivity.getConsumer() != null)
if (WarplyManagerHelper.getConsumer() != null)
mTvUsername.setText(String.format(getResources().getString(R.string.cos_profile_loyalty_name),
BaseFragmentActivity.getConsumer().getFirstName(), BaseFragmentActivity.getConsumer().getLastName()));
WarplyManagerHelper.getConsumer().getFirstName(), WarplyManagerHelper.getConsumer().getLastName()));
mIvBack.setOnClickListener(this);
mTvAnalysisButton.setOnClickListener(this);
mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
mAdapterCoupons = new HomeCouponAdapter(this, BaseFragmentActivity.getCouponList());
mAdapterCoupons = new HomeCouponAdapter(this, WarplyManagerHelper.getCouponList());
mRecyclerCoupons.setAdapter(mAdapterCoupons);
mAdapterCoupons.getPositionClicks()
.doOnNext(coupon -> {
......@@ -176,7 +163,7 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener,
.subscribe();
mRecyclerBurntCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
mAdapterBurntCoupons = new HomeCouponAdapter(this, BaseFragmentActivity.getCouponList(), true);
mAdapterBurntCoupons = new HomeCouponAdapter(this, WarplyManagerHelper.getCouponList(), true);
mRecyclerBurntCoupons.setAdapter(mAdapterBurntCoupons);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
......
......@@ -11,35 +11,26 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.json.JSONException;
import java.io.Serializable;
import ly.warp.sdk.R;
import ly.warp.sdk.activities.BaseFragmentActivity;
import ly.warp.sdk.activities.ActiveCouponsActivity;
import ly.warp.sdk.activities.BillPaymentActivity;
import ly.warp.sdk.activities.CouponInfoActivity;
import ly.warp.sdk.activities.WarpViewActivity;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyProperty;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.views.adapters.HomeCampaignAdapter;
import ly.warp.sdk.views.adapters.HomeCouponAdapter;
public class HomeFragment extends Fragment implements View.OnClickListener {
private RelativeLayout mOptionOne, mOptionTwo, mOptionThree;
private RecyclerView mRecyclerCampaigns, mRecyclerCoupons;
private HomeCouponAdapter mAdapterCoupons;
private RecyclerView mRecyclerCampaigns;
private HomeCampaignAdapter mAdapterCampaigns;
private LinearLayout mLlBillPayment;
private TextView mTvUsername;
private TextView mTvUsername, mTvActiveCoupons;
private ConstraintLayout mClActiveCoupons;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
......@@ -49,52 +40,47 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mOptionOne = (RelativeLayout) view.findViewById(R.id.info_button);
TextView mOptionOneText = (TextView) mOptionOne.findViewById(R.id.option_text);
ImageView mOptionOneImage = (ImageView) mOptionOne.findViewById(R.id.option_icon);
mOptionOne = view.findViewById(R.id.info_button);
TextView mOptionOneText = mOptionOne.findViewById(R.id.option_text);
ImageView mOptionOneImage = mOptionOne.findViewById(R.id.option_icon);
mOptionOneText.setText("2");
mOptionOneImage.setImageResource(R.drawable.mobile_option);
mOptionTwo = (RelativeLayout) view.findViewById(R.id.info_button2);
TextView mOptionTwoText = (TextView) mOptionTwo.findViewById(R.id.option_text);
ImageView mOptionTwoImage = (ImageView) mOptionTwo.findViewById(R.id.option_icon);
mOptionTwo = view.findViewById(R.id.info_button2);
TextView mOptionTwoText = mOptionTwo.findViewById(R.id.option_text);
ImageView mOptionTwoImage = mOptionTwo.findViewById(R.id.option_icon);
mOptionTwoText.setText("1");
mOptionTwoImage.setImageResource(R.drawable.phone_option);
mOptionThree = (RelativeLayout) view.findViewById(R.id.info_button3);
TextView mOptionThreeText = (TextView) mOptionThree.findViewById(R.id.option_text);
ImageView mOptionThreeImage = (ImageView) mOptionThree.findViewById(R.id.option_icon);
mOptionThree = view.findViewById(R.id.info_button3);
TextView mOptionThreeText = mOptionThree.findViewById(R.id.option_text);
ImageView mOptionThreeImage = mOptionThree.findViewById(R.id.option_icon);
mOptionThreeText.setText("1");
mOptionThreeImage.setImageResource(R.drawable.tv_option);
mClActiveCoupons = view.findViewById(R.id.cl_coupon);
mTvActiveCoupons = mClActiveCoupons.findViewById(R.id.tv_active_coupons);
mTvActiveCoupons.setText(String.format(getResources().getString(R.string.cos_active_coupons), String.valueOf(WarplyManagerHelper.getCouponList().size())));
mClActiveCoupons.setOnClickListener(this);
mLlBillPayment = view.findViewById(R.id.ll_bill_payment);
mLlBillPayment.setOnClickListener(this);
mTvUsername = view.findViewById(R.id.welcome_user_txt);
if (BaseFragmentActivity.getConsumer() != null)
if (WarplyManagerHelper.getConsumer() != null)
mTvUsername.setText(String.format(getResources().getString(R.string.welcome_user),
BaseFragmentActivity.getConsumer().getFirstName() + " " + BaseFragmentActivity.getConsumer().getLastName()));
WarplyManagerHelper.getConsumer().getFirstName() + " " + WarplyManagerHelper.getConsumer().getLastName()));
mRecyclerCampaigns = view.findViewById(R.id.rv_home_campaigns);
mRecyclerCampaigns.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
mAdapterCampaigns = new HomeCampaignAdapter(getContext(), BaseFragmentActivity.getUniqueCampaignList().get("homescreen"));
mAdapterCampaigns = new HomeCampaignAdapter(getContext(), WarplyManagerHelper.getUniqueCampaignList().get("homescreen"));
mRecyclerCampaigns.setAdapter(mAdapterCampaigns);
mAdapterCampaigns.getPositionClicks()
.doOnNext(campaign -> {
String tempUrl = campaign.getIndexUrl();
tempUrl = tempUrl
+ "?web_id=" + WarpUtils.getWebId(getContext())
+ "&app_uuid=" + WarplyProperty.getAppUuid(getContext())
+ "&api_key=" + WarpUtils.getApiKey(getContext())
+ "&session_uuid=" + campaign.getSessionUUID()
+ "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token")
+ "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token")
+ "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id")
+ "&client_secret=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_secret");
if (BaseFragmentActivity.getConsumer() != null)
tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
String tempUrl = WarplyManagerHelper.constructCampaignUrl(campaign);
if (WarplyManagerHelper.getConsumer() != null)
tempUrl = tempUrl + "&auth_token=" + (WarplyManagerHelper.getConsumer().getUuid());
else
tempUrl = tempUrl + "&auth_token=";
......@@ -103,20 +89,6 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
.doOnError(error -> {
})
.subscribe();
mRecyclerCoupons = view.findViewById(R.id.rv_home_coupons);
mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
mAdapterCoupons = new HomeCouponAdapter(getContext(), BaseFragmentActivity.getCouponList());
mRecyclerCoupons.setAdapter(mAdapterCoupons);
mAdapterCoupons.getPositionClicks()
.doOnNext(coupon -> {
Intent intent = new Intent(getContext(), CouponInfoActivity.class);
intent.putExtra("coupon", (Serializable) coupon);
startActivity(intent);
})
.doOnError(error -> {
})
.subscribe();
}
@Override
......@@ -129,6 +101,12 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
if (view.getId() == R.id.ll_bill_payment) {
Intent intent = new Intent(getContext(), BillPaymentActivity.class);
startActivity(intent);
return;
}
if (view.getId() == R.id.cl_coupon) {
Intent intent = new Intent(getContext(), ActiveCouponsActivity.class);
intent.putExtra("couponlist", WarplyManagerHelper.getCouponList());
startActivity(intent);
}
}
......
......@@ -5,7 +5,7 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.Nullable;
......@@ -15,12 +15,10 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import ly.warp.sdk.R;
import ly.warp.sdk.activities.BaseFragmentActivity;
import ly.warp.sdk.activities.ListForYouActivity;
import ly.warp.sdk.activities.LoyaltyActivity;
import ly.warp.sdk.activities.WarpViewActivity;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyProperty;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.views.adapters.ProfileCampaignAdapter;
public class LoyaltyFragment extends Fragment implements View.OnClickListener {
......@@ -35,8 +33,8 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
private RecyclerView mRecyclerDeals, mRecyclerGifts, mRecyclerMore;
private ProfileCampaignAdapter mAdapterDeals, mAdapterGifts, mAdapterMore;
private LinearLayout mLlMoreDeals, mLlMoreGifts, mLlMore;
private ConstraintLayout mClRewardsWallet;
private ImageView mIvMoreDeals, mIvMoreGifts, mIvMore;
private ConstraintLayout mClRewardsWallet, mClDealsOuter, mClGiftsOuter, mClMoreOuter;
private TextView mTvUsername;
// ===========================================================
......@@ -56,37 +54,29 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
mClRewardsWallet.setOnClickListener(this);
mTvUsername = view.findViewById(R.id.tv_name);
if (BaseFragmentActivity.getConsumer() != null)
if (WarplyManagerHelper.getConsumer() != null)
mTvUsername.setText(String.format(getResources().getString(R.string.cos_profile_name),
BaseFragmentActivity.getConsumer().getFirstName() + " " + BaseFragmentActivity.getConsumer().getLastName()));
WarplyManagerHelper.getConsumer().getFirstName() + " " + WarplyManagerHelper.getConsumer().getLastName()));
mLlMoreDeals = view.findViewById(R.id.ll_more);
mLlMoreDeals.setOnClickListener(this);
mLlMoreGifts = view.findViewById(R.id.ll_more2);
mLlMoreGifts.setOnClickListener(this);
mLlMore = view.findViewById(R.id.ll_more3);
mLlMore.setOnClickListener(this);
mIvMoreDeals = view.findViewById(R.id.iv_more);
mIvMoreDeals.setOnClickListener(this);
mIvMoreGifts = view.findViewById(R.id.iv_more2);
mIvMoreGifts.setOnClickListener(this);
mIvMore = view.findViewById(R.id.iv_more3);
mIvMore.setOnClickListener(this);
mClDealsOuter = view.findViewById(R.id.cl_recycler_inner);
mRecyclerDeals = view.findViewById(R.id.rv_deals);
if (WarplyManagerHelper.getUniqueCampaignList().get("deals_for_you") != null && WarplyManagerHelper.getUniqueCampaignList().get("deals_for_you").size() > 0) {
mRecyclerDeals.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
mAdapterDeals = new ProfileCampaignAdapter(getContext(), BaseFragmentActivity.getUniqueCampaignList().get("deals"));
mAdapterDeals = new ProfileCampaignAdapter(getContext(), WarplyManagerHelper.getUniqueCampaignList().get("deals_for_you"));
mRecyclerDeals.setAdapter(mAdapterDeals);
mAdapterDeals.getPositionClicks()
.doOnNext(deal -> {
String tempUrl = deal.getIndexUrl();
tempUrl = tempUrl
+ "?web_id=" + WarpUtils.getWebId(getContext())
+ "&app_uuid=" + WarplyProperty.getAppUuid(getContext())
+ "&api_key=" + WarpUtils.getApiKey(getContext())
+ "&session_uuid=" + deal.getSessionUUID()
+ "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token")
+ "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token")
+ "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id")
+ "&client_secret=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_secret");
if (BaseFragmentActivity.getConsumer() != null)
tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
String tempUrl = WarplyManagerHelper.constructCampaignUrl(deal);
if (WarplyManagerHelper.getConsumer() != null)
tempUrl = tempUrl + "&auth_token=" + (WarplyManagerHelper.getConsumer().getUuid());
else
tempUrl = tempUrl + "&auth_token=";
......@@ -95,27 +85,22 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
.doOnError(error -> {
})
.subscribe();
} else {
mClDealsOuter.setVisibility(View.GONE);
}
mClGiftsOuter = view.findViewById(R.id.cl_recycler_inner2);
mRecyclerGifts = view.findViewById(R.id.rv_gifts);
if (WarplyManagerHelper.getUniqueCampaignList().get("gifts_for_you") != null && WarplyManagerHelper.getUniqueCampaignList().get("gifts_for_you").size() > 0) {
mRecyclerGifts.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
mAdapterGifts = new ProfileCampaignAdapter(getContext(), BaseFragmentActivity.getUniqueCampaignList().get("gifts"));
mAdapterGifts = new ProfileCampaignAdapter(getContext(), WarplyManagerHelper.getUniqueCampaignList().get("gifts_for_you"));
mRecyclerGifts.setAdapter(mAdapterGifts);
mAdapterGifts.getPositionClicks()
.doOnNext(gift -> {
String tempUrl = gift.getIndexUrl();
tempUrl = tempUrl
+ "?web_id=" + WarpUtils.getWebId(getContext())
+ "&app_uuid=" + WarplyProperty.getAppUuid(getContext())
+ "&api_key=" + WarpUtils.getApiKey(getContext())
+ "&session_uuid=" + gift.getSessionUUID()
+ "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token")
+ "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token")
+ "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id")
+ "&client_secret=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_secret");
if (BaseFragmentActivity.getConsumer() != null)
tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
String tempUrl = WarplyManagerHelper.constructCampaignUrl(gift);
if (WarplyManagerHelper.getConsumer() != null)
tempUrl = tempUrl + "&auth_token=" + (WarplyManagerHelper.getConsumer().getUuid());
else
tempUrl = tempUrl + "&auth_token=";
......@@ -124,27 +109,22 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
.doOnError(error -> {
})
.subscribe();
} else {
mClGiftsOuter.setVisibility(View.GONE);
}
mClMoreOuter = view.findViewById(R.id.cl_recycler_inner3);
mRecyclerMore = view.findViewById(R.id.rv_more);
if (WarplyManagerHelper.getUniqueCampaignList().get("more_for_you") != null && WarplyManagerHelper.getUniqueCampaignList().get("more_for_you").size() > 0) {
mRecyclerMore.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
mAdapterMore = new ProfileCampaignAdapter(getContext(), BaseFragmentActivity.getUniqueCampaignList().get("more"));
mAdapterMore = new ProfileCampaignAdapter(getContext(), WarplyManagerHelper.getUniqueCampaignList().get("more_for_you"));
mRecyclerMore.setAdapter(mAdapterMore);
mAdapterMore.getPositionClicks()
.doOnNext(more -> {
String tempUrl = more.getIndexUrl();
tempUrl = tempUrl
+ "?web_id=" + WarpUtils.getWebId(getContext())
+ "&app_uuid=" + WarplyProperty.getAppUuid(getContext())
+ "&api_key=" + WarpUtils.getApiKey(getContext())
+ "&session_uuid=" + more.getSessionUUID()
+ "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token")
+ "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token")
+ "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id")
+ "&client_secret=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_secret");
if (BaseFragmentActivity.getConsumer() != null)
tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
String tempUrl = WarplyManagerHelper.constructCampaignUrl(more);
if (WarplyManagerHelper.getConsumer() != null)
tempUrl = tempUrl + "&auth_token=" + (WarplyManagerHelper.getConsumer().getUuid());
else
tempUrl = tempUrl + "&auth_token=";
......@@ -153,6 +133,9 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
.doOnError(error -> {
})
.subscribe();
} else {
mClMoreOuter.setVisibility(View.GONE);
}
}
@Override
......@@ -160,6 +143,12 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
if (view.getId() == R.id.cl_rewards_wallet) {
Intent intent = new Intent(getContext(), LoyaltyActivity.class);
startActivity(intent);
return;
}
if (view.getId() == R.id.iv_more2) {
Intent intent = new Intent(getContext(), ListForYouActivity.class);
intent.putExtra("title", getString(R.string.cos_gifts_title));
startActivity(intent);
}
}
......
......@@ -25,9 +25,12 @@
package ly.warp.sdk.io.models;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
......@@ -74,6 +77,25 @@ public class CouponList extends ArrayList<Coupon> {
}
}
public CouponList(String couponListJSONObject, boolean customCast) {
this();
if (couponListJSONObject == null || TextUtils.isEmpty(couponListJSONObject))
return;
JSONArray jArray = null;
try {
jArray = new JSONArray(couponListJSONObject);
} catch (JSONException e) {
e.printStackTrace();
}
if (jArray != null) {
for (int i = 0, lim = jArray.length(); i < lim; ++i) {
add(new Coupon(jArray.optJSONObject(i)));
}
}
}
@NonNull
public String getRequestSignature() {
return mRequestSignature;
......
......@@ -63,6 +63,7 @@ public class Couponset implements Parcelable, Serializable {
private static final String POINTS = "points";
private static final String POINTS_CAUSE = "points_cause";
private static final String EXPIRATION = "expiration";
private static final String VALUE = "value";
private static final String THIRD_PARTY_SERVICE = "third_party_service";
private static final String NAME = "name";
private static final String DESCRIPTION = "description";
......@@ -133,7 +134,14 @@ public class Couponset implements Parcelable, Serializable {
this.limits = json.optJSONObject(LIMITS);
this.points = json.optInt(POINTS);
this.points_cause = json.optString(POINTS_CAUSE);
this.expiration = json.optString(EXPIRATION);
JSONObject exp = null;
try {
exp = new JSONObject(json.optString(EXPIRATION));
this.expiration = exp.optString(VALUE);
} catch (JSONException e) {
e.printStackTrace();
this.expiration = "";
}
this.third_party_service = json.optBoolean(THIRD_PARTY_SERVICE);
this.name = json.optString(NAME);
this.description = json.optString(DESCRIPTION);
......
/*
* Copyright 2010-2022 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.utils;
import java.util.HashMap;
import ly.warp.sdk.Warply;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.io.models.Consumer;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.CouponsetsList;
/**
* Created by Panagiotis Triantafyllou on 18-Apr-22.
*/
public class WarplyManagerHelper {
private static Consumer mConsumer;
private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>();
private static CouponList mCouponList = new CouponList();
private static CouponsetsList mCouponsetsList = new CouponsetsList();
public static String constructCampaignUrl(Campaign item) {
String url = item.getIndexUrl()
+ "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext())
+ "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext())
+ "&api_key=" + WarpUtils.getApiKey(Warply.getWarplyContext())
+ "&session_uuid=" + item.getSessionUUID()
+ "&access_token=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token")
+ "&refresh_token=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("refresh_token")
+ "&client_id=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id")
+ "&client_secret=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret");
return url;
}
public static Consumer getConsumer() {
return mConsumer;
}
public static HashMap<String, CampaignList> getUniqueCampaignList() {
return mUniqueCampaignList;
}
public static CouponList getCouponList() {
return mCouponList;
}
public static void setConsumer(Consumer consumer) {
mConsumer = consumer;
}
public static void setUniqueCampaignList(HashMap<String, CampaignList> uniqueCouponList) {
mUniqueCampaignList = uniqueCouponList;
}
public static void setCouponList(CouponList couponList) {
mCouponList = couponList;
}
public static CouponsetsList getCouponsets() {
return mCouponsetsList;
}
public static void setCouponsets(CouponsetsList couponsets) {
mCouponsetsList = couponsets;
}
}
\ No newline at end of file
package ly.warp.sdk.views.adapters;
import android.content.Context;
import android.text.Html;
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 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;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.CouponsetsList;
public class CouponsetsAdapter extends RecyclerView.Adapter<CouponsetsAdapter.CouponsetViewHolder> {
private Context mContext;
private CouponsetsList mCouponsets;
private final PublishSubject<Couponset> onClickSubject = PublishSubject.create();
public CouponsetsAdapter(Context mContext, CouponsetsList couponsets) {
this.mContext = mContext;
this.mCouponsets = couponsets;
}
public class CouponsetViewHolder extends RecyclerView.ViewHolder {
private ImageView ivCouponLogo;
private TextView tvCouponTitle, tvCouponValue, tvCouponDate, tvCouponDescription;
public CouponsetViewHolder(View view) {
super(view);
ivCouponLogo = view.findViewById(R.id.iv_active_coupon);
tvCouponTitle = view.findViewById(R.id.tv_active_coupons_title);
tvCouponValue = view.findViewById(R.id.tv_active_coupons_value);
tvCouponDate = view.findViewById(R.id.tv_active_coupons_date);
tvCouponDescription = view.findViewById(R.id.tv_active_coupons_description);
}
}
@Override
public int getItemCount() {
if (mCouponsets == null)
return 0;
else
return mCouponsets.size();
}
public Couponset getItem(int id) {
return mCouponsets.get(id);
}
public void updateData(CouponsetsList couponsets) {
mCouponsets.clear();
mCouponsets.addAll(couponsets);
notifyDataSetChanged();
}
@Override
public CouponsetViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView;
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.active_coupon_layout, parent, false);
return new CouponsetViewHolder(itemView);
}
@Override
public void onBindViewHolder(final CouponsetViewHolder holder, int position) {
Couponset couponsetItem = mCouponsets.get(position);
if (couponsetItem != null) {
if (!TextUtils.isEmpty(couponsetItem.getImgPreview())) {
Glide.with(mContext)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(couponsetItem.getImgPreview())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(holder.ivCouponLogo);
} else {
Glide.with(mContext)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(holder.ivCouponLogo);
}
holder.tvCouponTitle.setText(couponsetItem.getName());
holder.tvCouponDescription.setText(Html.fromHtml(couponsetItem.getDescription()));
Date date = null;
try {
date = new SimpleDateFormat().parse(couponsetItem.getExpiration());
holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_active_coupon_date), String.valueOf(getDifferenceDays(date, new Date()))));
} catch (ParseException e) {
e.printStackTrace();
}
holder.tvCouponValue.setText(couponsetItem.getDiscount());
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponsetItem));
}
}
public Observable<Couponset> 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.mix;
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.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
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.activities.BaseFragmentActivity;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapter.ActiveCouponViewHolder> {
private Context mContext;
private CouponList mCoupons;
private final PublishSubject<Coupon> onClickSubject = PublishSubject.create();
public ActiveCouponAdapter(Context mContext, CouponList campaignList) {
this.mContext = mContext;
this.mCoupons = campaignList;
}
public class ActiveCouponViewHolder extends RecyclerView.ViewHolder {
private ImageView ivCouponLogo;
private TextView tvCouponTitle, tvCouponValue, tvCouponDate, tvCouponDescription;
public ActiveCouponViewHolder(View view) {
super(view);
ivCouponLogo = view.findViewById(R.id.iv_active_coupon);
tvCouponTitle = view.findViewById(R.id.tv_active_coupons_title);
tvCouponValue = view.findViewById(R.id.tv_active_coupons_value);
tvCouponDate = view.findViewById(R.id.tv_active_coupons_date);
tvCouponDescription = view.findViewById(R.id.tv_active_coupons_description);
}
}
@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 ActiveCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView;
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.active_coupon_layout, parent, false);
return new ActiveCouponViewHolder(itemView);
}
@Override
public void onBindViewHolder(final ActiveCouponViewHolder holder, int position) {
Coupon couponItem = mCoupons.get(position);
if (couponItem != null) {
if (!TextUtils.isEmpty(couponItem.getImage())) {
Glide.with(mContext)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(couponItem.getImage())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(holder.ivCouponLogo);
} else {
Glide.with(mContext)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(holder.ivCouponLogo);
}
holder.tvCouponTitle.setText(couponItem.getName());
holder.tvCouponDescription.setText(couponItem.getDescription());
Date date = null;
try {
date = new SimpleDateFormat().parse(couponItem.getExpiration());
holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_active_coupon_date), String.valueOf(getDifferenceDays(date, new Date()))));
} catch (ParseException e) {
e.printStackTrace();
}
holder.tvCouponValue.setText(couponItem.getDiscount());
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);
}
}
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_cos_green_tr" android:state_pressed="true" />
<item android:drawable="@drawable/shape_cos_green" android:state_pressed="false" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="7dp" />
<solid
android:width="2dp"
android:color="@color/cos_green5" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="7dp" />
<solid
android:width="2dp"
android:color="@color/cos_green5_tr" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:topLeftRadius="30dp" />
<gradient
android:startColor="@color/skyblue"
android:endColor="@color/cos_green4"
android:type="linear"
android:angle="270"/>
<!-- <stroke-->
<!-- android:width="1dp"-->
<!-- android:color="@color/cos_green" />-->
</shape>
\ No newline at end of file
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:topLeftRadius="27dp" />
<solid android:color="@color/white" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="140dp"
android:layout_marginBottom="16dp"
android:background="@drawable/ic_coupon_background">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_vertical_72_percent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.72" />
<ImageView
android:id="@+id/iv_active_coupon"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginStart="24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_gifts_for_you" />
<View
android:id="@+id/v_separator"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginVertical="16dp"
android:layout_marginStart="8dp"
android:background="@color/grey2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_active_coupon"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/ll_coupon_info"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_72_percent"
app:layout_constraintStart_toEndOf="@+id/v_separator"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_active_coupons_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="2"
android:textColor="#3A5266"
android:textFontWeight="600"
android:textSize="16sp"
tools:text="Εκπτωτικο κουπονι 10$ για αγορες στα ΙΚΕΑ" />
<TextView
android:id="@+id/tv_active_coupons_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#3A5266"
android:textSize="28sp"
android:textStyle="bold"
tools:text="10$" />
<TextView
android:id="@+id/tv_active_coupons_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#617181"
android:textFontWeight="600"
android:textSize="12sp"
tools:text="@string/cos_active_coupon_date" />
</LinearLayout>
<TextView
android:id="@+id/tv_active_coupons_description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="32dp"
android:maxLines="4"
android:textColor="#617181"
android:textFontWeight="600"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/gl_vertical_72_percent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Εκπτωση με ελάχιστες αγορές 100€" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ 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"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_bill_header"
android:layout_width="match_parent"
android:layout_height="80dp"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_coupons_close"
android:layout_width="21dp"
android:layout_height="20dp"
android:layout_marginStart="24dp"
android:layout_marginTop="4dp"
android:src="@drawable/ic_back"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/textView3" />
<TextView
android:id="@+id/textView3"
android:layout_width="206dp"
android:layout_height="32dp"
android:gravity="center"
android:text="Όλα τα κουπόνια μου"
android:textColor="@color/grey"
android:textSize="17sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.356"
app:layout_constraintStart_toEndOf="@+id/iv_coupons_close"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/cl_bill_header"
android:layout_marginTop="1dp"
android:background="@drawable/shape_cos_loyalty"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_active_coupons"
android:layout_width="match_parent"
android:layout_height="0dp"
android:paddingTop="48dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tv_no_coupons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Δεν υπάρχουν κουπόνια"
android:textColor="@color/grey"
android:textSize="18sp"
android:visibility="gone"
android:textStyle="bold" />
</RelativeLayout>
\ No newline at end of file
<RelativeLayout 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="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="@android:color/white">
<androidx.constraintlayout.widget.ConstraintLayout
......@@ -54,15 +54,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
<com.github.siyamed.shapeimageview.mask.PorterShapeImageView
android:id="@+id/imageView6"
android:layout_width="match_parent"
android:layout_height="224dp"
android:clipToOutline="true"
android:scaleType="centerCrop"
android:src="@drawable/carousel_banner"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:siShape="@drawable/shape_top_left_rounded"
tools:src="@drawable/carousel_banner" />
<TextView
android:id="@+id/textView13"
......@@ -184,29 +184,29 @@
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_get_gift"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="24dp"
android:background="@drawable/shape_cos_gradient2"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.516"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_gift_it">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Πάρε το δώρο σου"
android:textColor="@color/white"
android:textSize="17dp"
android:textStyle="bold" />
</LinearLayout>
<!-- <LinearLayout-->
<!-- android:id="@+id/ll_get_gift"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="50dp"-->
<!-- android:layout_marginHorizontal="32dp"-->
<!-- android:layout_marginTop="24dp"-->
<!-- android:background="@drawable/shape_cos_gradient2"-->
<!-- android:gravity="center"-->
<!-- android:orientation="horizontal"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintHorizontal_bias="0.516"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/ll_gift_it">-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:gravity="center"-->
<!-- android:text="Πάρε το δώρο σου"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="17dp"-->
<!-- android:textStyle="bold" />-->
<!-- </LinearLayout>-->
<TextView
android:id="@+id/tv_terms"
......@@ -219,7 +219,7 @@
android:textSize="15sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_get_gift" />
app:layout_constraintTop_toBottomOf="@+id/ll_gift_it" />
<ImageView
android:id="@+id/iv_barcode"
......
<RelativeLayout 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="match_parent"
android:background="@android:color/white">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_loyalty_wallet_header"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@android:color/white">
<ImageView
android:id="@+id/iv_couponset_info_back"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginStart="16dp"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_coupon_info_title"
android:textColor="@color/grey"
android:textSize="17sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/cl_loyalty_wallet_header"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_loyalty_info_view_inner"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_cos_coupon_info"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.github.siyamed.shapeimageview.mask.PorterShapeImageView
android:id="@+id/imageView6"
android:layout_width="match_parent"
android:layout_height="224dp"
android:scaleType="centerCrop"
android:src="@drawable/carousel_banner"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:siShape="@drawable/shape_top_left_rounded" />
<TextView
android:id="@+id/textView13"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:paddingHorizontal="32dp"
android:textColor="#415564"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.509"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView6"
tools:text="Πάρε δωρεάν μηνιαία πακέτα με πάνες στα supermarket Σκλαβενίτης!" />
<TextView
android:id="@+id/textView14"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:paddingHorizontal="32dp"
android:textColor="#415564"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView13"
tools:text="Χρησιμοποίησε τον παρακάτω κωδικό και πάρε δωρεάν πακέτο πάνες Pampers αποκλειστικά στα Supermarket Σκλαβενίτης" />
<LinearLayout
android:id="@+id/ll_get_gift"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginHorizontal="32dp"
android:layout_marginBottom="32dp"
android:background="@drawable/selector_button_green"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="@+id/tv_terms"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/cos_redeem_coupon"
android:textColor="@color/white"
android:textSize="17dp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/tv_terms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:text="@string/cos_coupon_terms_title"
android:textColor="#415564"
android:textFontWeight="600"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<ProgressBar
android:id="@+id/pb_loading"
android:layout_width="48dp"
android:layout_height="48dp"
android:indeterminate="true"
android:indeterminateTint="@color/cos_green5"
android:indeterminateTintMode="src_atop"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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="match_parent"
android:background="@android:color/white"
android:fillViewport="true">
<LinearLayout
android:id="@+id/cl_bill_payment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_bill_header"
android:layout_width="match_parent"
android:layout_height="80dp"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_list_close"
android:layout_width="21dp"
android:layout_height="20dp"
android:layout_marginStart="24dp"
android:layout_marginTop="4dp"
android:src="@drawable/ic_back"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/textView3" />
<TextView
android:id="@+id/textView3"
android:layout_width="206dp"
android:layout_height="32dp"
android:gravity="center"
android:textColor="@color/grey"
android:textSize="17sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.356"
app:layout_constraintStart_toEndOf="@+id/iv_list_close"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_cos_profile_gradient"
android:orientation="vertical"
android:paddingBottom="24dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_recycler_inner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
android:paddingBottom="4dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_gifts_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="@string/cos_gifts_title2"
android:textColor="@android:color/white"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_gifts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingEnd="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_gifts_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_recycler_inner2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/cl_recycler_inner"
android:layout_marginTop="36dp"
android:paddingBottom="4dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_rewards_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="@string/cos_rewards_title"
android:textColor="@android:color/white"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_rewards"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingEnd="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_rewards_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_recycler_inner3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/cl_recycler_inner2"
android:layout_marginTop="36dp"
android:paddingBottom="4dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_coupons_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="@string/cos_coupons_title"
android:textColor="@android:color/white"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_coupons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingEnd="24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_coupons_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>
\ 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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingHorizontal="16dp"
android:paddingVertical="56dp">
<TextView
android:id="@+id/tv_dl_title"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginHorizontal="48dp"
android:gravity="center"
tools:text="@string/cos_dlg_success_title"
android:textColor="#0072C9"
android:textSize="25sp"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_dl_subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_dl_title"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginHorizontal="48dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="24dp"
android:gravity="center"
tools:text="@string/cos_dlg_success_subtitle"
android:textColor="#5B5B5B"
android:textFontWeight="500"
android:textSize="18sp" />
<LinearLayout
android:id="@+id/ll_dl_redeem"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/tv_dl_subtitle"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="24dp"
android:background="@drawable/selector_button_green"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="ΟΚ"
android:textColor="@color/white"
android:textSize="17dp"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
......@@ -35,8 +35,7 @@
android:paddingLeft="10dp"
app:layout_constraintEnd_toStartOf="@+id/iv_settings"
app:layout_constraintStart_toEndOf="@+id/user_img"
app:layout_constraintTop_toTopOf="@+id/user_img"
tools:layout_editor_absoluteY="-10dp">
app:layout_constraintTop_toTopOf="@+id/user_img">
<TextView
android:id="@+id/welcome_user_txt"
......@@ -45,8 +44,8 @@
android:layout_marginBottom="8dp"
android:maxLines="1"
android:scrollHorizontally="true"
tools:text="@string/welcome_user"
android:textColor="#415564" />
android:textColor="#415564"
tools:text="@string/welcome_user" />
<ImageView
android:id="@+id/cosmote_one"
......@@ -121,7 +120,8 @@
android:id="@+id/rl_home_coupons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/rl_home_campaigns">
android:layout_below="@id/rl_home_campaigns"
android:visibility="gone">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_home_coupons"
......@@ -141,12 +141,57 @@
android:layout_below="@id/rl_home_coupons"
android:layout_marginHorizontal="8dp" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_coupon"
android:layout_width="match_parent"
android:layout_height="140dp"
android:layout_below="@+id/rl_home_info_widget"
android:layout_marginTop="24dp"
android:background="@drawable/ic_coupon_background">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_active_coupons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:textColor="#3A5266"
android:textFontWeight="600"
android:textSize="16sp"
tools:text="@string/cos_active_coupons" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Δες τα όλα ->"
android:textColor="#3A5266" />
</LinearLayout>
<ImageView
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_marginEnd="32dp"
android:src="@drawable/ic_gifts_for_you"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/hsv_title"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="@+id/rl_home_info_widget"
android:layout_marginTop="25dp"
android:layout_below="@+id/cl_coupon"
android:layout_marginTop="24dp"
android:background="@android:color/white"
android:paddingHorizontal="25dp"
android:paddingTop="10dp"
......
......@@ -21,4 +21,9 @@
<color name="grey_tr">#A3415564</color>
<color name="grey_light2">#F9F9F9</color>
<color name="grey_tr2">#D4415564</color>
<color name="grey2">#707070</color>
<color name="skyblue">#1AADCC</color>
<color name="cos_green4">#6DBC7A</color>
<color name="cos_green5">#79BF14</color>
<color name="cos_green5_tr">#6679BF14</color>
</resources>
\ No newline at end of file
......
......@@ -10,7 +10,7 @@
<string name="cos_profile_name">%1$s</string>
<string name="cos_profile_type">Traveller</string>
<string name="header_add">Προσθήκη</string>
<string name="cos_profile_reward">My reward wallet</string>
<string name="cos_profile_reward">My Loyalty\nWallet</string>
<string name="cos_deals_title">Deals for You</string>
<string name="cos_profile_more">Δες περισσότερα</string>
<string name="cos_gifts_title">Gifts for You</string>
......@@ -27,6 +27,19 @@
<string name="cos_coupon_info_title">Εκπτωτικό κουπόνι</string>
<string name="cos_coupon_date">Το κουπόνι ισχύει έως %1$s</string>
<string name="cos_dl_title">Μόλις έλαβες δώρο %1$s συμμετοχές στο My Lucky Day Draw!</string>
<string name="cos_active_coupons">Έχεις %1$s ενεργά\nκουπόνια</string>
<string name="cos_active_coupon_date">Λήγει σε %1$s ημέρες</string>
<string name="cos_gifts_title2">ΔΩΡΑ</string>
<string name="cos_rewards_title">ΕΠΙΒΡΑΒΕΥΣΕΙΣ</string>
<string name="cos_coupons_title">ΚΟΥΠΟΝΙΑ</string>
<string name="cos_coupon_terms_title">Όροι χρήσης</string>
<string name="cos_redeem_coupon">Απόκτησέ το</string>
<string name="cos_dlg_success_title">Συγχαρητήρια</string>
<string name="cos_dlg_success_subtitle">Το κουπόνι εξαργυρώθηκε με επιτυχία</string>
<string name="cos_dlg_error_title">Αποτυχία</string>
<string name="cos_dlg_error_subtitle">Κάτι πήγε στραβά</string>
<string name="cos_dlg_error_subtitle_non_buyable">Το κουπόνι δεν είναι διαθέσιμο για αγορά</string>
<string name="cos_dlg_error_subtitle_no_points">Δεν έχεις αρκετούς πόντους</string>
<string-array name="coupons_array">
<item>Κουπόνια</item>
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Transparent theme - Does not work in jar export -->
<!--<style name="Theme.Transparent" parent="android:Theme">-->
<!--<item name="android:windowIsTranslucent">true</item>-->
<!--<item name="android:windowBackground">@android:color/transparent</item>-->
<!--<item name="android:windowContentOverlay">@null</item>-->
<!--<item name="android:windowNoTitle">true</item>-->
<!--<item name="android:windowIsFloating">true</item>-->
<!--<item name="android:backgroundDimEnabled">false</item>-->
<!--</style>-->
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:layout_gravity">right</item>
<!--<item name="colorAccent">#23a890</item>-->
......