package com.xplora.xpsettings.Activity;

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

import com.xplora.xpsettings.R;


public class GotoWiFiActivity extends BaseActivity {
    String mErrorContent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.select_activity);

        initData();
        initView();
    }

    private void initData() {
        Intent intent = getIntent();
        int errorType = intent.getIntExtra("INTENT_WIFI_ERROR", 0);
        mErrorContent = getResources().getStringArray(R.array.software_wifi_error_array)[errorType];
    }

    private void initView() {
        TextView mHintText = findViewById(R.id.hintText);
        Button button1 = findViewById(R.id.button1);
        Button button2 = findViewById(R.id.button2);

        if (mHintText != null)
            mHintText.setText(mErrorContent);
        if (button1 != null)
            button1.setText(R.string.button_gotowifi);
        if (button2 != null)
            button2.setText(R.string.button_cancel);

        if (button1 != null) {
            button1.setOnClickListener(v -> {
                Intent intent = new Intent(GotoWiFiActivity.this, WiFiActivity.class);
                startActivity(intent);
                //关闭本界面
                finish();
            });
        }

        if (button2 != null) {
            button2.setOnClickListener(v -> finish());
        }

    }
}