Panagiotis Triantafyllou

many fixes and changes for UAT

Showing 22 changed files with 566 additions and 129 deletions
......@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public void onWarplyReady() {
if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
.setGuid("7000001406"), //6012049321, 6012049322, 6012049323
.setGuid("7000000832"), //6012049321, 6012049322, 6012049323
mLoginReceiver);
} else {
startNextActivity();
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta51'
PUBLISH_VERSION = '4.5.4-cosbeta52'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -2,7 +2,6 @@ package ly.warp.sdk.activities;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
......@@ -25,16 +24,15 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Consumer;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.request.CosmoteCouponSharingRequest;
import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest;
import ly.warp.sdk.io.request.WarplyConsumerRequest;
import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
import ly.warp.sdk.utils.managers.WarplyManager;
......@@ -265,6 +263,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
String message = result.optString("msg", "");
WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
runOnUiThread(() -> {
if (status == 1)
acceptSharingDialog();
......@@ -282,6 +281,18 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
}
};
private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
@Override
public void onSuccess(CouponList result) {
}
@Override
public void onFailure(int errorCode) {
}
};
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
......
......@@ -264,7 +264,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
private void nonTelcoDialog() {
mAlertDialogNonTelco = new AlertDialog.Builder(this)
.setTitle(R.string.cos_dlg_non_telco)
.setMessage(R.string.cos_dlg_non_telco)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
onBackPressed();
......
......@@ -43,7 +43,7 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
// ===========================================================
private ImageView mIvBack;
private TextView mTvCouponsValueAll;
private TextView mTvCouponsValueAll, mTvSharedEmpty, mTvExpiredEmpty;
private RecyclerView mRvExpiredCoupons, mRvSharedCoupons;
private ExpiredCouponAdapter mAdapterExpiredCoupons;
private SharedCouponAdapter mAdapterSharedCoupons;
......@@ -68,6 +68,8 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
mRlExpiredView = findViewById(R.id.rl_expired_view);
mRlSharedView = findViewById(R.id.rl_shared_view);
mRvSharedCoupons = findViewById(R.id.rv_shared_coupons);
mTvSharedEmpty = findViewById(R.id.tv_shared_empty);
mTvExpiredEmpty = findViewById(R.id.tv_expired_empty);
initViews();
}
......@@ -205,6 +207,8 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
// .doOnError(error -> {
// })
// .subscribe();
} else {
mTvExpiredEmpty.setVisibility(View.VISIBLE);
}
}
......@@ -232,9 +236,13 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
}
runOnUiThread(() -> {
mRvSharedCoupons.setLayoutManager(new LinearLayoutManager(LoyaltyAnalysisActivity.this, LinearLayoutManager.VERTICAL, false));
mAdapterSharedCoupons = new SharedCouponAdapter(LoyaltyAnalysisActivity.this, mSharedCoupons);
mRvSharedCoupons.setAdapter(mAdapterSharedCoupons);
if (mSharedCoupons != null && mSharedCoupons.size() > 0) {
mRvSharedCoupons.setLayoutManager(new LinearLayoutManager(LoyaltyAnalysisActivity.this, LinearLayoutManager.VERTICAL, false));
mAdapterSharedCoupons = new SharedCouponAdapter(LoyaltyAnalysisActivity.this, mSharedCoupons);
mRvSharedCoupons.setAdapter(mAdapterSharedCoupons);
} else {
mTvSharedEmpty.setVisibility(View.VISIBLE);
}
});
}
......
......@@ -11,6 +11,7 @@ import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.constraintlayout.widget.ConstraintLayout;
......@@ -24,8 +25,12 @@ import org.greenrobot.eventbus.EventBus;
import org.json.JSONObject;
import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import io.github.inflationx.calligraphy3.CalligraphyTypefaceSpan;
import io.github.inflationx.calligraphy3.TypefaceUtils;
......@@ -84,7 +89,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
mTvDealsValue = findViewById(R.id.tv_deals_value);
mTvDealsValueAll = findViewById(R.id.tv_deals_value_all);
mTvActiveCode = findViewById(R.id.tv_active_deals_text);
// mTvActiveDate = findViewById(R.id.tv_active_deals_date_text);
mTvActiveDate = findViewById(R.id.tv_active_deals_date_text);
mIvDealsLogo = findViewById(R.id.dfy_logo);
mClDealsView = findViewById(R.id.cl_mygifts);
mIvProfilePhoto = findViewById(R.id.iv_profile_photo);
......@@ -131,6 +136,10 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
return;
}
if (view.getId() == R.id.cl_deals_cos) {
//TODO: remove
WarpUtils.log("DFY coupon banner pressed!");
Toast.makeText(this, "TODO:Remove:DFY banner clicked", Toast.LENGTH_SHORT).show();
//TODO: remove
WarplyDealsAnalysisEventModel warplyDealsAnalysisEventModel = new WarplyDealsAnalysisEventModel();
warplyDealsAnalysisEventModel.setPressed(true);
EventBus.getDefault().post(new WarplyEventBusManager(warplyDealsAnalysisEventModel));
......@@ -174,9 +183,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
// ===========================================================
private void initViews() {
if(WarplyManagerHelper.getConsumerInternal() != null) {
if (WarplyManagerHelper.getConsumerInternal() != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata());
if(profMetadata != null) {
if (profMetadata != null) {
if (profMetadata.has("nonTelco") && profMetadata.optBoolean("nonTelco")) {
nonTelcoDialog();
}
......@@ -255,6 +264,20 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
if (WarplyManagerHelper.getActiveDFYCoupons().size() == 1) {
codes = WarplyManagerHelper.getActiveDFYCoupons().get(0).getCode();
mTvActiveTitle.setText(String.format(getString(R.string.cos_active_deals), String.valueOf(1)));
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
String date1 = WarplyManagerHelper.getActiveDFYCoupons().get(0).getDate();
String date2 = dateFormat.format(new Date());
try {
Date toDate = dateFormat.parse(date2);
Date fromDate = dateFormat.parse(date1);
long diff = TimeUnit.MILLISECONDS.toDays(fromDate.getTime() - toDate.getTime());
mTvActiveDate.setText(String.format(getString(R.string.cos_active_coupon_date), String.valueOf(diff)));
mTvActiveDate.setVisibility(View.VISIBLE);
} catch (ParseException e) {
e.printStackTrace();
}
} else {
for (ActiveDFYCouponModel coupon : WarplyManagerHelper.getActiveDFYCoupons()) {
codes = codes + coupon.getCode() + ",";
......@@ -264,19 +287,6 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
mTvActiveTitle.setText(String.format(getString(R.string.cos_active_deals_plural), String.valueOf(WarplyManagerHelper.getActiveDFYCoupons().size())));
}
mTvActiveCode.setText(codes);
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
// String date1 = WarplyManagerHelper.getActiveDFYCoupons().get(0).getDate();
// String date2 = dateFormat.format(new Date());
//
// try {
// Date toDate = dateFormat.parse(date2);
// Date fromDate = dateFormat.parse(date1);
// long diff = TimeUnit.MILLISECONDS.toDays(fromDate.getTime() - toDate.getTime());
// mTvActiveDate.setText(String.format(getString(R.string.cos_active_coupon_date), String.valueOf(diff)));
// } catch (ParseException e) {
// e.printStackTrace();
// }
} else {
mIvDealsLogo.setVisibility(View.GONE);
mClDealsView.setVisibility(View.GONE);
......@@ -322,7 +332,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
private void nonTelcoDialog() {
mAlertDialogNonTelco = new AlertDialog.Builder(this)
.setTitle(R.string.cos_dlg_non_telco)
.setMessage(R.string.cos_dlg_non_telco)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
onBackPressed();
......
package ly.warp.sdk.activities;
import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.maps.android.clustering.Cluster;
import com.google.maps.android.clustering.ClusterManager;
import java.util.ArrayList;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Couponset;
......@@ -35,7 +48,8 @@ import ly.warp.sdk.utils.managers.WarplyManager;
public class ShopsActivity extends FragmentActivity implements View.OnClickListener,
OnMapReadyCallback, GoogleMap.OnMapLoadedCallback, ClusterManager.OnClusterClickListener<Merchant> {
OnMapReadyCallback, GoogleMap.OnMapLoadedCallback, ClusterManager.OnClusterClickListener<Merchant>,
GoogleMap.OnMarkerClickListener {
// ===========================================================
// Constants
......@@ -52,6 +66,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
private GoogleMap mMap;
private ClusterManager<Merchant> mClusterManager;
SupportMapFragment mMapView;
private MerchantList mMerchantList = new MerchantList();
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -83,6 +98,11 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
}
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
}
@Override
public void onMapReady(@NonNull GoogleMap googleMap) {
mMap = googleMap;
......@@ -108,6 +128,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
mMap.getUiSettings().setTiltGesturesEnabled(false);
mMap.getUiSettings().setRotateGesturesEnabled(false);
mMap.setOnMapLoadedCallback(this);
mMap.setOnMarkerClickListener(/*mClusterManager*/this);
}
@Override
......@@ -118,11 +139,11 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
mMap.animateCamera(camUpdate);
}
if (mClusterManager == null) {
mClusterManager = new ClusterManager<>(this, mMap);
mClusterManager.setOnClusterClickListener(this);
mMap.setOnMarkerClickListener(mClusterManager);
}
// if (mClusterManager == null) {
// mClusterManager = new ClusterManager<>(this, mMap);
// mClusterManager.setOnClusterClickListener(this);
//// mMap.setOnMarkerClickListener(/*mClusterManager*/this);
// }
if (mCouponset != null) {
ArrayList<String> uuids = new ArrayList<>();
......@@ -153,6 +174,59 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
return true;
}
@Override
public boolean onMarkerClick(@NonNull Marker marker) {
for (Merchant merch : mMerchantList) {
if (merch.getUuid().equals(marker.getSnippet())) {
final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this);
bottomSheetDialog.setContentView(R.layout.dl_map_pin);
ImageView dialogClose = (ImageView) bottomSheetDialog.findViewById(R.id.iv_map_pin_close);
dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss());
TextView pinTitle = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_title);
pinTitle.setText(merch.getAdminName());
ImageView pinLogo = (ImageView) bottomSheetDialog.findViewById(R.id.iv_pin_logo);
if (!TextUtils.isEmpty(merch.getImgPreview())) {
Glide.with(this)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(merch.getImgPreview())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(pinLogo);
}
TextView pinName = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_name);
pinName.setText(merch.getName());
TextView pinDays = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_days);
pinDays.setText(merch.getSnippet());
TextView pinTel = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_tel);
pinTel.setText(merch.getTelephone());
TextView pinAddress = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_address);
pinAddress.setText(merch.getAddress());
LinearLayout pinDirections = (LinearLayout) bottomSheetDialog.findViewById(R.id.ll_directions);
pinDirections.setOnClickListener(view -> {
Uri gmmIntentUri = Uri.parse("google.navigation:q=" + merch.getLatitude() + "," + merch.getLongitude()/* + "&mode=w"*/);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
});
bottomSheetDialog.show();
return false;
}
}
return false;
}
// ===========================================================
// Methods
......@@ -161,14 +235,24 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
private final CallbackReceiver<MerchantList> mMerchantsCallback = new CallbackReceiver<MerchantList>() {
@Override
public void onSuccess(MerchantList result) {
mMerchantList.clear();
mMerchantList.addAll(result);
new Handler(Looper.getMainLooper()).post(() -> {
if (mClusterManager != null) {
mMap.clear();
mClusterManager.clearItems();
if (result != null) {
mClusterManager.addItems(result);
}
mClusterManager.cluster();
// if (mClusterManager != null) {
// mMap.clear();
// mClusterManager.clearItems();
// if (result != null) {
// mClusterManager.addItems(result);
// }
// mClusterManager.cluster();
// }
for (Merchant merch : result) {
mMap.addMarker(new MarkerOptions()
.position(new LatLng(merch.getLatitude(), merch.getLongitude()))
.anchor(0.5f, 0.5f)
.title(merch.getTitle())
.snippet(merch.getUuid()));
}
});
}
......
......@@ -52,6 +52,7 @@ public class SharingCoupon implements Parcelable, Serializable {
private static final String DATE = "date";
private static final String COUPONSET_UUID = "couponset_uuid";
private static final String NAME = "name";
private static final String MERCHANT_UUID = "merchant_uuid";
/* Member variables of the Campaign object */
......@@ -61,6 +62,7 @@ public class SharingCoupon implements Parcelable, Serializable {
private String date = "";
private String couponsetUuid = "";
private String name = "";
private String merchantUuid = "";
/**
* Basic constructor used to create an object from a String, representing a
......@@ -95,6 +97,7 @@ public class SharingCoupon implements Parcelable, Serializable {
this.sharingType = json.optString(SHARING_TYPE);
this.transactionMetadata = json.optString(TRANSACTION_METADATA);
this.name = json.optString(NAME);
this.merchantUuid = json.optString(MERCHANT_UUID);
}
}
......@@ -105,6 +108,7 @@ public class SharingCoupon implements Parcelable, Serializable {
this.sharingType = source.readString();
this.transactionMetadata = source.readString();
this.name = source.readString();
this.merchantUuid = source.readString();
}
@Override
......@@ -115,6 +119,7 @@ public class SharingCoupon implements Parcelable, Serializable {
dest.writeString(this.sharingType);
dest.writeString(this.transactionMetadata);
dest.writeString(this.name);
dest.writeString(this.merchantUuid);
}
/**
......@@ -131,6 +136,7 @@ public class SharingCoupon implements Parcelable, Serializable {
jObj.putOpt(SHARING_TYPE, this.sharingType);
jObj.putOpt(TRANSACTION_METADATA, this.transactionMetadata);
jObj.putOpt(NAME, this.name);
jObj.putOpt(MERCHANT_UUID, this.merchantUuid);
} catch (JSONException e) {
if (WarpConstants.DEBUG) {
e.printStackTrace();
......@@ -218,6 +224,14 @@ public class SharingCoupon implements Parcelable, Serializable {
this.name = name;
}
public String getMerchantUuid() {
return merchantUuid;
}
public void setMerchantUuid(String merchantUuid) {
this.merchantUuid = merchantUuid;
}
@Override
public int describeContents() {
return 0;
......
......@@ -136,13 +136,13 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
}
}
} else {
if (!TextUtils.isEmpty(merchant.getImage())) {
if (!TextUtils.isEmpty(merchant.getImgPreview())) {
Glide.with(mContext)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(merchant.getImage())
.load(merchant.getImgPreview())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(holder.ivCouponLogo);
} else {
......
package ly.warp.sdk.views.adapters;
import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -9,6 +10,9 @@ import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
......@@ -19,6 +23,8 @@ import io.reactivex.subjects.PublishSubject;
import ly.warp.sdk.R;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.utils.WarplyManagerHelper;
public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdapter.ExpiredCouponViewHolder> {
......@@ -33,12 +39,14 @@ public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdap
public class ExpiredCouponViewHolder extends RecyclerView.ViewHolder {
private TextView tvCouponTitle, tvCouponValue, tvCouponDate;
private ImageView ivCouponLogo;
public ExpiredCouponViewHolder(View view) {
super(view);
tvCouponTitle = view.findViewById(R.id.tv_expired_coupons_title);
tvCouponValue = view.findViewById(R.id.tv_expired_coupons_value);
tvCouponDate = view.findViewById(R.id.tv_expired_coupons_date);
ivCouponLogo = view.findViewById(R.id.iv_expired_logo);
}
}
......@@ -72,9 +80,33 @@ public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdap
@Override
public void onBindViewHolder(final ExpiredCouponViewHolder holder, int position) {
Coupon couponItem = mCoupons.get(position);
Merchant merchant = new Merchant();
if (couponItem != null) {
holder.tvCouponTitle.setText(couponItem.getName());
if (WarplyManagerHelper.getMerchantList() != null && WarplyManagerHelper.getMerchantList().size() > 0) {
for (Merchant mer : WarplyManagerHelper.getMerchantList()) {
if (mer.getUuid().equals(couponItem.getMerchantUuid())) {
merchant = mer;
break;
}
}
}
if (merchant == null) {
holder.tvCouponTitle.setText(couponItem.getName());
} else {
holder.tvCouponTitle.setText(merchant.getAdminName());
if (!TextUtils.isEmpty(merchant.getImgPreview())) {
Glide.with(mContext)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(merchant.getImgPreview())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(holder.ivCouponLogo);
}
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
......
package ly.warp.sdk.views.adapters;
import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import org.json.JSONObject;
import java.text.ParseException;
......@@ -18,9 +23,11 @@ import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.subjects.PublishSubject;
import ly.warp.sdk.R;
import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.io.models.SharingCoupon;
import ly.warp.sdk.io.models.SharingList;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarplyManagerHelper;
public class SharedCouponAdapter extends RecyclerView.Adapter<SharedCouponAdapter.SharedCouponViewHolder> {
......@@ -35,6 +42,7 @@ public class SharedCouponAdapter extends RecyclerView.Adapter<SharedCouponAdapte
public class SharedCouponViewHolder extends RecyclerView.ViewHolder {
private TextView tvCouponTitle, tvCouponValue, tvCouponDate, tvCouponLabel, tvCouponPhone;
private ImageView ivCouponLogo;
public SharedCouponViewHolder(View view) {
super(view);
......@@ -43,6 +51,7 @@ public class SharedCouponAdapter extends RecyclerView.Adapter<SharedCouponAdapte
tvCouponDate = view.findViewById(R.id.tv_shared_coupons_date);
tvCouponLabel = view.findViewById(R.id.tv_shared_coupons_label);
tvCouponPhone = view.findViewById(R.id.tv_shared_coupons_phone);
ivCouponLogo = view.findViewById(R.id.iv_shared_logo);
}
}
......@@ -76,11 +85,35 @@ public class SharedCouponAdapter extends RecyclerView.Adapter<SharedCouponAdapte
@Override
public void onBindViewHolder(final SharedCouponViewHolder holder, int position) {
SharingCoupon couponItem = mCoupons.get(position);
Merchant merchant = new Merchant();
if (couponItem != null) {
JSONObject extraFields = WarpJSONParser.getJSONFromString(couponItem.getTransactionMetadata());
if (WarplyManagerHelper.getMerchantList() != null && WarplyManagerHelper.getMerchantList().size() > 0) {
for (Merchant mer : WarplyManagerHelper.getMerchantList()) {
if (mer.getUuid().equals(couponItem.getMerchantUuid())) {
merchant = mer;
break;
}
}
}
holder.tvCouponTitle.setText(couponItem.getName());
if (merchant == null) {
holder.tvCouponTitle.setText(couponItem.getName());
} else {
holder.tvCouponTitle.setText(merchant.getAdminName());
if (!TextUtils.isEmpty(merchant.getImgPreview())) {
Glide.with(mContext)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(merchant.getImgPreview())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(holder.ivCouponLogo);
}
}
JSONObject extraFields = WarpJSONParser.getJSONFromString(couponItem.getTransactionMetadata());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<size android:width="1dp"/>
<solid android:color="@color/cos_grey8"/>
</shape>
\ No newline at end of file
......@@ -100,6 +100,19 @@
android:layout_marginHorizontal="8dp"
android:layout_marginTop="24dp"
android:orientation="vertical" />
<TextView
android:id="@+id/tv_expired_empty"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="56dp"
android:layout_below="@+id/tv_expired_title"
android:text="@string/cos_empty_expired_coupons"
android:textColor="@color/cos_light_grey2"
android:textSize="16sp"
android:visibility="gone"/>
</RelativeLayout>
<RelativeLayout
......@@ -128,5 +141,18 @@
android:layout_marginHorizontal="8dp"
android:layout_marginTop="24dp"
android:orientation="vertical" />
<TextView
android:id="@+id/tv_shared_empty"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="56dp"
android:layout_below="@+id/tv_shared_title"
android:text="@string/cos_empty_shared_coupons"
android:textColor="@color/cos_light_grey2"
android:textSize="16sp"
android:visibility="gone"/>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
......
......@@ -368,12 +368,13 @@
android:textSize="18sp"
tools:text="961544809" />
<!-- <TextView-->
<!-- android:id="@+id/tv_active_deals_date_text"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- tools:text="@string/cos_active_coupon_date"-->
<!-- android:textColor="@color/blue_dark" />-->
<TextView
android:id="@+id/tv_active_deals_date_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/blue_dark"
android:visibility="gone"
tools:text="@string/cos_active_coupon_date" />
</LinearLayout>
<ImageView
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rl_map_pin_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_map_pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:background="@drawable/shape_cos_white_rounded_top"
android:paddingHorizontal="24dp"
android:paddingTop="16dp">
<TextView
android:id="@+id/tv_pin_title"
fontPath="fonts/pf_square_sans_pro_bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:textColor="@color/cos_grey9"
android:textSize="16sp"
tools:text="ΓΕΡΜΑΝΟΣ" />
<ImageView
android:id="@+id/iv_map_pin_close"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_alignParentEnd="true"
android:src="@drawable/ic_close" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingHorizontal="24dp">
<ImageView
android:id="@+id/iv_pin_logo"
android:layout_width="36dp"
android:layout_height="36dp"
tools:src="@drawable/ic_deals_circle" />
<LinearLayout
android:id="@+id/ll_pin_title_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_toEndOf="@+id/iv_pin_logo"
android:orientation="vertical">
<TextView
android:id="@+id/tv_pin_name"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/grey"
android:textSize="14sp"
tools:text="Γερμανός Χαλανδρίου" />
<TextView
android:id="@+id/tv_pin_days"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_grey8"
android:textSize="14sp"
tools:text="Δευτέρα-Τετάρτη" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginHorizontal="12dp"
android:layout_marginVertical="12dp"
android:background="@drawable/divider2" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="36dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="24dp">
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:src="@drawable/ic_pin_tel" />
<TextView
android:id="@+id/tv_pin_tel"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:textColor="@color/grey"
android:textSize="14sp"
tools:text="210-6230543" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginHorizontal="12dp"
android:layout_marginVertical="12dp"
android:background="@drawable/divider2" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:paddingHorizontal="24dp">
<LinearLayout
android:id="@+id/ll_pin_address"
android:layout_width="match_parent"
android:layout_height="36dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:src="@drawable/ic_pin_location" />
<TextView
android:id="@+id/tv_pin_address"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="184dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:maxLines="2"
android:textColor="@color/grey"
android:textSize="14sp"
tools:text="ΕΘΝΙΚΗΣ ΑΝΤΙΣΤΑΣΕΩΣ 4 41" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_directions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@drawable/selector_button_green"
android:gravity="center"
android:orientation="horizontal"
android:paddingHorizontal="20dp"
android:paddingVertical="8dp">
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:src="@drawable/ic_pin_compass" />
<TextView
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:gravity="center"
android:text="@string/cos_directions"
android:textColor="@color/white"
android:textSize="14dp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
......@@ -7,52 +7,71 @@
<TextView
android:id="@+id/tv_expired_coupons_date"
fontPath="fonts/pf_square_sans_pro_bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_blue_dark2"
android:textSize="13sp"
fontPath="fonts/pf_square_sans_pro_bold.ttf"
tools:text="05/05/2022" />
<LinearLayout
android:id="@+id/ll_expired_info_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_expired_coupons_date"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:weightSum="1">
android:orientation="horizontal">
<TextView
android:id="@+id/tv_expired_coupons_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:maxLines="2"
android:textColor="@color/cos_blue_dark2"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:textSize="16sp"
tools:text="Box" />
<TextView
android:id="@+id/tv_expired_coupons_value"
android:layout_width="wrap_content"
<ImageView
android:id="@+id/iv_expired_logo"
android:layout_width="28dp"
android:layout_height="28dp"
tools:src="@drawable/ic_deals_circle" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="end"
android:textColor="@color/cos_blue_dark2"
android:textSize="16sp"
fontPath="fonts/pf_square_sans_pro_bold.ttf"
tools:text="4$" />
</LinearLayout>
android:layout_marginStart="6dp"
android:orientation="vertical">
<TextView
android:id="@+id/tv_expired_coupons_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_expired_info_view"
android:text="@string/cos_expired_coupon_label"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:textColor="@color/cos_light_grey2"
android:textSize="16sp" />
<LinearLayout
android:id="@+id/ll_expired_info_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:id="@+id/tv_expired_coupons_title"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:maxLines="2"
android:textColor="@color/cos_blue_dark2"
android:textSize="16sp"
tools:text="Box" />
<TextView
android:id="@+id/tv_expired_coupons_value"
fontPath="fonts/pf_square_sans_pro_bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="end"
android:textColor="@color/cos_blue_dark2"
android:textSize="16sp"
tools:text="4$" />
</LinearLayout>
<TextView
android:id="@+id/tv_expired_coupons_label"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_expired_info_view"
android:text="@string/cos_expired_coupon_label"
android:textColor="@color/cos_light_grey2"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
......
......@@ -7,62 +7,79 @@
<TextView
android:id="@+id/tv_shared_coupons_date"
fontPath="fonts/pf_square_sans_pro_bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_blue_dark2"
android:textSize="13sp"
fontPath="fonts/pf_square_sans_pro_bold.ttf"
tools:text="05/05/2022" />
<LinearLayout
android:id="@+id/ll_expired_info_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_shared_coupons_date"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:weightSum="1">
android:orientation="horizontal">
<TextView
android:id="@+id/tv_shared_coupons_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:maxLines="2"
android:textColor="@color/cos_blue_dark2"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:textSize="16sp"
tools:text="Box" />
<ImageView
android:id="@+id/iv_shared_logo"
android:layout_width="28dp"
android:layout_height="28dp"
tools:src="@drawable/ic_deals_circle" />
<TextView
android:id="@+id/tv_shared_coupons_value"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="end"
android:textColor="@color/cos_blue_dark2"
android:textSize="16sp"
fontPath="fonts/pf_square_sans_pro_bold.ttf"
tools:text="4$" />
</LinearLayout>
android:layout_marginStart="6dp"
android:orientation="vertical">
<TextView
android:id="@+id/tv_shared_coupons_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_expired_info_view"
android:textColor="@color/cos_light_grey2"
android:textSize="16sp"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
tools:text="@string/cos_expired_coupon_label" />
<LinearLayout
android:id="@+id/ll_expired_info_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:id="@+id/tv_shared_coupons_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:layout_below="@+id/tv_shared_coupons_label"
android:textColor="@color/cos_light_grey2"
android:textSize="16sp"
tools:text="@string/cos_expired_coupon_label" />
<TextView
android:id="@+id/tv_shared_coupons_title"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:maxLines="2"
android:textColor="@color/cos_blue_dark2"
android:textSize="16sp"
tools:text="Box" />
<TextView
android:id="@+id/tv_shared_coupons_value"
fontPath="fonts/pf_square_sans_pro_bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="end"
android:textColor="@color/cos_blue_dark2"
android:textSize="16sp"
tools:text="4$" />
</LinearLayout>
<TextView
android:id="@+id/tv_shared_coupons_label"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_light_grey2"
android:textSize="16sp"
tools:text="@string/cos_expired_coupon_label" />
<TextView
android:id="@+id/tv_shared_coupons_phone"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_light_grey2"
android:textSize="16sp"
tools:text="@string/cos_expired_coupon_label" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
......
......@@ -60,4 +60,5 @@
<color name="cos_blue4">#07A2D1</color>
<color name="cos_green10">#73CA34</color>
<color name="cos_blue5">#0D81B8</color>
<color name="cos_grey9">#757575</color>
</resources>
\ No newline at end of file
......
......@@ -114,7 +114,7 @@
<string name="cos_shared_coupon_receiver">Εκπτωτικό κουπόνι προς</string>
<string name="cos_shared_coupon_sender">Έκπτωτικό κουπόνι από</string>
<string name="cos_steps_for_good_notification_title">Steps for Good</string>
<string name="cos_empty_wallet">Δεν έχεις κάποιον ενεργό κωδικό ή κουπόνι! Μπες τώρα στην ενότητα COSMOTE For YOU και βρες αποκλειστικές προσφορές!</string>
<string name="cos_empty_wallet">Δεν έχεις κάποιον ενεργό κωδικό ή κουπόνι! Μπες τώρα στην ενότητα COSMOTE For You και βρες αποκλειστικές προσφορές!</string>
<string name="cos_wallet_text1">Μέχρι τώρα έχεις κερδίσει&#160;</string>
<string name="cos_wallet_text2">&#160;με το DEALS for YOU!</string>
<string name="cos_wallet_text3">Μέχρι τώρα έχεις κερδίσει&#160;</string>
......@@ -128,6 +128,9 @@
<string name="cos_dlg_error_used">Το δώρο έχει ήδη χρησιμοποιηθεί</string>
<string name="cos_see_more2">Δες Περισσότερα</string>
<string name="cos_dlg_non_telco">Παρακαλούμε πολύ πρόσθεσε τις συνδέσεις σου στην COSMOTE για να έχεις πρόσβαση στα προνόμια του νέου Loyalty προγράμματος της COSMOTE!</string>
<string name="cos_directions">Οδηγίες</string>
<string name="cos_empty_shared_coupons">Δεν έχεις μοιραστεί ακόμη κουπόνια</string>
<string name="cos_empty_expired_coupons">Δεν έχεις εξαργυρώσει ακόμη κουπόνια</string>
<string-array name="coupons_array">
<item>Κουπόνια</item>
......