Преглед изворни кода

新写入TCP,循环接收服务端消息,主界面ui修改

ChengJH пре 3 година
родитељ
комит
72ac3c3002

+ 105 - 79
app/src/main/java/com/uas/esop/activity/IndexActivity.java

@@ -8,6 +8,8 @@ import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.graphics.BitmapFactory;
 import android.graphics.drawable.BitmapDrawable;
+import android.os.Handler;
+import android.os.Message;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import android.support.v7.widget.DividerItemDecoration;
@@ -48,12 +50,11 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
 import com.chad.library.adapter.base.BaseViewHolder;
 import com.google.gson.Gson;
 import com.scwang.smartrefresh.layout.api.RefreshLayout;
-import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
 import com.uas.esop.R;
 import com.uas.esop.application.PdaApplication;
 import com.uas.esop.bean.Master;
-import com.uas.esop.bean.MoreEventBusBean;
 import com.uas.esop.bean.ResourcefileBean;
+import com.uas.esop.bean.TCPEventBusBean;
 import com.uas.esop.fragment.BaseFragment;
 import com.uas.esop.fragment.WorkOrderSearchFragment;
 import com.uas.esop.global.GloableParams;
@@ -69,6 +70,7 @@ import com.uas.esop.util.HttpCallback;
 import com.uas.esop.util.HttpParams;
 import com.uas.esop.util.LogUtil;
 import com.uas.esop.util.PermissionUtil;
+import com.uas.esop.util.QpushClient;
 import com.uas.esop.util.SocketCallback;
 import com.uas.esop.util.SocketUtils;
 import com.uas.esop.util.StringUtil;
@@ -78,8 +80,8 @@ import com.uas.esop.util.tcp.SocketConfig;
 import com.uas.esop.util.tcp.SocketHelper;
 import com.uas.esop.util.tcp.Tcpclient;
 import com.uas.esop.view.ClearableEditText;
+import com.uas.esop.view.SwitchView;
 import com.uas.esop.view.business.StaffUpPopup;
-import com.uas.esop.webtcp.JWebSocketClient;
 import com.uuzuche.lib_zxing.activity.CaptureActivity;
 import com.uuzuche.lib_zxing.activity.CodeUtils;
 
@@ -91,7 +93,6 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.ServerSocket;
 import java.net.Socket;
-import java.net.URI;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -109,7 +110,6 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
     private TextView  mFeeding, mUnfinish, tv_pihao,
             mEmCodeTv, mEmNameTv, mScName, mStaffTextView, mScrapTextView;
     private ClearableEditText mPositionR,mCurDoc,index_prodcode;
-    private String sc_code = null, mStaffName, mStaffCode,sc_name;
     private RefreshLayout mRefreshLayout;
     private PopupWindow editPW;
     private String MACODE = null; //工单编号
@@ -136,6 +136,7 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
     private InputStreamReader isr;
     private InputStream is;
     private BufferedReader br;
+    private SwitchView sound_monitor_vibration_sv;
 
     @Override
     protected void onDestroy() {
@@ -171,6 +172,8 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
         rv_data = findViewById(R.id.rv_data);
         rela_dimss = findViewById(R.id.rela_dimss);
         rv_datawork = findViewById(R.id.rv_datawork);
+
+        sound_monitor_vibration_sv = findViewById(R.id.sound_monitor_Vibration_sv);
         TextView btn_sengMessage = findViewById(R.id.btn_sengMessage);
         tcp_text = findViewById(R.id.tcp_text);
         findViewById(R.id.index_edit).setOnClickListener(this);
@@ -200,8 +203,8 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
             }
         });
         mFragment = new WorkOrderSearchFragment();
-        sc_code=SharedPreUtil.getString(this,Constants.FLAG.GANG_WEI_SOURCE_CODE,"");
-        sc_name=SharedPreUtil.getString(this,Constants.FLAG.GANG_WEI_SOURCE_NAME,"");
+//        sc_code=SharedPreUtil.getString(this,Constants.FLAG.GANG_WEI_SOURCE_CODE,"");
+//        sc_name=SharedPreUtil.getString(this,Constants.FLAG.GANG_WEI_SOURCE_NAME,"");
 //        new Handler().postDelayed(new Runnable() {
 //            @Override
 //            public void run() {
@@ -215,13 +218,18 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
         /**
          * tcp初始化
          */
-        mTcpClient = new Tcpclient();
-        mTcpClient.setConnectTimeOut(5000)//设置连接超时
-                .setSocket("10.1.81.48",10007);//设置连接ip和端口10.1.162.69
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                mTcpClient = new Tcpclient();
+                mTcpClient.setConnectTimeOut(5000)//设置连接超时
+                        .setSocket("192.168.23.74",10001);//设置连接ip和端口10.1.162.69
+            }
+        }).start();
+
 
 
         getPrintTemplate();
-        EventBus.getDefault().register(this);
         String filepath="https://magpie-pic.oss-cn-shenzhen.aliyuncs.com/MTPTXS099039202211110020661.pdf";
 
         btn_get.setOnClickListener(new View.OnClickListener() {
@@ -364,16 +372,16 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
                 rv_datawork.setVisibility(View.GONE);
             }
         });
-        setMessageData();
-        btn_sengMessage.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                SocketUtils.getInstance().send2Server(mPositionR.getText().toString().trim());
-            }
-        });
-        tcp_text.setOnClickListener(new View.OnClickListener() {
+
+
+
+//        historyData();
+
+
+
+        sound_monitor_vibration_sv.setOnCheckedChangeListener(new SwitchView.OnCheckedChangeListener() {
             @Override
-            public void onClick(View v) {
+            public void onCheckedChanged(View view, boolean isChecked) {
 
             }
         });
@@ -392,18 +400,18 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
             }
         });
 
