Showing
5 changed files
with
81 additions
and
17 deletions
... | @@ -18,7 +18,6 @@ import androidx.recyclerview.widget.RecyclerView; | ... | @@ -18,7 +18,6 @@ import androidx.recyclerview.widget.RecyclerView; |
18 | 18 | ||
19 | import org.greenrobot.eventbus.EventBus; | 19 | import org.greenrobot.eventbus.EventBus; |
20 | import org.greenrobot.eventbus.Subscribe; | 20 | import org.greenrobot.eventbus.Subscribe; |
21 | -import org.greenrobot.eventbus.ThreadMode; | ||
22 | import org.json.JSONArray; | 21 | import org.json.JSONArray; |
23 | import org.json.JSONObject; | 22 | import org.json.JSONObject; |
24 | 23 | ||
... | @@ -140,7 +139,7 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli | ... | @@ -140,7 +139,7 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli |
140 | EventBus.getDefault().unregister(this); | 139 | EventBus.getDefault().unregister(this); |
141 | } | 140 | } |
142 | 141 | ||
143 | - @Subscribe(threadMode = ThreadMode.ASYNC) | 142 | + @Subscribe() |
144 | public void onMessageEvent(WarplyEventBusManager event) { | 143 | public void onMessageEvent(WarplyEventBusManager event) { |
145 | if (event.getRefreshUnifiedCouponsAdded() != null || event.getRefreshVouchersEventModel() != null) { | 144 | if (event.getRefreshUnifiedCouponsAdded() != null || event.getRefreshVouchersEventModel() != null) { |
146 | Handler mUIHandler = new Handler(Looper.getMainLooper()); | 145 | Handler mUIHandler = new Handler(Looper.getMainLooper()); | ... | ... |
... | @@ -563,24 +563,37 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -563,24 +563,37 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
563 | 563 | ||
564 | String tempCoupon = ""; | 564 | String tempCoupon = ""; |
565 | int result = 0; | 565 | int result = 0; |
566 | - try { | 566 | + if (mCoupon.getCoupon().length() == 13) { |
567 | tempCoupon = mCoupon.getCoupon(); | 567 | tempCoupon = mCoupon.getCoupon(); |
568 | - for (int i = 0; i < (12 - mCoupon.getCoupon().length()); i++) { | 568 | + |
569 | - tempCoupon += "0"; | 569 | + try { |
570 | + for (int i = mCoupon.getCoupon().length() - 1; i >= 0; i--) { | ||
571 | + result = result + Integer.parseInt(String.valueOf((mCoupon.getCoupon()).charAt(i))) * (1 + (2 * (i % 2))); | ||
572 | + } | ||
573 | + } catch (Exception e) { | ||
574 | + e.printStackTrace(); | ||
575 | + } | ||
576 | + } else { | ||
577 | + try { | ||
578 | + tempCoupon = mCoupon.getCoupon(); | ||
579 | + for (int i = 0; i < (12 - mCoupon.getCoupon().length()); i++) { | ||
580 | + tempCoupon += "0"; | ||
581 | + } | ||
582 | + } catch (Exception e) { | ||
583 | + e.printStackTrace(); | ||
570 | } | 584 | } |
571 | - } catch (Exception e) { | ||
572 | - e.printStackTrace(); | ||
573 | - } | ||
574 | 585 | ||
575 | - try { | 586 | + try { |
576 | - for (int i = mCoupon.getCoupon().length() - 1; i >= 0; i--) { | 587 | + for (int i = mCoupon.getCoupon().length() - 1; i >= 0; i--) { |
577 | - result = result + Integer.parseInt(String.valueOf((mCoupon.getCoupon()).charAt(i))) * (1 + (2 * (i % 2))); | 588 | + result = result + Integer.parseInt(String.valueOf((mCoupon.getCoupon()).charAt(i))) * (1 + (2 * (i % 2))); |
589 | + } | ||
590 | + | ||
591 | + tempCoupon = tempCoupon + (10 - (result % 10)) % 10; | ||
592 | + } catch (Exception e) { | ||
593 | + e.printStackTrace(); | ||
578 | } | 594 | } |
579 | - } catch (Exception e) { | ||
580 | - e.printStackTrace(); | ||
581 | } | 595 | } |
582 | 596 | ||
583 | - tempCoupon = tempCoupon + (10 - (result % 10)) % 10; | ||
584 | createBarcodeBitmap(tempCoupon); | 597 | createBarcodeBitmap(tempCoupon); |
585 | } | 598 | } |
586 | 599 | ... | ... |
... | @@ -272,7 +272,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL | ... | @@ -272,7 +272,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL |
272 | String finalMerchantUrl = merchantUrl; | 272 | String finalMerchantUrl = merchantUrl; |
273 | 273 | ||
274 | LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); | 274 | LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
275 | - LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_sheet_merchant, null); | 275 | + LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_sheet_merchant_category, null); |
276 | 276 | ||
277 | TextView textView = (TextView) v.findViewById(R.id.button_sm_buy_it); | 277 | TextView textView = (TextView) v.findViewById(R.id.button_sm_buy_it); |
278 | textView.setText(R.string.cos_markets_eshop_item); | 278 | textView.setText(R.string.cos_markets_eshop_item); | ... | ... |
... | @@ -24,7 +24,7 @@ | ... | @@ -24,7 +24,7 @@ |
24 | 24 | ||
25 | <androidx.constraintlayout.widget.ConstraintLayout | 25 | <androidx.constraintlayout.widget.ConstraintLayout |
26 | android:id="@+id/cl_button_sm_buy_it" | 26 | android:id="@+id/cl_button_sm_buy_it" |
27 | - android:layout_width="150dp" | 27 | + android:layout_width="wrap_content" |
28 | android:layout_height="36dp" | 28 | android:layout_height="36dp" |
29 | android:layout_marginEnd="8dp" | 29 | android:layout_marginEnd="8dp" |
30 | android:background="@drawable/selector_button_green2" | 30 | android:background="@drawable/selector_button_green2" |
... | @@ -40,8 +40,10 @@ | ... | @@ -40,8 +40,10 @@ |
40 | android:text="@string/cos_sm_buy_it" | 40 | android:text="@string/cos_sm_buy_it" |
41 | android:textColor="@color/white" | 41 | android:textColor="@color/white" |
42 | android:textSize="14sp" | 42 | android:textSize="14sp" |
43 | + android:layout_marginStart="24dp" | ||
44 | + android:layout_marginEnd="12dp" | ||
43 | app:layout_constraintBottom_toBottomOf="parent" | 45 | app:layout_constraintBottom_toBottomOf="parent" |
44 | - app:layout_constraintEnd_toEndOf="parent" | 46 | + app:layout_constraintEnd_toStartOf="@+id/iv_sheet_cart" |
45 | app:layout_constraintStart_toStartOf="parent" | 47 | app:layout_constraintStart_toStartOf="parent" |
46 | app:layout_constraintTop_toTopOf="parent" /> | 48 | app:layout_constraintTop_toTopOf="parent" /> |
47 | 49 | ... | ... |
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | + android:layout_width="match_parent" | ||
5 | + android:layout_height="wrap_content" | ||
6 | + xmlns:tools="http://schemas.android.com/tools" | ||
7 | + android:background="@android:color/white"> | ||
8 | + | ||
9 | + <androidx.constraintlayout.widget.ConstraintLayout | ||
10 | + android:layout_width="match_parent" | ||
11 | + android:layout_height="56dp" | ||
12 | + android:layout_marginBottom="32dp" | ||
13 | + android:background="@drawable/shape_cos_sheet_item"> | ||
14 | + | ||
15 | + <ImageView | ||
16 | + android:id="@+id/iv_merchant_sheet_logo" | ||
17 | + android:layout_width="140dp" | ||
18 | + android:layout_height="36dp" | ||
19 | + android:layout_marginStart="24dp" | ||
20 | + tools:src="@drawable/cosmote_insurance_logo" | ||
21 | + app:layout_constraintBottom_toBottomOf="parent" | ||
22 | + app:layout_constraintStart_toStartOf="parent" | ||
23 | + app:layout_constraintTop_toTopOf="parent" /> | ||
24 | + | ||
25 | + <androidx.constraintlayout.widget.ConstraintLayout | ||
26 | + android:id="@+id/cl_button_sm_buy_it" | ||
27 | + android:layout_width="wrap_content" | ||
28 | + android:layout_height="36dp" | ||
29 | + android:layout_marginEnd="8dp" | ||
30 | + android:background="@drawable/selector_button_green2" | ||
31 | + app:layout_constraintBottom_toBottomOf="parent" | ||
32 | + app:layout_constraintEnd_toEndOf="parent" | ||
33 | + app:layout_constraintTop_toTopOf="parent"> | ||
34 | + | ||
35 | + <TextView | ||
36 | + android:id="@+id/button_sm_buy_it" | ||
37 | + android:layout_width="wrap_content" | ||
38 | + android:layout_height="wrap_content" | ||
39 | + android:includeFontPadding="false" | ||
40 | + android:text="@string/cos_sm_buy_it" | ||
41 | + android:textColor="@color/white" | ||
42 | + android:textSize="14sp" | ||
43 | + android:layout_marginHorizontal="24dp" | ||
44 | + app:layout_constraintBottom_toBottomOf="parent" | ||
45 | + app:layout_constraintEnd_toEndOf="parent" | ||
46 | + app:layout_constraintStart_toStartOf="parent" | ||
47 | + app:layout_constraintTop_toTopOf="parent" /> | ||
48 | + </androidx.constraintlayout.widget.ConstraintLayout> | ||
49 | + </androidx.constraintlayout.widget.ConstraintLayout> | ||
50 | +</LinearLayout> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment