thkouk00

conditional rendering in loyalty dropdowns

...@@ -2,6 +2,7 @@ package ly.warp.sdk.activities; ...@@ -2,6 +2,7 @@ package ly.warp.sdk.activities;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.content.Intent; 4 import android.content.Intent;
5 +import android.media.Image;
5 import android.os.Bundle; 6 import android.os.Bundle;
6 import android.view.View; 7 import android.view.View;
7 import android.widget.AdapterView; 8 import android.widget.AdapterView;
...@@ -77,6 +78,34 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener, ...@@ -77,6 +78,34 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener,
77 @Override 78 @Override
78 public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { 79 public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
79 // parent.getItemAtPosition(pos) 80 // parent.getItemAtPosition(pos)
81 + ImageView chartImg = findViewById(R.id.cl_chart).findViewById(R.id.iv_chart);
82 + ImageView innerChartImg = findViewById(R.id.cl_chart).findViewById(R.id.iv_inner_chart);
83 +
84 + if (parent.getId() == mCouponSpinner.getId()) {
85 + if (pos == 1) {
86 + mRedemptionSpinner.setVisibility(View.GONE);
87 + findViewById(R.id.cl_tab_analysis).setVisibility(View.GONE);
88 + findViewById(R.id.cl_chart).setVisibility(View.GONE);
89 +// findViewById(R.id.cl_chart2).setVisibility(View.VISIBLE);
90 + findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab).setVisibility(View.GONE);
91 + findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab2).setVisibility(View.GONE);
92 + findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab3).setVisibility(View.GONE);
93 + findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab4).setVisibility(View.VISIBLE);
94 + findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab5).setVisibility(View.VISIBLE);
95 + } else {
96 + mRedemptionSpinner.setVisibility(View.VISIBLE);
97 + findViewById(R.id.cl_chart).setVisibility(View.VISIBLE);
98 +// findViewById(R.id.cl_chart2).setVisibility(View.GONE);
99 + findViewById(R.id.cl_tab_analysis).setVisibility(View.VISIBLE);
100 + findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab).setVisibility(View.VISIBLE);
101 + findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab2).setVisibility(View.VISIBLE);
102 + findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab3).setVisibility(View.VISIBLE);
103 + findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab4).setVisibility(View.GONE);
104 + findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab5).setVisibility(View.GONE);
105 + }
106 + } else {
107 +
108 + }
80 } 109 }
81 110
82 @Override 111 @Override
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
6 android:orientation="vertical"> 6 android:orientation="vertical">
7 7
8 <androidx.constraintlayout.widget.ConstraintLayout 8 <androidx.constraintlayout.widget.ConstraintLayout
9 + android:id="@+id/analysis_tab"
9 android:layout_width="match_parent" 10 android:layout_width="match_parent"
10 android:layout_height="wrap_content"> 11 android:layout_height="wrap_content">
11 12
...@@ -43,6 +44,7 @@ ...@@ -43,6 +44,7 @@
43 </androidx.constraintlayout.widget.ConstraintLayout> 44 </androidx.constraintlayout.widget.ConstraintLayout>
44 45
45 <androidx.constraintlayout.widget.ConstraintLayout 46 <androidx.constraintlayout.widget.ConstraintLayout
47 + android:id="@+id/analysis_tab2"
46 android:layout_width="match_parent" 48 android:layout_width="match_parent"
47 android:layout_height="wrap_content" 49 android:layout_height="wrap_content"
48 android:layout_marginVertical="20dp"> 50 android:layout_marginVertical="20dp">
...@@ -81,6 +83,7 @@ ...@@ -81,6 +83,7 @@
81 </androidx.constraintlayout.widget.ConstraintLayout> 83 </androidx.constraintlayout.widget.ConstraintLayout>
82 84
83 <androidx.constraintlayout.widget.ConstraintLayout 85 <androidx.constraintlayout.widget.ConstraintLayout
86 + android:id="@+id/analysis_tab3"
84 android:layout_width="match_parent" 87 android:layout_width="match_parent"
85 android:layout_height="wrap_content"> 88 android:layout_height="wrap_content">
86 89
...@@ -117,6 +120,84 @@ ...@@ -117,6 +120,84 @@
117 app:layout_constraintTop_toTopOf="parent" /> 120 app:layout_constraintTop_toTopOf="parent" />
118 </androidx.constraintlayout.widget.ConstraintLayout> 121 </androidx.constraintlayout.widget.ConstraintLayout>
119 122
123 + <androidx.constraintlayout.widget.ConstraintLayout
124 + android:id="@+id/analysis_tab4"
125 + android:layout_width="match_parent"
126 + android:layout_height="wrap_content"
127 + android:layout_marginVertical="20dp">
128 +
129 + <ImageView
130 + android:id="@+id/iv_chart_icon4"
131 + android:layout_width="24dp"
132 + android:layout_height="24dp"
133 + android:src="@drawable/ic_food"
134 + app:layout_constraintBottom_toBottomOf="parent"
135 + app:layout_constraintStart_toStartOf="parent"
136 + app:layout_constraintTop_toTopOf="parent" />
137 +
138 + <TextView
139 + android:layout_width="wrap_content"
140 + android:layout_height="wrap_content"
141 + android:layout_marginStart="16dp"
142 + android:text="Γεύση"
143 + android:textColor="#4D4C58"
144 + android:textSize="15sp"
145 + android:textStyle="bold"
146 + app:layout_constraintBottom_toBottomOf="parent"
147 + app:layout_constraintStart_toEndOf="@+id/iv_chart_icon4"
148 + app:layout_constraintTop_toTopOf="parent" />
149 +
150 + <TextView
151 + android:layout_width="wrap_content"
152 + android:layout_height="wrap_content"
153 + android:text="77%"
154 + android:textColor="#00CB09"
155 + android:textSize="17sp"
156 + android:textStyle="bold"
157 + app:layout_constraintBottom_toBottomOf="parent"
158 + app:layout_constraintEnd_toEndOf="parent"
159 + app:layout_constraintTop_toTopOf="parent" />
160 + </androidx.constraintlayout.widget.ConstraintLayout>
161 +
162 + <androidx.constraintlayout.widget.ConstraintLayout
163 + android:id="@+id/analysis_tab5"
164 + android:layout_width="match_parent"
165 + android:layout_height="wrap_content"
166 + android:layout_marginVertical="20dp">
167 +
168 + <ImageView
169 + android:id="@+id/iv_chart_icon5"
170 + android:layout_width="24dp"
171 + android:layout_height="24dp"
172 + android:src="@drawable/ic_bag"
173 + app:layout_constraintBottom_toBottomOf="parent"
174 + app:layout_constraintStart_toStartOf="parent"
175 + app:layout_constraintTop_toTopOf="parent" />
176 +
177 + <TextView
178 + android:layout_width="wrap_content"
179 + android:layout_height="wrap_content"
180 + android:layout_marginStart="16dp"
181 + android:text="Shopping"
182 + android:textColor="#4D4C58"
183 + android:textSize="15sp"
184 + android:textStyle="bold"
185 + app:layout_constraintBottom_toBottomOf="parent"
186 + app:layout_constraintStart_toEndOf="@+id/iv_chart_icon5"
187 + app:layout_constraintTop_toTopOf="parent" />
188 +
189 + <TextView
190 + android:layout_width="wrap_content"
191 + android:layout_height="wrap_content"
192 + android:text="23%"
193 + android:textColor="#0072C9"
194 + android:textSize="17sp"
195 + android:textStyle="bold"
196 + app:layout_constraintBottom_toBottomOf="parent"
197 + app:layout_constraintEnd_toEndOf="parent"
198 + app:layout_constraintTop_toTopOf="parent" />
199 + </androidx.constraintlayout.widget.ConstraintLayout>
200 +
120 <TextView 201 <TextView
121 android:id="@+id/tv_analysis_details" 202 android:id="@+id/tv_analysis_details"
122 android:layout_width="match_parent" 203 android:layout_width="match_parent"
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
29 app:layout_constraintTop_toTopOf="parent" /> 29 app:layout_constraintTop_toTopOf="parent" />
30 30
31 <ImageView 31 <ImageView
32 + android:id="@+id/iv_inner_chart"
32 android:layout_width="wrap_content" 33 android:layout_width="wrap_content"
33 android:layout_height="wrap_content" 34 android:layout_height="wrap_content"
34 android:src="@drawable/ic_cosmote_logo" 35 android:src="@drawable/ic_cosmote_logo"
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:app="http://schemas.android.com/apk/res-auto"
4 + xmlns:tools="http://schemas.android.com/tools"
5 + android:layout_width="200dp"
6 + android:layout_height="200dp">
7 +
8 + <androidx.constraintlayout.widget.Guideline
9 + android:id="@+id/gl_vertical_15_guideline"
10 + android:layout_width="wrap_content"
11 + android:layout_height="wrap_content"
12 + android:orientation="vertical"
13 + app:layout_constraintGuide_percent="0.15" />
14 +
15 + <androidx.constraintlayout.widget.Guideline
16 + android:id="@+id/gl_vertical_85_guideline"
17 + android:layout_width="wrap_content"
18 + android:layout_height="wrap_content"
19 + android:orientation="vertical"
20 + app:layout_constraintGuide_percent="0.85" />
21 +
22 + <ImageView
23 + android:id="@+id/iv_chart"
24 + android:layout_width="0dp"
25 + android:layout_height="0dp"
26 + android:src="@drawable/ic_chart2"
27 + app:layout_constraintBottom_toBottomOf="parent"
28 + app:layout_constraintEnd_toEndOf="parent"
29 + app:layout_constraintStart_toStartOf="parent"
30 + app:layout_constraintTop_toTopOf="parent" />
31 +
32 + <ImageView
33 + android:id="@+id/iv_inner_chart"
34 + android:layout_width="wrap_content"
35 + android:layout_height="wrap_content"
36 + android:src="@drawable/deals_for_you"
37 + app:layout_constraintBottom_toBottomOf="parent"
38 + app:layout_constraintEnd_toStartOf="@+id/gl_vertical_85_guideline"
39 + app:layout_constraintStart_toEndOf="@+id/gl_vertical_15_guideline"
40 + app:layout_constraintTop_toTopOf="parent"
41 + app:layout_constraintVertical_bias="0.308" />
42 +
43 + <TextView
44 + android:id="@+id/textView4"
45 + android:layout_width="wrap_content"
46 + android:layout_height="wrap_content"
47 + android:layout_marginStart="60dp"
48 + android:layout_marginTop="12dp"
49 + android:gravity="center"
50 + android:text="έχεις κερδίσει"
51 + android:textColor="#4D4C58"
52 + android:textSize="12dp"
53 + app:layout_constraintEnd_toEndOf="parent"
54 + app:layout_constraintHorizontal_bias="0.0"
55 + app:layout_constraintStart_toStartOf="@+id/iv_chart"
56 + app:layout_constraintTop_toBottomOf="@+id/iv_inner_chart" />
57 +
58 + <TextView
59 + android:id="@+id/textView8"
60 + android:layout_width="wrap_content"
61 + android:layout_height="wrap_content"
62 + android:layout_marginTop="8dp"
63 + android:gravity="center"
64 + android:text="12,00€"
65 + android:textColor="#4D4C58"
66 + android:textSize="18dp"
67 + android:textFontWeight="1000"
68 + app:layout_constraintBottom_toBottomOf="parent"
69 + app:layout_constraintEnd_toEndOf="@+id/iv_chart"
70 + app:layout_constraintHorizontal_bias="0.503"
71 + app:layout_constraintStart_toStartOf="parent"
72 + app:layout_constraintTop_toBottomOf="@+id/textView4"
73 + app:layout_constraintVertical_bias="0.0" />
74 +</androidx.constraintlayout.widget.ConstraintLayout>
...\ No newline at end of file ...\ No newline at end of file
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
29 29
30 <string-array name="coupons_array"> 30 <string-array name="coupons_array">
31 <item>Κουπόνια</item> 31 <item>Κουπόνια</item>
32 - <item>Δώρα</item> 32 + <item>Deals for you</item>
33 </string-array> 33 </string-array>
34 34
35 <string-array name="redemption_array"> 35 <string-array name="redemption_array">
......