Showing
15 changed files
with
761 additions
and
138 deletions
| 1 | package ly.warp.sdk.activities; | 1 | package ly.warp.sdk.activities; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | +import android.content.ActivityNotFoundException; | ||
| 4 | import android.content.Intent; | 5 | import android.content.Intent; |
| 6 | +import android.net.Uri; | ||
| 5 | import android.os.Bundle; | 7 | import android.os.Bundle; |
| 6 | import android.os.Parcelable; | 8 | import android.os.Parcelable; |
| 9 | +import android.text.TextUtils; | ||
| 7 | import android.util.TypedValue; | 10 | import android.util.TypedValue; |
| 8 | import android.view.LayoutInflater; | 11 | import android.view.LayoutInflater; |
| 9 | import android.view.View; | 12 | import android.view.View; |
| ... | @@ -27,10 +30,10 @@ import java.util.List; | ... | @@ -27,10 +30,10 @@ import java.util.List; |
| 27 | import java.util.Map; | 30 | import java.util.Map; |
| 28 | 31 | ||
| 29 | import ly.warp.sdk.R; | 32 | import ly.warp.sdk.R; |
| 30 | -import ly.warp.sdk.io.adapters.BannerAdapter; | 33 | +import ly.warp.sdk.io.adapters.CarouselAdapter; |
| 31 | import ly.warp.sdk.io.adapters.CouponsetAdapter; | 34 | import ly.warp.sdk.io.adapters.CouponsetAdapter; |
| 32 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 35 | import ly.warp.sdk.io.callbacks.CallbackReceiver; |
| 33 | -import ly.warp.sdk.io.models.BannerItem; | 36 | +import ly.warp.sdk.io.models.CarouselItem; |
| 34 | import ly.warp.sdk.io.models.Coupon; | 37 | import ly.warp.sdk.io.models.Coupon; |
| 35 | import ly.warp.sdk.io.models.Couponset; | 38 | import ly.warp.sdk.io.models.Couponset; |
| 36 | import ly.warp.sdk.io.models.User; | 39 | import ly.warp.sdk.io.models.User; |
| ... | @@ -57,7 +60,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup | ... | @@ -57,7 +60,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup |
| 57 | /* View Pager */ | 60 | /* View Pager */ |
| 58 | // private ViewPager2 mBannerViewPager; | 61 | // private ViewPager2 mBannerViewPager; |
| 59 | private RecyclerView mRvBannerViewPager; | 62 | private RecyclerView mRvBannerViewPager; |
| 60 | - private BannerAdapter mBannerAdapter; | 63 | + private CarouselAdapter mBannerAdapter; |
| 61 | /* Pagination */ | 64 | /* Pagination */ |
| 62 | // private LinearLayout mDotsContainer; | 65 | // private LinearLayout mDotsContainer; |
| 63 | // private List<ImageView> mDots; | 66 | // private List<ImageView> mDots; |
| ... | @@ -87,8 +90,8 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup | ... | @@ -87,8 +90,8 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup |
| 87 | mSectionsLoading.setVisibility(View.VISIBLE); | 90 | mSectionsLoading.setVisibility(View.VISIBLE); |
| 88 | 91 | ||
| 89 | WarplyManager.getCoupons(mCouponsCallback); | 92 | WarplyManager.getCoupons(mCouponsCallback); |
| 90 | - WarplyManager.getCampaigns(mCampaignsCallback); | 93 | + WarplyManager.getCarousel(mCarouselCallback); |
| 91 | - WarplyManager.getCouponsets(mCouponsetsCallback); | 94 | + WarplyManager.getCouponsets(null, null, mCouponsetsCallback); |
| 92 | } | 95 | } |
| 93 | 96 | ||
| 94 | @Override | 97 | @Override |
| ... | @@ -201,19 +204,21 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup | ... | @@ -201,19 +204,21 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup |
| 201 | mRvBannerViewPager.setLayoutManager(layoutManager); | 204 | mRvBannerViewPager.setLayoutManager(layoutManager); |
| 202 | mRvBannerViewPager.setHasFixedSize(true); | 205 | mRvBannerViewPager.setHasFixedSize(true); |
| 203 | 206 | ||
| 204 | - mBannerAdapter = new BannerAdapter(this, WarplyManagerHelper.getBannerList()); | 207 | + mBannerAdapter = new CarouselAdapter(this, WarplyManagerHelper.getCarouselList()); |
| 205 | - mBannerAdapter.setOnBannerCampaignClickListener(campaign -> { | 208 | + mBannerAdapter.setOnBannerClickListener(carouselItem -> { |
| 206 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(campaign))); | 209 | +// startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(carouselItem.getUrl()))); |
| 207 | - }); | 210 | + |
| 208 | - mBannerAdapter.setOnBannerContentClickListener(article -> { | 211 | + if (!TextUtils.isEmpty(carouselItem.getUrl())) { |
| 209 | - if (article != null && article.getExtraFields() != null) { | 212 | + if (carouselItem.getUrl().contains("Offers?")) { |
| 210 | - String couponsetUuid = article.getExtraFields().optString("url_link", null); | 213 | + //TODO: category uuid |
| 211 | - if (couponsetUuid != null && !couponsetUuid.isEmpty()) { | 214 | + } else if (carouselItem.getUrl().contains("singleOffer")) { |
| 212 | - Couponset matchedCouponset = findCouponsetByUuid(couponsetUuid); | 215 | + if (!TextUtils.isEmpty(carouselItem.getUuid())) { |
| 213 | - if (matchedCouponset != null) { | 216 | + Couponset matchedCouponset = findCouponsetByUuid(carouselItem.getUuid()); |
| 214 | - Intent myIntent = new Intent(HomeActivity.this, SingleCouponsetActivity.class); | 217 | + if (matchedCouponset != null) { |
| 215 | - myIntent.putExtra(SingleCouponsetActivity.EXTRA_OFFER_ITEM, (Parcelable) matchedCouponset); | 218 | + Intent myIntent = new Intent(HomeActivity.this, SingleCouponsetActivity.class); |
| 216 | - startActivity(myIntent); | 219 | + myIntent.putExtra(SingleCouponsetActivity.EXTRA_OFFER_ITEM, (Parcelable) matchedCouponset); |
| 220 | + startActivity(myIntent); | ||
| 221 | + } | ||
| 217 | } | 222 | } |
| 218 | } | 223 | } |
| 219 | } | 224 | } |
| ... | @@ -343,15 +348,15 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup | ... | @@ -343,15 +348,15 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup |
| 343 | return null; | 348 | return null; |
| 344 | } | 349 | } |
| 345 | 350 | ||
| 346 | - private final CallbackReceiver<ArrayList<BannerItem>> mCampaignsCallback = new CallbackReceiver<ArrayList<BannerItem>>() { | 351 | + private final CallbackReceiver<ArrayList<CarouselItem>> mCarouselCallback = new CallbackReceiver<ArrayList<CarouselItem>>() { |
| 347 | @Override | 352 | @Override |
| 348 | - public void onSuccess(ArrayList<BannerItem> result) { | 353 | + public void onSuccess(ArrayList<CarouselItem> result) { |
| 349 | mPbLoading.setVisibility(View.GONE); | 354 | mPbLoading.setVisibility(View.GONE); |
| 350 | if (result != null && !result.isEmpty()) { | 355 | if (result != null && !result.isEmpty()) { |
| 351 | // Preloads the campaigns' images | 356 | // Preloads the campaigns' images |
| 352 | result.forEach(bannerItem -> { | 357 | result.forEach(bannerItem -> { |
| 353 | Glide.with(getApplicationContext()) | 358 | Glide.with(getApplicationContext()) |
| 354 | - .load(bannerItem.isCampaign() ? bannerItem.getCampaign().getLogoUrl() : bannerItem.getContent().getImgPreview()) | 359 | + .load(bannerItem.getAppImg()) |
| 355 | .diskCacheStrategy(DiskCacheStrategy.DATA) | 360 | .diskCacheStrategy(DiskCacheStrategy.DATA) |
| 356 | .preload(); | 361 | .preload(); |
| 357 | }); | 362 | }); | ... | ... |
| 1 | package ly.warp.sdk.activities; | 1 | package ly.warp.sdk.activities; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | +import android.content.ActivityNotFoundException; | ||
| 4 | import android.content.ClipData; | 5 | import android.content.ClipData; |
| 5 | import android.content.ClipboardManager; | 6 | import android.content.ClipboardManager; |
| 6 | import android.content.Context; | 7 | import android.content.Context; |
| 7 | import android.content.Intent; | 8 | import android.content.Intent; |
| 9 | +import android.net.Uri; | ||
| 8 | import android.os.Bundle; | 10 | import android.os.Bundle; |
| 9 | import android.text.TextUtils; | 11 | import android.text.TextUtils; |
| 10 | import android.view.View; | 12 | import android.view.View; |
| ... | @@ -45,7 +47,7 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen | ... | @@ -45,7 +47,7 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen |
| 45 | private TextView mTvSmallDescription; | 47 | private TextView mTvSmallDescription; |
| 46 | private TextView mTvFullDescription; | 48 | private TextView mTvFullDescription; |
| 47 | private TextView mTvEndDate; | 49 | private TextView mTvEndDate; |
| 48 | - private LinearLayout mLlDate, mLlShopsButton; | 50 | + private LinearLayout mLlDate, mLlShopsButton, mLlWebsiteButton; |
| 49 | private TextView mTvValue; | 51 | private TextView mTvValue; |
| 50 | private TextView mTvMoreButton; | 52 | private TextView mTvMoreButton; |
| 51 | private ImageView mIvImage; | 53 | private ImageView mIvImage; |
| ... | @@ -107,6 +109,20 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen | ... | @@ -107,6 +109,20 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen |
| 107 | Intent myIntent = new Intent(SingleCouponActivity.this, ShopsActivity.class); | 109 | Intent myIntent = new Intent(SingleCouponActivity.this, ShopsActivity.class); |
| 108 | myIntent.putExtra(SingleCouponActivity.EXTRA_MERCHANT_UUID, mOfferItem.getMerchantUuid()); | 110 | myIntent.putExtra(SingleCouponActivity.EXTRA_MERCHANT_UUID, mOfferItem.getMerchantUuid()); |
| 109 | startActivity(myIntent); | 111 | startActivity(myIntent); |
| 112 | + return; | ||
| 113 | + } | ||
| 114 | + if (v.getId() == R.id.ll_website) { | ||
| 115 | + if (mOfferItem != null && mOfferItem.getMerchantDetails() != null | ||
| 116 | + && !TextUtils.isEmpty(mOfferItem.getMerchantDetails().getWebsite()) | ||
| 117 | + && mOfferItem.getMerchantDetails().getWebsite().length() > 8) { | ||
| 118 | + try { | ||
| 119 | + Intent intent = new Intent(Intent.ACTION_VIEW); | ||
| 120 | + intent.setData(Uri.parse(mOfferItem.getMerchantDetails().getWebsite())); | ||
| 121 | + startActivity(intent); | ||
| 122 | + } catch (ActivityNotFoundException e) { | ||
| 123 | + e.printStackTrace(); | ||
| 124 | + } | ||
| 125 | + } | ||
| 110 | } | 126 | } |
| 111 | } | 127 | } |
| 112 | 128 | ||
| ... | @@ -121,6 +137,9 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen | ... | @@ -121,6 +137,9 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen |
| 121 | mLlShopsButton = findViewById(R.id.ll_shops); | 137 | mLlShopsButton = findViewById(R.id.ll_shops); |
| 122 | mLlShopsButton.setOnClickListener(this); | 138 | mLlShopsButton.setOnClickListener(this); |
| 123 | 139 | ||
| 140 | + mLlWebsiteButton = findViewById(R.id.ll_website); | ||
| 141 | + mLlWebsiteButton.setOnClickListener(this); | ||
| 142 | + | ||
| 124 | // Initialize views | 143 | // Initialize views |
| 125 | mTvSmallDescription = findViewById(R.id.tv_coupon_small_description); | 144 | mTvSmallDescription = findViewById(R.id.tv_coupon_small_description); |
| 126 | mTvFullDescription = findViewById(R.id.tv_coupon_full_description); | 145 | mTvFullDescription = findViewById(R.id.tv_coupon_full_description); |
| ... | @@ -202,8 +221,8 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen | ... | @@ -202,8 +221,8 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen |
| 202 | .into(mIvImage); | 221 | .into(mIvImage); |
| 203 | } | 222 | } |
| 204 | 223 | ||
| 205 | - if (mOfferItem.getCouponsetDetails() != null && mOfferItem.getCouponsetDetails().getAdmin_name() != null && !TextUtils.isEmpty(mOfferItem.getCouponsetDetails().getAdmin_name())) | 224 | + if (mOfferItem.getCouponsetDetails() != null && mOfferItem.getCouponsetDetails().getMerchantAdminName() != null && !TextUtils.isEmpty(mOfferItem.getCouponsetDetails().getMerchantAdminName())) |
| 206 | - mTvMerchantName.setText(mOfferItem.getCouponsetDetails().getAdmin_name()); | 225 | + mTvMerchantName.setText(mOfferItem.getCouponsetDetails().getMerchantAdminName()); |
| 207 | if (mOfferItem.getCouponsetDetails() != null && mOfferItem.getCouponsetDetails().getName() != null && !TextUtils.isEmpty(mOfferItem.getCouponsetDetails().getName())) | 226 | if (mOfferItem.getCouponsetDetails() != null && mOfferItem.getCouponsetDetails().getName() != null && !TextUtils.isEmpty(mOfferItem.getCouponsetDetails().getName())) |
| 208 | mTvValue.setText(mOfferItem.getCouponsetDetails().getName()); | 227 | mTvValue.setText(mOfferItem.getCouponsetDetails().getName()); |
| 209 | if (mOfferItem.getCouponsetDetails() != null && mOfferItem.getCouponsetDetails().getShort_description() != null && !TextUtils.isEmpty(mOfferItem.getCouponsetDetails().getShort_description())) | 228 | if (mOfferItem.getCouponsetDetails() != null && mOfferItem.getCouponsetDetails().getShort_description() != null && !TextUtils.isEmpty(mOfferItem.getCouponsetDetails().getShort_description())) | ... | ... |
| ... | @@ -3,6 +3,8 @@ package ly.warp.sdk.activities; | ... | @@ -3,6 +3,8 @@ package ly.warp.sdk.activities; |
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.content.Intent; | 4 | import android.content.Intent; |
| 5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 6 | +import android.os.Handler; | ||
| 7 | +import android.os.Looper; | ||
| 6 | import android.os.Parcelable; | 8 | import android.os.Parcelable; |
| 7 | import android.text.TextUtils; | 9 | import android.text.TextUtils; |
| 8 | import android.view.View; | 10 | import android.view.View; |
| ... | @@ -198,8 +200,8 @@ public class SingleCouponsetActivity extends Activity implements View.OnClickLis | ... | @@ -198,8 +200,8 @@ public class SingleCouponsetActivity extends Activity implements View.OnClickLis |
| 198 | .into(mIvImage); | 200 | .into(mIvImage); |
| 199 | } | 201 | } |
| 200 | 202 | ||
| 201 | - if (!TextUtils.isEmpty(mOfferItem.getAdmin_name())) | 203 | + if (!TextUtils.isEmpty(mOfferItem.getMerchantAdminName())) |
| 202 | - mTvMerchantName.setText(mOfferItem.getAdmin_name()); | 204 | + mTvMerchantName.setText(mOfferItem.getMerchantAdminName()); |
| 203 | if (!TextUtils.isEmpty(mOfferItem.getName())) | 205 | if (!TextUtils.isEmpty(mOfferItem.getName())) |
| 204 | mTvValue.setText(mOfferItem.getName()); | 206 | mTvValue.setText(mOfferItem.getName()); |
| 205 | if (!TextUtils.isEmpty(mOfferItem.getShort_description())) | 207 | if (!TextUtils.isEmpty(mOfferItem.getShort_description())) |
| ... | @@ -339,17 +341,18 @@ public class SingleCouponsetActivity extends Activity implements View.OnClickLis | ... | @@ -339,17 +341,18 @@ public class SingleCouponsetActivity extends Activity implements View.OnClickLis |
| 339 | @Override | 341 | @Override |
| 340 | public void onSuccess(JSONObject result) { | 342 | public void onSuccess(JSONObject result) { |
| 341 | mPbLoading.setVisibility(View.GONE); | 343 | mPbLoading.setVisibility(View.GONE); |
| 342 | - Toast.makeText(SingleCouponsetActivity.this, "RETRIEVE SUCCESS", Toast.LENGTH_SHORT).show(); | ||
| 343 | -// Coupon coupon = new Coupon(); | ||
| 344 | -// coupon.setCoupon(result.optString("coupon", "")); | ||
| 345 | -// coupon.setExpiration(result.optString("expiration", "")); | ||
| 346 | -// coupon.setCouponsetDetails(mOfferItem); | ||
| 347 | -// Intent myIntent = new Intent(SingleCouponsetActivity.this, SingleCouponActivity.class); | ||
| 348 | -// myIntent.putExtra(SingleCouponActivity.EXTRA_OFFER_ITEM, (Parcelable) coupon); | ||
| 349 | -// startActivity(myIntent); | ||
| 350 | - | ||
| 351 | mRedeemButton.setVisibility(View.GONE); | 344 | mRedeemButton.setVisibility(View.GONE); |
| 352 | mSuccessButton.setVisibility(View.VISIBLE); | 345 | mSuccessButton.setVisibility(View.VISIBLE); |
| 346 | + | ||
| 347 | + new Handler(Looper.getMainLooper()).postDelayed(() -> { | ||
| 348 | + Coupon coupon = new Coupon(); | ||
| 349 | + coupon.setCoupon(result.optString("coupon", "")); | ||
| 350 | + coupon.setExpiration(result.optString("expiration", "")); | ||
| 351 | + coupon.setCouponsetDetails(mOfferItem); | ||
| 352 | + Intent myIntent = new Intent(SingleCouponsetActivity.this, SingleCouponActivity.class); | ||
| 353 | + myIntent.putExtra(SingleCouponActivity.EXTRA_OFFER_ITEM, (Parcelable) coupon); | ||
| 354 | + startActivity(myIntent); | ||
| 355 | + }, 500); | ||
| 353 | } | 356 | } |
| 354 | 357 | ||
| 355 | @Override | 358 | @Override | ... | ... |
| 1 | +package ly.warp.sdk.io.adapters; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | +import android.util.TypedValue; | ||
| 5 | +import android.view.LayoutInflater; | ||
| 6 | +import android.view.View; | ||
| 7 | +import android.view.ViewGroup; | ||
| 8 | +import android.widget.ImageView; | ||
| 9 | + | ||
| 10 | +import androidx.annotation.NonNull; | ||
| 11 | +import androidx.recyclerview.widget.RecyclerView; | ||
| 12 | + | ||
| 13 | +import com.bumptech.glide.Glide; | ||
| 14 | +import com.bumptech.glide.load.engine.DiskCacheStrategy; | ||
| 15 | +import com.bumptech.glide.load.resource.bitmap.CenterCrop; | ||
| 16 | + | ||
| 17 | +import java.util.ArrayList; | ||
| 18 | + | ||
| 19 | +import ly.warp.sdk.R; | ||
| 20 | +import ly.warp.sdk.io.models.CarouselItem; | ||
| 21 | +import ly.warp.sdk.utils.TopRoundedCornersTransformation; | ||
| 22 | + | ||
| 23 | +public class CarouselAdapter extends RecyclerView.Adapter<CarouselAdapter.BannerViewHolder> { | ||
| 24 | + | ||
| 25 | + private final Context mContext; | ||
| 26 | + private final ArrayList<CarouselItem> mBannerItems; | ||
| 27 | + private OnBannerClickListener mListenerBanner; | ||
| 28 | + | ||
| 29 | + public interface OnBannerClickListener { | ||
| 30 | + void onBannerClick(CarouselItem item); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + public CarouselAdapter(Context context, ArrayList<CarouselItem> carouselItems) { | ||
| 34 | + this.mContext = context; | ||
| 35 | + this.mBannerItems = carouselItems; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public void setOnBannerClickListener(OnBannerClickListener listener) { | ||
| 39 | + this.mListenerBanner = listener; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @NonNull | ||
| 43 | + @Override | ||
| 44 | + public BannerViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||
| 45 | + View view = LayoutInflater.from(mContext).inflate(R.layout.item_banner, parent, false); | ||
| 46 | + return new BannerViewHolder(view); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + @Override | ||
| 50 | + public void onBindViewHolder(@NonNull BannerViewHolder holder, int position) { | ||
| 51 | + CarouselItem bannerItem = mBannerItems.get(position); | ||
| 52 | + | ||
| 53 | + int radiusInPixels = (int) TypedValue.applyDimension( | ||
| 54 | + TypedValue.COMPLEX_UNIT_DIP, 13, | ||
| 55 | + mContext.getResources().getDisplayMetrics()); | ||
| 56 | + | ||
| 57 | + if (bannerItem != null) { | ||
| 58 | + Glide.with(mContext) | ||
| 59 | +// .setDefaultRequestOptions( | ||
| 60 | +// RequestOptions | ||
| 61 | +// .placeholderOf(R.drawable.demo_logo) | ||
| 62 | +// .error(R.drawable.demo_logo)) | ||
| 63 | + .load(bannerItem.getAppImg()) | ||
| 64 | + .diskCacheStrategy(DiskCacheStrategy.DATA) | ||
| 65 | + .transform(new CenterCrop(), new TopRoundedCornersTransformation(radiusInPixels, true)) | ||
| 66 | + .into(holder.imageView); | ||
| 67 | + | ||
| 68 | + holder.itemView.setOnClickListener(v -> { | ||
| 69 | + if (mListenerBanner != null) { | ||
| 70 | + mListenerBanner.onBannerClick(bannerItem); | ||
| 71 | + } | ||
| 72 | + }); | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + @Override | ||
| 77 | + public int getItemCount() { | ||
| 78 | + return mBannerItems.size(); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + static class BannerViewHolder extends RecyclerView.ViewHolder { | ||
| 82 | + ImageView imageView; | ||
| 83 | + | ||
| 84 | + BannerViewHolder(@NonNull View itemView) { | ||
| 85 | + super(itemView); | ||
| 86 | + imageView = itemView.findViewById(R.id.iv_banner); | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | +} |
| ... | @@ -170,7 +170,7 @@ public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponView | ... | @@ -170,7 +170,7 @@ public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponView |
| 170 | llDateExpired.setVisibility(View.GONE); | 170 | llDateExpired.setVisibility(View.GONE); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | - tvMerchant.setText(!TextUtils.isEmpty(couponItem.getCouponsetDetails().getAdmin_name()) ? couponItem.getCouponsetDetails().getAdmin_name().trim() : ""); | 173 | + tvMerchant.setText(!TextUtils.isEmpty(couponItem.getCouponsetDetails().getMerchantAdminName()) ? couponItem.getCouponsetDetails().getMerchantAdminName().trim() : ""); |
| 174 | tvTitle.setText(!TextUtils.isEmpty(couponItem.getCouponsetDetails().getName()) ? couponItem.getCouponsetDetails().getName().trim() : ""); | 174 | tvTitle.setText(!TextUtils.isEmpty(couponItem.getCouponsetDetails().getName()) ? couponItem.getCouponsetDetails().getName().trim() : ""); |
| 175 | tvDescription.setText(!TextUtils.isEmpty(couponItem.getCouponsetDetails().getShort_description()) ? couponItem.getCouponsetDetails().getShort_description().trim() : ""); | 175 | tvDescription.setText(!TextUtils.isEmpty(couponItem.getCouponsetDetails().getShort_description()) ? couponItem.getCouponsetDetails().getShort_description().trim() : ""); |
| 176 | if (couponItem.getExpiration() != null && !couponItem.getExpiration().isEmpty()) { | 176 | if (couponItem.getExpiration() != null && !couponItem.getExpiration().isEmpty()) { |
| ... | @@ -205,7 +205,7 @@ public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponView | ... | @@ -205,7 +205,7 @@ public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponView |
| 205 | } | 205 | } |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | - loadMerchantLogo(couponItem.getMerchantDetails().getImgPreview(), couponItem.getStatus()); | 208 | + loadMerchantLogo(couponItem.getMerchantDetails().getAppImgPreview(), couponItem.getStatus()); |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | private String formatValidityDate(String endDate) { | 211 | private String formatValidityDate(String endDate) { |
| ... | @@ -267,10 +267,6 @@ public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponView | ... | @@ -267,10 +267,6 @@ public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponView |
| 267 | .transform(new CenterCrop(), new TopRoundedCornersTransformation(radiusInPixels, true)) | 267 | .transform(new CenterCrop(), new TopRoundedCornersTransformation(radiusInPixels, true)) |
| 268 | .into(ivLogo); | 268 | .into(ivLogo); |
| 269 | } | 269 | } |
| 270 | - | ||
| 271 | - ivLogo.setVisibility(View.VISIBLE); | ||
| 272 | - } else { | ||
| 273 | - ivLogo.setVisibility(View.GONE); | ||
| 274 | } | 270 | } |
| 275 | } | 271 | } |
| 276 | } | 272 | } | ... | ... |
| ... | @@ -104,10 +104,10 @@ public class CouponsetAdapter extends RecyclerView.Adapter<CouponsetAdapter.Coup | ... | @@ -104,10 +104,10 @@ public class CouponsetAdapter extends RecyclerView.Adapter<CouponsetAdapter.Coup |
| 104 | tvValidity.setVisibility(View.GONE); | 104 | tvValidity.setVisibility(View.GONE); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | - loadCouponsetImage(couponset.getImgPreview()); | 107 | + loadCouponsetImage(couponset.getAppImgPreview()); |
| 108 | 108 | ||
| 109 | - if (couponset.getMerchant() != null && couponset.getMerchant().getImgPreview() != null) { | 109 | + if (couponset.getMerchantDetails() != null && couponset.getMerchantDetails().getPreviewImg() != null) { |
| 110 | - loadMerchantLogo(couponset.getMerchant().getImgPreview()); | 110 | + loadMerchantLogo(couponset.getMerchantDetails().getPreviewImg()); |
| 111 | } else { | 111 | } else { |
| 112 | ivLogo.setVisibility(View.GONE); | 112 | ivLogo.setVisibility(View.GONE); |
| 113 | } | 113 | } | ... | ... |
| 1 | +package ly.warp.sdk.io.models; | ||
| 2 | + | ||
| 3 | +import android.os.Parcel; | ||
| 4 | +import android.os.Parcelable; | ||
| 5 | + | ||
| 6 | +import org.json.JSONObject; | ||
| 7 | + | ||
| 8 | +import java.io.Serializable; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * Model representing a single item from the carousel (get_carousel) API response. | ||
| 12 | + */ | ||
| 13 | +public class CarouselItem implements Parcelable, Serializable { | ||
| 14 | + | ||
| 15 | + private static final long serialVersionUID = 7812345678901234567L; | ||
| 16 | + | ||
| 17 | + private static final String APP_IMG = "app_img"; | ||
| 18 | + private static final String APP_URL = "app_url"; | ||
| 19 | + private static final String ENTITY = "entity"; | ||
| 20 | + private static final String NAME = "name"; | ||
| 21 | + private static final String URL = "url"; | ||
| 22 | + private static final String UUID = "uuid"; | ||
| 23 | + private static final String WEB_IMG = "web_img"; | ||
| 24 | + private static final String WEB_IMG_RESPONSIVE = "web_img_responsive"; | ||
| 25 | + | ||
| 26 | + private String appImg; | ||
| 27 | + private String appUrl; | ||
| 28 | + private String entity; | ||
| 29 | + private String name; | ||
| 30 | + private String url; | ||
| 31 | + private String uuid; | ||
| 32 | + private String webImg; | ||
| 33 | + private String webImgResponsive; | ||
| 34 | + | ||
| 35 | + private static String optNullableString(JSONObject json, String key) { | ||
| 36 | + return json.isNull(key) ? null : json.optString(key); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public CarouselItem() { | ||
| 40 | + this.appImg = null; | ||
| 41 | + this.appUrl = null; | ||
| 42 | + this.entity = null; | ||
| 43 | + this.name = null; | ||
| 44 | + this.url = null; | ||
| 45 | + this.uuid = null; | ||
| 46 | + this.webImg = null; | ||
| 47 | + this.webImgResponsive = null; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + public CarouselItem(JSONObject json) { | ||
| 51 | + if (json != null) { | ||
| 52 | + this.appImg = optNullableString(json, APP_IMG); | ||
| 53 | + this.appUrl = optNullableString(json, APP_URL); | ||
| 54 | + this.entity = optNullableString(json, ENTITY); | ||
| 55 | + this.name = optNullableString(json, NAME); | ||
| 56 | + this.url = optNullableString(json, URL); | ||
| 57 | + this.uuid = optNullableString(json, UUID); | ||
| 58 | + this.webImg = optNullableString(json, WEB_IMG); | ||
| 59 | + this.webImgResponsive = optNullableString(json, WEB_IMG_RESPONSIVE); | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public CarouselItem(Parcel source) { | ||
| 64 | + this.appImg = source.readString(); | ||
| 65 | + this.appUrl = source.readString(); | ||
| 66 | + this.entity = source.readString(); | ||
| 67 | + this.name = source.readString(); | ||
| 68 | + this.url = source.readString(); | ||
| 69 | + this.uuid = source.readString(); | ||
| 70 | + this.webImg = source.readString(); | ||
| 71 | + this.webImgResponsive = source.readString(); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @Override | ||
| 75 | + public void writeToParcel(Parcel dest, int flags) { | ||
| 76 | + dest.writeString(this.appImg); | ||
| 77 | + dest.writeString(this.appUrl); | ||
| 78 | + dest.writeString(this.entity); | ||
| 79 | + dest.writeString(this.name); | ||
| 80 | + dest.writeString(this.url); | ||
| 81 | + dest.writeString(this.uuid); | ||
| 82 | + dest.writeString(this.webImg); | ||
| 83 | + dest.writeString(this.webImgResponsive); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + @Override | ||
| 87 | + public int describeContents() { | ||
| 88 | + return 0; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + public static final Creator<CarouselItem> CREATOR = new Creator<CarouselItem>() { | ||
| 92 | + @Override | ||
| 93 | + public CarouselItem createFromParcel(Parcel source) { | ||
| 94 | + return new CarouselItem(source); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + @Override | ||
| 98 | + public CarouselItem[] newArray(int size) { | ||
| 99 | + return new CarouselItem[size]; | ||
| 100 | + } | ||
| 101 | + }; | ||
| 102 | + | ||
| 103 | + // ================================================================================ | ||
| 104 | + // Getters | ||
| 105 | + // ================================================================================ | ||
| 106 | + | ||
| 107 | + public String getAppImg() { | ||
| 108 | + return appImg; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + public String getAppUrl() { | ||
| 112 | + return appUrl; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + public String getEntity() { | ||
| 116 | + return entity; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + public String getName() { | ||
| 120 | + return name; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + public String getUrl() { | ||
| 124 | + return url; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public String getUuid() { | ||
| 128 | + return uuid; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + public String getWebImg() { | ||
| 132 | + return webImg; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + public String getWebImgResponsive() { | ||
| 136 | + return webImgResponsive; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + // ================================================================================ | ||
| 140 | + // Setters | ||
| 141 | + // ================================================================================ | ||
| 142 | + | ||
| 143 | + public void setAppImg(String appImg) { | ||
| 144 | + this.appImg = appImg; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + public void setAppUrl(String appUrl) { | ||
| 148 | + this.appUrl = appUrl; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + public void setEntity(String entity) { | ||
| 152 | + this.entity = entity; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + public void setName(String name) { | ||
| 156 | + this.name = name; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + public void setUrl(String url) { | ||
| 160 | + this.url = url; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + public void setUuid(String uuid) { | ||
| 164 | + this.uuid = uuid; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + public void setWebImg(String webImg) { | ||
| 168 | + this.webImg = webImg; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + public void setWebImgResponsive(String webImgResponsive) { | ||
| 172 | + this.webImgResponsive = webImgResponsive; | ||
| 173 | + } | ||
| 174 | +} |
| ... | @@ -92,6 +92,13 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -92,6 +92,13 @@ public class Couponset implements Parcelable, Serializable { |
| 92 | private static final String OFFER_CATEGORY = "offer_category"; | 92 | private static final String OFFER_CATEGORY = "offer_category"; |
| 93 | private static final String TAGGING = "tagging"; | 93 | private static final String TAGGING = "tagging"; |
| 94 | private static final String REGIONS = "regions"; | 94 | private static final String REGIONS = "regions"; |
| 95 | + private static final String MERCHANT_ADMIN_NAME = "merchant_admin_name"; | ||
| 96 | + private static final String MERCHANT_IMG_PREVIEW = "merchant_img_preview"; | ||
| 97 | + private static final String MERCHANT_DETAILS = "merchant_details"; | ||
| 98 | + private static final String MERCHANT_WEBSITE = "merchant_website"; | ||
| 99 | + private static final String SCORE = "score"; | ||
| 100 | + private static final String APP_IMG_PREVIEW = "app_img_preview"; | ||
| 101 | + private static final String APP_IMGS = "app_imgs"; | ||
| 95 | 102 | ||
| 96 | /* Member variables of the Couponset object */ | 103 | /* Member variables of the Couponset object */ |
| 97 | 104 | ||
| ... | @@ -141,6 +148,13 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -141,6 +148,13 @@ public class Couponset implements Parcelable, Serializable { |
| 141 | private JSONObject tagging; | 148 | private JSONObject tagging; |
| 142 | private JSONArray regions; | 149 | private JSONArray regions; |
| 143 | private Merchant merchant; | 150 | private Merchant merchant; |
| 151 | + private String merchantAdminName; | ||
| 152 | + private String merchantImgPreview; | ||
| 153 | + private String merchantWebsite; | ||
| 154 | + private MerchantDetails merchantDetails; | ||
| 155 | + private int score; | ||
| 156 | + private String appImgPreview; | ||
| 157 | + private JSONArray appImgs; | ||
| 144 | 158 | ||
| 145 | /** | 159 | /** |
| 146 | * Helper method to get a nullable String from a JSONObject. | 160 | * Helper method to get a nullable String from a JSONObject. |
| ... | @@ -197,6 +211,13 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -197,6 +211,13 @@ public class Couponset implements Parcelable, Serializable { |
| 197 | this.tagging = null; | 211 | this.tagging = null; |
| 198 | this.regions = null; | 212 | this.regions = null; |
| 199 | this.merchant = null; | 213 | this.merchant = null; |
| 214 | + this.merchantAdminName = null; | ||
| 215 | + this.merchantImgPreview = null; | ||
| 216 | + this.merchantWebsite = null; | ||
| 217 | + this.merchantDetails = null; | ||
| 218 | + this.score = 0; | ||
| 219 | + this.appImgPreview = null; | ||
| 220 | + this.appImgs = null; | ||
| 200 | } | 221 | } |
| 201 | 222 | ||
| 202 | public Couponset(boolean isUniversal) { | 223 | public Couponset(boolean isUniversal) { |
| ... | @@ -233,6 +254,13 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -233,6 +254,13 @@ public class Couponset implements Parcelable, Serializable { |
| 233 | this.offerCategory = null; | 254 | this.offerCategory = null; |
| 234 | this.tagging = null; | 255 | this.tagging = null; |
| 235 | this.regions = null; | 256 | this.regions = null; |
| 257 | + this.merchantAdminName = null; | ||
| 258 | + this.merchantImgPreview = null; | ||
| 259 | + this.merchantWebsite = null; | ||
| 260 | + this.merchantDetails = null; | ||
| 261 | + this.score = 0; | ||
| 262 | + this.appImgPreview = null; | ||
| 263 | + this.appImgs = null; | ||
| 236 | } | 264 | } |
| 237 | 265 | ||
| 238 | /** | 266 | /** |
| ... | @@ -301,6 +329,14 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -301,6 +329,14 @@ public class Couponset implements Parcelable, Serializable { |
| 301 | this.offerCategory = optNullableString(json, OFFER_CATEGORY); | 329 | this.offerCategory = optNullableString(json, OFFER_CATEGORY); |
| 302 | this.tagging = json.optJSONObject(TAGGING); | 330 | this.tagging = json.optJSONObject(TAGGING); |
| 303 | this.regions = json.optJSONArray(REGIONS); | 331 | this.regions = json.optJSONArray(REGIONS); |
| 332 | + this.merchantAdminName = optNullableString(json, MERCHANT_ADMIN_NAME); | ||
| 333 | + this.merchantImgPreview = optNullableString(json, MERCHANT_IMG_PREVIEW); | ||
| 334 | + this.merchantWebsite = optNullableString(json, MERCHANT_WEBSITE); | ||
| 335 | + JSONObject merchantDetailsJson = json.optJSONObject(MERCHANT_DETAILS); | ||
| 336 | + this.merchantDetails = merchantDetailsJson != null ? new MerchantDetails(merchantDetailsJson) : null; | ||
| 337 | + this.score = json.optInt(SCORE, 0); | ||
| 338 | + this.appImgPreview = optNullableString(json, APP_IMG_PREVIEW); | ||
| 339 | + this.appImgs = json.optJSONArray(APP_IMGS); | ||
| 304 | } | 340 | } |
| 305 | } | 341 | } |
| 306 | 342 | ||
| ... | @@ -324,6 +360,7 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -324,6 +360,7 @@ public class Couponset implements Parcelable, Serializable { |
| 324 | this.active = json.optBoolean(ACTIVE); | 360 | this.active = json.optBoolean(ACTIVE); |
| 325 | this.buyable = json.optBoolean(BUYABLE); | 361 | this.buyable = json.optBoolean(BUYABLE); |
| 326 | this.name = optNullableString(json, NAME); | 362 | this.name = optNullableString(json, NAME); |
| 363 | + this.description = optNullableString(json, DESCRIPTION); | ||
| 327 | this.short_description = optNullableString(json, SHORT_DESCRIPTION); | 364 | this.short_description = optNullableString(json, SHORT_DESCRIPTION); |
| 328 | this.discount = optNullableString(json, DISCOUNT); | 365 | this.discount = optNullableString(json, DISCOUNT); |
| 329 | this.category = optNullableString(json, CATEGORY); | 366 | this.category = optNullableString(json, CATEGORY); |
| ... | @@ -343,6 +380,14 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -343,6 +380,14 @@ public class Couponset implements Parcelable, Serializable { |
| 343 | this.offerCategory = optNullableString(json, OFFER_CATEGORY); | 380 | this.offerCategory = optNullableString(json, OFFER_CATEGORY); |
| 344 | this.tagging = json.optJSONObject(TAGGING); | 381 | this.tagging = json.optJSONObject(TAGGING); |
| 345 | this.regions = json.optJSONArray(REGIONS); | 382 | this.regions = json.optJSONArray(REGIONS); |
| 383 | + this.merchantAdminName = optNullableString(json, MERCHANT_ADMIN_NAME); | ||
| 384 | + this.merchantImgPreview = optNullableString(json, MERCHANT_IMG_PREVIEW); | ||
| 385 | + this.merchantWebsite = optNullableString(json, MERCHANT_WEBSITE); | ||
| 386 | + JSONObject merchantDetailsJson = json.optJSONObject(MERCHANT_DETAILS); | ||
| 387 | + this.merchantDetails = merchantDetailsJson != null ? new MerchantDetails(merchantDetailsJson) : null; | ||
| 388 | + this.score = json.optInt(SCORE, 0); | ||
| 389 | + this.appImgPreview = optNullableString(json, APP_IMG_PREVIEW); | ||
| 390 | + this.appImgs = json.optJSONArray(APP_IMGS); | ||
| 346 | } | 391 | } |
| 347 | } | 392 | } |
| 348 | 393 | ||
| ... | @@ -438,6 +483,19 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -438,6 +483,19 @@ public class Couponset implements Parcelable, Serializable { |
| 438 | } catch (JSONException e) { | 483 | } catch (JSONException e) { |
| 439 | this.regions = null; | 484 | this.regions = null; |
| 440 | } | 485 | } |
| 486 | + this.merchant = source.readParcelable(Merchant.class.getClassLoader()); | ||
| 487 | + this.merchantAdminName = source.readString(); | ||
| 488 | + this.merchantImgPreview = source.readString(); | ||
| 489 | + this.merchantWebsite = source.readString(); | ||
| 490 | + this.merchantDetails = source.readParcelable(MerchantDetails.class.getClassLoader()); | ||
| 491 | + this.score = source.readInt(); | ||
| 492 | + this.appImgPreview = source.readString(); | ||
| 493 | + try { | ||
| 494 | + String appImgsStr = source.readString(); | ||
| 495 | + this.appImgs = appImgsStr != null ? new JSONArray(appImgsStr) : null; | ||
| 496 | + } catch (JSONException e) { | ||
| 497 | + this.appImgs = null; | ||
| 498 | + } | ||
| 441 | } | 499 | } |
| 442 | 500 | ||
| 443 | @Override | 501 | @Override |
| ... | @@ -487,6 +545,14 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -487,6 +545,14 @@ public class Couponset implements Parcelable, Serializable { |
| 487 | dest.writeString(this.offerCategory); | 545 | dest.writeString(this.offerCategory); |
| 488 | dest.writeString(this.tagging != null ? this.tagging.toString() : null); | 546 | dest.writeString(this.tagging != null ? this.tagging.toString() : null); |
| 489 | dest.writeString(this.regions != null ? this.regions.toString() : null); | 547 | dest.writeString(this.regions != null ? this.regions.toString() : null); |
| 548 | + dest.writeParcelable(this.merchant, flags); | ||
| 549 | + dest.writeString(this.merchantAdminName); | ||
| 550 | + dest.writeString(this.merchantImgPreview); | ||
| 551 | + dest.writeString(this.merchantWebsite); | ||
| 552 | + dest.writeParcelable(this.merchantDetails, flags); | ||
| 553 | + dest.writeInt(this.score); | ||
| 554 | + dest.writeString(this.appImgPreview); | ||
| 555 | + dest.writeString(this.appImgs != null ? this.appImgs.toString() : null); | ||
| 490 | } | 556 | } |
| 491 | 557 | ||
| 492 | /** | 558 | /** |
| ... | @@ -541,6 +607,13 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -541,6 +607,13 @@ public class Couponset implements Parcelable, Serializable { |
| 541 | jObj.put(OFFER_CATEGORY, this.offerCategory != null ? this.offerCategory : JSONObject.NULL); | 607 | jObj.put(OFFER_CATEGORY, this.offerCategory != null ? this.offerCategory : JSONObject.NULL); |
| 542 | jObj.put(TAGGING, this.tagging != null ? this.tagging : JSONObject.NULL); | 608 | jObj.put(TAGGING, this.tagging != null ? this.tagging : JSONObject.NULL); |
| 543 | jObj.put(REGIONS, this.regions != null ? this.regions : JSONObject.NULL); | 609 | jObj.put(REGIONS, this.regions != null ? this.regions : JSONObject.NULL); |
| 610 | + jObj.put(MERCHANT_ADMIN_NAME, this.merchantAdminName != null ? this.merchantAdminName : JSONObject.NULL); | ||
| 611 | + jObj.put(MERCHANT_IMG_PREVIEW, this.merchantImgPreview != null ? this.merchantImgPreview : JSONObject.NULL); | ||
| 612 | + jObj.put(MERCHANT_WEBSITE, this.merchantWebsite != null ? this.merchantWebsite : JSONObject.NULL); | ||
| 613 | + jObj.put(MERCHANT_DETAILS, this.merchantDetails != null ? new JSONObject(this.merchantDetails.toString()) : JSONObject.NULL); | ||
| 614 | + jObj.putOpt(SCORE, this.score); | ||
| 615 | + jObj.put(APP_IMG_PREVIEW, this.appImgPreview != null ? this.appImgPreview : JSONObject.NULL); | ||
| 616 | + jObj.put(APP_IMGS, this.appImgs != null ? this.appImgs : JSONObject.NULL); | ||
| 544 | } catch (JSONException e) { | 617 | } catch (JSONException e) { |
| 545 | if (WarpConstants.DEBUG) { | 618 | if (WarpConstants.DEBUG) { |
| 546 | e.printStackTrace(); | 619 | e.printStackTrace(); |
| ... | @@ -799,6 +872,34 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -799,6 +872,34 @@ public class Couponset implements Parcelable, Serializable { |
| 799 | return merchant; | 872 | return merchant; |
| 800 | } | 873 | } |
| 801 | 874 | ||
| 875 | + public String getMerchantAdminName() { | ||
| 876 | + return merchantAdminName; | ||
| 877 | + } | ||
| 878 | + | ||
| 879 | + public String getMerchantImgPreview() { | ||
| 880 | + return merchantImgPreview; | ||
| 881 | + } | ||
| 882 | + | ||
| 883 | + public String getMerchantWebsite() { | ||
| 884 | + return merchantWebsite; | ||
| 885 | + } | ||
| 886 | + | ||
| 887 | + public MerchantDetails getMerchantDetails() { | ||
| 888 | + return merchantDetails; | ||
| 889 | + } | ||
| 890 | + | ||
| 891 | + public int getScore() { | ||
| 892 | + return score; | ||
| 893 | + } | ||
| 894 | + | ||
| 895 | + public String getAppImgPreview() { | ||
| 896 | + return appImgPreview; | ||
| 897 | + } | ||
| 898 | + | ||
| 899 | + public JSONArray getAppImgs() { | ||
| 900 | + return appImgs; | ||
| 901 | + } | ||
| 902 | + | ||
| 802 | // ================================================================================ | 903 | // ================================================================================ |
| 803 | // Setters | 904 | // Setters |
| 804 | // ================================================================================ | 905 | // ================================================================================ |
| ... | @@ -987,6 +1088,34 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -987,6 +1088,34 @@ public class Couponset implements Parcelable, Serializable { |
| 987 | this.merchant = merchant; | 1088 | this.merchant = merchant; |
| 988 | } | 1089 | } |
| 989 | 1090 | ||
| 1091 | + public void setMerchantAdminName(String merchantAdminName) { | ||
| 1092 | + this.merchantAdminName = merchantAdminName; | ||
| 1093 | + } | ||
| 1094 | + | ||
| 1095 | + public void setMerchantImgPreview(String merchantImgPreview) { | ||
| 1096 | + this.merchantImgPreview = merchantImgPreview; | ||
| 1097 | + } | ||
| 1098 | + | ||
| 1099 | + public void setMerchantWebsite(String merchantWebsite) { | ||
| 1100 | + this.merchantWebsite = merchantWebsite; | ||
| 1101 | + } | ||
| 1102 | + | ||
| 1103 | + public void setMerchantDetails(MerchantDetails merchantDetails) { | ||
| 1104 | + this.merchantDetails = merchantDetails; | ||
| 1105 | + } | ||
| 1106 | + | ||
| 1107 | + public void setScore(int score) { | ||
| 1108 | + this.score = score; | ||
| 1109 | + } | ||
| 1110 | + | ||
| 1111 | + public void setAppImgPreview(String appImgPreview) { | ||
| 1112 | + this.appImgPreview = appImgPreview; | ||
| 1113 | + } | ||
| 1114 | + | ||
| 1115 | + public void setAppImgs(JSONArray appImgs) { | ||
| 1116 | + this.appImgs = appImgs; | ||
| 1117 | + } | ||
| 1118 | + | ||
| 990 | @Override | 1119 | @Override |
| 991 | public int describeContents() { | 1120 | public int describeContents() { |
| 992 | return 0; | 1121 | return 0; | ... | ... |
| ... | @@ -101,6 +101,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { | ... | @@ -101,6 +101,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { |
| 101 | private static final String MIN_PRICE = "min_price"; | 101 | private static final String MIN_PRICE = "min_price"; |
| 102 | private static final String MAX_PRICE = "max_price"; | 102 | private static final String MAX_PRICE = "max_price"; |
| 103 | private static final String URL_NAME = "url_name"; | 103 | private static final String URL_NAME = "url_name"; |
| 104 | + private static final String APP_IMG_PREVIEW = "app_img_preview"; | ||
| 105 | + private static final String APP_IMGS = "app_imgs"; | ||
| 104 | 106 | ||
| 105 | /* Member variables of the Merchant object */ | 107 | /* Member variables of the Merchant object */ |
| 106 | 108 | ||
| ... | @@ -154,6 +156,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { | ... | @@ -154,6 +156,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { |
| 154 | private String minPrice; | 156 | private String minPrice; |
| 155 | private String maxPrice; | 157 | private String maxPrice; |
| 156 | private String urlName; | 158 | private String urlName; |
| 159 | + private String appImgPreview; | ||
| 160 | + private JSONArray appImgs; | ||
| 157 | private LatLng coordinates; | 161 | private LatLng coordinates; |
| 158 | 162 | ||
| 159 | /** | 163 | /** |
| ... | @@ -215,6 +219,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { | ... | @@ -215,6 +219,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { |
| 215 | this.minPrice = null; | 219 | this.minPrice = null; |
| 216 | this.maxPrice = null; | 220 | this.maxPrice = null; |
| 217 | this.urlName = null; | 221 | this.urlName = null; |
| 222 | + this.appImgPreview = null; | ||
| 223 | + this.appImgs = null; | ||
| 218 | this.coordinates = new LatLng( | 224 | this.coordinates = new LatLng( |
| 219 | this.latitude != null ? this.latitude : 0.0, | 225 | this.latitude != null ? this.latitude : 0.0, |
| 220 | this.longitude != null ? this.longitude : 0.0); | 226 | this.longitude != null ? this.longitude : 0.0); |
| ... | @@ -304,6 +310,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { | ... | @@ -304,6 +310,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { |
| 304 | this.minPrice = optNullableString(json, MIN_PRICE); | 310 | this.minPrice = optNullableString(json, MIN_PRICE); |
| 305 | this.maxPrice = optNullableString(json, MAX_PRICE); | 311 | this.maxPrice = optNullableString(json, MAX_PRICE); |
| 306 | this.urlName = optNullableString(json, URL_NAME); | 312 | this.urlName = optNullableString(json, URL_NAME); |
| 313 | + this.appImgPreview = optNullableString(json, APP_IMG_PREVIEW); | ||
| 314 | + this.appImgs = json.optJSONArray(APP_IMGS); | ||
| 307 | this.coordinates = new LatLng( | 315 | this.coordinates = new LatLng( |
| 308 | this.latitude != null ? this.latitude : 0.0, | 316 | this.latitude != null ? this.latitude : 0.0, |
| 309 | this.longitude != null ? this.longitude : 0.0); | 317 | this.longitude != null ? this.longitude : 0.0); |
| ... | @@ -325,6 +333,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { | ... | @@ -325,6 +333,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { |
| 325 | this.admin_name = optNullableString(json, ADMIN_NAME); | 333 | this.admin_name = optNullableString(json, ADMIN_NAME); |
| 326 | this.img_preview = optNullableString(json, IMG_PREVIEW); | 334 | this.img_preview = optNullableString(json, IMG_PREVIEW); |
| 327 | this.website = optNullableString(json, WEBSITE); | 335 | this.website = optNullableString(json, WEBSITE); |
| 336 | + this.appImgPreview = optNullableString(json, APP_IMG_PREVIEW); | ||
| 337 | + this.appImgs = json.optJSONArray(APP_IMGS); | ||
| 328 | } | 338 | } |
| 329 | } | 339 | } |
| 330 | 340 | ||
| ... | @@ -408,6 +418,13 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { | ... | @@ -408,6 +418,13 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { |
| 408 | this.minPrice = source.readString(); | 418 | this.minPrice = source.readString(); |
| 409 | this.maxPrice = source.readString(); | 419 | this.maxPrice = source.readString(); |
| 410 | this.urlName = source.readString(); | 420 | this.urlName = source.readString(); |
| 421 | + this.appImgPreview = source.readString(); | ||
| 422 | + try { | ||
| 423 | + String appImgsStr = source.readString(); | ||
| 424 | + this.appImgs = appImgsStr != null ? new JSONArray(appImgsStr) : null; | ||
| 425 | + } catch (JSONException e) { | ||
| 426 | + this.appImgs = null; | ||
| 427 | + } | ||
| 411 | this.coordinates = new LatLng( | 428 | this.coordinates = new LatLng( |
| 412 | this.latitude != null ? this.latitude : 0.0, | 429 | this.latitude != null ? this.latitude : 0.0, |
| 413 | this.longitude != null ? this.longitude : 0.0); | 430 | this.longitude != null ? this.longitude : 0.0); |
| ... | @@ -465,6 +482,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { | ... | @@ -465,6 +482,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { |
| 465 | dest.writeString(this.minPrice); | 482 | dest.writeString(this.minPrice); |
| 466 | dest.writeString(this.maxPrice); | 483 | dest.writeString(this.maxPrice); |
| 467 | dest.writeString(this.urlName); | 484 | dest.writeString(this.urlName); |
| 485 | + dest.writeString(this.appImgPreview); | ||
| 486 | + dest.writeString(this.appImgs != null ? this.appImgs.toString() : null); | ||
| 468 | dest.writeParcelable(coordinates, flags); | 487 | dest.writeParcelable(coordinates, flags); |
| 469 | } | 488 | } |
| 470 | 489 | ||
| ... | @@ -526,6 +545,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { | ... | @@ -526,6 +545,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { |
| 526 | jObj.put(MIN_PRICE, this.minPrice != null ? this.minPrice : JSONObject.NULL); | 545 | jObj.put(MIN_PRICE, this.minPrice != null ? this.minPrice : JSONObject.NULL); |
| 527 | jObj.put(MAX_PRICE, this.maxPrice != null ? this.maxPrice : JSONObject.NULL); | 546 | jObj.put(MAX_PRICE, this.maxPrice != null ? this.maxPrice : JSONObject.NULL); |
| 528 | jObj.put(URL_NAME, this.urlName != null ? this.urlName : JSONObject.NULL); | 547 | jObj.put(URL_NAME, this.urlName != null ? this.urlName : JSONObject.NULL); |
| 548 | + jObj.put(APP_IMG_PREVIEW, this.appImgPreview != null ? this.appImgPreview : JSONObject.NULL); | ||
| 549 | + jObj.put(APP_IMGS, this.appImgs != null ? this.appImgs : JSONObject.NULL); | ||
| 529 | } catch (JSONException e) { | 550 | } catch (JSONException e) { |
| 530 | if (WarpConstants.DEBUG) { | 551 | if (WarpConstants.DEBUG) { |
| 531 | e.printStackTrace(); | 552 | e.printStackTrace(); |
| ... | @@ -790,6 +811,14 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { | ... | @@ -790,6 +811,14 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { |
| 790 | return urlName; | 811 | return urlName; |
| 791 | } | 812 | } |
| 792 | 813 | ||
| 814 | + public String getAppImgPreview() { | ||
| 815 | + return appImgPreview; | ||
| 816 | + } | ||
| 817 | + | ||
| 818 | + public JSONArray getAppImgs() { | ||
| 819 | + return appImgs; | ||
| 820 | + } | ||
| 821 | + | ||
| 793 | // ================================================================================ | 822 | // ================================================================================ |
| 794 | // Setters | 823 | // Setters |
| 795 | // ================================================================================ | 824 | // ================================================================================ |
| ... | @@ -994,6 +1023,14 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { | ... | @@ -994,6 +1023,14 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { |
| 994 | this.urlName = urlName; | 1023 | this.urlName = urlName; |
| 995 | } | 1024 | } |
| 996 | 1025 | ||
| 1026 | + public void setAppImgPreview(String appImgPreview) { | ||
| 1027 | + this.appImgPreview = appImgPreview; | ||
| 1028 | + } | ||
| 1029 | + | ||
| 1030 | + public void setAppImgs(JSONArray appImgs) { | ||
| 1031 | + this.appImgs = appImgs; | ||
| 1032 | + } | ||
| 1033 | + | ||
| 997 | public void setCoordinates(LatLng coordinates) { | 1034 | public void setCoordinates(LatLng coordinates) { |
| 998 | this.coordinates = coordinates; | 1035 | this.coordinates = coordinates; |
| 999 | } | 1036 | } | ... | ... |
| 1 | +package ly.warp.sdk.io.models; | ||
| 2 | + | ||
| 3 | +import android.os.Parcel; | ||
| 4 | +import android.os.Parcelable; | ||
| 5 | + | ||
| 6 | +import org.json.JSONObject; | ||
| 7 | + | ||
| 8 | +import java.io.Serializable; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * Lightweight model representing the merchant_details object inside a Couponset response. | ||
| 12 | + */ | ||
| 13 | +public class MerchantDetails implements Parcelable, Serializable { | ||
| 14 | + | ||
| 15 | + private static final long serialVersionUID = 3891274651234567890L; | ||
| 16 | + | ||
| 17 | + private static final String ADMIN_NAME = "admin_name"; | ||
| 18 | + private static final String PREVIEW_IMG = "preview_img"; | ||
| 19 | + private static final String UUID = "uuid"; | ||
| 20 | + private static final String WEBSITE = "website"; | ||
| 21 | + | ||
| 22 | + private String adminName; | ||
| 23 | + private String previewImg; | ||
| 24 | + private String uuid; | ||
| 25 | + private String website; | ||
| 26 | + | ||
| 27 | + private static String optNullableString(JSONObject json, String key) { | ||
| 28 | + return json.isNull(key) ? null : json.optString(key); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public MerchantDetails() { | ||
| 32 | + this.adminName = null; | ||
| 33 | + this.previewImg = null; | ||
| 34 | + this.uuid = null; | ||
| 35 | + this.website = null; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public MerchantDetails(JSONObject json) { | ||
| 39 | + if (json != null) { | ||
| 40 | + this.adminName = optNullableString(json, ADMIN_NAME); | ||
| 41 | + this.previewImg = optNullableString(json, PREVIEW_IMG); | ||
| 42 | + this.uuid = optNullableString(json, UUID); | ||
| 43 | + this.website = optNullableString(json, WEBSITE); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public MerchantDetails(Parcel source) { | ||
| 48 | + this.adminName = source.readString(); | ||
| 49 | + this.previewImg = source.readString(); | ||
| 50 | + this.uuid = source.readString(); | ||
| 51 | + this.website = source.readString(); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @Override | ||
| 55 | + public void writeToParcel(Parcel dest, int flags) { | ||
| 56 | + dest.writeString(this.adminName); | ||
| 57 | + dest.writeString(this.previewImg); | ||
| 58 | + dest.writeString(this.uuid); | ||
| 59 | + dest.writeString(this.website); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @Override | ||
| 63 | + public int describeContents() { | ||
| 64 | + return 0; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public static final Creator<MerchantDetails> CREATOR = new Creator<MerchantDetails>() { | ||
| 68 | + @Override | ||
| 69 | + public MerchantDetails createFromParcel(Parcel source) { | ||
| 70 | + return new MerchantDetails(source); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + @Override | ||
| 74 | + public MerchantDetails[] newArray(int size) { | ||
| 75 | + return new MerchantDetails[size]; | ||
| 76 | + } | ||
| 77 | + }; | ||
| 78 | + | ||
| 79 | + public String toString() { | ||
| 80 | + JSONObject jObj = new JSONObject(); | ||
| 81 | + try { | ||
| 82 | + jObj.put(ADMIN_NAME, this.adminName != null ? this.adminName : JSONObject.NULL); | ||
| 83 | + jObj.put(PREVIEW_IMG, this.previewImg != null ? this.previewImg : JSONObject.NULL); | ||
| 84 | + jObj.put(UUID, this.uuid != null ? this.uuid : JSONObject.NULL); | ||
| 85 | + jObj.put(WEBSITE, this.website != null ? this.website : JSONObject.NULL); | ||
| 86 | + } catch (Exception e) { | ||
| 87 | + e.printStackTrace(); | ||
| 88 | + } | ||
| 89 | + return jObj.toString(); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + // ================================================================================ | ||
| 93 | + // Getters | ||
| 94 | + // ================================================================================ | ||
| 95 | + | ||
| 96 | + public String getAdminName() { | ||
| 97 | + return adminName; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public String getPreviewImg() { | ||
| 101 | + return previewImg; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public String getUuid() { | ||
| 105 | + return uuid; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + public String getWebsite() { | ||
| 109 | + return website; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + // ================================================================================ | ||
| 113 | + // Setters | ||
| 114 | + // ================================================================================ | ||
| 115 | + | ||
| 116 | + public void setAdminName(String adminName) { | ||
| 117 | + this.adminName = adminName; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + public void setPreviewImg(String previewImg) { | ||
| 121 | + this.previewImg = previewImg; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + public void setUuid(String uuid) { | ||
| 125 | + this.uuid = uuid; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + public void setWebsite(String website) { | ||
| 129 | + this.website = website; | ||
| 130 | + } | ||
| 131 | +} |
| ... | @@ -135,6 +135,18 @@ public interface ApiService { | ... | @@ -135,6 +135,18 @@ public interface ApiService { |
| 135 | @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer); | 135 | @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer); |
| 136 | 136 | ||
| 137 | @Headers("Content-Type: application/json") | 137 | @Headers("Content-Type: application/json") |
| 138 | + @POST("/oauth/{appUuid}/context") | ||
| 139 | + Call<ResponseBody> getCarousel(@Path("appUuid") String appUuid, | ||
| 140 | + @Body RequestBody request, | ||
| 141 | + @Header(WarpConstants.HEADER_DATE) String timeStamp, | ||
| 142 | + @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, | ||
| 143 | + @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId, | ||
| 144 | + @Header(WarpConstants.HEADER_CHANNEL) String channel, | ||
| 145 | + @Header(WarpConstants.HEADER_WEB_ID) String webId, | ||
| 146 | + @Header(WarpConstants.HEADER_SIGNATURE) String signature, | ||
| 147 | + @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer); | ||
| 148 | + | ||
| 149 | + @Headers("Content-Type: application/json") | ||
| 138 | @POST("/api/mobile/v2/{appUuid}/context/") | 150 | @POST("/api/mobile/v2/{appUuid}/context/") |
| 139 | Call<ResponseBody> getCouponsets(@Path("appUuid") String appUuid, | 151 | Call<ResponseBody> getCouponsets(@Path("appUuid") String appUuid, |
| 140 | @Body RequestBody request, | 152 | @Body RequestBody request, |
| ... | @@ -160,13 +172,13 @@ public interface ApiService { | ... | @@ -160,13 +172,13 @@ public interface ApiService { |
| 160 | @Headers("Content-Type: application/json") | 172 | @Headers("Content-Type: application/json") |
| 161 | @POST("/api/mobile/v2/{appUuid}/context/") | 173 | @POST("/api/mobile/v2/{appUuid}/context/") |
| 162 | Call<ResponseBody> getStores(@Path("appUuid") String appUuid, | 174 | Call<ResponseBody> getStores(@Path("appUuid") String appUuid, |
| 163 | - @Body RequestBody request, | 175 | + @Body RequestBody request, |
| 164 | - @Header(WarpConstants.HEADER_DATE) String timeStamp, | 176 | + @Header(WarpConstants.HEADER_DATE) String timeStamp, |
| 165 | - @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, | 177 | + @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, |
| 166 | - @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId, | 178 | + @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId, |
| 167 | - @Header(WarpConstants.HEADER_CHANNEL) String channel, | 179 | + @Header(WarpConstants.HEADER_CHANNEL) String channel, |
| 168 | - @Header(WarpConstants.HEADER_WEB_ID) String webId, | 180 | + @Header(WarpConstants.HEADER_WEB_ID) String webId, |
| 169 | - @Header(WarpConstants.HEADER_SIGNATURE) String signature); | 181 | + @Header(WarpConstants.HEADER_SIGNATURE) String signature); |
| 170 | 182 | ||
| 171 | // =========================================================== | 183 | // =========================================================== |
| 172 | // Getter & Setter | 184 | // Getter & Setter | ... | ... |
| ... | @@ -35,6 +35,7 @@ import ly.warp.sdk.Warply; | ... | @@ -35,6 +35,7 @@ import ly.warp.sdk.Warply; |
| 35 | import ly.warp.sdk.db.WarplyDBHelper; | 35 | import ly.warp.sdk.db.WarplyDBHelper; |
| 36 | import ly.warp.sdk.io.models.BannerItem; | 36 | import ly.warp.sdk.io.models.BannerItem; |
| 37 | import ly.warp.sdk.io.models.Campaign; | 37 | import ly.warp.sdk.io.models.Campaign; |
| 38 | +import ly.warp.sdk.io.models.CarouselItem; | ||
| 38 | import ly.warp.sdk.io.models.Coupon; | 39 | import ly.warp.sdk.io.models.Coupon; |
| 39 | import ly.warp.sdk.io.models.CouponList; | 40 | import ly.warp.sdk.io.models.CouponList; |
| 40 | import ly.warp.sdk.io.models.Couponset; | 41 | import ly.warp.sdk.io.models.Couponset; |
| ... | @@ -59,6 +60,7 @@ public class WarplyManagerHelper { | ... | @@ -59,6 +60,7 @@ public class WarplyManagerHelper { |
| 59 | private static ArrayList<Coupon> mCouponList = new ArrayList<Coupon>(); | 60 | private static ArrayList<Coupon> mCouponList = new ArrayList<Coupon>(); |
| 60 | private static ArrayList<Campaign> mCampaignListAll = new ArrayList<Campaign>(); | 61 | private static ArrayList<Campaign> mCampaignListAll = new ArrayList<Campaign>(); |
| 61 | private static ArrayList<BannerItem> mBannerListAll = new ArrayList<BannerItem>(); | 62 | private static ArrayList<BannerItem> mBannerListAll = new ArrayList<BannerItem>(); |
| 63 | + private static ArrayList<CarouselItem> mCarouselListAll = new ArrayList<>(); | ||
| 62 | private static LinkedHashMap<String, ArrayList<Couponset>> mCouponsetCategorizedMap = new LinkedHashMap<>(); | 64 | private static LinkedHashMap<String, ArrayList<Couponset>> mCouponsetCategorizedMap = new LinkedHashMap<>(); |
| 63 | private static User mUser = null; | 65 | private static User mUser = null; |
| 64 | 66 | ||
| ... | @@ -96,6 +98,15 @@ public class WarplyManagerHelper { | ... | @@ -96,6 +98,15 @@ public class WarplyManagerHelper { |
| 96 | return mBannerListAll; | 98 | return mBannerListAll; |
| 97 | } | 99 | } |
| 98 | 100 | ||
| 101 | + public static void setCarouselList(ArrayList<CarouselItem> carouselList) { | ||
| 102 | + mCarouselListAll.clear(); | ||
| 103 | + mCarouselListAll.addAll(carouselList); | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + public static ArrayList<CarouselItem> getCarouselList() { | ||
| 107 | + return mCarouselListAll; | ||
| 108 | + } | ||
| 109 | + | ||
| 99 | public static void setCouponsetCategorizedMap(LinkedHashMap<String, ArrayList<Couponset>> couponsetMap) { | 110 | public static void setCouponsetCategorizedMap(LinkedHashMap<String, ArrayList<Couponset>> couponsetMap) { |
| 100 | mCouponsetCategorizedMap.clear(); | 111 | mCouponsetCategorizedMap.clear(); |
| 101 | mCouponsetCategorizedMap.putAll(couponsetMap); | 112 | mCouponsetCategorizedMap.putAll(couponsetMap); | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -267,6 +267,7 @@ | ... | @@ -267,6 +267,7 @@ |
| 267 | </LinearLayout> | 267 | </LinearLayout> |
| 268 | 268 | ||
| 269 | <LinearLayout | 269 | <LinearLayout |
| 270 | + android:id="@+id/ll_website" | ||
| 270 | android:layout_width="match_parent" | 271 | android:layout_width="match_parent" |
| 271 | android:layout_height="55dp" | 272 | android:layout_height="55dp" |
| 272 | android:layout_marginTop="16dp" | 273 | android:layout_marginTop="16dp" | ... | ... |
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| 3 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
| 4 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 5 | - android:layout_height="150dp" | 6 | + android:layout_height="175dp" |
| 6 | android:background="@drawable/shape_rounded_skyblue_skyblue_border"> | 7 | android:background="@drawable/shape_rounded_skyblue_skyblue_border"> |
| 7 | 8 | ||
| 8 | - <LinearLayout | 9 | + <androidx.constraintlayout.widget.ConstraintLayout |
| 10 | + android:id="@+id/cl_top" | ||
| 9 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
| 10 | android:layout_height="wrap_content" | 12 | android:layout_height="wrap_content" |
| 11 | android:layout_alignParentTop="true" | 13 | android:layout_alignParentTop="true" |
| 12 | - android:orientation="horizontal"> | 14 | + android:paddingHorizontal="10dp" |
| 15 | + android:paddingTop="12dp"> | ||
| 16 | + | ||
| 17 | + <ImageView | ||
| 18 | + android:id="@+id/iv_logo" | ||
| 19 | + android:layout_width="68dp" | ||
| 20 | + android:layout_height="68dp" | ||
| 21 | + android:scaleType="centerInside" | ||
| 22 | + android:background="@drawable/shape_rectangle_rounded_white2" | ||
| 23 | + app:layout_constraintStart_toStartOf="parent" | ||
| 24 | + app:layout_constraintTop_toTopOf="parent" | ||
| 25 | + tools:src="@drawable/demo_avis" /> | ||
| 26 | + | ||
| 27 | + <LinearLayout | ||
| 28 | + android:id="@+id/ll_date" | ||
| 29 | + android:layout_width="wrap_content" | ||
| 30 | + android:layout_height="wrap_content" | ||
| 31 | + android:background="@drawable/demo_shape_grey_border_grey" | ||
| 32 | + android:gravity="center" | ||
| 33 | + android:orientation="horizontal" | ||
| 34 | + android:paddingHorizontal="8dp" | ||
| 35 | + android:paddingVertical="6dp" | ||
| 36 | + app:layout_constraintEnd_toEndOf="parent" | ||
| 37 | + app:layout_constraintTop_toTopOf="parent"> | ||
| 38 | + | ||
| 39 | + <ImageView | ||
| 40 | + android:layout_width="14dp" | ||
| 41 | + android:layout_height="14dp" | ||
| 42 | + android:src="@drawable/demo_time" /> | ||
| 43 | + | ||
| 44 | + <View | ||
| 45 | + android:layout_width="4dp" | ||
| 46 | + android:layout_height="match_parent" /> | ||
| 47 | + | ||
| 48 | + <TextView | ||
| 49 | + android:id="@+id/tv_coupon_end_date" | ||
| 50 | + android:layout_width="wrap_content" | ||
| 51 | + android:layout_height="wrap_content" | ||
| 52 | + android:includeFontPadding="false" | ||
| 53 | + android:textColor="@color/custom_black7" | ||
| 54 | + android:textSize="12sp" | ||
| 55 | + tools:text="@string/demo_purchases" /> | ||
| 56 | + </LinearLayout> | ||
| 57 | + | ||
| 58 | + <LinearLayout | ||
| 59 | + android:layout_width="wrap_content" | ||
| 60 | + android:layout_height="wrap_content" | ||
| 61 | + android:gravity="center" | ||
| 62 | + android:orientation="horizontal" | ||
| 63 | + app:layout_constraintEnd_toEndOf="parent" | ||
| 64 | + app:layout_constraintTop_toTopOf="parent"> | ||
| 65 | + | ||
| 66 | + <LinearLayout | ||
| 67 | + android:layout_width="0dp" | ||
| 68 | + android:layout_height="wrap_content" | ||
| 69 | + android:layout_weight="1"> | ||
| 70 | + | ||
| 71 | + <LinearLayout | ||
| 72 | + android:id="@+id/ll_date_expired" | ||
| 73 | + android:layout_width="wrap_content" | ||
| 74 | + android:layout_height="wrap_content" | ||
| 75 | + android:background="@drawable/demo_shape_grey_border_grey" | ||
| 76 | + android:gravity="center" | ||
| 77 | + android:orientation="horizontal" | ||
| 78 | + android:paddingHorizontal="8dp" | ||
| 79 | + android:paddingVertical="6dp" | ||
| 80 | + android:visibility="gone"> | ||
| 81 | + | ||
| 82 | + <TextView | ||
| 83 | + android:id="@+id/tv_expired_label" | ||
| 84 | + android:layout_width="wrap_content" | ||
| 85 | + android:layout_height="wrap_content" | ||
| 86 | + android:includeFontPadding="false" | ||
| 87 | + android:text="@string/demo_coupon_expired" | ||
| 88 | + android:textColor="@color/custom_black7" | ||
| 89 | + android:textSize="12sp" /> | ||
| 90 | + </LinearLayout> | ||
| 91 | + </LinearLayout> | ||
| 92 | + </LinearLayout> | ||
| 93 | + </androidx.constraintlayout.widget.ConstraintLayout> | ||
| 94 | + | ||
| 95 | + <androidx.constraintlayout.widget.ConstraintLayout | ||
| 96 | + android:id="@+id/cl_bottom" | ||
| 97 | + android:layout_width="match_parent" | ||
| 98 | + android:layout_height="wrap_content" | ||
| 99 | + android:layout_alignParentBottom="true" | ||
| 100 | + android:paddingBottom="16dp"> | ||
| 13 | 101 | ||
| 14 | <LinearLayout | 102 | <LinearLayout |
| 15 | android:layout_width="0dp" | 103 | android:layout_width="0dp" |
| 16 | android:layout_height="wrap_content" | 104 | android:layout_height="wrap_content" |
| 17 | - android:layout_marginTop="16dp" | ||
| 18 | - android:layout_weight="1" | ||
| 19 | android:orientation="vertical" | 105 | android:orientation="vertical" |
| 20 | - android:paddingHorizontal="16dp"> | 106 | + android:paddingHorizontal="16dp" |
| 107 | + app:layout_constraintBottom_toBottomOf="parent" | ||
| 108 | + app:layout_constraintEnd_toStartOf="@+id/header_layout" | ||
| 109 | + app:layout_constraintStart_toStartOf="parent"> | ||
| 21 | 110 | ||
| 22 | <TextView | 111 | <TextView |
| 23 | android:id="@+id/tv_merchant" | 112 | android:id="@+id/tv_merchant" |
| 24 | android:layout_width="wrap_content" | 113 | android:layout_width="wrap_content" |
| 25 | android:layout_height="wrap_content" | 114 | android:layout_height="wrap_content" |
| 115 | + android:ellipsize="end" | ||
| 26 | android:includeFontPadding="false" | 116 | android:includeFontPadding="false" |
| 27 | android:maxLines="1" | 117 | android:maxLines="1" |
| 28 | - android:ellipsize="end" | ||
| 29 | android:textColor="@color/custom_grey3" | 118 | android:textColor="@color/custom_grey3" |
| 30 | android:textSize="14sp" | 119 | android:textSize="14sp" |
| 31 | tools:text="2 πίτσες & Coca-COLA 1,5lt" /> | 120 | tools:text="2 πίτσες & Coca-COLA 1,5lt" /> |
| ... | @@ -34,10 +123,10 @@ | ... | @@ -34,10 +123,10 @@ |
| 34 | android:id="@+id/tv_title" | 123 | android:id="@+id/tv_title" |
| 35 | android:layout_width="wrap_content" | 124 | android:layout_width="wrap_content" |
| 36 | android:layout_height="wrap_content" | 125 | android:layout_height="wrap_content" |
| 37 | - android:layout_marginTop="8dp" | 126 | + android:layout_marginTop="2dp" |
| 127 | + android:ellipsize="end" | ||
| 38 | android:includeFontPadding="false" | 128 | android:includeFontPadding="false" |
| 39 | android:maxLines="1" | 129 | android:maxLines="1" |
| 40 | - android:ellipsize="end" | ||
| 41 | android:textColor="@color/custom_black6" | 130 | android:textColor="@color/custom_black6" |
| 42 | android:textSize="21sp" | 131 | android:textSize="21sp" |
| 43 | tools:text="Móvo 17,95" /> | 132 | tools:text="Móvo 17,95" /> |
| ... | @@ -54,86 +143,13 @@ | ... | @@ -54,86 +143,13 @@ |
| 54 | tools:text="2 πίτσες & Coca-COLA 1,5lt" /> | 143 | tools:text="2 πίτσες & Coca-COLA 1,5lt" /> |
| 55 | </LinearLayout> | 144 | </LinearLayout> |
| 56 | 145 | ||
| 57 | - <ImageView | ||
| 58 | - android:id="@+id/iv_logo" | ||
| 59 | - android:layout_width="68dp" | ||
| 60 | - android:layout_height="68dp" | ||
| 61 | - android:layout_marginTop="10dp" | ||
| 62 | - android:layout_marginEnd="10dp" | ||
| 63 | - android:scaleType="centerInside" | ||
| 64 | - tools:src="@drawable/demo_avis" /> | ||
| 65 | - </LinearLayout> | ||
| 66 | - | ||
| 67 | - <LinearLayout | ||
| 68 | - android:layout_width="match_parent" | ||
| 69 | - android:layout_height="wrap_content" | ||
| 70 | - android:layout_alignParentBottom="true" | ||
| 71 | - android:gravity="center" | ||
| 72 | - android:orientation="horizontal" | ||
| 73 | - android:paddingStart="16dp" | ||
| 74 | - android:paddingEnd="10dp" | ||
| 75 | - android:layout_marginBottom="8dp"> | ||
| 76 | - | ||
| 77 | - <LinearLayout | ||
| 78 | - android:layout_width="0dp" | ||
| 79 | - android:layout_height="wrap_content" | ||
| 80 | - android:layout_weight="1"> | ||
| 81 | - | ||
| 82 | - <LinearLayout | ||
| 83 | - android:id="@+id/ll_date" | ||
| 84 | - android:layout_width="wrap_content" | ||
| 85 | - android:layout_height="wrap_content" | ||
| 86 | - android:background="@drawable/demo_shape_grey_border_grey" | ||
| 87 | - android:gravity="center" | ||
| 88 | - android:orientation="horizontal" | ||
| 89 | - android:paddingHorizontal="8dp" | ||
| 90 | - android:paddingVertical="6dp"> | ||
| 91 | - | ||
| 92 | - <ImageView | ||
| 93 | - android:layout_width="14dp" | ||
| 94 | - android:layout_height="14dp" | ||
| 95 | - android:src="@drawable/demo_time" /> | ||
| 96 | - | ||
| 97 | - <View | ||
| 98 | - android:layout_width="4dp" | ||
| 99 | - android:layout_height="match_parent" /> | ||
| 100 | - | ||
| 101 | - <TextView | ||
| 102 | - android:id="@+id/tv_coupon_end_date" | ||
| 103 | - android:layout_width="wrap_content" | ||
| 104 | - android:layout_height="wrap_content" | ||
| 105 | - android:includeFontPadding="false" | ||
| 106 | - android:textColor="@color/custom_black7" | ||
| 107 | - android:textSize="12sp" | ||
| 108 | - tools:text="@string/demo_purchases" /> | ||
| 109 | - </LinearLayout> | ||
| 110 | - | ||
| 111 | - <LinearLayout | ||
| 112 | - android:id="@+id/ll_date_expired" | ||
| 113 | - android:layout_width="wrap_content" | ||
| 114 | - android:layout_height="wrap_content" | ||
| 115 | - android:background="@drawable/demo_shape_grey_border_grey" | ||
| 116 | - android:gravity="center" | ||
| 117 | - android:orientation="horizontal" | ||
| 118 | - android:paddingHorizontal="8dp" | ||
| 119 | - android:paddingVertical="6dp" | ||
| 120 | - android:visibility="gone"> | ||
| 121 | - | ||
| 122 | - <TextView | ||
| 123 | - android:id="@+id/tv_expired_label" | ||
| 124 | - android:layout_width="wrap_content" | ||
| 125 | - android:layout_height="wrap_content" | ||
| 126 | - android:includeFontPadding="false" | ||
| 127 | - android:text="@string/demo_coupon_expired" | ||
| 128 | - android:textColor="@color/custom_black7" | ||
| 129 | - android:textSize="12sp" /> | ||
| 130 | - </LinearLayout> | ||
| 131 | - </LinearLayout> | ||
| 132 | - | ||
| 133 | <LinearLayout | 146 | <LinearLayout |
| 134 | android:id="@+id/header_layout" | 147 | android:id="@+id/header_layout" |
| 135 | android:layout_width="wrap_content" | 148 | android:layout_width="wrap_content" |
| 136 | - android:layout_height="wrap_content"> | 149 | + android:layout_height="wrap_content" |
| 150 | + android:layout_marginEnd="10dp" | ||
| 151 | + app:layout_constraintBottom_toBottomOf="parent" | ||
| 152 | + app:layout_constraintEnd_toEndOf="parent"> | ||
| 137 | 153 | ||
| 138 | <ImageView | 154 | <ImageView |
| 139 | android:id="@+id/iv_back" | 155 | android:id="@+id/iv_back" |
| ... | @@ -144,5 +160,5 @@ | ... | @@ -144,5 +160,5 @@ |
| 144 | android:rotation="180" | 160 | android:rotation="180" |
| 145 | android:src="@drawable/ic_back" /> | 161 | android:src="@drawable/ic_back" /> |
| 146 | </LinearLayout> | 162 | </LinearLayout> |
| 147 | - </LinearLayout> | 163 | + </androidx.constraintlayout.widget.ConstraintLayout> |
| 148 | </RelativeLayout> | 164 | </RelativeLayout> | ... | ... |
-
Please register or login to post a comment