Panagiotis Triantafyllou

new keys

......@@ -518,6 +518,10 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
}
mValuesList.addAll(gfyList);
// HashSet hs = new HashSet();
// hs.addAll(mValuesList);
// mValuesList.clear();
// mValuesList.addAll(hs);
}
}
......
......@@ -12,6 +12,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
......@@ -21,8 +22,8 @@ import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.google.android.flexbox.FlexboxLayout;
import org.apmem.tools.layouts.FlowLayout;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
......@@ -67,11 +68,12 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
private ConstraintLayout mClDealsBanner, mClDealsView,
mClGiftsBanner;
private LinearLayout mLlQuestionnaire, mLlUserBadge, mLlEmptyWallet;
FlexboxLayout mLlActiveCodesView;
FlowLayout mLlActiveCodesView;
private float couponDfyValue = 0.0f;
private RecyclerView mRecyclerCoupons;
private ActiveCouponAdapter mAdapterCoupons;
private AlertDialog mAlertDialogNonTelco;
private ScrollView mScActiveCodes;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -102,6 +104,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
mTvActiveCouponsHeader = findViewById(R.id.tv_active_coupons_header);
mLlEmptyWallet = findViewById(R.id.ll_empty_wallet);
mLlActiveCodesView = findViewById(R.id.ll_active_deals_codes_view);
mScActiveCodes = findViewById(R.id.sv_active_deals_codes_view);
// ArrayList<ActiveDFYCouponModel> dlist = new ArrayList<>();
// ActiveDFYCouponModel model = new ActiveDFYCouponModel();
......@@ -402,13 +405,13 @@ 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.setVisibility(View.GONE);
//TODO fix logic
for (ActiveDFYCouponModel dealsItem : WarplyManagerHelper.getActiveDFYCoupons().subList(0, 4)) {
// Collections.reverse(WarplyManagerHelper.getActiveDFYCoupons());
for (int i = 0; i < WarplyManagerHelper.getActiveDFYCoupons().size(); i++) {
LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_selectable, null);
TextView textView = (TextView) v.findViewById(R.id.tv_code_copy);
TextView textViewComma = (TextView) v.findViewById(R.id.tv_code_comma);
textView.setText(dealsItem.getCode());
textView.setText(WarplyManagerHelper.getActiveDFYCoupons().get(i).getCode());
textView.setTextIsSelectable(true);
textViewComma.setText(getString(R.string.cos_comma));
mLlActiveCodesView.addView(v, 0, new ViewGroup.LayoutParams(
......@@ -416,6 +419,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
ViewGroup.LayoutParams.WRAP_CONTENT));
}
mScActiveCodes.setVisibility(View.VISIBLE);
mLlActiveCodesView.setVisibility(View.VISIBLE);
}
// mTvActiveCode.setText(codes);
......
......@@ -42,6 +42,7 @@ import org.json.JSONObject;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import ly.warp.sdk.R;
import ly.warp.sdk.Warply;
......@@ -214,6 +215,9 @@ public class WarplyManagerHelper {
} else if (status == 5) {
String modalText5 = result.optString("msg", "");
errorUsedDialog(context, modalText5);
} else if (status == 7) {
String modalText7 = result.optString("msg", "");
returnDialog(context, modalText7, sharingId);
} else
errorSharingDialog(context);
}
......@@ -357,6 +361,52 @@ public class WarplyManagerHelper {
}
/**
* Return dialog
*/
private static void returnDialog(Context context, String message, String sharingId) {
mAlertDialogErrorSharing = new AlertDialog.Builder(context)
.setTitle(R.string.cos_dlg_return_title)
.setMessage(message)
.setNegativeButton(R.string.cos_dlg_negative_button, (dialogPositive, whichPositive) -> {
rejectSharingDialog(context, sharingId);
})
.setPositiveButton(R.string.cos_dlg_positive_button, (dialogNegative, whichNegative) -> {
WarplyManager.cosmoteRetrieveSharing(new CosmoteRetrieveSharingRequest()
.setSharingId(sharingId)
.setAccept(true),
new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1) {
WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), new CallbackReceiver<CouponList>() {
@Override
public void onSuccess(CouponList result) {
WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel();
couponsChanged.setChanged(true);
EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged));
}
@Override
public void onFailure(int errorCode) {
}
});
acceptSharingDialog(context);
} else
errorSharingDialog(context);
}
@Override
public void onFailure(int errorCode) {
errorSharingDialog(context);
}
});
})
.show();
}
/**
* Expired dialog
*/
private static void errorExpiredDialog(Context context, String message) {
......@@ -1005,6 +1055,10 @@ public class WarplyManagerHelper {
public static void setCarouselList(CampaignList carouselList) {
mCarouselList.clear();
mCarouselList = carouselList;
HashSet hs = new HashSet();
hs.addAll(mCarouselList);
mCarouselList.clear();
mCarouselList.addAll(hs);
}
public static CampaignList getCarouselList() {
......
......@@ -1369,7 +1369,7 @@ public class WarplyManager {
public void onSuccess(CampaignList result) {
// receiver.onSuccess(result);
mNewCampaignList.clear();
mNewCampaignList = result;
mNewCampaignList.addAll(result);
getCampaignsPersonalized(request, new CallbackReceiver<CampaignList>() {
@Override
public void onSuccess(CampaignList resultPersonalized) {
......
......@@ -335,23 +335,21 @@
tools:text="961544809"
tools:visibility="gone" />
<com.google.android.flexbox.FlexboxLayout
<ScrollView
android:id="@+id/sv_active_deals_codes_view"
android:layout_width="match_parent"
android:layout_height="48dp"
android:nestedScrollingEnabled="true"
android:visibility="gone">
<org.apmem.tools.layouts.FlowLayout
android:id="@+id/ll_active_deals_codes_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:flexDirection="row"
app:flexWrap="wrap"
app:justifyContent="flex_start">
</com.google.android.flexbox.FlexboxLayout>
<!-- <org.apmem.tools.layouts.FlowLayout-->
<!-- android:id="@+id/ll_active_deals_codes_view"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content">-->
android:visibility="gone">
<!-- </org.apmem.tools.layouts.FlowLayout>-->
</org.apmem.tools.layouts.FlowLayout>
</ScrollView>
<TextView
android:id="@+id/tv_active_deals_date_text"
......
......@@ -39,6 +39,7 @@
<string name="cos_redeem_coupon">Απόκτησέ το</string>
<string name="cos_dlg_success_subtitle">Το κουπόνι εξαργυρώθηκε με επιτυχία</string>
<string name="cos_dlg_error_title">Αποτυχία</string>
<string name="cos_dlg_return_title">Επιστροφή δώρου</string>
<string name="cos_dlg_error_subtitle">Κάτι πήγε στραβά</string>
<string name="cos_dlg_error_subtitle_non_buyable">Το κουπόνι δεν είναι διαθέσιμο για αγορά</string>
<string name="cos_dlg_error_subtitle_no_points">Δεν έχεις αρκετούς πόντους</string>
......