package com.example.calcutator.CalculatorMenu;

import android.content.Intent;
import android.os.Bundle;

import com.example.calcutator.Calculator1.Calculator_1_3;
import com.example.calcutator.Calculator1.Calculator_1_4;
import com.example.calcutator.Calculator2.Calculator_2_1;
import com.example.calcutator.Calculator1.Calculator_1_1;
import com.example.calcutator.R;

import androidx.appcompat.app.AppCompatActivity;

import android.view.View;
import android.widget.Button;
import android.widget.RadioGroup;

public class Bar_select extends AppCompatActivity {
    int gap=1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bar_select);
        Button sub = (Button)findViewById(R.id.numsend);
        final RadioGroup R_group=(RadioGroup)findViewById(R.id.Bar_Group);
        Intent intent = getIntent();
        final int m_select = intent.getExtras().getInt("menu");
        final int m_select2 = intent.getExtras().getInt("menu2");

        sub.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (m_select==1){
                    Intent intent = new Intent(getApplicationContext(), Calculator_1_1.class);
                    switch (R_group.getCheckedRadioButtonId()){
                        case R.id.Bar_1:
                            gap=1;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_2:
                            gap=2;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_3:
                            gap=3;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_4:
                            gap=4;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_5:
                            gap=5;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_6:
                            gap=6;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_7:
                            gap=7;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                }
                }else if(m_select==2){
                    Intent intent = new Intent(getApplicationContext(), Calculator_1_3.class);
                    switch (R_group.getCheckedRadioButtonId()){
                        case R.id.Bar_1:
                            gap=1;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_2:
                            gap=2;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_3:
                            gap=3;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_4:
                            gap=4;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_5:
                            gap=5;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_6:
                            gap=6;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_7:
                            gap=7;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                    }
                }else if(m_select==3){
                    Intent intent = new Intent(getApplicationContext(), Calculator_1_4.class);
                    switch (R_group.getCheckedRadioButtonId()){
                        case R.id.Bar_1:
                            gap=1;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_2:
                            gap=2;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_3:
                            gap=3;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_4:
                            gap=4;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_5:
                            gap=5;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_6:
                            gap=6;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_7:
                            gap=7;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                    }
                }



                if(m_select2==1){
                    Intent intent = new Intent(getApplicationContext(), Calculator_2_1.class);
                    switch (R_group.getCheckedRadioButtonId()){
                        case R.id.Bar_1:
                            gap=1;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_2:
                            gap=2;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_3:
                            gap=3;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_4:
                            gap=4;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_5:
                            gap=5;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_6:
                            gap=6;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                        case R.id.Bar_7:
                            gap=7;
                            intent.putExtra("bars",gap);
                            startActivity(intent);
                            break;
                    }
                }
            }
        });
    }



}
