Panagiotis Triantafyllou

loyalty profile wip3

......@@ -3,7 +3,10 @@ package ly.warp.sdk.activities;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.Spinner;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
......@@ -16,7 +19,8 @@ import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.views.adapters.HomeCouponAdapter;
public class LoyaltyActivity extends Activity implements View.OnClickListener {
public class LoyaltyActivity extends Activity implements View.OnClickListener,
AdapterView.OnItemSelectedListener {
// ===========================================================
// Constants
......@@ -27,8 +31,9 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
// ===========================================================
private ImageView mIvBack;
private RecyclerView mRecyclerCoupons ,mRecyclerBurntCoupons;
private RecyclerView mRecyclerCoupons, mRecyclerBurntCoupons;
private HomeCouponAdapter mAdapterCoupons, mAdapterBurntCoupons;
private Spinner mCouponSpinner, mRedemptionSpinner;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -43,6 +48,8 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
mRecyclerCoupons = findViewById(R.id.rv_loyalty_coupons);
mRecyclerBurntCoupons = findViewById(R.id.rv_loyalty_burnt_coupons);
mCouponSpinner = findViewById(R.id.sp_coupons);
mRedemptionSpinner = findViewById(R.id.sp_redemption);
initViews();
}
......@@ -59,6 +66,16 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
}
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
// parent.getItemAtPosition(pos)
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
// ===========================================================
// Methods
// ===========================================================
......@@ -90,6 +107,18 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
mRecyclerBurntCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
mAdapterBurntCoupons = new HomeCouponAdapter(this, clist, true);
mRecyclerBurntCoupons.setAdapter(mAdapterBurntCoupons);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.coupons_array, R.layout.spinner_item);
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item_grey);
mCouponSpinner.setAdapter(adapter);
mCouponSpinner.setOnItemSelectedListener(this);
ArrayAdapter<CharSequence> adapter2 = ArrayAdapter.createFromResource(this,
R.array.redemption_array, R.layout.spinner_item);
adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item_sky_blue);
mRedemptionSpinner.setAdapter(adapter2);
mRedemptionSpinner.setOnItemSelectedListener(this);
}
// ===========================================================
......
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:angle="91"
android:endColor="#C4F187"
android:startColor="#8EF593" />
</shape>
</item>
<item android:bottom="4dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white" />
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:angle="91"
android:endColor="@android:color/transparent"
android:startColor="@android:color/transparent" />
</shape>
</item>
<item android:bottom="4dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white" />
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="false">
<layer-list>
<item>
<shape>
<solid android:color="#F5F5F5" />
<corners android:radius="8dp" />
<padding
android:left="5dp"
android:top="5dp"
android:right="5dp"
android:bottom="5dp" />
</shape>
</item>
<item>
<bitmap android:gravity="center_vertical|right" android:src="@drawable/ic_down" />
</item>
</layer-list>
</item>
<item android:state_selected="true">
<layer-list>
<item>
<shape>
<solid android:color="#F5F5F5" />
<corners android:radius="8dp" />
</shape>
</item>
<item>
<bitmap android:gravity="center_vertical|right" android:src="@drawable/ic_up" />
</item>
</layer-list>
</item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="11dp" />
<solid android:color="#F5F5F5" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="11dp" />
<solid android:color="#EEF7FF" />
</shape>
\ No newline at end of file
......@@ -136,13 +136,76 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_analysis_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rl_gifts_row">
<TextView
android:id="@+id/tv_analysis_loyalty_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="Ανάλυση"
android:textColor="@color/grey"
android:textSize="18sp"
android:textStyle="bold" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_analysis_loyalty_title"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="24dp"
android:background="@drawable/shape_cos_white"
android:paddingHorizontal="16dp"
android:paddingVertical="24dp">
<Spinner
android:id="@+id/sp_coupons"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:background="@drawable/shape_cos_grey"
android:dropDownVerticalOffset="62dp"
android:popupBackground="@drawable/shape_cos_grey"
android:popupElevation="1dp"
android:spinnerMode="dropdown" />
<include
android:id="@+id/cl_tab_analysis"
layout="@layout/tab_analysis"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/sp_coupons"
android:layout_marginTop="32dp" />
<Spinner
android:id="@+id/sp_redemption"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="@+id/cl_tab_analysis"
android:layout_centerHorizontal="true"
android:layout_marginTop="32dp"
android:background="@drawable/shape_cos_sky_blue"
android:dropDownVerticalOffset="62dp"
android:popupBackground="@drawable/shape_cos_sky_blue"
android:popupElevation="1dp"
android:spinnerMode="dropdown" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_burnt_coupons_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rl_gifts_row">
app:layout_constraintTop_toBottomOf="@+id/rl_analysis_row">
<TextView
android:id="@+id/tv_burnt_coupons_loyalty_title"
......
<?xml version="1.0" encoding="utf-8"?><!--
/* //device/apps/common/assets/res/any/layout/simple_spinner_item.xml
**
** Copyright 2008, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License")
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="60dp"
android:ellipsize="marquee"
android:gravity="center"
android:singleLine="true"
android:textColor="#3C3B48"
android:textSize="16sp"
tools:text="Test Spinner Dropdown" />
<?xml version="1.0" encoding="utf-8"?><!--
/* //device/apps/common/assets/res/any/layout/simple_spinner_item.xml
**
** Copyright 2008, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License")
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="60dp"
android:ellipsize="marquee"
android:gravity="center"
android:singleLine="true"
android:textColor="#3C3B48"
android:textSize="16sp"
tools:text="Test Spinner Dropdown" />
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:drawableEnd="@drawable/ic_down"
android:paddingHorizontal="16dp"
android:textAlignment="inherit"
android:textColor="#3C3B48"
android:textSize="16sp"
android:textStyle="bold"
tools:text="Test Spinner" />
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bottom_border_gradient"
android:text="ΜΗΝΙΑΙΑ"
android:textColor="@color/grey"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_six_month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bottom_border_transparent"
android:text="6ΜΗΝΟ"
android:textColor="@color/grey"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/tv_twelve_month"
app:layout_constraintStart_toEndOf="@+id/tv_month"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_twelve_month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bottom_border_transparent"
android:text="12ΜΗΝΟ"
android:textColor="@color/grey"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -24,4 +24,14 @@
<string name="cos_questionnaire">Ερωτηματολόγιο</string>
<string name="cos_gifts_loyalty_title">Τα δώρα μου</string>
<string name="cos_coupons_loyalty_title">Ενεργά κουπόνια</string>
<string-array name="coupons_array">
<item>Κουπόνια</item>
<item>Δώρα</item>
</string-array>
<string-array name="redemption_array">
<item>Εξαργύρωση</item>
<item>Επιστροφή</item>
</string-array>
</resources>
\ No newline at end of file
......
......@@ -28,4 +28,8 @@
<item name="android:textSize">14sp</item>
</style>
<style name="SpinnerTheme" parent="android:Widget.Spinner">
<item name="android:background">@drawable/selector_spinner_arrow</item>
</style>
</resources>
\ No newline at end of file
......