thkouk00

conditional rendering in loyalty dropdowns

......@@ -2,6 +2,7 @@ package ly.warp.sdk.activities;
import android.app.Activity;
import android.content.Intent;
import android.media.Image;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
......@@ -77,6 +78,34 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener,
@Override
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
// parent.getItemAtPosition(pos)
ImageView chartImg = findViewById(R.id.cl_chart).findViewById(R.id.iv_chart);
ImageView innerChartImg = findViewById(R.id.cl_chart).findViewById(R.id.iv_inner_chart);
if (parent.getId() == mCouponSpinner.getId()) {
if (pos == 1) {
mRedemptionSpinner.setVisibility(View.GONE);
findViewById(R.id.cl_tab_analysis).setVisibility(View.GONE);
findViewById(R.id.cl_chart).setVisibility(View.GONE);
// findViewById(R.id.cl_chart2).setVisibility(View.VISIBLE);
findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab).setVisibility(View.GONE);
findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab2).setVisibility(View.GONE);
findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab3).setVisibility(View.GONE);
findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab4).setVisibility(View.VISIBLE);
findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab5).setVisibility(View.VISIBLE);
} else {
mRedemptionSpinner.setVisibility(View.VISIBLE);
findViewById(R.id.cl_chart).setVisibility(View.VISIBLE);
// findViewById(R.id.cl_chart2).setVisibility(View.GONE);
findViewById(R.id.cl_tab_analysis).setVisibility(View.VISIBLE);
findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab).setVisibility(View.VISIBLE);
findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab2).setVisibility(View.VISIBLE);
findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab3).setVisibility(View.VISIBLE);
findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab4).setVisibility(View.GONE);
findViewById(R.id.cl_chart_info).findViewById(R.id.analysis_tab5).setVisibility(View.GONE);
}
} else {
}
}
@Override
......
......@@ -6,6 +6,7 @@
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/analysis_tab"
android:layout_width="match_parent"
android:layout_height="wrap_content">
......@@ -43,6 +44,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/analysis_tab2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="20dp">
......@@ -81,6 +83,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/analysis_tab3"
android:layout_width="match_parent"
android:layout_height="wrap_content">
......@@ -117,6 +120,84 @@
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/analysis_tab4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="20dp">
<ImageView
android:id="@+id/iv_chart_icon4"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_food"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="Γεύση"
android:textColor="#4D4C58"
android:textSize="15sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_chart_icon4"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="77%"
android:textColor="#00CB09"
android:textSize="17sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/analysis_tab5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="20dp">
<ImageView
android:id="@+id/iv_chart_icon5"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_bag"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="Shopping"
android:textColor="#4D4C58"
android:textSize="15sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_chart_icon5"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="23%"
android:textColor="#0072C9"
android:textSize="17sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tv_analysis_details"
android:layout_width="match_parent"
......
......@@ -29,6 +29,7 @@
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_inner_chart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_cosmote_logo"
......
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="200dp"
android:layout_height="200dp">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_vertical_15_guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.15" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_vertical_85_guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.85" />
<ImageView
android:id="@+id/iv_chart"
android:layout_width="0dp"
android:layout_height="0dp"
android:src="@drawable/ic_chart2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_inner_chart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/deals_for_you"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_85_guideline"
app:layout_constraintStart_toEndOf="@+id/gl_vertical_15_guideline"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.308" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="60dp"
android:layout_marginTop="12dp"
android:gravity="center"
android:text="έχεις κερδίσει"
android:textColor="#4D4C58"
android:textSize="12dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/iv_chart"
app:layout_constraintTop_toBottomOf="@+id/iv_inner_chart" />
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="12,00€"
android:textColor="#4D4C58"
android:textSize="18dp"
android:textFontWeight="1000"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/iv_chart"
app:layout_constraintHorizontal_bias="0.503"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView4"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -29,7 +29,7 @@
<string-array name="coupons_array">
<item>Κουπόνια</item>
<item>Δώρα</item>
<item>Deals for you</item>
</string-array>
<string-array name="redemption_array">
......