Panagiotis Triantafyllou

deh part3

......@@ -16,6 +16,7 @@ import ly.warp.sdk.io.adapters.OfferAdapter;
import ly.warp.sdk.io.models.DummyDataProvider;
import ly.warp.sdk.io.models.OfferCategory;
import ly.warp.sdk.io.models.OfferItem;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.views.HorizontalSpaceItemDecoration;
......@@ -62,6 +63,9 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
private RecyclerView mRvPurchases;
private OfferAdapter mPurchasesAdapter;
private TextView mTvAllOffers, mTvAllFavorites, mTvAllViability, mTvAllFamily,
mTvAllCoffee, mTvAllTravelling, mTvAllKids, mTvAllPurchases;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
......@@ -120,34 +124,49 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
// Initialize Top Offers section
mTvCategoryTopOffers = findViewById(R.id.tv_recycler_category1);
mRvTopOffers = findViewById(R.id.rl_recycler1);
mTvAllOffers = findViewById(R.id.tv_recycler_all1);
// Initialize Favorites section
mTvCategoryFavorites = findViewById(R.id.tv_recycler_category2);
mRvFavorites = findViewById(R.id.rl_recycler2);
mTvAllFavorites = findViewById(R.id.tv_recycler_all2);
// Initialize Viability section
mTvCategoryViability = findViewById(R.id.tv_recycler_category3);
mRvViability = findViewById(R.id.rl_recycler3);
mTvAllViability = findViewById(R.id.tv_recycler_all3);
// Initialize Family section
mTvCategoryFamily = findViewById(R.id.tv_recycler_category4);
mRvFamily = findViewById(R.id.rl_recycler4);
mTvAllFamily = findViewById(R.id.tv_recycler_all4);
// Initialize Food & Coffee section
mTvCategoryFoodCoffee = findViewById(R.id.tv_recycler_category5);
mRvFoodCoffee = findViewById(R.id.rl_recycler5);
mTvAllCoffee = findViewById(R.id.tv_recycler_all5);
// Initialize Travelling section
mTvCategoryTravelling = findViewById(R.id.tv_recycler_category6);
mRvTravelling = findViewById(R.id.rl_recycler6);
mTvAllTravelling = findViewById(R.id.tv_recycler_all6);
// Initialize Kids section
mTvCategoryKids = findViewById(R.id.tv_recycler_category7);
mRvKids = findViewById(R.id.rl_recycler7);
mTvAllKids = findViewById(R.id.tv_recycler_all7);
// Initialize Purchases section
mTvCategoryPurchases = findViewById(R.id.tv_recycler_category8);
mRvPurchases = findViewById(R.id.rl_recycler8);
mTvAllPurchases = findViewById(R.id.tv_recycler_all8);
WarpUtils.renderCustomFont(this, R.font.ping_lcg_bold, mTvCategoryTopOffers,
mTvCategoryFavorites, mTvCategoryViability, mTvCategoryFamily, mTvCategoryFoodCoffee,
mTvCategoryTravelling, mTvCategoryKids, mTvCategoryPurchases);
WarpUtils.renderCustomFont(this, R.font.ping_lcg_regular, mTvAllOffers, mTvAllFavorites,
mTvAllViability, mTvAllFamily, mTvAllCoffee, mTvAllTravelling, mTvAllKids, mTvAllPurchases);
}
/**
......
......@@ -5,8 +5,11 @@ import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.WindowInsetsController;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
......@@ -14,6 +17,7 @@ import android.widget.Toast;
import ly.warp.sdk.R;
import ly.warp.sdk.io.models.OfferItem;
import ly.warp.sdk.utils.WarpUtils;
public class SingleCouponActivity extends Activity implements View.OnClickListener {
// ===========================================================
......@@ -27,8 +31,7 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen
private ImageView mIvBack;
private OfferItem mOfferItem;
private TextView mTvTitle, mTvSmallDescription;
private TextView mTvDescription;
private TextView mTvSmallDescription;
private TextView mTvFullDescription;
private TextView mTvEndDate;
private TextView mTvValue;
......@@ -45,6 +48,7 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen
private ImageView mIvCouponArrow;
private ImageView mIvCopyCode;
private TextView mTvCouponCode;
private TextView mTvCouponCodeTitle;
private boolean mIsCouponCodeExpanded = false;
// QR code section
......@@ -53,6 +57,7 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen
private LinearLayout mQrCodeContent;
private ImageView mIvQrArrow;
private ImageView mIvQrCode;
private TextView mTvQrCodeTitle;
private boolean mIsQrCodeExpanded = false;
// Terms of Use section
......@@ -63,6 +68,8 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen
private TextView mTvTermsText;
private boolean mIsTermsExpanded = false;
private TextView mTvHeaderTitle, mTvTermsTitle, mTvShopsTitle, mTvWebsiteTitle, mTVMoreTitle;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -73,6 +80,9 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_single_coupon);
// Setup white status bar
setupStatusBar();
// Get offer item from intent
Intent intent = getIntent();
if (intent != null && intent.hasExtra(EXTRA_OFFER_ITEM)) {
......@@ -82,6 +92,32 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen
initViews();
}
/**
* Sets up the status bar to be white with dark icons
*/
private void setupStatusBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
// API 30+
WindowInsetsController controller = getWindow().getInsetsController();
if (controller != null) {
controller.setSystemBarsAppearance(
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS,
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS
);
}
getWindow().setStatusBarColor(Color.WHITE);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// API 23+
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
getWindow().setStatusBarColor(Color.WHITE);
} else {
// For older versions, just set a light gray color
getWindow().setStatusBarColor(Color.parseColor("#F5F5F5"));
}
}
@Override
public void onResume() {
super.onResume();
......@@ -110,6 +146,7 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen
mIvCouponArrow = findViewById(R.id.iv_coupon_arrow);
mIvCopyCode = findViewById(R.id.iv_copy_code);
mTvCouponCode = findViewById(R.id.tv_coupon_code);
mTvCouponCodeTitle = findViewById(R.id.tv_coupon_code_title);
// Initialize QR code section
mQrCodeContainer = findViewById(R.id.qr_code_container);
......@@ -117,6 +154,7 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen
mQrCodeContent = findViewById(R.id.qr_code_content);
mIvQrArrow = findViewById(R.id.iv_qr_arrow);
mIvQrCode = findViewById(R.id.iv_qr_code);
mTvQrCodeTitle = findViewById(R.id.tv_qr_code_title);
// Initialize Terms of Use section
mTermsContainer = findViewById(R.id.terms_container);
......@@ -125,6 +163,19 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen
mIvTermsArrow = findViewById(R.id.iv_terms_arrow);
mTvTermsText = findViewById(R.id.tv_terms_text);
mTvHeaderTitle = findViewById(R.id.tv_header_title);
mTvTermsTitle = findViewById(R.id.tv_terms_title);
mTvShopsTitle = findViewById(R.id.tv_shops_title);
mTvWebsiteTitle = findViewById(R.id.tv_website_title);
mTVMoreTitle = findViewById(R.id.tv_more_title);
WarpUtils.renderCustomFont(this, R.font.ping_lcg_bold, mTvHeaderTitle, mTvValue,
mTvCouponCode, mTvTermsTitle, mTvShopsTitle, mTvWebsiteTitle);
WarpUtils.renderCustomFont(this, R.font.ping_lcg_regular, mTvSmallDescription,
mTvEndDate, mTvFullDescription, mTvCouponCodeTitle, mTvQrCodeTitle, mTvTermsText,
mTVMoreTitle, mTvMoreButton);
// Populate views with offer data
if (mOfferItem != null) {
mTvValue.setText(mOfferItem.getValue());
......
......@@ -24,6 +24,7 @@ import ly.warp.sdk.R;
import ly.warp.sdk.io.models.DummyDataProvider;
import ly.warp.sdk.io.models.OfferItem;
import ly.warp.sdk.utils.TopRoundedCornersTransformation;
import ly.warp.sdk.utils.WarpUtils;
/**
* Adapter for displaying offer items in a RecyclerView
......@@ -102,6 +103,9 @@ public class OfferAdapter extends RecyclerView.Adapter<OfferAdapter.OfferViewHol
tvDescription = itemView.findViewById(R.id.tv_description);
tvValidity = itemView.findViewById(R.id.tv_validity);
WarpUtils.renderCustomFont(context, R.font.ping_lcg_bold, tvPrice, tvTitle);
WarpUtils.renderCustomFont(context, R.font.ping_lcg_regular, tvDescription, tvValidity);
// Set click listeners
itemView.setOnClickListener(v -> {
int position = getAdapterPosition();
......
......@@ -80,7 +80,6 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textStyle="bold"
android:textSize="16sp"
tools:text="Top Offers (10)" />
......@@ -127,7 +126,6 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textStyle="bold"
android:textSize="16sp"
tools:text="Favorites (10)" />
......@@ -174,7 +172,6 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textStyle="bold"
android:textSize="16sp"
tools:text="Viability (10)" />
......@@ -221,7 +218,6 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textStyle="bold"
android:textSize="16sp"
tools:text="Family (10)" />
......@@ -268,7 +264,6 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textStyle="bold"
android:textSize="16sp"
tools:text="Food and Coffee (10)" />
......@@ -315,7 +310,6 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textStyle="bold"
android:textSize="16sp"
tools:text="Travelling (10)" />
......@@ -362,7 +356,6 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textStyle="bold"
android:textSize="16sp"
tools:text="Kids (10)" />
......@@ -410,7 +403,6 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textStyle="bold"
android:textSize="16sp"
tools:text="Purchases (10)" />
......
......@@ -41,13 +41,13 @@
android:src="@drawable/ic_back" />
<TextView
android:id="@+id/tv_header_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:text="@string/demo_offer"
android:textColor="@color/black4"
android:textSize="16sp"
android:textStyle="bold" />
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
......@@ -85,6 +85,7 @@
android:src="@drawable/ic_info" />
<TextView
android:id="@+id/tv_more_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
......@@ -127,7 +128,6 @@
android:maxLines="1"
android:textColor="@color/pink2"
android:textSize="23sp"
android:textStyle="bold"
tools:text="@string/demo_more" />
<TextView
......@@ -181,7 +181,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:ellipsize="end"
android:lineSpacingExtra="4dp"
android:lineSpacingExtra="2dp"
android:maxLines="4"
android:textColor="@color/black5"
android:textSize="17sp"
......@@ -215,6 +215,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/tv_coupon_code_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
......@@ -247,8 +248,7 @@
android:includeFontPadding="false"
android:text="test_coupon_code"
android:textColor="@color/black2"
android:textSize="23sp"
android:textStyle="bold" />
android:textSize="23sp" />
<ImageView
android:id="@+id/iv_copy_code"
......@@ -275,6 +275,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/tv_qr_code_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
......@@ -324,12 +325,12 @@
android:orientation="horizontal">
<TextView
android:id="@+id/tv_terms_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/demo_terms"
android:textColor="@color/black2"
android:textSize="15sp"
android:textStyle="bold" />
android:textSize="15sp"/>
<ImageView
android:id="@+id/iv_terms_arrow"
......@@ -369,12 +370,13 @@
android:orientation="horizontal">
<TextView
android:id="@+id/tv_shops_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/demo_shops"
android:textColor="@color/white"
android:textStyle="bold"
android:textSize="15sp" />
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
......@@ -386,12 +388,13 @@
android:orientation="horizontal">
<TextView
android:id="@+id/tv_website_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/demo_website"
android:textColor="@color/black2"
android:textStyle="bold"
android:textSize="15sp" />
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
......
......@@ -33,7 +33,6 @@
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="16sp"
android:textStyle="bold"
tools:text="17,95€" />
<!-- Content Section -->
......@@ -59,7 +58,6 @@
android:maxLines="1"
android:textColor="@color/black2"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_70"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
......