package com.example.shengwutanzhen;

import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class ConfirmActivity extends AppCompatActivity {

    private String uuid, gesture, gesture_phone;
    private TextView show_uuid_confirm, show_gesture_confirm, show_gesture_phone_confirm;

    private Button btn_cancel, btn_confirm;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_confirm);
        initView();
        Bundle bundle = getIntent().getExtras();
        assert bundle != null;
        uuid = bundle.getString("uuid");
        gesture = bundle.getString("gesture");
        gesture_phone = bundle.getString("gesture_phone");

        show_uuid_confirm.setText(uuid);
        show_uuid_confirm.setTextSize(25);
        show_uuid_confirm.setTextColor(getResources().getColor(R.color.text_color));

        show_gesture_confirm.setText(gesture);
        show_gesture_confirm.setTextSize(25);
        show_gesture_confirm.setTextColor(getResources().getColor(R.color.text_color));

        show_gesture_phone_confirm.setText(gesture_phone);
        show_gesture_phone_confirm.setTextSize(25);
        show_gesture_phone_confirm.setTextColor(getResources().getColor(R.color.text_color));

        setListener();

    }

    private void initView(){
        show_uuid_confirm = findViewById(R.id.show_uuid_confirm);
        show_gesture_confirm = findViewById(R.id.show_gesture_confirm);
        show_gesture_phone_confirm = findViewById(R.id.show_gesture_phone_confirm);
        btn_cancel = findViewById(R.id.btn_cancel);
        btn_confirm = findViewById(R.id.btn_confirm);
    }

    private void setListener() {
        btn_cancel.setOnClickListener(view -> {
            onBackPressed();
        });
        btn_confirm.setOnClickListener(view -> {
            Bundle bundle = new Bundle();
            bundle.putString("gesture", gesture);
            bundle.putString("uuid",uuid);
            bundle.putString("gesture_phone", gesture_phone);
            Intent intent = new Intent(ConfirmActivity.this, MainActivity.class);
            intent.putExtras(bundle);
            startActivity(intent);
        });
    }
}