From db21de901bb1bbc6ec66b59e7b0766d0d2c5c6cc Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期二, 16 七月 2019 13:54:44 +0800 Subject: [PATCH] 20190716 1.提供声必可SDK,部分数据处理调整; 2.演示DemoAPP,地热和新风页面调整; --- app/src/main/java/com/hdl/sdk/hdl_sdk/activity/GeothermalActivity.java | 71 +++++++++++++++++++++++++---------- 1 files changed, 50 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/GeothermalActivity.java b/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/GeothermalActivity.java index 7a752f0..740955b 100644 --- a/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/GeothermalActivity.java +++ b/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/GeothermalActivity.java @@ -1,6 +1,7 @@ package com.hdl.sdk.hdl_sdk.activity; +import android.app.ProgressDialog; import android.os.Bundle; import android.text.TextUtils; import android.view.View; @@ -9,12 +10,12 @@ import android.widget.TextView; import com.hdl.sdk.hdl_core.HDLAppliances.Config.HDLApConfig; -import com.hdl.sdk.hdl_core.HDLAppliances.HDLFreshAir.Parser.FreshAirParser; import com.hdl.sdk.hdl_core.HDLAppliances.HDLGeothermal.GeothermalBackInfo; import com.hdl.sdk.hdl_core.HDLAppliances.HDLGeothermal.Parser.GeothermalParser; import com.hdl.sdk.hdl_core.HDLDeviceManger.Bean.AppliancesInfo; import com.hdl.sdk.hdl_core.HDLDeviceManger.Core.HDLCommand; import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.DeviceStateEvent; +import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.EventCode; import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.GeothermalFeedBackEvent; import com.hdl.sdk.hdl_sdk.R; import com.hdl.sdk.hdl_sdk.base.BaseActivity; @@ -37,7 +38,7 @@ private int gModeState; private int gTempState; private int ctrlId; - + private ProgressDialog proDialog; /** * 瑕佹敞鍐屼娇鐢‥ventBus锛岃繖閲岃璁剧疆杩斿洖true * @@ -63,6 +64,13 @@ HDLCommand.getDeviceState(appliancesInfo); } + @Override + protected void onDestroy() { + super.onDestroy(); + proDialog.dismiss(); + HDLLog.I("onDestroy: GeothermalActivity"); + } + private void initcurState() { appliancesInfo = (AppliancesInfo) getIntent().getSerializableExtra("hdl"); } @@ -74,12 +82,17 @@ btn_temp = findViewById(R.id.btn_temp); tempEditText = findViewById(R.id.et_temp); + proDialog = new ProgressDialog(this); + proDialog.setTitle("姝e湪鍙戦�佹帶鍒跺懡浠�..."); + proDialog.setMessage("璇疯�愬績绛夊緟"); + proDialog.onStart(); } private void initClickOnEvent() { btn_switch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { + proDialog.show(); ctrlId = GeothermalParser.gSwich; //婕旂ず褰撳墠鐘舵�佷负鍏筹紝璁剧疆涓哄紑銆傚紑锛岃缃负鍏炽�� if (gSwitchState == 0) { @@ -97,6 +110,7 @@ btn_mode.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { + proDialog.show(); ctrlId = GeothermalParser.gMode; switch (gModeState) { case 1: @@ -146,11 +160,10 @@ showToast("娓╁害璁剧疆鑼冨洿涓猴細16~35鎽勬皬搴�(鈩�)"); return; } - + proDialog.show(); switch (gModeState) { case 1: - //褰撳墠鍦扮儹妯″紡涓烘櫘閫� HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gNormalTemp, tempInt);//鏅�氭俯搴� ctrlId = GeothermalParser.gNormalTemp; @@ -171,10 +184,14 @@ ctrlId = GeothermalParser.gLeaveTemp; break; case 5: + proDialog.dismiss(); //褰撳墠鍦扮儹妯″紡涓鸿嚜鍔� - showToast("鑷姩妯″紡涓嶈兘鎺у埗娓╁害"); + showToast("鑷姩妯″紡锛屼笉鑳芥帶鍒舵俯搴�"); break; default: + proDialog.dismiss(); + //褰撳墠鍦扮儹妯″紡涓鸿嚜鍔� + showToast("鏈煡妯″紡锛屼笉鑳芥帶鍒舵俯搴�"); break; } @@ -191,9 +208,9 @@ GeothermalBackInfo mGeothermalBackInfo = new GeothermalBackInfo(appliancesInfo, false); String stringState = ""; - if (mGeothermalBackInfo.getIsOn() == 0) { + if (mGeothermalBackInfo.getIsOn() == GeothermalParser.gSwichOff) { stringState = "鍦扮儹妯″潡锛氬叧闂�"; - } else if (mGeothermalBackInfo.getIsOn() == 1) { + } else if (mGeothermalBackInfo.getIsOn() == GeothermalParser.gSwichOn) { stringState = "鍦扮儹妯″潡锛氭墦寮�"; stringState += "\n" + getModeStateString(mGeothermalBackInfo.getgMode()); @@ -227,10 +244,10 @@ String mStrState = "鏈煡"; gSwitchState = mState; //鏇存柊寮�鍏崇姸鎬� switch (mState) { - case FreshAirParser.freshAirOn: + case GeothermalParser.gSwichOn: mStrState = "鍦扮儹妯″潡锛氭墦寮�"; break; - case FreshAirParser.freshAirOff: + case GeothermalParser.gSwichOff: mStrState = "鍦扮儹妯″潡锛氬叧闂�"; break; @@ -253,19 +270,19 @@ gModeState = mState; //鏇存柊妯″紡鐘舵�� switch (mState) { case GeothermalParser.gModeNormal: - mStrState = " 妯″紡锛氭櫘閫�"; + mStrState = "妯″紡锛氭櫘閫�"; break; case GeothermalParser.gModeDay: - mStrState = " 妯″紡锛氱櫧澶�"; + mStrState = "妯″紡锛氱櫧澶�"; break; case GeothermalParser.gModeNight: - mStrState = " 妯″紡锛氬闂�"; + mStrState = "妯″紡锛氬闂�"; break; case GeothermalParser.gModeLeave: - mStrState = " 妯″紡锛氱寮�"; + mStrState = "妯″紡锛氱寮�"; break; case GeothermalParser.gModeAuto: - mStrState = " 妯″紡锛氳嚜鍔�"; + mStrState = "妯″紡锛氳嚜鍔�"; break; default: @@ -277,13 +294,19 @@ @Subscribe(threadMode = ThreadMode.MAIN) public void onGeothermalFeedBackEventMain(GeothermalFeedBackEvent event) { + proDialog.dismiss(); if (event.getGeothermalBackInfo().getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID() && event.getGeothermalBackInfo().getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID() && event.getGeothermalBackInfo().getAppliancesInfo().getChannelNum() == appliancesInfo.getChannelNum() ) { //鍏堝垽鏂槸鍚﹁秴鏃� - if (!event.isSuccess()) { + if (event.getStatusID() == EventCode.FAILURE) { showToast("鍦扮儹妯″潡鎺у埗瓒呮椂锛岃閲嶆柊鍐嶈瘯"); + return; + } + + if (event.getStatusID() == EventCode.DATAEMPTY) { + showToast("鍦扮儹妯″潡,杩斿洖鏁版嵁涓虹┖"); return; } @@ -326,6 +349,7 @@ @Subscribe(threadMode = ThreadMode.MAIN) public void onDeviceStateEventMain(DeviceStateEvent event) { + proDialog.dismiss(); if (event.getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID() && event.getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID() ) { @@ -345,12 +369,17 @@ return; } - message += "\n" + getSwichStateString(mGeothermalBackInfo.getIsOn()); - message += "\n" + getModeStateString(mGeothermalBackInfo.getgMode()); - message += "\n" + "鏅�氭ā寮忔俯搴︼細" + mGeothermalBackInfo.getgNormalTemp(); - message += "\n" + "鐧藉ぉ妯″紡娓╁害锛�" + mGeothermalBackInfo.getgDayTemp(); - message += "\n" + "澶滈棿妯″紡娓╁害锛�" + mGeothermalBackInfo.getgNightTemp(); - message += "\n" + "绂诲紑妯″紡娓╁害锛�" + mGeothermalBackInfo.getgLeaveTemp(); + if(mGeothermalBackInfo.getIsOn() == GeothermalParser.gSwichOn) { + message = getSwichStateString(mGeothermalBackInfo.getIsOn()); + + message += "\n" + getModeStateString(mGeothermalBackInfo.getgMode()); + message += "\n" + "鏅�氭ā寮忔俯搴︼細" + mGeothermalBackInfo.getgNormalTemp(); + message += "\n" + "鐧藉ぉ妯″紡娓╁害锛�" + mGeothermalBackInfo.getgDayTemp(); + message += "\n" + "澶滈棿妯″紡娓╁害锛�" + mGeothermalBackInfo.getgNightTemp(); + message += "\n" + "绂诲紑妯″紡娓╁害锛�" + mGeothermalBackInfo.getgLeaveTemp(); + }else { + message = getSwichStateString(mGeothermalBackInfo.getIsOn()); + } mTextView.setText(message); -- Gitblit v1.8.0