Panagiotis Triantafyllou

fixed coupons

......@@ -5,7 +5,15 @@ import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.json.JSONException;
import ly.warp.sdk.R;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.views.adapters.HomeCouponAdapter;
public class LoyaltyActivity extends Activity implements View.OnClickListener {
......@@ -19,6 +27,8 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
// ===========================================================
private ImageView mIvBack;
private RecyclerView mRecyclerCoupons;
private HomeCouponAdapter mAdapterCoupons;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -31,6 +41,28 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
mIvBack = findViewById(R.id.iv_back);
/********* TEST COUPONS DATA **********/
CouponList clist = new CouponList();
try {
clist.add(new Coupon("{\"barcode\": \"a724e911a71a42408b6ba50ae6c08dbb\", \"coupon\": \"123456789\", \"name\": \"\\u039a\\u03ac\\u03bd\\u03b5 strike\", \"description\": \"\\u03ba\\u03b1\\u03b9 \\u03ba\\u03ad\\u03c1\\u03b4\\u03b9\\u03c3\\u03b5!\", \"image\": \"https://warply.s3.amazonaws.com/artworks/034fba10ceac4e0f9338bd8e60086292/index.html\"}"));
clist.add(new Coupon("{\"barcode\": \"a724e911a71a42408b6ba50ae6c08dbb\", \"coupon\": \"12345678910\", \"name\": \"\\u039a\\u03ac\\u03bd\\u03b5 strike\", \"description\": \"\\u03ba\\u03b1\\u03b9 \\u03ba\\u03ad\\u03c1\\u03b4\\u03b9\\u03c3\\u03b5!\", \"image\": \"https://warply.s3.amazonaws.com/artworks/034fba10ceac4e0f9338bd8e60086292/index.html\"}"));
} catch (JSONException e) {
e.printStackTrace();
}
/********* TEST COUPONS DATA **********/
mRecyclerCoupons = findViewById(R.id.rv_loyalty_coupons);
mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
mAdapterCoupons = new HomeCouponAdapter(this, clist);
mRecyclerCoupons.setAdapter(mAdapterCoupons);
mAdapterCoupons.getPositionClicks()
.doOnNext(coupon -> {
// startActivity(WarpViewActivity.createIntentFromSessionUUID(this, coupon.getCoupon()));
})
.doOnError(error -> {
})
.subscribe();
initViews();
}
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="@color/cos_green2"
android:centerColor="@color/green_dark"
android:endColor="@color/cos_blue2"
android:type="linear"/>
<corners
android:radius="1000dp"/>
</shape>
\ No newline at end of file
......@@ -55,6 +55,7 @@
android:id="@+id/rl_gifts_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:background="@color/cos_cyan"
app:layout_constraintTop_toBottomOf="@+id/cl_loyalty_info_banner">
......@@ -62,98 +63,132 @@
android:id="@+id/tv_gifts_loyalty_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_gifts_loyalty_title"
android:layout_marginStart="10dp"
android:text="@string/cos_coupons_loyalty_title"
android:textColor="@color/grey"
android:textSize="18sp"
android:textStyle="bold" />
<HorizontalScrollView
android:id="@+id/ll_add"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tv_gifts_loyalty_title"
android:background="@android:color/white"
android:scrollbars="none">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="400dp"
android:layout_height="200dp"
android:layout_marginStart="10dp">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_horizontal_80_guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.8" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_horizontal_55_guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.55" />
<ImageView
android:id="@+id/iv_gift_item_logo"
android:layout_width="match_parent"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:src="@drawable/ic_banner_gift"
app:layout_constraintBottom_toTopOf="@+id/gl_horizontal_80_guideline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<RelativeLayout
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/cos_cyan"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_55_guideline">
<LinearLayout
android:id="@+id/ll_loyalty_item1"
android:id="@+id/rl_home_coupons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white_tr3"
android:paddingVertical="4dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Αποκλειστικά για σένα"
android:textColor="@color/grey"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/ll_loyalty_item1"
android:background="@android:color/white"
android:orientation="vertical">
android:layout_below="@id/tv_gifts_loyalty_title">
<TextView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_loyalty_coupons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:text="2 ώρες δωρεάν απεριόριστα data όποτε θέλεις εσύ, κάθε μήνα!" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_cos_gradient2"
android:text="Πάρε το δώρο σου"
android:textColor="@android:color/white"
android:textFontWeight="600" />
android:layout_marginBottom="8dp"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingEnd="10dp" />
</LinearLayout>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</HorizontalScrollView>
</RelativeLayout>
<!-- <RelativeLayout-->
<!-- android:id="@+id/rl_gifts_row"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:background="@color/cos_cyan"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/cl_loyalty_info_banner">-->
<!-- <TextView-->
<!-- android:id="@+id/tv_gifts_loyalty_title"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="@string/cos_gifts_loyalty_title"-->
<!-- android:textColor="@color/grey"-->
<!-- android:textSize="18sp"-->
<!-- android:textStyle="bold" />-->
<!-- <HorizontalScrollView-->
<!-- android:id="@+id/ll_add"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_below="@id/tv_gifts_loyalty_title"-->
<!-- android:background="@android:color/white"-->
<!-- android:scrollbars="none">-->
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
<!-- android:layout_width="400dp"-->
<!-- android:layout_height="200dp"-->
<!-- android:layout_marginStart="10dp">-->
<!-- <androidx.constraintlayout.widget.Guideline-->
<!-- android:id="@+id/gl_horizontal_80_guideline"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal"-->
<!-- app:layout_constraintGuide_percent="0.8" />-->
<!-- <androidx.constraintlayout.widget.Guideline-->
<!-- android:id="@+id/gl_horizontal_55_guideline"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal"-->
<!-- app:layout_constraintGuide_percent="0.55" />-->
<!-- <ImageView-->
<!-- android:id="@+id/iv_gift_item_logo"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="0dp"-->
<!-- android:scaleType="centerCrop"-->
<!-- android:src="@drawable/ic_banner_gift"-->
<!-- app:layout_constraintBottom_toTopOf="@+id/gl_horizontal_80_guideline"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent" />-->
<!-- <RelativeLayout-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="0dp"-->
<!-- android:background="@color/cos_cyan"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_55_guideline">-->
<!-- <LinearLayout-->
<!-- android:id="@+id/ll_loyalty_item1"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:background="@color/white_tr3"-->
<!-- android:paddingVertical="4dp">-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="Αποκλειστικά για σένα"-->
<!-- android:textColor="@color/grey"-->
<!-- android:textStyle="bold" />-->
<!-- </LinearLayout>-->
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_below="@+id/ll_loyalty_item1"-->
<!-- android:background="@android:color/white"-->
<!-- android:orientation="vertical">-->
<!-- <TextView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:maxLines="2"-->
<!-- android:text="2 ώρες δωρεάν απεριόριστα data όποτε θέλεις εσύ, κάθε μήνα!" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:background="@drawable/shape_cos_gradient2"-->
<!-- android:text="Πάρε το δώρο σου"-->
<!-- android:textColor="@android:color/white"-->
<!-- android:textFontWeight="600" />-->
<!-- </LinearLayout>-->
<!-- </RelativeLayout>-->
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
<!-- </HorizontalScrollView>-->
<!-- </RelativeLayout>-->
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</RelativeLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="250dp">
android:layout_width="360dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/horizontal_guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.18" />
app:layout_constraintGuide_percent="0.12" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/horizontal_guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.75" />
app:layout_constraintGuide_percent="0.88" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/vertical_guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.85" />
app:layout_constraintGuide_percent="0.94" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/vertical_guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.14" />
app:layout_constraintGuide_percent="0.06" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="403dp"
android:layout_height="238dp"
android:scaleType="fitXY"
android:src="@drawable/coupon_wrapper"
android:layout_width="match_parent"
android:layout_height="250dp"
android:src="@drawable/coupon_wrapper2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="300dp"
android:layout_height="150dp"
android:paddingHorizontal="5dp"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/horizontal_guideline2"
app:layout_constraintEnd_toStartOf="@+id/vertical_guideline"
app:layout_constraintStart_toStartOf="@+id/vertical_guideline2"
......@@ -55,50 +53,56 @@
<TextView
android:id="@+id/tv_coupon_title"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:maxLines="1"
android:text="Αποκλειστικά για σένα"
app:layout_constraintBottom_toTopOf="@+id/tv_coupon_subtitle"
android:textColor="@color/grey"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginTop="16dp"
app:layout_constraintEnd_toStartOf="@+id/iv_coupon_logo"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.2" />
<ImageView
android:id="@+id/iv_coupon_logo"
android:layout_width="80dp"
android:layout_height="60dp"
android:src="@drawable/sklavenitis_logo"
app:layout_constraintBottom_toTopOf="@+id/tv_coupon_subtitle"
app:layout_constraintEnd_toEndOf="@+id/tv_coupon_subtitle"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/tv_coupon_title"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_coupon_subtitle"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:maxLines="2"
android:layout_marginTop="8dp"
android:text="10€ έκπτωση στα ψώνια σου στα supermarket Σκλαβενίτης!"
app:layout_constraintBottom_toTopOf="@+id/button"
android:textColor="@color/grey"
android:textFontWeight="600"
android:textSize="16sp"
app:layout_constraintEnd_toStartOf="@+id/iv_coupon_logo"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_coupon_title" />
<ImageView
android:id="@+id/iv_coupon_logo"
android:layout_width="80dp"
android:layout_height="60dp"
android:layout_marginTop="16dp"
android:src="@drawable/sklavenitis_logo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintTop_toTopOf="parent" />
<Button
<TextView
android:id="@+id/button"
android:layout_width="150dp"
android:layout_height="40dp"
android:background="@drawable/round_border"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_cos_gradient3"
android:paddingHorizontal="16dp"
android:paddingVertical="4dp"
android:text="Εξαργύρωση"
android:textAlignment="center"
android:textSize="11dp"
android:textColor="@android:color/white"
android:textFontWeight="600"
android:textSize="15dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......
......@@ -93,6 +93,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/rl_header"
android:layout_marginTop="16dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_home_campaigns"
android:layout_width="match_parent"
......@@ -100,7 +101,7 @@
android:layout_marginBottom="8dp"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingEnd="10dp"/>
android:paddingEnd="10dp" />
</RelativeLayout>
<LinearLayout
......
......@@ -23,4 +23,5 @@
<string name="cos_profile_loyalty_name">Γιώργος Γεωργίου</string>
<string name="cos_questionnaire">Ερωτηματολόγιο</string>
<string name="cos_gifts_loyalty_title">Τα δώρα μου</string>
<string name="cos_coupons_loyalty_title">Ενεργά κουπόνια</string>
</resources>
\ No newline at end of file
......