|
|
@@ -13,7 +13,9 @@ import android.os.Handler;
|
|
|
import android.os.StrictMode;
|
|
|
import android.provider.Settings;
|
|
|
import android.view.View;
|
|
|
+import android.widget.EditText;
|
|
|
|
|
|
+import com.qy.agv.R;
|
|
|
import com.qy.agv.activity.model.EventMessage;
|
|
|
import com.qy.agv.comm.BaseActivity;
|
|
|
import com.qy.agv.comm.CacheService;
|
|
|
@@ -43,6 +45,8 @@ public class RobotInfoActivity extends BaseActivity {
|
|
|
private Context context;
|
|
|
private QyRobotInfoBinding binding;
|
|
|
private HashMap<String,String> mHashMap;
|
|
|
+ private EditText inputServer;
|
|
|
+ public AlertDialog dialog;
|
|
|
|
|
|
@Override
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
@@ -57,6 +61,7 @@ public class RobotInfoActivity extends BaseActivity {
|
|
|
|
|
|
@SuppressLint("ClickableViewAccessibility")
|
|
|
public void init(){
|
|
|
+ inputServer = new EditText(this);
|
|
|
if(Constant.user!=null) {
|
|
|
binding.tvLoginName.setText(Constant.user.getReal_name());
|
|
|
}else{
|
|
|
@@ -71,7 +76,9 @@ public class RobotInfoActivity extends BaseActivity {
|
|
|
binding.exit.setOnClickListener(view->{
|
|
|
myLogout();
|
|
|
});
|
|
|
+ binding.tvIp.setVisibility(View.GONE);
|
|
|
binding.tvIp.setText(Constant.server_ip);
|
|
|
+ updateIP();
|
|
|
}
|
|
|
|
|
|
private void updateApp(){
|
|
|
@@ -124,6 +131,36 @@ public class RobotInfoActivity extends BaseActivity {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ private void updateIP(){
|
|
|
+ binding.tvIp.setOnLongClickListener(view->{
|
|
|
+ AlertDialog.Builder builder = new AlertDialog.Builder(context)
|
|
|
+ .setTitle("设置IP")
|
|
|
+ .setIcon(R.mipmap.logo)
|
|
|
+ .setView(inputServer)
|
|
|
+ .setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
+ dialog.dismiss();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .setPositiveButton(getString(R.string.sure), null);
|
|
|
+ if(dialog==null){
|
|
|
+ dialog = builder.show();
|
|
|
+ }else{
|
|
|
+ inputServer.setText(binding.tvIp.getText().toString());
|
|
|
+ dialog.show();
|
|
|
+ }
|
|
|
+ dialog.getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
|
|
|
+ public void onClick(View v){
|
|
|
+ Constant.server_ip = inputServer.getText().toString();
|
|
|
+ ToastUtils.showToast(context, "设置成功");
|
|
|
+ dialog.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void receiverTask(String barcode) {
|
|
|
|