|
@@ -3,6 +3,8 @@ package com.example.informationkanban;
|
|
|
import android.app.AlertDialog;
|
|
|
import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
+import android.content.pm.PackageInfo;
|
|
|
+import android.content.pm.PackageManager;
|
|
|
import android.graphics.Color;
|
|
|
import android.os.Build;
|
|
|
import android.os.Bundle;
|
|
@@ -17,6 +19,7 @@ import android.view.Window;
|
|
|
import android.view.WindowManager;
|
|
|
import android.widget.Button;
|
|
|
import android.widget.EditText;
|
|
|
+import android.widget.LinearLayout;
|
|
|
import android.widget.RadioButton;
|
|
|
import android.widget.RadioGroup;
|
|
|
import android.widget.TextView;
|
|
@@ -31,6 +34,9 @@ import com.example.informationkanban.utils.LanguageSetDialogHelper;
|
|
|
import com.example.informationkanban.utils.LocaleMangerUtils;
|
|
|
import com.example.informationkanban.utils.NetFunctionConfig;
|
|
|
|
|
|
+import java.security.acl.Group;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
public class InitActivity extends AppCompatActivity {
|
|
|
|
|
|
private TextView tvMac;
|
|
@@ -39,6 +45,7 @@ public class InitActivity extends AppCompatActivity {
|
|
|
private TextView tvServerStatus;
|
|
|
private TextView tvVersion;
|
|
|
private TextView tvTime;
|
|
|
+ private TextView tvType;
|
|
|
private RadioGroup group;
|
|
|
private RadioButton btnWebview;
|
|
|
private RadioButton btnXwalk;
|
|
@@ -82,6 +89,7 @@ public class InitActivity extends AppCompatActivity {
|
|
|
//设置分辨率为
|
|
|
Log.e("kanban", "set screen size: 1920x1080");
|
|
|
AppUtil.setScreenSize(1920, 1080);
|
|
|
+ //AppUtil.resetScreenSize();
|
|
|
}
|
|
|
|
|
|
tvMac = findViewById(R.id.textView_mac);
|
|
@@ -98,6 +106,7 @@ public class InitActivity extends AppCompatActivity {
|
|
|
btnSettings = findViewById(R.id.btn_settings);
|
|
|
btnEnterMain = findViewById(R.id.btn_enter_main);
|
|
|
btnLanguageSet = findViewById(R.id.btn_change_language);
|
|
|
+ tvType = findViewById(R.id.tv_info_type);
|
|
|
|
|
|
//webview类型,默认为原生webview
|
|
|
if (NetFunctionConfig.getWebviewType() == 1) {
|
|
@@ -106,7 +115,7 @@ public class InitActivity extends AppCompatActivity {
|
|
|
btnXwalk.setChecked(true);
|
|
|
}
|
|
|
|
|
|
- tvServer.setText("Server: " + NetFunctionConfig.getServerIp() + ":" + NetFunctionConfig.getServerPort());
|
|
|
+ //tvServer.setText("Server: " + NetFunctionConfig.getServerIp() + ":" + NetFunctionConfig.getServerPort());
|
|
|
|
|
|
group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
|
|
@Override
|
|
@@ -203,15 +212,64 @@ public class InitActivity extends AppCompatActivity {
|
|
|
editIp.setText(NetFunctionConfig.getServerIp());
|
|
|
final EditText editPort = contentView.findViewById(R.id.edit_server_port);
|
|
|
editPort.setText(NetFunctionConfig.getServerPort());
|
|
|
+ final LinearLayout llServerIp = contentView.findViewById(R.id.ll_server_ip);
|
|
|
+ final LinearLayout llServerPort = contentView.findViewById(R.id.ll_server_port);
|
|
|
+ final LinearLayout llPart = contentView.findViewById(R.id.ll_part_id);
|
|
|
+
|
|
|
+ final RadioGroup mode = contentView.findViewById(R.id.group_type);
|
|
|
+ RadioButton yy = contentView.findViewById(R.id.rb_yiyuan);
|
|
|
+ RadioButton yl = contentView.findViewById(R.id.rb_yanglao);
|
|
|
+ EditText part = contentView.findViewById(R.id.edit_part_id);
|
|
|
+ part.setText(NetFunctionConfig.getPartId());
|
|
|
+
|
|
|
+ if (NetFunctionConfig.getMode() == 2) {
|
|
|
+ yl.setChecked(true);
|
|
|
+ llServerIp.setVisibility(View.GONE);
|
|
|
+ llServerPort.setVisibility(View.GONE);
|
|
|
+ llPart.setVisibility(View.VISIBLE);
|
|
|
+ } else {
|
|
|
+ yy.setChecked(true);
|
|
|
+ llServerIp.setVisibility(View.VISIBLE);
|
|
|
+ llServerPort.setVisibility(View.VISIBLE);
|
|
|
+ llPart.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+
|
|
|
+ mode.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onCheckedChanged(RadioGroup group, int checkedId) {
|
|
|
+ if (checkedId == R.id.rb_yanglao) {
|
|
|
+ NetFunctionConfig.setMode(2);
|
|
|
+ llServerIp.setVisibility(View.GONE);
|
|
|
+ llServerPort.setVisibility(View.GONE);
|
|
|
+ llPart.setVisibility(View.VISIBLE);
|
|
|
+ } else {
|
|
|
+ NetFunctionConfig.setMode(1);
|
|
|
+ llServerIp.setVisibility(View.VISIBLE);
|
|
|
+ llServerPort.setVisibility(View.VISIBLE);
|
|
|
+ llPart.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
builder.setTitle(R.string.str_set_server_ip);
|
|
|
builder.setPositiveButton(R.string.str_save, new DialogInterface.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
String newIp = editIp.getText().toString();
|
|
|
String newPort = editPort.getText().toString();
|
|
|
+ String partId = part.getText().toString();
|
|
|
NetFunctionConfig.setServerIp(newIp);
|
|
|
NetFunctionConfig.setServerPort(newPort);
|
|
|
+ NetFunctionConfig.setPartId(partId);
|
|
|
tvServer.setText("Server: " + newIp + ":" + newPort);
|
|
|
+
|
|
|
+ if (NetFunctionConfig.getMode() == 2) {
|
|
|
+ tvType.setText(R.string.type_pension);
|
|
|
+ tvServer.setVisibility(View.INVISIBLE);
|
|
|
+ } else {
|
|
|
+ tvType.setText(R.string.type_hospital);
|
|
|
+ tvServer.setVisibility(View.VISIBLE);
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -250,20 +308,25 @@ public class InitActivity extends AppCompatActivity {
|
|
|
public void run() {
|
|
|
while (loop) {
|
|
|
updateView();
|
|
|
- if (NetworkUtils.isAvailableByPing(NetFunctionConfig.getServerIp())) {
|
|
|
+ if (NetFunctionConfig.getMode() == 2) {
|
|
|
loop = false;
|
|
|
- showServerStatus(true);
|
|
|
- if (!connected) {
|
|
|
- connected = true;
|
|
|
- startMain();
|
|
|
- }
|
|
|
+ startMain();
|
|
|
} else {
|
|
|
- showServerStatus(false);
|
|
|
- showMessage();
|
|
|
- try {
|
|
|
- Thread.sleep(10000);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ if (NetworkUtils.isAvailableByPing(NetFunctionConfig.getServerIp())) {
|
|
|
+ loop = false;
|
|
|
+ showServerStatus(true);
|
|
|
+ if (!connected) {
|
|
|
+ connected = true;
|
|
|
+ startMain();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ showServerStatus(false);
|
|
|
+ showMessage();
|
|
|
+ try {
|
|
|
+ Thread.sleep(10000);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -275,7 +338,14 @@ public class InitActivity extends AppCompatActivity {
|
|
|
new Thread(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
- if (NetworkUtils.isAvailableByPing(NetFunctionConfig.getServerIp())) {
|
|
|
+ String server;
|
|
|
+ if (NetFunctionConfig.getMode() == 2) {
|
|
|
+ server = "t.wdklchina.com";
|
|
|
+ } else {
|
|
|
+ server = NetFunctionConfig.getServerIp();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (NetworkUtils.isAvailableByPing(server)) {
|
|
|
showServerStatus(true);
|
|
|
} else {
|
|
|
showServerStatus(false);
|
|
@@ -309,6 +379,13 @@ public class InitActivity extends AppCompatActivity {
|
|
|
tvMac.setText("Device ID: " + GetInformationUtils.getSerialNo(getApplicationContext()));
|
|
|
tvIP.setText("Local IP: " + GetInformationUtils.getLocalIP());
|
|
|
tvServer.setText("Server IP: " + NetFunctionConfig.getServerIp() + ":" + NetFunctionConfig.getServerPort());
|
|
|
+ if (NetFunctionConfig.getMode() == 2) {
|
|
|
+ tvType.setText(R.string.type_pension);
|
|
|
+ tvServer.setVisibility(View.INVISIBLE);
|
|
|
+ } else {
|
|
|
+ tvType.setText(R.string.type_hospital);
|
|
|
+ tvServer.setVisibility(View.VISIBLE);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|