Panagiotis Triantafyllou

unified screen basket part4

......@@ -49,15 +49,18 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
// Fields
// ===========================================================
private ImageView mIvBack, mIvCouponPhoto, mIvBarcode;
private ImageView mIvBack, mIvCouponPhoto, mIvBarcode, mIvActiveBarcode;
private TextView mTvTerms, mTvCouponCode, mTvCouponTitle, mTvCouponSubtitle, mTvCouponDate,
mTvTermsValue, mTvFullBarcode, mTvDescription, mTvCouponCodeTitle, mFontHeader,
mFontButtonGiftIt, mFontButtonShops, mFontButtonSite;
private LinearLayout mLlGiftIt, mLlShops, mLlBarcodeShown, mLlBarcodeContainer, mLlTerms, mLlWebsite;
mFontButtonGiftIt, mFontButtonShops, mFontButtonSite, mTvActiveSmCouponValue,
mTvActiveSmExpirationValue, mTvBarcodeTitle, mFontButtonActiveGiftIt, mTvFindIt;
private LinearLayout mLlGiftIt, mLlShops, mLlBarcodeShown, mLlBarcodeContainer, mLlTerms,
mLlWebsite, mLlActiveSmCouponValue, mLlBarcodeActiveContainer, mLlActiveGiftIt,
mLlSMFindIt;
private Coupon mCoupon;
private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false,
mShopsPressed = false, mGiftPressed = false, mEshopPressed = false, mIsUnified = false,
mIsActiveUnified = false;
mIsActiveUnified = false, mIsFindItPressed = false;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -107,6 +110,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mIvBack = findViewById(R.id.iv_coupon_info_back);
mTvTerms = findViewById(R.id.tv_terms);
mLlGiftIt = findViewById(R.id.ll_gift_it);
mLlActiveGiftIt = findViewById(R.id.ll_active_shops);
mTvCouponCode = findViewById(R.id.textView16);
mTvCouponTitle = findViewById(R.id.textView13);
mTvCouponSubtitle = findViewById(R.id.textView14);
......@@ -124,14 +128,25 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mTvCouponCodeTitle = findViewById(R.id.textView15);
mFontHeader = findViewById(R.id.textView3);
mFontButtonGiftIt = findViewById(R.id.button_gift_it);
mFontButtonActiveGiftIt = findViewById(R.id.button_active_shops);
mFontButtonShops = findViewById(R.id.button_shops);
mFontButtonSite = findViewById(R.id.button_site);
WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, mFontHeader, mTvCouponTitle);
mLlActiveSmCouponValue = findViewById(R.id.ll_active_sm_coupon_value);
mTvActiveSmCouponValue = mLlActiveSmCouponValue.findViewById(R.id.tv_active_sm_coupon_value);
mTvActiveSmExpirationValue = findViewById(R.id.tv_active_sm_coupon_expiration_value);
mLlBarcodeActiveContainer = findViewById(R.id.ll_barcode_active_container);
mIvActiveBarcode = findViewById(R.id.iv_barcode_active);
mTvBarcodeTitle = findViewById(R.id.tv_barcode_title);
mLlSMFindIt = findViewById(R.id.ll_find_shops);
mTvFindIt = mLlSMFindIt.findViewById(R.id.button_find_shops);
WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, mFontHeader,
mTvCouponTitle, mTvActiveSmCouponValue);
WarpUtils.renderCustomFont(this, R.font.peridot_regular, mTvCouponSubtitle, mTvDescription,
mTvFullBarcode, mTvCouponDate, mTvTermsValue);
WarpUtils.renderCustomFont(this, R.font.peridot_bold, mTvCouponCodeTitle, mTvCouponCode,
mFontButtonShops, mFontButtonSite, mTvTerms);
WarpUtils.renderCustomFont(this, R.font.peridot_semi_bold, mFontButtonGiftIt);
mFontButtonShops, mFontButtonSite, mTvTerms, mTvActiveSmExpirationValue,
mTvBarcodeTitle, mFontButtonActiveGiftIt);
WarpUtils.renderCustomFont(this, R.font.peridot_semi_bold, mFontButtonGiftIt, mTvFindIt);
initViews();
}
......@@ -143,6 +158,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mShopsPressed = false;
mGiftPressed = false;
mEshopPressed = false;
mIsFindItPressed = false;
}
@Override
......@@ -166,7 +182,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
onBackPressed();
return;
}
if (view.getId() == R.id.ll_gift_it) {
if (view.getId() == R.id.ll_gift_it || view.getId() == R.id.ll_active_shops) {
if (!mGiftPressed) {
mGiftPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("ShareCoupon")
......@@ -176,6 +192,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
Intent intent = new Intent(CouponInfoActivity.this, CouponShareActivity.class);
intent.putExtra("coupon", mCoupon != null ? mCoupon.getCoupon() : "");
intent.putExtra("isFromWallet", mIsFromWallet);
intent.putExtra("isActiveUnified", mIsActiveUnified);
if (!mIsFromWallet)
startActivity(intent);
else
......@@ -246,6 +263,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
termsButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_up_dark_new));
mIsTermsShown = true;
}
return;
}
if (view.getId() == R.id.ll_find_shops) {
if (!mIsFindItPressed) {
mIsFindItPressed = true;
}
}
}
......@@ -286,6 +309,27 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
}
mTvTermsValue.setText(HtmlCompat.fromHtml(mCoupon.getCouponsetDetails().getTerms(), HtmlCompat.FROM_HTML_MODE_COMPACT));
mTvTermsValue.setMovementMethod(LinkMovementMethod.getInstance());
if (mIsActiveUnified) {
if (TextUtils.isEmpty(mCoupon.getDiscount_type())) {
mTvActiveSmCouponValue.setText("-" + mCoupon.getDiscount().replace(".", ",") + getString(R.string.euro));
} else {
if (mCoupon.getDiscount_type().equals("value")) {
mTvActiveSmCouponValue.setText("-" + mCoupon.getDiscount().replace(".", ",") + getString(R.string.euro));
} else if (mCoupon.getDiscount_type().equals("percentage")) {
mTvActiveSmCouponValue.setText("-" + mCoupon.getDiscount() + getString(R.string.percentage));
} else if (mCoupon.getDiscount_type().equals("plus_one")) {
mTvActiveSmCouponValue.setText(mCoupon.getDiscount() + getString(R.string.plus_one));
} else {
mTvActiveSmCouponValue.setText("-" + mCoupon.getDiscount().replace(".", ",") + getString(R.string.euro));
}
}
mLlActiveSmCouponValue.setVisibility(View.VISIBLE);
mLlGiftIt.setVisibility(View.GONE);
mLlActiveGiftIt.setVisibility(View.VISIBLE);
mLlShops.setVisibility(View.GONE);
mLlSMFindIt.setVisibility(View.VISIBLE);
}
} else {
if (mCoupon.getMerchantDetails() != null) {
if (mCoupon.getMerchantDetails() != null && !TextUtils.isEmpty(mCoupon.getMerchantDetails().getBody()) && !mCoupon.getMerchantDetails().getBody().equals("null")) {
......@@ -311,8 +355,15 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
e.printStackTrace();
}
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
if (mIsActiveUnified) {
mTvCouponDate.setVisibility(View.GONE);
mTvActiveSmExpirationValue.setText(String.format(getResources().getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
mTvActiveSmExpirationValue.setVisibility(View.VISIBLE);
} else {
mTvCouponDate.setText(String.format(getResources().getString(R.string.cos_mycoupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
}
}
if (mIsUnified) {
mIvCouponPhoto.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
......@@ -368,6 +419,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mLlWebsite.setOnClickListener(this);
mLlBarcodeShown.setOnClickListener(this);
mLlTerms.setOnClickListener(this);
mLlActiveGiftIt.setOnClickListener(this);
mLlSMFindIt.setOnClickListener(this);
String tempCoupon = "";
int result = 0;
......@@ -407,11 +460,16 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mIvBarcode.setImageBitmap(bmp);
mTvFullBarcode.setText(barcodeString);
if (mIsActiveUnified) {
mLlBarcodeActiveContainer.setVisibility(View.VISIBLE);
mIvActiveBarcode.setImageBitmap(bmp);
}
} catch (Exception e) {
e.printStackTrace();
mLlBarcodeShown.setVisibility(View.GONE);
mLlBarcodeContainer.setVisibility(View.GONE);
mIvBarcode.setVisibility(View.GONE);
mLlBarcodeActiveContainer.setVisibility(View.GONE);
}
}
......
......@@ -65,7 +65,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
private EditText mEdtReceiver;
private AlertDialog mAlertDialogSuccessSharing, mAlertDialogErrorSharing,
mAlertDialogCouponAskSharing, mAlertDialogWrongNumberSharing, mAlertDialogNoAssets;
private boolean mIsFromWallet = false;
private boolean mIsFromWallet = false, mIsActiveUnified = false;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -78,13 +78,23 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
String couponCode = getIntent().getStringExtra("coupon");
mIsFromWallet = getIntent().getBooleanExtra("isFromWallet", false);
mIsActiveUnified = getIntent().getBooleanExtra("isActiveUnified", false);
if (mIsActiveUnified) {
for (Coupon cpn : WarplyManagerHelper.getSmCouponsList()) {
if (cpn.getCoupon().equals(couponCode)) {
mCoupon = cpn;
break;
}
}
} else {
for (Coupon cpn : WarplyManagerHelper.getCouponList()) {
if (cpn.getCoupon().equals(couponCode)) {
mCoupon = cpn;
break;
}
}
}
mIvBack = findViewById(R.id.iv_coupon_share_back);
mTvCouponTitle = findViewById(R.id.textView13);
......
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="13dp" />
<solid android:color="@color/cos_skyblue4" />
</shape>
\ No newline at end of file
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:topLeftRadius="16dp" android:bottomRightRadius="16dp" />
<solid android:color="@color/cos_skyblue4" />
</shape>
\ No newline at end of file
......@@ -54,6 +54,10 @@
android:orientation="vertical"
android:paddingBottom="48dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView6"
android:layout_width="match_parent"
......@@ -61,6 +65,30 @@
android:scaleType="centerCrop"
tools:src="@drawable/carousel_banner" />
<LinearLayout
android:id="@+id/ll_active_sm_coupon_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:background="@drawable/shape_top_left_bottom_right_rounded_blue"
android:orientation="vertical"
android:paddingHorizontal="8dp"
android:paddingVertical="26dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/tv_active_sm_coupon_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_terms_inner"
android:textColor="@color/cos_blue6"
android:textSize="28sp"
tools:text="@string/temp_value" />
</LinearLayout>
</RelativeLayout>
<TextView
android:id="@+id/textView13"
android:layout_width="match_parent"
......@@ -73,6 +101,22 @@
tools:text="Πάρε δωρεάν μηνιαία πακέτα με πάνες στα supermarket Σκλαβενίτης!" />
<TextView
android:id="@+id/tv_active_sm_coupon_expiration_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:background="@drawable/shape_rounded_blue"
android:includeFontPadding="false"
android:paddingHorizontal="14dp"
android:paddingVertical="3dp"
android:textColor="@color/cos_blue6"
android:textSize="14sp"
android:visibility="gone"
tools:text="@string/cos_coupon_date"
tools:visibility="visible" />
<TextView
android:id="@+id/textView14"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -197,6 +241,58 @@
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_barcode_active_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:id="@+id/ll_barcode_active_container_items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/tv_barcode_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/cos_barcode_coupon_title"
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
<View
android:id="@+id/view_active_5"
android:layout_width="match_parent"
android:layout_height="0.8dp"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="16dp"
android:background="#E6E6E6" />
<ImageView
android:id="@+id/iv_barcode_active"
android:layout_width="match_parent"
android:layout_height="86dp"
android:layout_marginHorizontal="48dp"
android:layout_marginTop="16dp"
android:scaleType="fitXY"
tools:srcCompat="@tools:sample/avatars" />
<View
android:id="@+id/view_active_4"
android:layout_width="match_parent"
android:layout_height="0.8dp"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="16dp"
android:background="#E6E6E6" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/textView17"
android:layout_width="wrap_content"
......@@ -209,8 +305,8 @@
<LinearLayout
android:id="@+id/ll_gift_it"
android:layout_width="140dp"
android:layout_height="45dp"
android:layout_width="260dp"
android:layout_height="55dp"
android:layout_gravity="center"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="32dp"
......@@ -231,8 +327,58 @@
</LinearLayout>
<LinearLayout
android:id="@+id/ll_find_shops"
android:layout_width="260dp"
android:layout_height="55dp"
android:layout_gravity="center"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="32dp"
android:background="@drawable/selector_button_green"
android:gravity="center"
android:orientation="horizontal"
android:paddingVertical="8dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/button_find_shops"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:includeFontPadding="false"
android:text="@string/cos_sm_find_it"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_active_shops"
android:layout_width="260dp"
android:layout_height="55dp"
android:layout_gravity="center"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="12dp"
android:background="@drawable/selector_button_green_border"
android:gravity="center"
android:orientation="horizontal"
android:paddingVertical="8dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/button_active_shops"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:includeFontPadding="false"
android:text="@string/cos_gift_it"
android:textColor="@color/cos_green12"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_shops"
android:layout_width="220dp"
android:layout_width="260dp"
android:layout_height="55dp"
android:layout_gravity="center"
android:layout_marginHorizontal="32dp"
......@@ -257,7 +403,7 @@
<LinearLayout
android:id="@+id/ll_website"
android:layout_width="220dp"
android:layout_width="260dp"
android:layout_height="55dp"
android:layout_gravity="center"
android:layout_marginHorizontal="32dp"
......
......@@ -168,7 +168,7 @@
<LinearLayout
android:id="@+id/ll_share_button"
android:layout_width="190dp"
android:layout_width="260dp"
android:layout_height="55dp"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="64dp"
......
......@@ -35,6 +35,7 @@
<string name="cos_coupons_loyalty_title">Ενεργά κουπόνια</string>
<string name="cos_coupon_info_title">Εκπτωτικό κουπόνι</string>
<string name="cos_coupon_date">Ισχύει έως %1$s</string>
<string name="temp_value">-0,30$</string>
<string name="cos_dl_title">Μόλις έλαβες δώρο %1$s συμμετοχές στο My Lucky Day Draw!</string>
<string name="cos_active_coupons">Έχεις %1$s ενεργά\nκουπόνια</string>
<string name="cos_active_coupon_date">Λήγει σε %1$s ημέρες</string>
......@@ -59,6 +60,7 @@
<string name="cos_loyalty_rewards">My rewards</string>
<string name="cos_loyalty_old_rewards">Παλαιότερα δώρα</string>
<string name="cos_see_all">Δες τα όλα -></string>
<string name="cos_barcode_coupon_title">barcode κουπονιού</string>
<string name="cos_active_rewards">Έχεις %1$s ενεργά δώρα</string>
<string name="cos_analysis">Ανάλυση</string>
<string name="cos_active_deals">%1$s Ενεργός κωδικός:</string>
......@@ -85,6 +87,7 @@
<string name="cos_popup_gifts_subtitle">Σε αυτή την ενότητα βρίσκεις τα διαθέσιμα δώρα και επιβραβεύσεις αποκλειστικά για σένα!</string>
<string name="cos_mycoupon_date">Το κουπόνι ισχύει έως %1$s</string>
<string name="cos_gift_it">Δώρισέ το</string>
<string name="cos_sm_find_it">Βρες το στα supermarket</string>
<string name="cos_activate_unified">Συνδύασε τις προσφορές σε ένα κουπόνι</string>
<string name="cos_popup_more_title">COSMOTE MORE FOR YOU</string>
<string name="cos_popup_more_subtitle">Σε αυτή την ενότητα βρες έρευνες, παιχνίδια, διαγωνισμούς και επιβραβεύσεις για τις αθλητικές σου δραστηριότητες!</string>
......