Showing
13 changed files
with
187 additions
and
10 deletions
| ... | @@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { | ... | @@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { |
| 36 | public void onWarplyReady() { | 36 | public void onWarplyReady() { |
| 37 | if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { | 37 | if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { |
| 38 | WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() | 38 | WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() |
| 39 | - .setGuid("6012049139"), //6012049321, 6012049322, 6012049323 | 39 | + .setGuid("7000001406"), //6012049321, 6012049322, 6012049323 |
| 40 | mLoginReceiver); | 40 | mLoginReceiver); |
| 41 | } else { | 41 | } else { |
| 42 | startNextActivity(); | 42 | startNextActivity(); | ... | ... |
| ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' |
| 2 | 2 | ||
| 3 | ext { | 3 | ext { |
| 4 | PUBLISH_GROUP_ID = 'ly.warp' | 4 | PUBLISH_GROUP_ID = 'ly.warp' |
| 5 | - PUBLISH_VERSION = '4.5.4-cosbeta49' | 5 | + PUBLISH_VERSION = '4.5.4-cosbeta50' |
| 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
| 7 | } | 7 | } |
| 8 | 8 | ... | ... |
| ... | @@ -35,6 +35,7 @@ import ly.warp.sdk.io.request.WarplyRedeemCouponRequest; | ... | @@ -35,6 +35,7 @@ import ly.warp.sdk.io.request.WarplyRedeemCouponRequest; |
| 35 | import ly.warp.sdk.io.request.WarplyUserCouponsRequest; | 35 | import ly.warp.sdk.io.request.WarplyUserCouponsRequest; |
| 36 | import ly.warp.sdk.services.EventCampaignService; | 36 | import ly.warp.sdk.services.EventCampaignService; |
| 37 | import ly.warp.sdk.services.EventService; | 37 | import ly.warp.sdk.services.EventService; |
| 38 | +import ly.warp.sdk.utils.WarpJSONParser; | ||
| 38 | import ly.warp.sdk.utils.WarplyManagerHelper; | 39 | import ly.warp.sdk.utils.WarplyManagerHelper; |
| 39 | import ly.warp.sdk.utils.managers.WarplyManager; | 40 | import ly.warp.sdk.utils.managers.WarplyManager; |
| 40 | 41 | ||
| ... | @@ -59,6 +60,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -59,6 +60,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe |
| 59 | private AlertDialog mAlertDialogCouponset; | 60 | private AlertDialog mAlertDialogCouponset; |
| 60 | private Campaign mLoyalty; | 61 | private Campaign mLoyalty; |
| 61 | private LoyaltyContextualOfferModel mCcms = null; | 62 | private LoyaltyContextualOfferModel mCcms = null; |
| 63 | + private AlertDialog mAlertDialogNonTelco; | ||
| 62 | 64 | ||
| 63 | // =========================================================== | 65 | // =========================================================== |
| 64 | // Methods for/from SuperClass/Interfaces | 66 | // Methods for/from SuperClass/Interfaces |
| ... | @@ -156,6 +158,15 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -156,6 +158,15 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe |
| 156 | // =========================================================== | 158 | // =========================================================== |
| 157 | 159 | ||
| 158 | private void initViews() { | 160 | private void initViews() { |
| 161 | + if (WarplyManagerHelper.getConsumerInternal() != null) { | ||
| 162 | + JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata()); | ||
| 163 | + if (profMetadata != null) { | ||
| 164 | + if (profMetadata.has("nonTelco") && profMetadata.optBoolean("nonTelco")) { | ||
| 165 | + nonTelcoDialog(); | ||
| 166 | + } | ||
| 167 | + } | ||
| 168 | + } | ||
| 169 | + | ||
| 159 | mTvCouponsetTitle.setText(mCouponset.getName()); | 170 | mTvCouponsetTitle.setText(mCouponset.getName()); |
| 160 | mTvCouponsetSubtitle.setText(Html.fromHtml(mCouponset.getDescription())); | 171 | mTvCouponsetSubtitle.setText(Html.fromHtml(mCouponset.getDescription())); |
| 161 | mLlTerms.setOnClickListener(this); | 172 | mLlTerms.setOnClickListener(this); |
| ... | @@ -251,6 +262,16 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -251,6 +262,16 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe |
| 251 | } | 262 | } |
| 252 | } | 263 | } |
| 253 | 264 | ||
| 265 | + private void nonTelcoDialog() { | ||
| 266 | + mAlertDialogNonTelco = new AlertDialog.Builder(this) | ||
| 267 | + .setTitle(R.string.cos_dlg_non_telco) | ||
| 268 | + .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> { | ||
| 269 | + dialogPositive.dismiss(); | ||
| 270 | + onBackPressed(); | ||
| 271 | + }) | ||
| 272 | + .show(); | ||
| 273 | + } | ||
| 274 | + | ||
| 254 | // =========================================================== | 275 | // =========================================================== |
| 255 | // Inner and Anonymous Classes | 276 | // Inner and Anonymous Classes |
| 256 | // =========================================================== | 277 | // =========================================================== | ... | ... |
| ... | @@ -12,6 +12,7 @@ import android.widget.ImageView; | ... | @@ -12,6 +12,7 @@ import android.widget.ImageView; |
| 12 | import android.widget.LinearLayout; | 12 | import android.widget.LinearLayout; |
| 13 | import android.widget.TextView; | 13 | import android.widget.TextView; |
| 14 | 14 | ||
| 15 | +import androidx.appcompat.app.AlertDialog; | ||
| 15 | import androidx.constraintlayout.widget.ConstraintLayout; | 16 | import androidx.constraintlayout.widget.ConstraintLayout; |
| 16 | import androidx.recyclerview.widget.LinearLayoutManager; | 17 | import androidx.recyclerview.widget.LinearLayoutManager; |
| 17 | import androidx.recyclerview.widget.RecyclerView; | 18 | import androidx.recyclerview.widget.RecyclerView; |
| ... | @@ -20,6 +21,7 @@ import com.bumptech.glide.Glide; | ... | @@ -20,6 +21,7 @@ import com.bumptech.glide.Glide; |
| 20 | import com.bumptech.glide.load.engine.DiskCacheStrategy; | 21 | import com.bumptech.glide.load.engine.DiskCacheStrategy; |
| 21 | 22 | ||
| 22 | import org.greenrobot.eventbus.EventBus; | 23 | import org.greenrobot.eventbus.EventBus; |
| 24 | +import org.json.JSONObject; | ||
| 23 | 25 | ||
| 24 | import java.io.Serializable; | 26 | import java.io.Serializable; |
| 25 | import java.util.Collections; | 27 | import java.util.Collections; |
| ... | @@ -32,6 +34,7 @@ import ly.warp.sdk.R; | ... | @@ -32,6 +34,7 @@ import ly.warp.sdk.R; |
| 32 | import ly.warp.sdk.io.models.ActiveDFYCouponEventModel; | 34 | import ly.warp.sdk.io.models.ActiveDFYCouponEventModel; |
| 33 | import ly.warp.sdk.io.models.ActiveDFYCouponModel; | 35 | import ly.warp.sdk.io.models.ActiveDFYCouponModel; |
| 34 | import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; | 36 | import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; |
| 37 | +import ly.warp.sdk.utils.WarpJSONParser; | ||
| 35 | import ly.warp.sdk.utils.WarpUtils; | 38 | import ly.warp.sdk.utils.WarpUtils; |
| 36 | import ly.warp.sdk.utils.WarplyManagerHelper; | 39 | import ly.warp.sdk.utils.WarplyManagerHelper; |
| 37 | import ly.warp.sdk.utils.managers.WarplyEventBusManager; | 40 | import ly.warp.sdk.utils.managers.WarplyEventBusManager; |
| ... | @@ -58,6 +61,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -58,6 +61,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
| 58 | private float couponDfyValue = 0.0f; | 61 | private float couponDfyValue = 0.0f; |
| 59 | private RecyclerView mRecyclerCoupons; | 62 | private RecyclerView mRecyclerCoupons; |
| 60 | private ActiveCouponAdapter mAdapterCoupons; | 63 | private ActiveCouponAdapter mAdapterCoupons; |
| 64 | + private AlertDialog mAlertDialogNonTelco; | ||
| 61 | 65 | ||
| 62 | // =========================================================== | 66 | // =========================================================== |
| 63 | // Methods for/from SuperClass/Interfaces | 67 | // Methods for/from SuperClass/Interfaces |
| ... | @@ -170,6 +174,15 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -170,6 +174,15 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
| 170 | // =========================================================== | 174 | // =========================================================== |
| 171 | 175 | ||
| 172 | private void initViews() { | 176 | private void initViews() { |
| 177 | + if(WarplyManagerHelper.getConsumerInternal() != null) { | ||
| 178 | + JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata()); | ||
| 179 | + if(profMetadata != null) { | ||
| 180 | + if (profMetadata.has("nonTelco") && profMetadata.optBoolean("nonTelco")) { | ||
| 181 | + nonTelcoDialog(); | ||
| 182 | + } | ||
| 183 | + } | ||
| 184 | + } | ||
| 185 | + | ||
| 173 | if (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() > 0) { | 186 | if (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() > 0) { |
| 174 | mAdapterCoupons = new ActiveCouponAdapter(this, WarplyManagerHelper.getCouponList()); | 187 | mAdapterCoupons = new ActiveCouponAdapter(this, WarplyManagerHelper.getCouponList()); |
| 175 | mRecyclerCoupons.setAdapter(mAdapterCoupons); | 188 | mRecyclerCoupons.setAdapter(mAdapterCoupons); |
| ... | @@ -307,6 +320,16 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -307,6 +320,16 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
| 307 | mClDealsView.setOnClickListener(this); | 320 | mClDealsView.setOnClickListener(this); |
| 308 | } | 321 | } |
| 309 | 322 | ||
| 323 | + private void nonTelcoDialog() { | ||
| 324 | + mAlertDialogNonTelco = new AlertDialog.Builder(this) | ||
| 325 | + .setTitle(R.string.cos_dlg_non_telco) | ||
| 326 | + .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> { | ||
| 327 | + dialogPositive.dismiss(); | ||
| 328 | + onBackPressed(); | ||
| 329 | + }) | ||
| 330 | + .show(); | ||
| 331 | + } | ||
| 332 | + | ||
| 310 | // =========================================================== | 333 | // =========================================================== |
| 311 | // Inner and Anonymous Classes | 334 | // Inner and Anonymous Classes |
| 312 | // =========================================================== | 335 | // =========================================================== | ... | ... |
| ... | @@ -13,6 +13,7 @@ import android.widget.LinearLayout; | ... | @@ -13,6 +13,7 @@ import android.widget.LinearLayout; |
| 13 | import android.widget.TextView; | 13 | import android.widget.TextView; |
| 14 | 14 | ||
| 15 | import androidx.appcompat.app.AlertDialog; | 15 | import androidx.appcompat.app.AlertDialog; |
| 16 | +import androidx.core.content.ContextCompat; | ||
| 16 | 17 | ||
| 17 | import com.bumptech.glide.Glide; | 18 | import com.bumptech.glide.Glide; |
| 18 | import com.bumptech.glide.load.engine.DiskCacheStrategy; | 19 | import com.bumptech.glide.load.engine.DiskCacheStrategy; |
| ... | @@ -22,15 +23,14 @@ import org.json.JSONArray; | ... | @@ -22,15 +23,14 @@ import org.json.JSONArray; |
| 22 | import org.json.JSONException; | 23 | import org.json.JSONException; |
| 23 | import org.json.JSONObject; | 24 | import org.json.JSONObject; |
| 24 | 25 | ||
| 26 | +import io.github.inflationx.viewpump.ViewPumpContextWrapper; | ||
| 25 | import ly.warp.sdk.R; | 27 | import ly.warp.sdk.R; |
| 26 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 28 | import ly.warp.sdk.io.callbacks.CallbackReceiver; |
| 27 | import ly.warp.sdk.io.models.Campaign; | 29 | import ly.warp.sdk.io.models.Campaign; |
| 28 | import ly.warp.sdk.io.models.Consumer; | 30 | import ly.warp.sdk.io.models.Consumer; |
| 29 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | 31 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; |
| 30 | -import ly.warp.sdk.io.request.CosmotePostEventRequest; | ||
| 31 | import ly.warp.sdk.io.request.CosmoteSubmitOrderRequest; | 32 | import ly.warp.sdk.io.request.CosmoteSubmitOrderRequest; |
| 32 | import ly.warp.sdk.io.request.WarplyConsumerRequest; | 33 | import ly.warp.sdk.io.request.WarplyConsumerRequest; |
| 33 | -import ly.warp.sdk.utils.WarpUtils; | ||
| 34 | import ly.warp.sdk.utils.managers.WarplyManager; | 34 | import ly.warp.sdk.utils.managers.WarplyManager; |
| 35 | 35 | ||
| 36 | 36 | ||
| ... | @@ -47,13 +47,16 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -47,13 +47,16 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
| 47 | // =========================================================== | 47 | // =========================================================== |
| 48 | 48 | ||
| 49 | private ImageView mIvBack, mIvCampaignPhoto; | 49 | private ImageView mIvBack, mIvCampaignPhoto; |
| 50 | - private TextView mTvCampaignTitle, mTvCampaignSubtitle; | 50 | + private TextView mTvCampaignTitle, mTvTelcoGiftValue, mTvTelcoGiftType, mTvTelcoHeaderTitle, |
| 51 | + mTvTelcoGiftDuration, mTvSeeMoreValue; | ||
| 51 | private LoyaltyContextualOfferModel mCCMS = new LoyaltyContextualOfferModel(); | 52 | private LoyaltyContextualOfferModel mCCMS = new LoyaltyContextualOfferModel(); |
| 52 | private Campaign mLoyalty = new Campaign(); | 53 | private Campaign mLoyalty = new Campaign(); |
| 53 | private LinearLayout mLlActivateOffer; | 54 | private LinearLayout mLlActivateOffer; |
| 54 | private Consumer mConsumer; | 55 | private Consumer mConsumer; |
| 55 | private String mSender = ""; | 56 | private String mSender = ""; |
| 56 | private AlertDialog mAlertDialogAskActivate, mAlertDialogErrorActivating, mAlertDialogSuccessActivating; | 57 | private AlertDialog mAlertDialogAskActivate, mAlertDialogErrorActivating, mAlertDialogSuccessActivating; |
| 58 | + private LinearLayout mLlSeeMore; | ||
| 59 | + private boolean mIsSeeMoreShown = false; | ||
| 57 | 60 | ||
| 58 | // =========================================================== | 61 | // =========================================================== |
| 59 | // Methods for/from SuperClass/Interfaces | 62 | // Methods for/from SuperClass/Interfaces |
| ... | @@ -70,8 +73,13 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -70,8 +73,13 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
| 70 | mIvBack = findViewById(R.id.iv_telco_back); | 73 | mIvBack = findViewById(R.id.iv_telco_back); |
| 71 | mTvCampaignTitle = findViewById(R.id.textView13); | 74 | mTvCampaignTitle = findViewById(R.id.textView13); |
| 72 | mIvCampaignPhoto = findViewById(R.id.imageView6); | 75 | mIvCampaignPhoto = findViewById(R.id.imageView6); |
| 73 | - mTvCampaignSubtitle = findViewById(R.id.textView14); | ||
| 74 | mLlActivateOffer = findViewById(R.id.ll_activate_button); | 76 | mLlActivateOffer = findViewById(R.id.ll_activate_button); |
| 77 | + mTvTelcoGiftValue = findViewById(R.id.tv_telco_gift_value); | ||
| 78 | + mTvTelcoGiftType = findViewById(R.id.tv_telco_gift_type); | ||
| 79 | + mTvTelcoHeaderTitle = findViewById(R.id.tv_telco_header_title); | ||
| 80 | + mTvTelcoGiftDuration = findViewById(R.id.tv_telco_gift_duration); | ||
| 81 | + mLlSeeMore = findViewById(R.id.ll_see_more); | ||
| 82 | + mTvSeeMoreValue = findViewById(R.id.tv_see_more_value); | ||
| 75 | 83 | ||
| 76 | initViews(); | 84 | initViews(); |
| 77 | } | 85 | } |
| ... | @@ -97,18 +105,41 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -97,18 +105,41 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
| 97 | } | 105 | } |
| 98 | if (view.getId() == R.id.ll_activate_button) { | 106 | if (view.getId() == R.id.ll_activate_button) { |
| 99 | showActivationDialog(); | 107 | showActivationDialog(); |
| 108 | + return; | ||
| 109 | + } | ||
| 110 | + if (view.getId() == R.id.ll_see_more) { | ||
| 111 | + if (mIsSeeMoreShown) { | ||
| 112 | + mTvSeeMoreValue.setVisibility(View.GONE); | ||
| 113 | + ImageView seeMoreButtonArrow = mLlSeeMore.findViewById(R.id.iv_see_more_arrow); | ||
| 114 | + seeMoreButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_arrow_down_dark)); | ||
| 115 | + mIsSeeMoreShown = false; | ||
| 116 | + } else { | ||
| 117 | + mTvSeeMoreValue.setVisibility(View.VISIBLE); | ||
| 118 | + ImageView seeMoreButtonArrow = mLlSeeMore.findViewById(R.id.iv_see_more_arrow); | ||
| 119 | + seeMoreButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_arrow_up_dark)); | ||
| 120 | + mIsSeeMoreShown = true; | ||
| 121 | + } | ||
| 100 | } | 122 | } |
| 101 | } | 123 | } |
| 102 | 124 | ||
| 125 | + @Override | ||
| 126 | + protected void attachBaseContext(Context newBase) { | ||
| 127 | + super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase)); | ||
| 128 | + } | ||
| 129 | + | ||
| 103 | // =========================================================== | 130 | // =========================================================== |
| 104 | // Methods | 131 | // Methods |
| 105 | // =========================================================== | 132 | // =========================================================== |
| 106 | 133 | ||
| 107 | private void initViews() { | 134 | private void initViews() { |
| 108 | - mTvCampaignTitle.setText(mCCMS.getTitle()); | 135 | + mTvTelcoHeaderTitle.setText(mCCMS.getTitleOffer()); |
| 109 | - mTvCampaignSubtitle.setText(mCCMS.getSubtitle()); | 136 | + mTvCampaignTitle.setText(mCCMS.getDescription()); |
| 110 | - | 137 | + mTvTelcoGiftValue.setText(mCCMS.getGiftValue()); |
| 111 | - if (!TextUtils.isEmpty(mCCMS.getImageUrl())) { | 138 | + mTvTelcoGiftType.setText(mCCMS.getGiftType()); |
| 139 | + mTvTelcoGiftDuration.setText(mCCMS.getDuration()); | ||
| 140 | + mTvSeeMoreValue.setText(mCCMS.getTermsAndConditions()); | ||
| 141 | + | ||
| 142 | + if (!TextUtils.isEmpty(mCCMS.getImageOfferUrl())) { | ||
| 112 | Glide.with(this) | 143 | Glide.with(this) |
| 113 | // .setDefaultRequestOptions( | 144 | // .setDefaultRequestOptions( |
| 114 | // RequestOptions | 145 | // RequestOptions |
| ... | @@ -124,6 +155,7 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -124,6 +155,7 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
| 124 | } | 155 | } |
| 125 | mIvBack.setOnClickListener(this); | 156 | mIvBack.setOnClickListener(this); |
| 126 | mLlActivateOffer.setOnClickListener(this); | 157 | mLlActivateOffer.setOnClickListener(this); |
| 158 | + mLlSeeMore.setOnClickListener(this); | ||
| 127 | } | 159 | } |
| 128 | 160 | ||
| 129 | private void showActivationDialog() { | 161 | private void showActivationDialog() { | ... | ... |
This diff is collapsed. Click to expand it.
| 1 | package ly.warp.sdk.views.adapters; | 1 | package ly.warp.sdk.views.adapters; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | +import android.content.Intent; | ||
| 4 | import android.text.TextUtils; | 5 | import android.text.TextUtils; |
| 5 | import android.view.LayoutInflater; | 6 | import android.view.LayoutInflater; |
| 6 | import android.view.View; | 7 | import android.view.View; |
| ... | @@ -15,6 +16,9 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy; | ... | @@ -15,6 +16,9 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy; |
| 15 | import com.bumptech.glide.load.resource.bitmap.CenterCrop; | 16 | import com.bumptech.glide.load.resource.bitmap.CenterCrop; |
| 16 | import com.bumptech.glide.load.resource.bitmap.RoundedCorners; | 17 | import com.bumptech.glide.load.resource.bitmap.RoundedCorners; |
| 17 | 18 | ||
| 19 | +import org.json.JSONObject; | ||
| 20 | + | ||
| 21 | +import java.io.Serializable; | ||
| 18 | import java.util.ArrayList; | 22 | import java.util.ArrayList; |
| 19 | import java.util.Date; | 23 | import java.util.Date; |
| 20 | import java.util.concurrent.TimeUnit; | 24 | import java.util.concurrent.TimeUnit; |
| ... | @@ -22,7 +26,12 @@ import java.util.concurrent.TimeUnit; | ... | @@ -22,7 +26,12 @@ import java.util.concurrent.TimeUnit; |
| 22 | import io.reactivex.Observable; | 26 | import io.reactivex.Observable; |
| 23 | import io.reactivex.subjects.PublishSubject; | 27 | import io.reactivex.subjects.PublishSubject; |
| 24 | import ly.warp.sdk.R; | 28 | import ly.warp.sdk.R; |
| 29 | +import ly.warp.sdk.activities.GiftsForYouActivity; | ||
| 30 | +import ly.warp.sdk.activities.TelcoActivity; | ||
| 31 | +import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | ||
| 25 | import ly.warp.sdk.io.models.MergedGifts; | 32 | import ly.warp.sdk.io.models.MergedGifts; |
| 33 | +import ly.warp.sdk.utils.WarpJSONParser; | ||
| 34 | +import ly.warp.sdk.utils.WarplyManagerHelper; | ||
| 26 | 35 | ||
| 27 | public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.MergedGiftsViewHolder> { | 36 | public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.MergedGiftsViewHolder> { |
| 28 | 37 | ||
| ... | @@ -78,6 +87,33 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter. | ... | @@ -78,6 +87,33 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter. |
| 78 | public void onBindViewHolder(final MergedGiftsViewHolder holder, int position) { | 87 | public void onBindViewHolder(final MergedGiftsViewHolder holder, int position) { |
| 79 | MergedGifts mergedgiftsItem = mMergedGifts.get(position); | 88 | MergedGifts mergedgiftsItem = mMergedGifts.get(position); |
| 80 | if (mergedgiftsItem != null && mergedgiftsItem.getDataType() == 1) { | 89 | if (mergedgiftsItem != null && mergedgiftsItem.getDataType() == 1) { |
| 90 | + JSONObject extraFields = WarpJSONParser.getJSONFromString(mergedgiftsItem.getCampaign().getExtraFields()); | ||
| 91 | + if (extraFields != null) { | ||
| 92 | + if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { | ||
| 93 | + for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | ||
| 94 | + if (ccms.getLoyaltyCampaignId().equals(mergedgiftsItem.getCampaign().getSessionUUID())) { | ||
| 95 | + if (!TextUtils.isEmpty(ccms.getImageUrl())) { | ||
| 96 | + Glide.with(mContext) | ||
| 97 | + .load(ccms.getImageUrl()) | ||
| 98 | + .transform(new CenterCrop(), new RoundedCorners(4)) | ||
| 99 | + .diskCacheStrategy(DiskCacheStrategy.DATA) | ||
| 100 | + .into(holder.ivMergedGiftsLogo); | ||
| 101 | + } else { | ||
| 102 | + Glide.with(mContext) | ||
| 103 | + .load(R.drawable.ic_cosmote_logo_horizontal_grey) | ||
| 104 | + .into(holder.ivMergedGiftsLogo); | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + holder.tvMergedGiftsTitle.setText(ccms.getTitle()); | ||
| 108 | + holder.itemView.setOnClickListener(v -> onClickSubject.onNext(mergedgiftsItem)); | ||
| 109 | + return; | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + return; | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + | ||
| 81 | if (!TextUtils.isEmpty(mergedgiftsItem.getCampaign().getLogoUrl())) { | 117 | if (!TextUtils.isEmpty(mergedgiftsItem.getCampaign().getLogoUrl())) { |
| 82 | Glide.with(mContext) | 118 | Glide.with(mContext) |
| 83 | .load(mergedgiftsItem.getCampaign().getLogoUrl()) | 119 | .load(mergedgiftsItem.getCampaign().getLogoUrl()) | ... | ... |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + android:shape="rectangle"> | ||
| 4 | + <gradient | ||
| 5 | + android:angle="180" | ||
| 6 | + android:endColor="@color/cos_blue5" | ||
| 7 | + android:startColor="@color/cos_green" /> | ||
| 8 | +</shape> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | + <item> | ||
| 4 | + <shape android:shape="oval"> | ||
| 5 | + <padding | ||
| 6 | + android:bottom="1dp" | ||
| 7 | + android:left="1dp" | ||
| 8 | + android:right="1dp" | ||
| 9 | + android:top="1dp" /> | ||
| 10 | + <gradient | ||
| 11 | + android:angle="180" | ||
| 12 | + android:endColor="@color/cos_blue4" | ||
| 13 | + android:startColor="@color/cos_green10" /> | ||
| 14 | + </shape> | ||
| 15 | + </item> | ||
| 16 | + | ||
| 17 | + <item> | ||
| 18 | + <shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 19 | + android:shape="oval"> | ||
| 20 | + <solid android:color="@android:color/white" /> | ||
| 21 | + </shape> | ||
| 22 | + </item> | ||
| 23 | + | ||
| 24 | +</layer-list> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | + <item> | ||
| 4 | + <shape android:shape="rectangle"> | ||
| 5 | + <padding | ||
| 6 | + android:bottom="2dp" | ||
| 7 | + android:left="2dp" | ||
| 8 | + android:right="2dp" | ||
| 9 | + android:top="2dp" /> | ||
| 10 | + <gradient | ||
| 11 | + android:angle="180" | ||
| 12 | + android:endColor="@color/cos_blue5" | ||
| 13 | + android:startColor="@color/cos_green" /> | ||
| 14 | + | ||
| 15 | + <corners android:radius="1000dp" /> | ||
| 16 | + </shape> | ||
| 17 | + </item> | ||
| 18 | + | ||
| 19 | + <item> | ||
| 20 | + <shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 21 | + android:shape="rectangle"> | ||
| 22 | + <solid android:color="@android:color/white" /> | ||
| 23 | + <corners android:radius="1000dp" /> | ||
| 24 | + </shape> | ||
| 25 | + </item> | ||
| 26 | + | ||
| 27 | +</layer-list> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
This diff is collapsed. Click to expand it.
| ... | @@ -56,4 +56,8 @@ | ... | @@ -56,4 +56,8 @@ |
| 56 | <color name="cos_cyan4">#2EAFB9</color> | 56 | <color name="cos_cyan4">#2EAFB9</color> |
| 57 | <color name="cos_dark_grey">#394A5B</color> | 57 | <color name="cos_dark_grey">#394A5B</color> |
| 58 | <color name="cos_white_tr">#9CFFFFFF</color> | 58 | <color name="cos_white_tr">#9CFFFFFF</color> |
| 59 | + <color name="cos_skyblue2">#22A9B5</color> | ||
| 60 | + <color name="cos_blue4">#07A2D1</color> | ||
| 61 | + <color name="cos_green10">#73CA34</color> | ||
| 62 | + <color name="cos_blue5">#0D81B8</color> | ||
| 59 | </resources> | 63 | </resources> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -126,6 +126,8 @@ | ... | @@ -126,6 +126,8 @@ |
| 126 | <string name="cos_wrong_number_dlg">Το κινητό που καταχώρησες δεν είναι COSMOTE. Παρακαλούμε καταχώρησε το COSMOTE τηλέφωνο του φίλου σου.</string> | 126 | <string name="cos_wrong_number_dlg">Το κινητό που καταχώρησες δεν είναι COSMOTE. Παρακαλούμε καταχώρησε το COSMOTE τηλέφωνο του φίλου σου.</string> |
| 127 | <string name="cos_dlg_error_expired">Το δώρο έχει λήξει</string> | 127 | <string name="cos_dlg_error_expired">Το δώρο έχει λήξει</string> |
| 128 | <string name="cos_dlg_error_used">Το δώρο έχει ήδη χρησιμοποιηθεί</string> | 128 | <string name="cos_dlg_error_used">Το δώρο έχει ήδη χρησιμοποιηθεί</string> |
| 129 | + <string name="cos_see_more2">Δες Περισσότερα</string> | ||
| 130 | + <string name="cos_dlg_non_telco">Παρακαλούμε πολύ πρόσθεσε τις συνδέσεις σου στην COSMOTE για να έχεις πρόσβαση στα προνόμια του νέου Loyalty προγράμματος της COSMOTE!</string> | ||
| 129 | 131 | ||
| 130 | <string-array name="coupons_array"> | 132 | <string-array name="coupons_array"> |
| 131 | <item>Κουπόνια</item> | 133 | <item>Κουπόνια</item> | ... | ... |
-
Please register or login to post a comment