Panagiotis Triantafyllou

redesign part3

package ly.warp.sdk.views;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;
import ly.warp.sdk.R;
/**
* Created by Panagiotis Triantafyllou on 13/Απρ/2023.
* @ https://stackoverflow.com/questions/20583298/creating-horizontal-and-vertical-dotted-lines-in-android
*/
public class DividerView extends View {
static public int ORIENTATION_HORIZONTAL = 0;
static public int ORIENTATION_VERTICAL = 1;
private Paint mPaint;
private int orientation;
public DividerView(Context context, AttributeSet attrs) {
super(context, attrs);
int dashGap, dashLength, dashThickness;
int color;
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.DividerView, 0, 0);
try {
dashGap = a.getDimensionPixelSize(R.styleable.DividerView_dashGap, 5);
dashLength = a.getDimensionPixelSize(R.styleable.DividerView_dashLength, 5);
dashThickness = a.getDimensionPixelSize(R.styleable.DividerView_dashThickness, 3);
color = a.getColor(R.styleable.DividerView_color, 0xff000000);
orientation = a.getInt(R.styleable.DividerView_orientation, ORIENTATION_HORIZONTAL);
} finally {
a.recycle();
}
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setColor(color);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(dashThickness);
mPaint.setPathEffect(new DashPathEffect(new float[]{dashLength, dashGap,}, 0));
}
public DividerView(Context context) {
this(context, null);
}
@Override
protected void onDraw(Canvas canvas) {
if (orientation == ORIENTATION_HORIZONTAL) {
float center = getHeight() * .5f;
canvas.drawLine(0, center, getWidth(), center, mPaint);
} else {
float center = getWidth() * .5f;
canvas.drawLine(center, 0, center, getHeight(), mPaint);
}
}
}
\ No newline at end of file
<?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:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginVertical="6dp"
android:layout_marginHorizontal="4dp"
android:layout_marginVertical="6dp"
android:background="@drawable/ic_coupon_background_new2">
<androidx.constraintlayout.widget.Guideline
......@@ -25,16 +26,21 @@
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_gifts_for_you" />
<View
<ly.warp.sdk.views.DividerView
android:id="@+id/v_separator"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_height="0dp"
android:layerType="software"
android:layout_marginVertical="16dp"
android:layout_marginStart="16dp"
android:background="@drawable/shape_dashed_vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_active_coupon"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
custom:color="@color/cos_gray"
custom:dashGap="10dp"
custom:dashLength="10dp"
custom:dashThickness="1dp"
custom:orientation="vertical" />
<LinearLayout
android:id="@+id/ll_coupon_info"
......@@ -49,41 +55,41 @@
<TextView
android:id="@+id/tv_active_coupons_title"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/cos_light_black"
fontPath="fonts/BTCosmo-Bold.ttf"
android:textSize="16sp"
tools:text="Εκπτωτικο κουπονι 10$ για αγορες στα ΙΚΕΑ" />
<TextView
android:id="@+id/tv_active_coupons_value"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_light_black"
android:textSize="42sp"
fontPath="fonts/BTCosmo-Bold.ttf"
tools:text="10$" />
<TextView
android:id="@+id/tv_active_coupons_date"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_gray"
fontPath="fonts/PeridotPE-Regular.ttf"
android:textSize="12sp"
tools:text="@string/cos_active_coupon_date" />
</LinearLayout>
<TextView
android:id="@+id/tv_active_coupons_description"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="32dp"
fontPath="fonts/PeridotPE-Regular.ttf"
android:maxLines="4"
android:textColor="@color/cos_gray"
android:textSize="12sp"
......
......@@ -82,7 +82,7 @@
<LinearLayout
android:id="@+id/ll_user_badge"
android:layout_width="180dp"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:background="@drawable/selector_button_green_border"
android:gravity="center"
......@@ -97,7 +97,8 @@
android:includeFontPadding="false"
android:textColor="@color/cos_green12"
android:textSize="16sp"
tools:text="@string/cos_profile_type" />
android:layout_marginHorizontal="20dp"
tools:text="@string/cos_profile_preferences_placeholder" />
</LinearLayout>
<LinearLayout
......@@ -179,7 +180,7 @@
android:includeFontPadding="false"
android:text="@string/cos_deals_win_title_cos"
android:textColor="@color/cos_light_black"
android:textSize="16sp"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/gl_vertical_16_cos"
......@@ -188,8 +189,8 @@
<ImageView
android:id="@+id/iv_deals_logo"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_width="76dp"
android:layout_height="76dp"
android:layout_marginVertical="4dp"
android:src="@drawable/ic_deals_polygon_new"
app:layout_constraintBottom_toBottomOf="parent"
......@@ -258,7 +259,7 @@
android:includeFontPadding="false"
android:text="@string/cos_deals_win_title"
android:textColor="@color/cos_light_black"
android:textSize="16sp"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/gl_vertical_16"
......@@ -267,8 +268,8 @@
<ImageView
android:id="@+id/iv_gifts_logo"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_width="76dp"
android:layout_height="76dp"
android:layout_marginVertical="4dp"
android:src="@drawable/ic_gifts_polygon_new"
app:layout_constraintBottom_toBottomOf="parent"
......@@ -301,7 +302,7 @@
<ImageView
android:id="@+id/dfy_logo"
android:layout_width="220dp"
android:layout_width="200dp"
android:layout_height="30dp"
android:layout_gravity="start"
android:layout_marginHorizontal="16dp"
......
......@@ -48,7 +48,7 @@
android:layout_weight="0.5"
android:maxLines="2"
android:textColor="@color/cos_light_black"
android:textSize="18sp"
android:textSize="16sp"
tools:text="Box" />
<TextView
......
......@@ -48,7 +48,7 @@
android:layout_weight="0.5"
android:maxLines="2"
android:textColor="@color/cos_light_black"
android:textSize="18sp"
android:textSize="16sp"
tools:text="Box" />
<TextView
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="DividerView">
<attr name="color" format="color" />
<attr name="dashLength" format="dimension" />
<attr name="dashGap" format="dimension" />
<attr name="dashThickness" format="dimension" />
<attr name="orientation" format="enum">
<enum name="horizontal" value="0" />
<enum name="vertical" value="1" />
</attr>
</declare-styleable>
</resources>
\ No newline at end of file
......@@ -149,6 +149,7 @@
<string name="cos_dlg_no_map">Το πρόγραμμα Χάρτες Petal λείπει.</string>
<string name="cos_dlg_no_shops_title">Καταστήματα συνεργάτη</string>
<string name="cos_dlg_no_shops_positive">Δες το eshop</string>
<string name="cos_profile_preferences_placeholder">Οι προτιμήσεις μου</string>
<string-array name="coupons_array">
<item>Κουπόνια</item>
......