thkouk00

conditional rendering in loyalty dropdowns v2

......@@ -78,15 +78,13 @@ 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).findViewById(R.id.cl_inner_chart).setVisibility(View.GONE);
findViewById(R.id.cl_chart).findViewById(R.id.cl_inner_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);
......@@ -94,8 +92,8 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener,
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_chart).findViewById(R.id.cl_inner_chart).setVisibility(View.VISIBLE);
findViewById(R.id.cl_chart).findViewById(R.id.cl_inner_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);
......
......@@ -18,6 +18,14 @@
android:orientation="vertical"
app:layout_constraintGuide_percent="0.85" />
<include
android:id="@+id/piechart"
layout="@layout/cos_piechart2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/iv_chart"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_chart"
android:layout_width="0dp"
......
<?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="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" />
<include
android:id="@+id/cl_inner_chart"
layout="@layout/cos_piechart"
android:layout_width="200dp"
android:layout_height="200dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<include
android:id="@+id/cl_inner_chart2"
layout="@layout/cos_piechart2"
android:layout_width="200dp"
android:layout_height="200dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -63,7 +63,7 @@
<include
android:id="@+id/cl_chart"
layout="@layout/cos_piechart"
layout="@layout/cos_piechart_conditional_render"
android:layout_width="200dp"
android:layout_height="200dp"
app:layout_constraintEnd_toEndOf="parent"
......