|
@@ -0,0 +1,149 @@
|
|
|
+package com.example.informationkanban;
|
|
|
+
|
|
|
+import android.content.Intent;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.os.Handler;
|
|
|
+import android.text.TextUtils;
|
|
|
+import android.view.View;
|
|
|
+import android.widget.Button;
|
|
|
+import android.widget.EditText;
|
|
|
+import android.widget.RadioButton;
|
|
|
+import android.widget.RadioGroup;
|
|
|
+import android.widget.TextView;
|
|
|
+
|
|
|
+import androidx.annotation.Nullable;
|
|
|
+import androidx.appcompat.app.AppCompatActivity;
|
|
|
+
|
|
|
+import com.example.informationkanban.utils.GetInformationUtils;
|
|
|
+import com.example.informationkanban.utils.NetFunctionConfig;
|
|
|
+
|
|
|
+public class InitActivity extends AppCompatActivity {
|
|
|
+
|
|
|
+ TextView tvMac;
|
|
|
+ TextView tvIP;
|
|
|
+ EditText editText;
|
|
|
+ RadioGroup group1;
|
|
|
+ RadioButton radioButton1;
|
|
|
+ RadioButton radioButton2;
|
|
|
+ RadioGroup group2;
|
|
|
+ RadioButton radioButton3;
|
|
|
+ RadioButton radioButton4;
|
|
|
+ RadioGroup group3;
|
|
|
+ RadioButton radioButton5;
|
|
|
+ RadioButton radioButton6;
|
|
|
+ Button btnSet;
|
|
|
+ Button btnSave;
|
|
|
+
|
|
|
+ private Handler handler;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+
|
|
|
+ setContentView(R.layout.init_layout);
|
|
|
+ init();
|
|
|
+
|
|
|
+ handler = new Handler(getMainLooper());
|
|
|
+ startMainDelay(15000);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void startMainDelay(long time) {
|
|
|
+ handler.postDelayed(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ Intent intent = new Intent(getApplicationContext(), XwalkMainActivity.class);
|
|
|
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
+ getApplicationContext().startActivity(intent);
|
|
|
+
|
|
|
+ InitActivity.this.finish();
|
|
|
+ }
|
|
|
+ }, time);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void init() {
|
|
|
+ tvMac = findViewById(R.id.tv_mac);
|
|
|
+ tvMac.setText("MAC地址: " + GetInformationUtils.getMacAddress(this));
|
|
|
+ tvIP = findViewById(R.id.tv_ip);
|
|
|
+ tvIP.setText("MAC地址: " + GetInformationUtils.getLocalIP());
|
|
|
+
|
|
|
+ editText = findViewById(R.id.edit_scale);
|
|
|
+ editText.setText(String.valueOf(NetFunctionConfig.getInitScale()));
|
|
|
+
|
|
|
+ group1 = findViewById(R.id.group_over_view);
|
|
|
+ radioButton1 = findViewById(R.id.over_view_yes);
|
|
|
+ radioButton2 = findViewById(R.id.over_view_no);
|
|
|
+ if (NetFunctionConfig.getOverView()) {
|
|
|
+ radioButton1.setChecked(true);
|
|
|
+ } else {
|
|
|
+ radioButton2.setChecked(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ group2 = findViewById(R.id.group_wide_view);
|
|
|
+ radioButton3 = findViewById(R.id.wide_view_yes);
|
|
|
+ radioButton4 = findViewById(R.id.wide_view_no);
|
|
|
+ if (NetFunctionConfig.getWideView()) {
|
|
|
+ radioButton3.setChecked(true);
|
|
|
+ } else {
|
|
|
+ radioButton4.setChecked(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ group3 = findViewById(R.id.group_support_zoom);
|
|
|
+ radioButton5 = findViewById(R.id.support_zoom_yes);
|
|
|
+ radioButton6 = findViewById(R.id.support_zoom_no);
|
|
|
+ if (NetFunctionConfig.getZoom()) {
|
|
|
+ radioButton5.setChecked(true);
|
|
|
+ } else {
|
|
|
+ radioButton6.setChecked(true);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ btnSet = findViewById(R.id.btn_set);
|
|
|
+ btnSave = findViewById(R.id.btn_save);
|
|
|
+
|
|
|
+ btnSet.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ handler.removeCallbacksAndMessages(null);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ btnSave.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ handler.removeCallbacksAndMessages(null);
|
|
|
+
|
|
|
+ if (!TextUtils.isEmpty(editText.getText().toString())
|
|
|
+ && TextUtils.isDigitsOnly(editText.getText().toString())) {
|
|
|
+ NetFunctionConfig.setInitScale(Integer.parseInt(editText.getText().toString()));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (group1.getCheckedRadioButtonId() == R.id.over_view_yes) {
|
|
|
+ NetFunctionConfig.setOverView(true);
|
|
|
+ } else {
|
|
|
+ NetFunctionConfig.setOverView(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (group2.getCheckedRadioButtonId() == R.id.wide_view_yes) {
|
|
|
+ NetFunctionConfig.setWideView(true);
|
|
|
+ } else {
|
|
|
+ NetFunctionConfig.setWideView(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (group3.getCheckedRadioButtonId() == R.id.support_zoom_yes) {
|
|
|
+ NetFunctionConfig.setZoom(true);
|
|
|
+ } else {
|
|
|
+ NetFunctionConfig.setZoom(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ startMainDelay(3000);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onDestroy() {
|
|
|
+ super.onDestroy();
|
|
|
+ handler.removeCallbacksAndMessages(null);
|
|
|
+ }
|
|
|
+}
|