-        mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
-            @Override
-            public void onRefresh(RefreshLayout refreshLayout) {
-                if (StringUtil.isEmpty(sc_code)) {
-                    CommonUtil.toastNoRepeat(IndexActivity.this, "请先采集岗位资源");
-                    mRefreshLayout.finishRefresh(0);
-                    return;
-                }
-                getDeviceline(sc_code);
-                mRefreshLayout.finishRefresh(0);
-            }
-        });
+//        mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
+//            @Override
+//            public void onRefresh(RefreshLayout refreshLayout) {
+//                if (StringUtil.isEmpty(sc_code)) {
+//                    CommonUtil.toastNoRepeat(IndexActivity.this, "请先采集岗位资源");
+//                    mRefreshLayout.finishRefresh(0);
+//                    return;
+//                }
+//                getDeviceline(sc_code);
+//                mRefreshLayout.finishRefresh(0);
+//            }
+//        });
 
         mBackButton.setOnClickListener(new View.OnClickListener() {
             @Override
@@ -468,7 +476,7 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
                 LogUtil.i("onActivityResult", result);
                 if (!StringUtil.isEmpty(result)) {
                     mPositionR.setText(result);
-                    sc_code = result;
+//                    sc_code = result;
 //                    handleCode(result, true);
                 }
             }
@@ -597,13 +605,15 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
 
     @Override
     protected void initDatas() {
-
+        if (!EventBus.getDefault().isRegistered(this)) {
+            EventBus.getDefault().register(this);
+        }
     }
 
     private void getDeviceline(String scCode) {
         progressDialog.show();
-        mStaffCode = "";
-        mStaffName = "";
+//        mStaffCode = "";
+//        mStaffName = "";
         VollyRequest.getInstance().stringRequest(new HttpParams.Builder()
                 .url(GloableParams.ADDRESS_PDA_INDEX_GETDEVICELINE)
                 .method(Request.Method.GET)
@@ -640,10 +650,10 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
 
     private void showDataView(JSONObject dataObject) {
         if (!StringUtil.isEmpty(dataObject.getString("SC_CODE"))) {
-            sc_code = dataObject.getString("SC_CODE");
-            SharedPreUtil.saveString(this, "SC_CODE", sc_code);
+//            sc_code = dataObject.getString("SC_CODE");
+//            SharedPreUtil.saveString(this, "SC_CODE", sc_code);
 //            mPositionR.setText(sc_code);
-            SharedPreUtil.saveString(this,Constants.FLAG.GANG_WEI_SOURCE_CODE,sc_code);
+//            SharedPreUtil.saveString(this,Constants.FLAG.GANG_WEI_SOURCE_CODE,sc_code);
             String sc_name = dataObject.getString("SC_NAME");
             if (sc_name.length() == 0 || sc_name == "") {
                 sc_name = "-";
@@ -679,10 +689,10 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
         //待设置
         tv_metrimal_name.setText(dataObject.getString("PR_DETAIL"));
         mScrapTextView.setText(FastjsonUtil.getText(dataObject, "NGQTY"));//MA_ONLINESCRAPQTY
-        mStaffName = FastjsonUtil.getText(dataObject, "UO_EMNAME");
-        mStaffCode = TextUtils.isEmpty(FastjsonUtil.getText(dataObject, "UO_EMCODE"))?
-                SharedPreUtil.getString(this, Constants.FLAG.CACHE_USER_EMCODE, "")
-                :FastjsonUtil.getText(dataObject, "UO_EMCODE");
+//        mStaffName = FastjsonUtil.getText(dataObject, "UO_EMNAME");
+//        mStaffCode = TextUtils.isEmpty(FastjsonUtil.getText(dataObject, "UO_EMCODE"))?
+//                SharedPreUtil.getString(this, Constants.FLAG.CACHE_USER_EMCODE, "")
+//                :FastjsonUtil.getText(dataObject, "UO_EMCODE");
        // mStaffTextView.setText(mStaffName + (TextUtils.isEmpty(mStaffCode) ? "" : ("(" + mStaffCode + ")")));
     }
 
@@ -691,13 +701,13 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
     protected void onResume() {
         super.onResume();
 //        mEmCodeTv.setText("(" + SharedPreUtil.getString(this, Constants.FLAG.CACHE_USER_EMCODE, "-") + ")");
-        mEmNameTv.setText(SharedPreUtil.getString(this, Constants.FLAG.CACHE_USER_EMNAME, "-"));
+//        mEmNameTv.setText(SharedPreUtil.getString(this, Constants.FLAG.CACHE_USER_EMNAME, "-"));
         //新增---给上线人员设置默认值
-        mStaffCode =SharedPreUtil.getString(this, Constants.FLAG.CACHE_USER_EMCODE, "");
-        sc_code=SharedPreUtil.getString(this,Constants.FLAG.GANG_WEI_SOURCE_CODE,"");
-        sc_name=SharedPreUtil.getString(this,Constants.FLAG.GANG_WEI_SOURCE_NAME,"");
+//        mStaffCode =SharedPreUtil.getString(this, Constants.FLAG.CACHE_USER_EMCODE, "");
+//        sc_code=SharedPreUtil.getString(this,Constants.FLAG.GANG_WEI_SOURCE_CODE,"");
+//        sc_name=SharedPreUtil.getString(this,Constants.FLAG.GANG_WEI_SOURCE_NAME,"");
 //        mPositionR.setText(sc_code);
-        mScName.setText(sc_name);
+//        mScName.setText(sc_name);
 //        if (!StringUtil.isEmpty(sc_code)) {
 //            handleCode(sc_code, true);
 //        }
@@ -715,7 +725,7 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
         if (!StringUtil.isEmpty(fromSc_Code) && !needClear) {
 //            handleCode(fromSc_Code, false);
         } else if (!StringUtil.isEmpty(fromSc_Code) && needClear) {
-            sc_code = null;
+//            sc_code = null;
             mPositionR.setText("");
             mScName.setText("");
             mFeeding.setText("");
@@ -735,7 +745,9 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
             return;
         } else {
             //工单暂停,工单切换,实时报工
-            if (TextUtils.isEmpty(mStaffCode) && (GloableParams.GRIDNAME_WORK_PAUSE.equals(itemName)
+            if (
+//                    TextUtils.isEmpty(mStaffCode) &&
+                            (GloableParams.GRIDNAME_WORK_PAUSE.equals(itemName)
                     || GloableParams.GRIDNAME_WORK_SWITCH.equals(itemName)
                     || GloableParams.GRIDNAME_TIME_REPORT.equals(itemName)
                     || GloableParams.GRIDNAME_TIME_REPORT_DETAIL.equals(itemName))) {
@@ -840,7 +852,8 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
     }
 
     @Subscribe
-    public void onMessageEvent(MoreEventBusBean evensst) {
+    public void onMessageEvent(TCPEventBusBean evensst) {
+        Log.e("EVENTBUG",evensst.getmMsg());
 
     }
 
@@ -904,7 +917,7 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
                             CommonUtil.toastNoRepeat(IndexActivity.this,"解绑成功!");
                             JSONObject dataObject = FastjsonUtil.getJSONObject(o.toString(),"data");
                             Intent intent =  new Intent(IndexActivity.this, IndexActivity.class);
-                            intent.putExtra(Constants.FLAG.SC_CODE,sc_code);
+//                            intent.putExtra(Constants.FLAG.SC_CODE,sc_code);
                             startActivity(intent);
                             Log.e("密码","解绑成功");
                         }else{
@@ -926,7 +939,7 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
         VollyRequest.getInstance().stringRequest(new HttpParams.Builder()
                 .url(GloableParams.ADDRESS_PDASHOP_DOWNSORUCEMAN)
                 .method(Request.Method.POST)
-                .addParam("sc_code", sc_code)
+                .addParam("sc_code", "sc_code")
                 .addParam("em_code", SharedPreUtil.getString(this, Constants.FLAG.CACHE_USER_EMCODE, ""))
                 .build(), new HttpCallback() {
             @Override
@@ -956,7 +969,7 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
         String itemName = (String) gridItemList.get(position).get(DataSourceManager.KEY_GRID_ITEMNAME);
         Intent intent = new Intent(IndexActivity.this, FunctionActivity.class);
         intent.putExtra(DataSourceManager.KEY_GRID_ITEMNAME, itemName);
-        intent.putExtra(Constants.FLAG.SC_CODE, sc_code);
+        intent.putExtra(Constants.FLAG.SC_CODE, "sc_code");
         intent.putExtra(Constants.FLAG.MA_CODE, mCurDoc.getText().toString());
         startActivity(intent);
     }
@@ -979,7 +992,7 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
             VollyRequest.getInstance().stringRequest(new HttpParams.Builder()
                     .url(GloableParams.ADDRESS_PDASHOP_UPSORUCEMAN)
                     .method(Request.Method.POST)
-                    .addParam("sc_code", sc_code)
+                    .addParam("sc_code", "sc_code")
                     .addParam("em_id", emid)
                     .addParam("em_code", SharedPreUtil.getString(this, Constants.FLAG.CACHE_USER_EMCODE, ""))
                     .build(), new HttpCallback() {
@@ -1075,9 +1088,10 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
                 new HttpParams.Builder()
                         .url(GloableParams.ASTATIONTHE_RESOURCEFILE)
                         .method(Request.Method.GET)
-                        .addParam("sourcecode",mPositionR.getText().toString().trim())//岗位资源
-                        .addParam("makecode",mCurDoc.getText().toString().trim())//工序单号
-                        .addParam("prodcode",index_prodcode.getText().toString().trim())//产品编号
+//                        .addParam("sourcecode",mPositionR.getText().toString().trim())//岗位资源
+//                        .addParam("makecode",mCurDoc.getText().toString().trim())//工序单号
+//                        .addParam("prodcode",index_prodcode.getText().toString().trim())//产品编号
+                        .addParam("id","157043")
                         .tag("Tag" + "getSourceByEmp")
                         .flag(0)
                         .build(), new HttpCallback() {
@@ -1405,46 +1419,58 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
     private void getMessageData() {
 //        String deviceId = SocketUtils.getInstance().getDeviceId();//"192.168.23.74",50484
         String deviceId = getDeviceId();
-        SocketUtils.getInstance().initSocket("10.1.81.48", "10007", new SocketCallback() {//10.1.162.69//192.168.23.74
+        new Thread(new Runnable() {
             @Override
-            public void call(int code, Object object) {
-                Log.e("服务器返回:=====",object.toString()+"");
+            public void run() {
+                    SocketUtils.getInstance().initSocket("10.1.162.69", "8786", new SocketCallback() {//10.1.162.69//192.168.23.74
+                        @Override
+                        public void call(int code, Object object) {
+                            Log.e("服务器返回:=====",object.toString()+"");
+                        }
+                    }, deviceId);
+
             }
-        }, deviceId);
+        }).start();
 
 
     }
     //发送+接收
     private void setMessageData(){
-                new Thread(new Runnable() {
+        new Thread(new Runnable() {
             @Override
             public void run() {
-                String message="我是客户端a";
-                message= SocketHelper.getMessageByReadLine(message);
-                mTcpClient.sendMessage(message, SocketConfig.UTF_8);
-                String result = mTcpClient.receiveMessage(SocketConfig.UTF_8);
-                runOnUiThread(new Runnable() {
-                    @Override
-                    public void run() {
-                        tcp_text.setText(result);
+                    String message="我是客户端a";
+                    message= SocketHelper.getMessageByReadLine(message);
+                    mTcpClient.sendMessage(message, SocketConfig.UTF_8);
+                    while (true){
+                        String result = mTcpClient.receiveMessage(SocketConfig.UTF_8);
+
+                        runOnUiThread(new Runnable() {
+                            @Override
+                            public void run() {
+                                Log.e("服务器接收数据====",result);
+                                tcp_text.setText(result);
+                            }
+                        });
+
                     }
-                });
 
             }
         }).start();
 
     }
 
+
+    /**
+     * Tcp监听服务器消息
+     */
     public void historyData(){
-        //url是后台给的socket的路径
-        URI uri = URI.create("10.1.162.69");  //后台给的一个websocket 的路径
-        JWebSocketClient client = new JWebSocketClient(uri) {
+        QpushClient.getInstance(new Handler(new Handler.Callback() {
             @Override
-            public void onMessage(String message) {
-                //message就是接收到的消息
-                Log.e("JWebSClientService", message);
+            public boolean handleMessage(Message msg) {
+                return false;
             }
-        };
+        })).init("10.1.162.69",10001);
 
     }
 

+ 0 - 15
app/src/main/java/com/uas/esop/application/PdaApplication.java

@@ -7,7 +7,6 @@ import android.media.AudioAttributes;
 import android.media.SoundPool;
 import android.os.Build;
 import android.telephony.TelephonyManager;
-import android.util.Log;
 
 import com.android.volley.RequestQueue;
 import com.android.volley.toolbox.Volley;
@@ -15,8 +14,6 @@ import com.facebook.stetho.Stetho;
 import com.uas.esop.R;
 import com.uas.esop.util.AndroidUtil;
 import com.uas.esop.util.FakeX509TrustManager;
-import com.uas.esop.util.SocketCallback;
-import com.uas.esop.util.SocketUtils;
 import com.uas.esop.util.SoundUtil;
 import com.umeng.analytics.MobclickAgent;
 import com.umeng.commonsdk.UMConfigure;
@@ -224,18 +221,6 @@ public class PdaApplication extends Application {
         }
 
         return factory;
-    }
-    private void getMessageData() {
-//        String deviceId = SocketUtils.getInstance().getDeviceId();//"192.168.23.74",50484
-        String deviceId = getDeviceId();
-        SocketUtils.getInstance().initSocket("10.1.162.69", "8789", new SocketCallback() {//10.1.162.69//192.168.23.74
-            @Override
-            public void call(int code, Object object) {
-                Log.e("服务器返回:=====",object.toString()+"");
-            }
-        }, deviceId);
-
-
     }
     private String getDeviceId() {
         TelephonyManager tm = (TelephonyManager)getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);

+ 12 - 0
app/src/main/java/com/uas/esop/bean/TCPEventBusBean.java

@@ -0,0 +1,12 @@
+package com.uas.esop.bean;
+
+public class TCPEventBusBean {
+    private String mMsg;
+    public TCPEventBusBean(String msg) {
+        mMsg = msg;
+    }
+
+    public String getmMsg() {
+        return mMsg;
+    }
+}

+ 10 - 1
app/src/main/java/com/uas/esop/fragment/IndexSettingFragment.java

@@ -245,6 +245,8 @@ public class IndexSettingFragment extends BaseFragment implements View.OnClickLi
 //        root.findViewById(R.id.setting_account_book_btn).setOnClickListener(this);
         root.findViewById(R.id.setting_printer_rl).setOnClickListener(this);
         root.findViewById(R.id.setting_default_rl).setOnClickListener(this);
+        root.findViewById(R.id.setting_monitor_rl).setOnClickListener(this);
+
         root.findViewById(R.id.setting_style_rl).setOnClickListener(this);
         root.findViewById(R.id.setting_sound_rl).setOnClickListener(this);
         root.findViewById(R.id.setting_ip_address_rl).setOnClickListener(this);
@@ -383,7 +385,14 @@ public class IndexSettingFragment extends BaseFragment implements View.OnClickLi
             case R.id.setting_default_rl:
                 mFragment = new DefaultSettingFragment();
                 getFragmentManager().beginTransaction().addToBackStack(null).replace(R.id.container_function_fragment, mFragment).commit();
+
+                break;
+            case R.id.setting_monitor_rl://设置ip和端口页面
+                mFragment = new MonitorSettingFragment();
+                getFragmentManager().beginTransaction().addToBackStack(null).replace(R.id.container_function_fragment, mFragment).commit();
                 break;
+
+
             case R.id.setting_exit_current_account_ll:
                 new AlertDialog.Builder(getActivity()).setTitle("提示").setMessage("确定要退出当前账号吗?")
                         .setPositiveButton(getString(R.string.confirm), new DialogInterface.OnClickListener() {
@@ -609,7 +618,7 @@ public class IndexSettingFragment extends BaseFragment implements View.OnClickLi
     /**
      * 切换登录账号
      *
-     * @param position
+     * @param loginDataBean
      */
     private void switchLoginAccount(LoginDataBean loginDataBean) {
         progressDialog.show();

+ 62 - 0
app/src/main/java/com/uas/esop/fragment/MonitorSettingFragment.java

@@ -0,0 +1,62 @@
+package com.uas.esop.fragment;
+
+import android.view.KeyEvent;
+import android.view.View;
+
+import com.uas.esop.R;
+import com.uas.esop.activity.FunctionActivity;
+import com.uas.esop.tools.SharedPreUtil;
+import com.uas.esop.util.Constants;
+import com.uas.esop.view.ClearableEditText;
+import com.uas.esop.view.SwitchView;
+
+/**
+ * Created by cjh-sail on 2022-11-25
+ */
+public class MonitorSettingFragment extends BaseFragment{
+
+
+    private ClearableEditText monitor_ip;
+    private ClearableEditText monitor_port;
+    private SwitchView sound_monitor_Vibration_sv;
+    @Override
+    protected int getLayout() {
+        return R.layout.layout_monitorsettingfragment;
+    }
+
+    @Override
+    protected void initViews() {
+        FunctionActivity.setTitle(getResources().getString(R.string.monitor_setting));
+
+        monitor_ip = root.findViewById(R.id.monitor_ip);
+        monitor_port = root.findViewById(R.id.monitor_port);
+        sound_monitor_Vibration_sv = root.findViewById(R.id.sound_monitor_Vibration_sv);
+
+
+    }
+
+    @Override
+    protected void initEvents() {
+        sound_monitor_Vibration_sv.setOnCheckedChangeListener(new SwitchView.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(View view, boolean isChecked) {
+                SharedPreUtil.saveInt(mActivity, Constants.FLAG.NOTICE_VIBRATION_SETTING, isChecked ? 1 : 0);
+            }
+        });
+    }
+
+    @Override
+    protected void initDatas() {
+
+    }
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        return false;
+    }
+
+    @Override
+    public boolean onFragmentBackPressed() {
+        return false;
+    }
+}

+ 2 - 2
app/src/main/java/com/uas/esop/global/GloableParams.java

@@ -898,8 +898,8 @@ public class GloableParams {
     //过站信息查询
     private static final String ASTATIONTHEQURE= "/api/pdashop/getLotInfo.action";
     //获取资源文件
-    private static final String ADDRESSTAIL_RESOURCEFILE = "/api/pda/ESOP/getESOP.action";
-
+//    private static final String ADDRESSTAIL_RESOURCEFILE = "/api/pda/ESOP/getESOP.action";
+    private static final String ADDRESSTAIL_RESOURCEFILE = "/common/downloadbyId.action";
 
 
     /***********************************************************************************************/

+ 2 - 1
app/src/main/java/com/uas/esop/util/Constants.java

@@ -114,7 +114,8 @@ public interface Constants {
 
         //操作权限caller缓存
         String POWER_CALLER_CACHE = "power_caller_cache";
-
+        //SOP缓存
+        String NOTICE_MONITOR_SETTING="monitor_login";
 
 
         //保存登录密码

+ 224 - 0
app/src/main/java/com/uas/esop/util/QpushClient.java

@@ -0,0 +1,224 @@
+package com.uas.esop.util;
+
+import android.os.Handler;
+import android.util.Log;
+
+import com.uas.esop.bean.TCPEventBusBean;
+
+import org.greenrobot.eventbus.EventBus;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+
+/**
+ * Created by cjh-sail on 2022-11-25
+ */
+public class QpushClient implements Runnable {
+    protected static QpushClient mInstance;
+    protected Handler mHandler;
+    protected InetSocketAddress mAddress;
+    protected String TAG = "QpushClient";
+    private final int TIME_OUT = 5 * 1000;
+    //巡检周期
+    private final int CHECK_PERIOD = 2 * 1000;
+    //连接尝试间隔时间
+    private final int CONNECT_PERIOD = 30 * 1000;
+    private final int HEARTBEART_PERIOD = 10 * 1000;
+    //若连接失败或响应失败,则尝试次数为9,若仍无效,则不再尝试
+    private final int CONNECT_TRY_TIMES = 9;
+
+    //连接尝试次数
+    private int mConnectCount;
+
+    Socket mClientSocket;
+    String mHost;
+    int mPort;
+    //设置是否去读取数据
+    boolean isStartRecieveMsg = false;
+    //开启心跳检测
+    boolean isKeepHeartBeat = false;
+
+    private QpushClient(Handler handler) {
+        mHandler = handler;
+    }
+
+    public static QpushClient getInstance(Handler handler) {
+        if (mInstance == null) {
+            mInstance = new QpushClient(handler);
+        }
+        return mInstance;
+    }
+
+    public void init(String host, int port) {
+        mHost = host;
+        mPort = port;
+        new Thread(this).start();
+        isStartRecieveMsg = true;
+        isKeepHeartBeat = true;
+    }
+
+    @Override
+    public void run() {
+        mAddress = new InetSocketAddress(mHost, mPort);
+        if (mClientSocket == null) {
+            mClientSocket = new Socket();
+        }
+
+        //尝试连接,若未连接,则设置尝试次数
+        while (!mClientSocket.isConnected() && mConnectCount < CONNECT_TRY_TIMES) {
+            connect();
+            if (!mClientSocket.isConnected()) {
+                mConnectCount++;
+                sleep(CONNECT_PERIOD);
+            } else {
+                mConnectCount = 0;//连接上,则恢复置0
+            }
+        }
+        if (mClientSocket.isConnected()) {
+            //开始登陆
+//            sendMsg("login");
+            recvMsg();
+            keepHeartBeat();
+        }
+    }
+
+    private void connect() {
+        try {
+            mClientSocket.connect(mAddress);
+        } catch (IOException e) {
+            e.printStackTrace();
+            Log.e(TAG, "mClientSocket.connect fail " + e.getMessage());
+        }
+    }
+
+    /**
+     * 心跳维护
+     */
+    private void keepHeartBeat() {
+        //设置心跳频率,启动心跳
+        while(isKeepHeartBeat){
+//            sendMsg("我是心跳包");
+            sleep(HEARTBEART_PERIOD);
+        }
+    }
+
+    BufferedWriter mWriter;
+    BufferedReader mReader;
+
+    /**
+     * 不断的检测是否有服务器推送的数据过来
+     */
+    public void recvMsg() {
+        while (mClientSocket != null && mClientSocket.isConnected() && !mClientSocket.isClosed()) {
+            try {
+                mReader = new BufferedReader(new InputStreamReader(mClientSocket.getInputStream(), "utf-8"));
+                while (isStartRecieveMsg) {
+                    Log.e(TAG, "recvMsg5");
+                    if (mReader.ready()) {
+                        Log.e(TAG, "recvMsg6");
+                            /*读取一行字符串,读取的内容来自于客户机
+                            reader.readLine()方法是一个阻塞方法,
+                            从调用这个方法开始,该线程会一直处于阻塞状态,
+                            直到接收到新的消息,代码才会往下走*/
+                        String data = mReader.readLine();
+                        Log.e(TAG,"isStartRecieveMsg data="+data);
+                        EventBus.getDefault().post(new TCPEventBusBean("111111"));
+
+
+                        //handler发送消息,在handleMessage()方法中接收
+//                        handlerMsg(data);
+                    }
+                    Thread.sleep(200);
+                }
+            } catch (InterruptedException ex) {
+                ex.printStackTrace();
+            } catch (IOException e) {
+                e.printStackTrace();
+            } catch (Exception ex) {
+                ex.printStackTrace();
+            }
+            sleep(200);
+        }
+        if (!mClientSocket.isConnected()) {
+            connect();
+            recvMsg();
+        }
+        sleep(CHECK_PERIOD);
+    }
+
+    private void sleep(long sleepTime) {
+        try {
+            Thread.sleep(sleepTime);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 销毁socket
+     */
+    public void onDestory() {
+        if (mClientSocket != null) {
+            try {
+                mClientSocket.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            mClientSocket = null;
+        }
+    }
+    public void sendMsg(String message) {
+        PrintWriter writer;
+        try {
+            writer = new PrintWriter(new OutputStreamWriter(
+                    mClientSocket.getOutputStream()), true);
+            writer.println(message);
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    /*
+     * Ready for use.
+     */
+    public void close() {
+        try {
+            if (mClientSocket != null && !mClientSocket.isClosed())
+                mClientSocket.close();
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 处理服务器返回过来的消息
+     * @param data
+     */
+    private void handlerMsg(String data){
+        //对数据进行protobuf解析
+
+        //消息类型:1=登录成功、2=心跳检测、3=推送消息
+        int msgType=1;
+        switch(msgType){
+            case 1:
+                sendMsg("success");
+                break;
+            case 2:
+                sendMsg("success");
+                break;
+            case 3: //需要通知service
+                sendMsg("success");
+                mHandler.obtainMessage(1, data).sendToTarget();
+                break;
+
+        }
+    }
+}

+ 1 - 1
app/src/main/java/com/uas/esop/webtcp/WebSocketService.java

@@ -121,7 +121,7 @@ public class WebSocketService extends Service {
                 Log.d(TAG, "WebSocketService收到的消息:" + message);
 
 
-//这里我通过EvenBus获取接收的消息并更新ui
+                //这里我通过EvenBus获取接收的消息并更新ui
                 EventBus.getDefault().post(new WebSocketEvent(message));
             }
 

+ 140 - 124
app/src/main/res/layout-large/activity_index.xml

@@ -33,99 +33,99 @@
     </com.scwang.smartrefresh.layout.SmartRefreshLayout>
 
 
-            <LinearLayout
-                android:visibility="gone"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/include_menuactionbar"
-                android:layout_centerInParent="true"
-                android:orientation="vertical">
-                <LinearLayout
-                    android:visibility="gone"
-                    android:layout_width="match_parent"
-                    android:layout_height="20dp"
-                    android:layout_marginTop="10dp"
-                    android:paddingLeft="20dp"
-                    android:paddingRight="20dp">
-
-                    <TextView
-                        style="@style/captiontext"
-                        android:layout_width="wrap_content"
-                        android:text="工单数:" />
-
-                    <TextView
-                        android:id="@+id/index_unfinish_number"
-                        style="@style/valuetext"
-                        android:layout_width="0dp"
-                        android:layout_weight="1" />
+    <LinearLayout
+        android:visibility="gone"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/include_menuactionbar"
+        android:layout_centerInParent="true"
+        android:orientation="vertical">
+        <LinearLayout
+            android:visibility="gone"
+            android:layout_width="match_parent"
+            android:layout_height="20dp"
+            android:layout_marginTop="10dp"
+            android:paddingLeft="20dp"
+            android:paddingRight="20dp">
 
-                    <TextView
-                        android:layout_marginLeft="@dimen/textsize_20"
-                        style="@style/captiontext"
-                        android:text="报废数: " />
+            <TextView
+                style="@style/captiontext"
+                android:layout_width="wrap_content"
+                android:text="工单数:" />
 
-                    <TextView
-                        android:id="@+id/index_scrap_number"
-                        style="@style/valuetext"
-                        android:layout_width="0dp"
-                        android:layout_weight="1" />
-                    <View
-                        android:layout_width="20dp"
-                        android:layout_height="wrap_content"/>
-                </LinearLayout>
-                <LinearLayout
-                    android:visibility="gone"
-                    android:layout_width="match_parent"
-                    android:layout_height="20dp"
-                    android:layout_marginTop="10dp"
-                    android:paddingLeft="20dp"
-                    android:paddingRight="20dp">
+            <TextView
+                android:id="@+id/index_unfinish_number"
+                style="@style/valuetext"
+                android:layout_width="0dp"
+                android:layout_weight="1" />
 
-                    <TextView
-                        style="@style/captiontext"
-                        android:layout_width="wrap_content"
-                        android:text="报工数:" />
+            <TextView
+                android:layout_marginLeft="@dimen/textsize_20"
+                style="@style/captiontext"
+                android:text="报废数: " />
 
-                    <TextView
-                        android:id="@+id/index_qty"
-                        style="@style/valuetext"
-                        android:layout_width="0dp"
-                        android:layout_weight="1" />
+            <TextView
+                android:id="@+id/index_scrap_number"
+                style="@style/valuetext"
+                android:layout_width="0dp"
+                android:layout_weight="1" />
+            <View
+                android:layout_width="20dp"
+                android:layout_height="wrap_content"/>
+        </LinearLayout>
+        <LinearLayout
+            android:visibility="gone"
+            android:layout_width="match_parent"
+            android:layout_height="20dp"
+            android:layout_marginTop="10dp"
+            android:paddingLeft="20dp"
+            android:paddingRight="20dp">
 
+            <TextView
+                style="@style/captiontext"
+                android:layout_width="wrap_content"
+                android:text="报工数:" />
 
-                </LinearLayout>
-                <TextView
-                    android:visibility="gone"
-                    android:id="@+id/tv_metrimal_name"
-                    android:layout_width="match_parent"
-                    android:layout_height="match_parent"
-                    android:padding="15dp"
-                    android:layout_marginLeft="5dp"
-                    tools:text="K002雾化棒半成品_金桔柠檬0mg"/>
+            <TextView
+                android:id="@+id/index_qty"
+                style="@style/valuetext"
+                android:layout_width="0dp"
+                android:layout_weight="1" />
 
-                <com.uas.esop.view.MyGridView
 
-                    android:id="@+id/grid_menu"
-                    style="@style/MenuGridViewStyle"
-                    android:numColumns="3" />
-                <View
-                    android:visibility="gone"
-                    android:layout_gravity="center"
-                    android:layout_width="match_parent"
-                    android:layout_height="100dp">
-                </View>
-                <Button
-                    android:visibility="gone"
-                    android:id="@+id/btn_getbanner"
-                    android:text="获取Image"
-                    android:layout_marginTop="@dimen/dp_10"
-                    android:layout_marginLeft="@dimen/textsize_20"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:background="@drawable/bg_button">
-                </Button>
+        </LinearLayout>
+        <TextView
+            android:visibility="gone"
+            android:id="@+id/tv_metrimal_name"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:padding="15dp"
+            android:layout_marginLeft="5dp"
+            tools:text="K002雾化棒半成品_金桔柠檬0mg"/>
+
+        <com.uas.esop.view.MyGridView
+
+            android:id="@+id/grid_menu"
+            style="@style/MenuGridViewStyle"
+            android:numColumns="3" />
+        <View
+            android:visibility="gone"
+            android:layout_gravity="center"
+            android:layout_width="match_parent"
+            android:layout_height="100dp">
+        </View>
+        <Button
+            android:visibility="gone"
+            android:id="@+id/btn_getbanner"
+            android:text="获取Image"
+            android:layout_marginTop="@dimen/dp_10"
+            android:layout_marginLeft="@dimen/textsize_20"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:background="@drawable/bg_button">
+        </Button>
 
-            </LinearLayout>
+    </LinearLayout>
 
     <ScrollView
         android:layout_below="@id/include_menuactionbar"
@@ -141,58 +141,72 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:orientation="vertical">
-                <LinearLayout
+                <RelativeLayout
                     android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical">
+                    android:layout_height="wrap_content">
                     <LinearLayout
-                        android:layout_width="0dp"
+                        android:layout_width="match_parent"
                         android:layout_height="wrap_content"
-                        android:layout_weight="1"
-                        android:orientation="vertical"
-                        android:layout_marginLeft="12dp"
-                        android:padding="8dp">
-
+                        android:gravity="center_vertical">
                         <LinearLayout
-                            android:layout_gravity="center"
-                            android:layout_width="wrap_content"
+                            android:layout_width="0dp"
                             android:layout_height="wrap_content"
-                            android:gravity="center_vertical"
-                            android:orientation="horizontal">
-                            <ImageView
-                                android:layout_width="30dp"
-                                android:layout_height="30dp"
-                                android:src="@mipmap/infoimage">
-                            </ImageView>
-                            <TextView
-                                android:visibility="gone"
-                                android:layout_width="wrap_content"
-                                android:layout_height="wrap_content"
-                                android:text="账号:"
-                                android:textColor="#333333"
-                                android:textSize="@dimen/textsize_20" />
-
-                            <TextView
-                                android:id="@+id/em_name_tv"
-                                android:layout_width="wrap_content"
-                                android:layout_height="wrap_content"
-                                android:textSize="@dimen/textsize_20"
-                                tools:text="吴雨潇" />
+                            android:layout_weight="1"
+                            android:orientation="vertical"
+                            android:layout_marginLeft="12dp"
+                            android:padding="8dp">
 
-                            <TextView
-                                android:visibility="gone"
-                                android:id="@+id/em_code_tv"
+                            <LinearLayout
+                                android:layout_gravity="center"
                                 android:layout_width="wrap_content"
                                 android:layout_height="wrap_content"
-                                android:layout_marginLeft="10dp"
-                                android:textColor="#333333"
-                                android:textSize="@dimen/textsize_20" />
+                                android:gravity="center_vertical"
+                                android:orientation="horizontal">
+                                <ImageView
+                                    android:layout_width="30dp"
+                                    android:layout_height="30dp"
+                                    android:src="@mipmap/infoimage">
+                                </ImageView>
+                                <TextView
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:text="ip:10.1.162.69"
+                                    android:textColor="#333333"
+                                    android:textSize="@dimen/textsize_20" />
+
+                                <TextView
+                                    android:layout_marginLeft="@dimen/dp_10"
+                                    android:id="@+id/em_name_tv"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:textColor="#333333"
+                                    android:textSize="@dimen/textsize_20"
+                                    tools:text="port:10007" />
+
+                                <TextView
+                                    android:visibility="gone"
+                                    android:id="@+id/em_code_tv"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:layout_marginLeft="10dp"
+                                    android:textColor="#333333"
+                                    android:textSize="@dimen/textsize_20" />
+
+                            </LinearLayout>
 
                         </LinearLayout>
 
                     </LinearLayout>
+                    <com.uas.esop.view.SwitchView
+                        android:id="@+id/sound_monitor_Vibration_sv"
+                        android:layout_width="40dp"
+                        android:layout_height="25dp"
+                        android:layout_marginLeft="@dimen/textsize_20"
+                        android:layout_centerVertical="true"/>
+
+
+                </RelativeLayout>
 
-                </LinearLayout>
             </LinearLayout>
             <LinearLayout
                 android:id="@+id/linetwo"
@@ -222,7 +236,7 @@
                                 android:id="@+id/index_position_resource"
                                 style="@style/EditTextLineStyle"
                                 android:layout_width="match_parent"
-                                android:hint="请输入岗位资源"
+                                android:hint="请输入工序编号"
                                 android:imeOptions="actionSend" />
                         </LinearLayout>
 
@@ -368,6 +382,7 @@
 
 
             <TextView
+                android:visibility="gone"
                 android:id="@+id/btn_sengMessage"
                 android:text="tcp发送消息"
                 android:layout_marginLeft="20dp"
@@ -381,6 +396,7 @@
                 android:background="@drawable/bg_button">
             </TextView>
             <TextView
+                android:visibility="gone"
                 android:id="@+id/tcp_text"
                 android:text="tcp服务端发送"
                 android:layout_marginLeft="20dp"

+ 21 - 0
app/src/main/res/layout-large/fragment_setting.xml

@@ -174,7 +174,28 @@
                         android:layout_alignParentRight="true"
                         android:visibility="gone" />
                 </RelativeLayout>
+                <RelativeLayout
+                    android:id="@+id/setting_monitor_rl"
+                    style="@style/SettingListItemStyle">
+
+                    <ImageView
+                        android:id="@+id/setting_monitor_img"
+                        style="@style/SettingListImgStyle"
+                        android:layout_alignParentLeft="true"
+                        android:background="@drawable/ic_setting_default" />
 
+                    <TextView
+                        android:id="@+id/setting_monitor_title"
+                        style="@style/SettingListTitleTextStyle"
+                        android:layout_toRightOf="@id/setting_monitor_img"
+                        android:text="@string/monitor_setting" />
+
+                    <Button
+                        android:id="@+id/setting_monitor_btn"
+                        style="@style/SettingListBtnStyle"
+                        android:layout_alignParentRight="true"
+                        android:visibility="gone" />
+                </RelativeLayout>
                 <RelativeLayout
                     android:id="@+id/setting_default_rl"
                     style="@style/SettingListItemStyle">

+ 39 - 0
app/src/main/res/layout-large/layout_monitorsettingfragment.xml

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    <LinearLayout
+        android:id="@+id/line_ip_port"
+        android:orientation="vertical"
+        android:layout_marginTop="@dimen/textsize_20"
+        android:layout_marginLeft="@dimen/textsize_20"
+        android:layout_marginRight="@dimen/textsize_20"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+        <com.uas.esop.view.ClearableEditText
+            android:id="@+id/monitor_ip"
+            style="@style/EditTextLineStyle"
+            android:layout_width="match_parent"
+            android:hint="请输入IP"
+            android:imeOptions="actionSend" />
+        <com.uas.esop.view.ClearableEditText
+            android:layout_marginTop="@dimen/dp_10"
+            android:id="@+id/monitor_port"
+            style="@style/EditTextLineStyle"
+            android:layout_width="match_parent"
+            android:hint="情书端口"
+            android:imeOptions="actionSend" />
+    </LinearLayout>
+    <com.uas.esop.view.SwitchView
+        android:id="@+id/sound_setting_Vibration_sv"
+        android:layout_width="40dp"
+        android:layout_height="25dp"
+        android:layout_below="@+id/line_ip_port"
+        android:layout_alignParentRight="true"
+        android:layout_marginRight="50dp"
+        android:layout_marginTop="30dp"/>
+
+
+
+
+</RelativeLayout>

+ 54 - 39
app/src/main/res/layout/activity_index.xml

@@ -141,58 +141,71 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:orientation="vertical">
-                <LinearLayout
+                <RelativeLayout
                     android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical">
+                    android:layout_height="wrap_content">
                     <LinearLayout
-                        android:layout_width="0dp"
+                        android:layout_width="match_parent"
                         android:layout_height="wrap_content"
-                        android:layout_weight="1"
-                        android:orientation="vertical"
-                        android:layout_marginLeft="12dp"
-                        android:padding="8dp">
-
+                        android:gravity="center_vertical">
                         <LinearLayout
-                            android:layout_gravity="center"
-                            android:layout_width="wrap_content"
+                            android:layout_width="0dp"
                             android:layout_height="wrap_content"
-                            android:gravity="center_vertical"
-                            android:orientation="horizontal">
-                            <ImageView
-                                android:layout_width="30dp"
-                                android:layout_height="30dp"
-                                android:src="@mipmap/infoimage">
-                            </ImageView>
-                            <TextView
-                                android:visibility="gone"
-                                android:layout_width="wrap_content"
-                                android:layout_height="wrap_content"
-                                android:text="账号:"
-                                android:textColor="#333333"
-                                android:textSize="@dimen/textsize_20" />
-
-                            <TextView
-                                android:id="@+id/em_name_tv"
-                                android:layout_width="wrap_content"
-                                android:layout_height="wrap_content"
-                                android:textSize="@dimen/textsize_20"
-                                tools:text="吴雨潇" />
+                            android:layout_weight="1"
+                            android:orientation="vertical"
+                            android:layout_marginLeft="12dp"
+                            android:padding="8dp">
 
-                            <TextView
-                                android:visibility="gone"
-                                android:id="@+id/em_code_tv"
+                            <LinearLayout
+                                android:layout_gravity="center"
                                 android:layout_width="wrap_content"
                                 android:layout_height="wrap_content"
-                                android:layout_marginLeft="10dp"
-                                android:textColor="#333333"
-                                android:textSize="@dimen/textsize_20" />
+                                android:gravity="center_vertical"
+                                android:orientation="horizontal">
+                                <ImageView
+                                    android:layout_width="30dp"
+                                    android:layout_height="30dp"
+                                    android:src="@mipmap/infoimage">
+                                </ImageView>
+                                <TextView
+                                    android:visibility="gone"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:text="账号:"
+                                    android:textColor="#333333"
+                                    android:textSize="@dimen/textsize_20" />
+
+                                <TextView
+                                    android:id="@+id/em_name_tv"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:textSize="@dimen/textsize_20"
+                                    tools:text="吴雨潇" />
+
+                                <TextView
+                                    android:visibility="gone"
+                                    android:id="@+id/em_code_tv"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:layout_marginLeft="10dp"
+                                    android:textColor="#333333"
+                                    android:textSize="@dimen/textsize_20" />
+
+                            </LinearLayout>
 
                         </LinearLayout>
 
                     </LinearLayout>
+                    <com.uas.esop.view.SwitchView
+                        android:id="@+id/sound_monitor_Vibration_sv"
+                        android:layout_width="40dp"
+                        android:layout_height="25dp"
+                        android:layout_marginLeft="@dimen/textsize_20"
+                        android:layout_centerVertical="true"/>
+
+
+                </RelativeLayout>
 
-                </LinearLayout>
             </LinearLayout>
             <LinearLayout
                 android:id="@+id/linetwo"
@@ -368,6 +381,7 @@
 
 
             <TextView
+                android:visibility="gone"
                 android:id="@+id/btn_sengMessage"
                 android:text="tcp发送消息"
                 android:layout_marginLeft="20dp"
@@ -381,6 +395,7 @@
                 android:background="@drawable/bg_button">
             </TextView>
             <TextView
+                android:visibility="gone"
                 android:id="@+id/tcp_text"
                 android:text="tcp服务端发送"
                 android:layout_marginLeft="20dp"

+ 25 - 0
app/src/main/res/layout/fragment_setting.xml

@@ -175,6 +175,31 @@
                         android:visibility="gone" />
                 </RelativeLayout>
 
+                <RelativeLayout
+                    android:visibility="gone"
+                    android:id="@+id/setting_monitor_rl"
+                    style="@style/SettingListItemStyle">
+
+                    <ImageView
+                        android:id="@+id/setting_monitor_img"
+                        style="@style/SettingListImgStyle"
+                        android:layout_alignParentLeft="true"
+                        android:background="@drawable/ic_setting_default" />
+
+                    <TextView
+                        android:id="@+id/setting_monitor_title"
+                        style="@style/SettingListTitleTextStyle"
+                        android:layout_toRightOf="@id/setting_monitor_img"
+                        android:text="@string/monitor_setting" />
+
+                    <Button
+                        android:id="@+id/setting_monitor_btn"
+                        style="@style/SettingListBtnStyle"
+                        android:layout_alignParentRight="true"
+                        android:visibility="gone" />
+                </RelativeLayout>
+
+
                 <RelativeLayout
                     android:id="@+id/setting_default_rl"
                     style="@style/SettingListItemStyle">

+ 39 - 0
app/src/main/res/layout/layout_monitorsettingfragment.xml

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    <LinearLayout
+        android:id="@+id/line_ip_port"
+        android:orientation="vertical"
+        android:layout_marginTop="@dimen/textsize_20"
+        android:layout_marginLeft="@dimen/textsize_20"
+        android:layout_marginRight="@dimen/textsize_20"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+        <com.uas.esop.view.ClearableEditText
+            android:id="@+id/monitor_ip"
+            style="@style/EditTextLineStyle"
+            android:layout_width="match_parent"
+            android:hint="请输入IP"
+            android:imeOptions="actionSend" />
+        <com.uas.esop.view.ClearableEditText
+            android:layout_marginTop="@dimen/dp_10"
+            android:id="@+id/monitor_port"
+            style="@style/EditTextLineStyle"
+            android:layout_width="match_parent"
+            android:hint="情书端口"
+            android:imeOptions="actionSend" />
+    </LinearLayout>
+    <com.uas.esop.view.SwitchView
+        android:id="@+id/sound_monitor_Vibration_sv"
+        android:layout_width="40dp"
+        android:layout_height="25dp"
+        android:layout_below="@+id/line_ip_port"
+        android:layout_alignParentRight="true"
+        android:layout_marginRight="50dp"
+        android:layout_marginTop="30dp"/>
+
+
+
+
+</RelativeLayout>

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -343,6 +343,7 @@
     <string name="check_for_update">检查更新</string>
     <string name="style_setting">样式设置</string>
     <string name="default_setting">缺省设置</string>
+    <string name="monitor_setting">监听广播设置</string>
     <string name="defaults_setting">缺省项设置</string>
     <string name="printer_setting">打印设置</string>
     <string name="sound_setting">错误提示</string>