Panagiotis Triantafyllou

loyalty profile wip3

...@@ -3,7 +3,10 @@ package ly.warp.sdk.activities; ...@@ -3,7 +3,10 @@ package ly.warp.sdk.activities;
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.view.View; 5 import android.view.View;
6 +import android.widget.AdapterView;
7 +import android.widget.ArrayAdapter;
6 import android.widget.ImageView; 8 import android.widget.ImageView;
9 +import android.widget.Spinner;
7 10
8 import androidx.recyclerview.widget.LinearLayoutManager; 11 import androidx.recyclerview.widget.LinearLayoutManager;
9 import androidx.recyclerview.widget.RecyclerView; 12 import androidx.recyclerview.widget.RecyclerView;
...@@ -16,7 +19,8 @@ import ly.warp.sdk.io.models.CouponList; ...@@ -16,7 +19,8 @@ import ly.warp.sdk.io.models.CouponList;
16 import ly.warp.sdk.views.adapters.HomeCouponAdapter; 19 import ly.warp.sdk.views.adapters.HomeCouponAdapter;
17 20
18 21
19 -public class LoyaltyActivity extends Activity implements View.OnClickListener { 22 +public class LoyaltyActivity extends Activity implements View.OnClickListener,
23 + AdapterView.OnItemSelectedListener {
20 24
21 // =========================================================== 25 // ===========================================================
22 // Constants 26 // Constants
...@@ -27,8 +31,9 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener { ...@@ -27,8 +31,9 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
27 // =========================================================== 31 // ===========================================================
28 32
29 private ImageView mIvBack; 33 private ImageView mIvBack;
30 - private RecyclerView mRecyclerCoupons ,mRecyclerBurntCoupons; 34 + private RecyclerView mRecyclerCoupons, mRecyclerBurntCoupons;
31 private HomeCouponAdapter mAdapterCoupons, mAdapterBurntCoupons; 35 private HomeCouponAdapter mAdapterCoupons, mAdapterBurntCoupons;
36 + private Spinner mCouponSpinner, mRedemptionSpinner;
32 37
33 // =========================================================== 38 // ===========================================================
34 // Methods for/from SuperClass/Interfaces 39 // Methods for/from SuperClass/Interfaces
...@@ -43,6 +48,8 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener { ...@@ -43,6 +48,8 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
43 48
44 mRecyclerCoupons = findViewById(R.id.rv_loyalty_coupons); 49 mRecyclerCoupons = findViewById(R.id.rv_loyalty_coupons);
45 mRecyclerBurntCoupons = findViewById(R.id.rv_loyalty_burnt_coupons); 50 mRecyclerBurntCoupons = findViewById(R.id.rv_loyalty_burnt_coupons);
51 + mCouponSpinner = findViewById(R.id.sp_coupons);
52 + mRedemptionSpinner = findViewById(R.id.sp_redemption);
46 53
47 initViews(); 54 initViews();
48 } 55 }
...@@ -59,6 +66,16 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener { ...@@ -59,6 +66,16 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
59 } 66 }
60 } 67 }
61 68
69 + @Override
70 + public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
71 + // parent.getItemAtPosition(pos)
72 + }
73 +
74 + @Override
75 + public void onNothingSelected(AdapterView<?> parent) {
76 +
77 + }
78 +
62 // =========================================================== 79 // ===========================================================
63 // Methods 80 // Methods
64 // =========================================================== 81 // ===========================================================
...@@ -90,6 +107,18 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener { ...@@ -90,6 +107,18 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
90 mRecyclerBurntCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)); 107 mRecyclerBurntCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
91 mAdapterBurntCoupons = new HomeCouponAdapter(this, clist, true); 108 mAdapterBurntCoupons = new HomeCouponAdapter(this, clist, true);
92 mRecyclerBurntCoupons.setAdapter(mAdapterBurntCoupons); 109 mRecyclerBurntCoupons.setAdapter(mAdapterBurntCoupons);
110 +
111 + ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
112 + R.array.coupons_array, R.layout.spinner_item);
113 + adapter.setDropDownViewResource(R.layout.spinner_dropdown_item_grey);
114 + mCouponSpinner.setAdapter(adapter);
115 + mCouponSpinner.setOnItemSelectedListener(this);
116 +
117 + ArrayAdapter<CharSequence> adapter2 = ArrayAdapter.createFromResource(this,
118 + R.array.redemption_array, R.layout.spinner_item);
119 + adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item_sky_blue);
120 + mRedemptionSpinner.setAdapter(adapter2);
121 + mRedemptionSpinner.setOnItemSelectedListener(this);
93 } 122 }
94 123
95 // =========================================================== 124 // ===========================================================
......
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item>
4 + <shape android:shape="rectangle">
5 + <gradient
6 + android:angle="91"
7 + android:endColor="#C4F187"
8 + android:startColor="#8EF593" />
9 +
10 + </shape>
11 + </item>
12 +
13 + <item android:bottom="4dp">
14 + <shape android:shape="rectangle">
15 + <solid android:color="@android:color/white" />
16 + </shape>
17 + </item>
18 +
19 +</layer-list>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item>
4 + <shape android:shape="rectangle">
5 + <gradient
6 + android:angle="91"
7 + android:endColor="@android:color/transparent"
8 + android:startColor="@android:color/transparent" />
9 +
10 + </shape>
11 + </item>
12 +
13 + <item android:bottom="4dp">
14 + <shape android:shape="rectangle">
15 + <solid android:color="@android:color/white" />
16 + </shape>
17 + </item>
18 +
19 +</layer-list>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item android:state_selected="false">
4 + <layer-list>
5 + <item>
6 + <shape>
7 + <solid android:color="#F5F5F5" />
8 + <corners android:radius="8dp" />
9 + <padding
10 + android:left="5dp"
11 + android:top="5dp"
12 + android:right="5dp"
13 + android:bottom="5dp" />
14 + </shape>
15 + </item>
16 +
17 + <item>
18 + <bitmap android:gravity="center_vertical|right" android:src="@drawable/ic_down" />
19 + </item>
20 + </layer-list>
21 + </item>
22 +
23 + <item android:state_selected="true">
24 + <layer-list>
25 + <item>
26 + <shape>
27 + <solid android:color="#F5F5F5" />
28 + <corners android:radius="8dp" />
29 + </shape>
30 + </item>
31 +
32 + <item>
33 + <bitmap android:gravity="center_vertical|right" android:src="@drawable/ic_up" />
34 + </item>
35 + </layer-list>
36 + </item>
37 +</selector>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:shape="rectangle">
4 + <corners android:radius="11dp" />
5 +
6 + <solid android:color="#F5F5F5" />
7 +</shape>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:shape="rectangle">
4 + <corners android:radius="11dp" />
5 +
6 + <solid android:color="#EEF7FF" />
7 +</shape>
...\ No newline at end of file ...\ No newline at end of file
...@@ -136,13 +136,76 @@ ...@@ -136,13 +136,76 @@
136 </RelativeLayout> 136 </RelativeLayout>
137 137
138 <RelativeLayout 138 <RelativeLayout
139 + android:id="@+id/rl_analysis_row"
140 + android:layout_width="match_parent"
141 + android:layout_height="wrap_content"
142 + android:layout_marginTop="40dp"
143 + app:layout_constraintEnd_toEndOf="parent"
144 + app:layout_constraintStart_toStartOf="parent"
145 + app:layout_constraintTop_toBottomOf="@+id/rl_gifts_row">
146 +
147 + <TextView
148 + android:id="@+id/tv_analysis_loyalty_title"
149 + android:layout_width="wrap_content"
150 + android:layout_height="wrap_content"
151 + android:layout_marginStart="10dp"
152 + android:text="Ανάλυση"
153 + android:textColor="@color/grey"
154 + android:textSize="18sp"
155 + android:textStyle="bold" />
156 +
157 + <RelativeLayout
158 + android:layout_width="match_parent"
159 + android:layout_height="wrap_content"
160 + android:layout_below="@+id/tv_analysis_loyalty_title"
161 + android:layout_marginHorizontal="16dp"
162 + android:layout_marginTop="24dp"
163 + android:background="@drawable/shape_cos_white"
164 + android:paddingHorizontal="16dp"
165 + android:paddingVertical="24dp">
166 +
167 + <Spinner
168 + android:id="@+id/sp_coupons"
169 + android:layout_width="match_parent"
170 + android:layout_height="60dp"
171 + android:layout_centerHorizontal="true"
172 + android:background="@drawable/shape_cos_grey"
173 + android:dropDownVerticalOffset="62dp"
174 + android:popupBackground="@drawable/shape_cos_grey"
175 + android:popupElevation="1dp"
176 + android:spinnerMode="dropdown" />
177 +
178 + <include
179 + android:id="@+id/cl_tab_analysis"
180 + layout="@layout/tab_analysis"
181 + android:layout_width="match_parent"
182 + android:layout_height="wrap_content"
183 + android:layout_below="@+id/sp_coupons"
184 + android:layout_marginTop="32dp" />
185 +
186 + <Spinner
187 + android:id="@+id/sp_redemption"
188 + android:layout_width="match_parent"
189 + android:layout_height="60dp"
190 + android:layout_below="@+id/cl_tab_analysis"
191 + android:layout_centerHorizontal="true"
192 + android:layout_marginTop="32dp"
193 + android:background="@drawable/shape_cos_sky_blue"
194 + android:dropDownVerticalOffset="62dp"
195 + android:popupBackground="@drawable/shape_cos_sky_blue"
196 + android:popupElevation="1dp"
197 + android:spinnerMode="dropdown" />
198 + </RelativeLayout>
199 + </RelativeLayout>
200 +
201 + <RelativeLayout
139 android:id="@+id/rl_burnt_coupons_row" 202 android:id="@+id/rl_burnt_coupons_row"
140 android:layout_width="match_parent" 203 android:layout_width="match_parent"
141 android:layout_height="wrap_content" 204 android:layout_height="wrap_content"
142 android:layout_marginTop="32dp" 205 android:layout_marginTop="32dp"
143 app:layout_constraintEnd_toEndOf="parent" 206 app:layout_constraintEnd_toEndOf="parent"
144 app:layout_constraintStart_toStartOf="parent" 207 app:layout_constraintStart_toStartOf="parent"
145 - app:layout_constraintTop_toBottomOf="@+id/rl_gifts_row"> 208 + app:layout_constraintTop_toBottomOf="@+id/rl_analysis_row">
146 209
147 <TextView 210 <TextView
148 android:id="@+id/tv_burnt_coupons_loyalty_title" 211 android:id="@+id/tv_burnt_coupons_loyalty_title"
......
1 +<?xml version="1.0" encoding="utf-8"?><!--
2 +/* //device/apps/common/assets/res/any/layout/simple_spinner_item.xml
3 +**
4 +** Copyright 2008, The Android Open Source Project
5 +**
6 +** Licensed under the Apache License, Version 2.0 (the "License")
7 +** you may not use this file except in compliance with the License.
8 +** You may obtain a copy of the License at
9 +**
10 +** http://www.apache.org/licenses/LICENSE-2.0
11 +**
12 +** Unless required by applicable law or agreed to in writing, software
13 +** distributed under the License is distributed on an "AS IS" BASIS,
14 +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 +** See the License for the specific language governing permissions and
16 +** limitations under the License.
17 +*/
18 +-->
19 +<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
20 + xmlns:tools="http://schemas.android.com/tools"
21 + android:id="@android:id/text1"
22 + android:layout_width="match_parent"
23 + android:layout_height="60dp"
24 + android:ellipsize="marquee"
25 + android:gravity="center"
26 + android:singleLine="true"
27 + android:textColor="#3C3B48"
28 + android:textSize="16sp"
29 + tools:text="Test Spinner Dropdown" />
1 +<?xml version="1.0" encoding="utf-8"?><!--
2 +/* //device/apps/common/assets/res/any/layout/simple_spinner_item.xml
3 +**
4 +** Copyright 2008, The Android Open Source Project
5 +**
6 +** Licensed under the Apache License, Version 2.0 (the "License")
7 +** you may not use this file except in compliance with the License.
8 +** You may obtain a copy of the License at
9 +**
10 +** http://www.apache.org/licenses/LICENSE-2.0
11 +**
12 +** Unless required by applicable law or agreed to in writing, software
13 +** distributed under the License is distributed on an "AS IS" BASIS,
14 +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 +** See the License for the specific language governing permissions and
16 +** limitations under the License.
17 +*/
18 +-->
19 +<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
20 + xmlns:tools="http://schemas.android.com/tools"
21 + android:id="@android:id/text1"
22 + android:layout_width="match_parent"
23 + android:layout_height="60dp"
24 + android:ellipsize="marquee"
25 + android:gravity="center"
26 + android:singleLine="true"
27 + android:textColor="#3C3B48"
28 + android:textSize="16sp"
29 + tools:text="Test Spinner Dropdown" />
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<TextView xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:tools="http://schemas.android.com/tools"
4 + android:id="@android:id/text1"
5 + android:layout_width="match_parent"
6 + android:layout_height="wrap_content"
7 + android:ellipsize="marquee"
8 + android:singleLine="true"
9 + android:drawableEnd="@drawable/ic_down"
10 + android:paddingHorizontal="16dp"
11 + android:textAlignment="inherit"
12 + android:textColor="#3C3B48"
13 + android:textSize="16sp"
14 + android:textStyle="bold"
15 + tools:text="Test Spinner" />
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 + android:layout_width="match_parent"
5 + android:layout_height="wrap_content">
6 +
7 + <TextView
8 + android:id="@+id/tv_month"
9 + android:layout_width="wrap_content"
10 + android:layout_height="wrap_content"
11 + android:background="@drawable/bottom_border_gradient"
12 + android:text="ΜΗΝΙΑΙΑ"
13 + android:textColor="@color/grey"
14 + android:textSize="18sp"
15 + android:textStyle="bold"
16 + app:layout_constraintBottom_toBottomOf="parent"
17 + app:layout_constraintHorizontal_bias="0.0"
18 + app:layout_constraintStart_toStartOf="parent"
19 + app:layout_constraintTop_toTopOf="parent" />
20 +
21 + <TextView
22 + android:id="@+id/tv_six_month"
23 + android:layout_width="wrap_content"
24 + android:layout_height="wrap_content"
25 + android:background="@drawable/bottom_border_transparent"
26 + android:text="6ΜΗΝΟ"
27 + android:textColor="@color/grey"
28 + android:textSize="18sp"
29 + android:textStyle="bold"
30 + app:layout_constraintBottom_toBottomOf="parent"
31 + app:layout_constraintEnd_toStartOf="@+id/tv_twelve_month"
32 + app:layout_constraintStart_toEndOf="@+id/tv_month"
33 + app:layout_constraintTop_toTopOf="parent" />
34 +
35 + <TextView
36 + android:id="@+id/tv_twelve_month"
37 + android:layout_width="wrap_content"
38 + android:layout_height="wrap_content"
39 + android:background="@drawable/bottom_border_transparent"
40 + android:text="12ΜΗΝΟ"
41 + android:textColor="@color/grey"
42 + android:textSize="18sp"
43 + android:textStyle="bold"
44 + app:layout_constraintBottom_toBottomOf="parent"
45 + app:layout_constraintEnd_toEndOf="parent"
46 + app:layout_constraintTop_toTopOf="parent" />
47 +</androidx.constraintlayout.widget.ConstraintLayout>
...\ No newline at end of file ...\ No newline at end of file
...@@ -24,4 +24,14 @@ ...@@ -24,4 +24,14 @@
24 <string name="cos_questionnaire">Ερωτηματολόγιο</string> 24 <string name="cos_questionnaire">Ερωτηματολόγιο</string>
25 <string name="cos_gifts_loyalty_title">Τα δώρα μου</string> 25 <string name="cos_gifts_loyalty_title">Τα δώρα μου</string>
26 <string name="cos_coupons_loyalty_title">Ενεργά κουπόνια</string> 26 <string name="cos_coupons_loyalty_title">Ενεργά κουπόνια</string>
27 +
28 + <string-array name="coupons_array">
29 + <item>Κουπόνια</item>
30 + <item>Δώρα</item>
31 + </string-array>
32 +
33 + <string-array name="redemption_array">
34 + <item>Εξαργύρωση</item>
35 + <item>Επιστροφή</item>
36 + </string-array>
27 </resources> 37 </resources>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -28,4 +28,8 @@ ...@@ -28,4 +28,8 @@
28 <item name="android:textSize">14sp</item> 28 <item name="android:textSize">14sp</item>
29 </style> 29 </style>
30 30
31 + <style name="SpinnerTheme" parent="android:Widget.Spinner">
32 + <item name="android:background">@drawable/selector_spinner_arrow</item>
33 + </style>
34 +
31 </resources> 35 </resources>
...\ No newline at end of file ...\ No newline at end of file
......