Showing
8 changed files
with
104 additions
and
20 deletions
| 1 | +package ly.warp.sdk.views; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | +import android.content.res.TypedArray; | ||
| 5 | +import android.graphics.Canvas; | ||
| 6 | +import android.graphics.DashPathEffect; | ||
| 7 | +import android.graphics.Paint; | ||
| 8 | +import android.util.AttributeSet; | ||
| 9 | +import android.view.View; | ||
| 10 | + | ||
| 11 | +import ly.warp.sdk.R; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * Created by Panagiotis Triantafyllou on 13/Απρ/2023. | ||
| 15 | + * @ https://stackoverflow.com/questions/20583298/creating-horizontal-and-vertical-dotted-lines-in-android | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +public class DividerView extends View { | ||
| 19 | + static public int ORIENTATION_HORIZONTAL = 0; | ||
| 20 | + static public int ORIENTATION_VERTICAL = 1; | ||
| 21 | + private Paint mPaint; | ||
| 22 | + private int orientation; | ||
| 23 | + | ||
| 24 | + public DividerView(Context context, AttributeSet attrs) { | ||
| 25 | + super(context, attrs); | ||
| 26 | + int dashGap, dashLength, dashThickness; | ||
| 27 | + int color; | ||
| 28 | + | ||
| 29 | + TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.DividerView, 0, 0); | ||
| 30 | + | ||
| 31 | + try { | ||
| 32 | + dashGap = a.getDimensionPixelSize(R.styleable.DividerView_dashGap, 5); | ||
| 33 | + dashLength = a.getDimensionPixelSize(R.styleable.DividerView_dashLength, 5); | ||
| 34 | + dashThickness = a.getDimensionPixelSize(R.styleable.DividerView_dashThickness, 3); | ||
| 35 | + color = a.getColor(R.styleable.DividerView_color, 0xff000000); | ||
| 36 | + orientation = a.getInt(R.styleable.DividerView_orientation, ORIENTATION_HORIZONTAL); | ||
| 37 | + } finally { | ||
| 38 | + a.recycle(); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + mPaint = new Paint(); | ||
| 42 | + mPaint.setAntiAlias(true); | ||
| 43 | + mPaint.setColor(color); | ||
| 44 | + mPaint.setStyle(Paint.Style.STROKE); | ||
| 45 | + mPaint.setStrokeWidth(dashThickness); | ||
| 46 | + mPaint.setPathEffect(new DashPathEffect(new float[]{dashLength, dashGap,}, 0)); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + public DividerView(Context context) { | ||
| 50 | + this(context, null); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + protected void onDraw(Canvas canvas) { | ||
| 55 | + if (orientation == ORIENTATION_HORIZONTAL) { | ||
| 56 | + float center = getHeight() * .5f; | ||
| 57 | + canvas.drawLine(0, center, getWidth(), center, mPaint); | ||
| 58 | + } else { | ||
| 59 | + float center = getWidth() * .5f; | ||
| 60 | + canvas.drawLine(center, 0, center, getHeight(), mPaint); | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | 
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> | 
| 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 
| 4 | + xmlns:custom="http://schemas.android.com/apk/res-auto" | ||
| 4 | xmlns:tools="http://schemas.android.com/tools" | 5 | xmlns:tools="http://schemas.android.com/tools" | 
| 5 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" | 
| 6 | android:layout_height="150dp" | 7 | android:layout_height="150dp" | 
| 7 | - android:layout_marginVertical="6dp" | ||
| 8 | android:layout_marginHorizontal="4dp" | 8 | android:layout_marginHorizontal="4dp" | 
| 9 | + android:layout_marginVertical="6dp" | ||
| 9 | android:background="@drawable/ic_coupon_background_new2"> | 10 | android:background="@drawable/ic_coupon_background_new2"> | 
| 10 | 11 | ||
| 11 | <androidx.constraintlayout.widget.Guideline | 12 | <androidx.constraintlayout.widget.Guideline | 
| ... | @@ -25,16 +26,21 @@ | ... | @@ -25,16 +26,21 @@ | 
| 25 | app:layout_constraintTop_toTopOf="parent" | 26 | app:layout_constraintTop_toTopOf="parent" | 
| 26 | tools:src="@drawable/ic_gifts_for_you" /> | 27 | tools:src="@drawable/ic_gifts_for_you" /> | 
| 27 | 28 | ||
| 28 | - <View | 29 | + <ly.warp.sdk.views.DividerView | 
| 29 | android:id="@+id/v_separator" | 30 | android:id="@+id/v_separator" | 
| 30 | android:layout_width="1dp" | 31 | android:layout_width="1dp" | 
| 31 | - android:layout_height="match_parent" | 32 | + android:layout_height="0dp" | 
| 33 | + android:layerType="software" | ||
| 32 | android:layout_marginVertical="16dp" | 34 | android:layout_marginVertical="16dp" | 
| 33 | android:layout_marginStart="16dp" | 35 | android:layout_marginStart="16dp" | 
| 34 | - android:background="@drawable/shape_dashed_vertical" | ||
| 35 | app:layout_constraintBottom_toBottomOf="parent" | 36 | app:layout_constraintBottom_toBottomOf="parent" | 
| 36 | app:layout_constraintStart_toEndOf="@+id/iv_active_coupon" | 37 | app:layout_constraintStart_toEndOf="@+id/iv_active_coupon" | 
| 37 | - app:layout_constraintTop_toTopOf="parent" /> | 38 | + app:layout_constraintTop_toTopOf="parent" | 
| 39 | + custom:color="@color/cos_gray" | ||
| 40 | + custom:dashGap="10dp" | ||
| 41 | + custom:dashLength="10dp" | ||
| 42 | + custom:dashThickness="1dp" | ||
| 43 | + custom:orientation="vertical" /> | ||
| 38 | 44 | ||
| 39 | <LinearLayout | 45 | <LinearLayout | 
| 40 | android:id="@+id/ll_coupon_info" | 46 | android:id="@+id/ll_coupon_info" | 
| ... | @@ -49,41 +55,41 @@ | ... | @@ -49,41 +55,41 @@ | 
| 49 | 55 | ||
| 50 | <TextView | 56 | <TextView | 
| 51 | android:id="@+id/tv_active_coupons_title" | 57 | android:id="@+id/tv_active_coupons_title" | 
| 58 | + fontPath="fonts/BTCosmo-Bold.ttf" | ||
| 52 | android:layout_width="wrap_content" | 59 | android:layout_width="wrap_content" | 
| 53 | android:layout_height="wrap_content" | 60 | android:layout_height="wrap_content" | 
| 54 | android:ellipsize="end" | 61 | android:ellipsize="end" | 
| 55 | android:maxLines="1" | 62 | android:maxLines="1" | 
| 56 | android:textColor="@color/cos_light_black" | 63 | android:textColor="@color/cos_light_black" | 
| 57 | - fontPath="fonts/BTCosmo-Bold.ttf" | ||
| 58 | android:textSize="16sp" | 64 | android:textSize="16sp" | 
| 59 | tools:text="Εκπτωτικο κουπονι 10$ για αγορες στα ΙΚΕΑ" /> | 65 | tools:text="Εκπτωτικο κουπονι 10$ για αγορες στα ΙΚΕΑ" /> | 
| 60 | 66 | ||
| 61 | <TextView | 67 | <TextView | 
| 62 | android:id="@+id/tv_active_coupons_value" | 68 | android:id="@+id/tv_active_coupons_value" | 
| 69 | + fontPath="fonts/BTCosmo-Bold.ttf" | ||
| 63 | android:layout_width="wrap_content" | 70 | android:layout_width="wrap_content" | 
| 64 | android:layout_height="wrap_content" | 71 | android:layout_height="wrap_content" | 
| 65 | android:textColor="@color/cos_light_black" | 72 | android:textColor="@color/cos_light_black" | 
| 66 | android:textSize="42sp" | 73 | android:textSize="42sp" | 
| 67 | - fontPath="fonts/BTCosmo-Bold.ttf" | ||
| 68 | tools:text="10$" /> | 74 | tools:text="10$" /> | 
| 69 | 75 | ||
| 70 | <TextView | 76 | <TextView | 
| 71 | android:id="@+id/tv_active_coupons_date" | 77 | android:id="@+id/tv_active_coupons_date" | 
| 78 | + fontPath="fonts/PeridotPE-Regular.ttf" | ||
| 72 | android:layout_width="wrap_content" | 79 | android:layout_width="wrap_content" | 
| 73 | android:layout_height="wrap_content" | 80 | android:layout_height="wrap_content" | 
| 74 | android:textColor="@color/cos_gray" | 81 | android:textColor="@color/cos_gray" | 
| 75 | - fontPath="fonts/PeridotPE-Regular.ttf" | ||
| 76 | android:textSize="12sp" | 82 | android:textSize="12sp" | 
| 77 | tools:text="@string/cos_active_coupon_date" /> | 83 | tools:text="@string/cos_active_coupon_date" /> | 
| 78 | </LinearLayout> | 84 | </LinearLayout> | 
| 79 | 85 | ||
| 80 | <TextView | 86 | <TextView | 
| 81 | android:id="@+id/tv_active_coupons_description" | 87 | android:id="@+id/tv_active_coupons_description" | 
| 88 | + fontPath="fonts/PeridotPE-Regular.ttf" | ||
| 82 | android:layout_width="0dp" | 89 | android:layout_width="0dp" | 
| 83 | android:layout_height="wrap_content" | 90 | android:layout_height="wrap_content" | 
| 84 | android:layout_marginStart="8dp" | 91 | android:layout_marginStart="8dp" | 
| 85 | android:layout_marginEnd="32dp" | 92 | android:layout_marginEnd="32dp" | 
| 86 | - fontPath="fonts/PeridotPE-Regular.ttf" | ||
| 87 | android:maxLines="4" | 93 | android:maxLines="4" | 
| 88 | android:textColor="@color/cos_gray" | 94 | android:textColor="@color/cos_gray" | 
| 89 | android:textSize="12sp" | 95 | android:textSize="12sp" | ... | ... | 
This diff is collapsed. Click to expand it.
| ... | @@ -82,7 +82,7 @@ | ... | @@ -82,7 +82,7 @@ | 
| 82 | 82 | ||
| 83 | <LinearLayout | 83 | <LinearLayout | 
| 84 | android:id="@+id/ll_user_badge" | 84 | android:id="@+id/ll_user_badge" | 
| 85 | - android:layout_width="180dp" | 85 | + android:layout_width="wrap_content" | 
| 86 | android:layout_height="42dp" | 86 | android:layout_height="42dp" | 
| 87 | android:background="@drawable/selector_button_green_border" | 87 | android:background="@drawable/selector_button_green_border" | 
| 88 | android:gravity="center" | 88 | android:gravity="center" | 
| ... | @@ -97,7 +97,8 @@ | ... | @@ -97,7 +97,8 @@ | 
| 97 | android:includeFontPadding="false" | 97 | android:includeFontPadding="false" | 
| 98 | android:textColor="@color/cos_green12" | 98 | android:textColor="@color/cos_green12" | 
| 99 | android:textSize="16sp" | 99 | android:textSize="16sp" | 
| 100 | - tools:text="@string/cos_profile_type" /> | 100 | + android:layout_marginHorizontal="20dp" | 
| 101 | + tools:text="@string/cos_profile_preferences_placeholder" /> | ||
| 101 | </LinearLayout> | 102 | </LinearLayout> | 
| 102 | 103 | ||
| 103 | <LinearLayout | 104 | <LinearLayout | 
| ... | @@ -179,7 +180,7 @@ | ... | @@ -179,7 +180,7 @@ | 
| 179 | android:includeFontPadding="false" | 180 | android:includeFontPadding="false" | 
| 180 | android:text="@string/cos_deals_win_title_cos" | 181 | android:text="@string/cos_deals_win_title_cos" | 
| 181 | android:textColor="@color/cos_light_black" | 182 | android:textColor="@color/cos_light_black" | 
| 182 | - android:textSize="16sp" | 183 | + android:textSize="15sp" | 
| 183 | app:layout_constraintBottom_toBottomOf="parent" | 184 | app:layout_constraintBottom_toBottomOf="parent" | 
| 184 | app:layout_constraintEnd_toEndOf="parent" | 185 | app:layout_constraintEnd_toEndOf="parent" | 
| 185 | app:layout_constraintStart_toStartOf="@+id/gl_vertical_16_cos" | 186 | app:layout_constraintStart_toStartOf="@+id/gl_vertical_16_cos" | 
| ... | @@ -188,8 +189,8 @@ | ... | @@ -188,8 +189,8 @@ | 
| 188 | 189 | ||
| 189 | <ImageView | 190 | <ImageView | 
| 190 | android:id="@+id/iv_deals_logo" | 191 | android:id="@+id/iv_deals_logo" | 
| 191 | - android:layout_width="80dp" | 192 | + android:layout_width="76dp" | 
| 192 | - android:layout_height="80dp" | 193 | + android:layout_height="76dp" | 
| 193 | android:layout_marginVertical="4dp" | 194 | android:layout_marginVertical="4dp" | 
| 194 | android:src="@drawable/ic_deals_polygon_new" | 195 | android:src="@drawable/ic_deals_polygon_new" | 
| 195 | app:layout_constraintBottom_toBottomOf="parent" | 196 | app:layout_constraintBottom_toBottomOf="parent" | 
| ... | @@ -258,7 +259,7 @@ | ... | @@ -258,7 +259,7 @@ | 
| 258 | android:includeFontPadding="false" | 259 | android:includeFontPadding="false" | 
| 259 | android:text="@string/cos_deals_win_title" | 260 | android:text="@string/cos_deals_win_title" | 
| 260 | android:textColor="@color/cos_light_black" | 261 | android:textColor="@color/cos_light_black" | 
| 261 | - android:textSize="16sp" | 262 | + android:textSize="15sp" | 
| 262 | app:layout_constraintBottom_toBottomOf="parent" | 263 | app:layout_constraintBottom_toBottomOf="parent" | 
| 263 | app:layout_constraintEnd_toEndOf="parent" | 264 | app:layout_constraintEnd_toEndOf="parent" | 
| 264 | app:layout_constraintStart_toStartOf="@+id/gl_vertical_16" | 265 | app:layout_constraintStart_toStartOf="@+id/gl_vertical_16" | 
| ... | @@ -267,8 +268,8 @@ | ... | @@ -267,8 +268,8 @@ | 
| 267 | 268 | ||
| 268 | <ImageView | 269 | <ImageView | 
| 269 | android:id="@+id/iv_gifts_logo" | 270 | android:id="@+id/iv_gifts_logo" | 
| 270 | - android:layout_width="80dp" | 271 | + android:layout_width="76dp" | 
| 271 | - android:layout_height="80dp" | 272 | + android:layout_height="76dp" | 
| 272 | android:layout_marginVertical="4dp" | 273 | android:layout_marginVertical="4dp" | 
| 273 | android:src="@drawable/ic_gifts_polygon_new" | 274 | android:src="@drawable/ic_gifts_polygon_new" | 
| 274 | app:layout_constraintBottom_toBottomOf="parent" | 275 | app:layout_constraintBottom_toBottomOf="parent" | 
| ... | @@ -301,7 +302,7 @@ | ... | @@ -301,7 +302,7 @@ | 
| 301 | 302 | ||
| 302 | <ImageView | 303 | <ImageView | 
| 303 | android:id="@+id/dfy_logo" | 304 | android:id="@+id/dfy_logo" | 
| 304 | - android:layout_width="220dp" | 305 | + android:layout_width="200dp" | 
| 305 | android:layout_height="30dp" | 306 | android:layout_height="30dp" | 
| 306 | android:layout_gravity="start" | 307 | android:layout_gravity="start" | 
| 307 | android:layout_marginHorizontal="16dp" | 308 | android:layout_marginHorizontal="16dp" | ... | ... | 
| ... | @@ -48,7 +48,7 @@ | ... | @@ -48,7 +48,7 @@ | 
| 48 | android:layout_weight="0.5" | 48 | android:layout_weight="0.5" | 
| 49 | android:maxLines="2" | 49 | android:maxLines="2" | 
| 50 | android:textColor="@color/cos_light_black" | 50 | android:textColor="@color/cos_light_black" | 
| 51 | - android:textSize="18sp" | 51 | + android:textSize="16sp" | 
| 52 | tools:text="Box" /> | 52 | tools:text="Box" /> | 
| 53 | 53 | ||
| 54 | <TextView | 54 | <TextView | ... | ... | 
| ... | @@ -48,7 +48,7 @@ | ... | @@ -48,7 +48,7 @@ | 
| 48 | android:layout_weight="0.5" | 48 | android:layout_weight="0.5" | 
| 49 | android:maxLines="2" | 49 | android:maxLines="2" | 
| 50 | android:textColor="@color/cos_light_black" | 50 | android:textColor="@color/cos_light_black" | 
| 51 | - android:textSize="18sp" | 51 | + android:textSize="16sp" | 
| 52 | tools:text="Box" /> | 52 | tools:text="Box" /> | 
| 53 | 53 | ||
| 54 | <TextView | 54 | <TextView | ... | ... | 
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<resources> | ||
| 3 | + <declare-styleable name="DividerView"> | ||
| 4 | + <attr name="color" format="color" /> | ||
| 5 | + <attr name="dashLength" format="dimension" /> | ||
| 6 | + <attr name="dashGap" format="dimension" /> | ||
| 7 | + <attr name="dashThickness" format="dimension" /> | ||
| 8 | + <attr name="orientation" format="enum"> | ||
| 9 | + <enum name="horizontal" value="0" /> | ||
| 10 | + <enum name="vertical" value="1" /> | ||
| 11 | + </attr> | ||
| 12 | + </declare-styleable> | ||
| 13 | +</resources> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | 
| ... | @@ -149,6 +149,7 @@ | ... | @@ -149,6 +149,7 @@ | 
| 149 | <string name="cos_dlg_no_map">Το πρόγραμμα Χάρτες Petal λείπει.</string> | 149 | <string name="cos_dlg_no_map">Το πρόγραμμα Χάρτες Petal λείπει.</string> | 
| 150 | <string name="cos_dlg_no_shops_title">Καταστήματα συνεργάτη</string> | 150 | <string name="cos_dlg_no_shops_title">Καταστήματα συνεργάτη</string> | 
| 151 | <string name="cos_dlg_no_shops_positive">Δες το eshop</string> | 151 | <string name="cos_dlg_no_shops_positive">Δες το eshop</string> | 
| 152 | + <string name="cos_profile_preferences_placeholder">Οι προτιμήσεις μου</string> | ||
| 152 | 153 | ||
| 153 | <string-array name="coupons_array"> | 154 | <string-array name="coupons_array"> | 
| 154 | <item>Κουπόνια</item> | 155 | <item>Κουπόνια</item> | ... | ... | 
- 
Please register or login to post a comment