package com.youra.qlicker.Acitvitys.EER.KYC;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.youra.qlicker.R;

public class KYCSitFamOneActivity extends AppCompatActivity {

    private CheckBox checkbox1,checkbox2 , checkbox3;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_kycsit_fam_one);

        ImageView btn_back = (ImageView) findViewById(R.id.img_back);
        TextView btn_next = (TextView) findViewById(R.id.btn_next);

          checkbox1 = (CheckBox)findViewById(R.id.checkbox_one);
          checkbox2  = (CheckBox)findViewById(R.id.checkbox_tow);
          checkbox3  = (CheckBox)findViewById(R.id.checkbox_tree);


        /// click btn for return previous activity
        btn_next.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                  startActivity(new Intent(KYCSitFamOneActivity.this, KYCSitFamTowActivity.class ));

            }
        });

        /// click btn for return previous activity
        btn_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                finish();
            }
        });

        //toggel checks box
        ToggelCheck();

    }

    /**
     * function is checked checkbox deslecte auther
     */
   private void ToggelCheck(){
       checkbox1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
           @Override
           public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
               if (isChecked){
                   checkbox2.setChecked( !isChecked);
                   checkbox3.setChecked( !isChecked);
               }

           }
       });
       checkbox2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
           @Override
           public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {


               if (isChecked){
                   checkbox1.setChecked( !isChecked);
                   checkbox3.setChecked( !isChecked);
               }

           }
       });
       checkbox3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
           @Override
           public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

               if (isChecked){
                   checkbox2.setChecked( !isChecked);
                   checkbox1.setChecked( !isChecked);
               }


           }
       });
    }
}