diff --git a/app/build.gradle b/app/build.gradle index f1e426c..cdfd9a7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "com.zyc.zcontrol" minSdkVersion 19 targetSdkVersion 28 - versionCode 5 - versionName "0.5" + versionCode 6 + versionName "0.6" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/app/release/app-release.apk b/app/release/app-release.apk index 5adfbfa..cc1dce8 100644 Binary files a/app/release/app-release.apk and b/app/release/app-release.apk differ diff --git a/app/src/main/java/com/zyc/zcontrol/controlItem/tc1/TC1Fragment.java b/app/src/main/java/com/zyc/zcontrol/controlItem/tc1/TC1Fragment.java index 624813a..32b00d2 100644 --- a/app/src/main/java/com/zyc/zcontrol/controlItem/tc1/TC1Fragment.java +++ b/app/src/main/java/com/zyc/zcontrol/controlItem/tc1/TC1Fragment.java @@ -56,10 +56,10 @@ public class TC1Fragment extends Fragment { //region 控件 final private int PLUG_COUNT=6; ToggleButton tbtn_all; + TextView tv_power; ToggleButton tbtn_main_button[] = new ToggleButton[PLUG_COUNT]; TextView tv_main_button[] = new TextView[PLUG_COUNT]; //endregion - TextView log; String device_mac = null; @@ -123,6 +123,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, //region 控件初始化 tbtn_all = view.findViewById(R.id.tbtn_all); + tv_power = view.findViewById(R.id.tv_power); tbtn_main_button[0] = view.findViewById(R.id.tbtn_main_button1); tbtn_main_button[1] = view.findViewById(R.id.tbtn_main_button2); tbtn_main_button[2] = view.findViewById(R.id.tbtn_main_button3); @@ -266,6 +267,12 @@ void Receive(String topic, String message) { if (jsonObject.has("setting")) jsonSetting = jsonObject.getJSONObject("setting"); if (mac == null || !mac.equals(device_mac)) return; + if (jsonObject.has("power")) { + String power = jsonObject.getString("power"); + Log.d(Tag,"power:"+power); + tv_power.setText(power+"W"); + } + //region 解析plug for (int plug_id = 0; plug_id < 6; plug_id++) { if (!jsonObject.has("plug_" + plug_id)) continue; diff --git a/app/src/main/java/com/zyc/zcontrol/controlItem/tc1/TC1SettingFragment.java b/app/src/main/java/com/zyc/zcontrol/controlItem/tc1/TC1SettingFragment.java index 37701f2..8a3749e 100644 --- a/app/src/main/java/com/zyc/zcontrol/controlItem/tc1/TC1SettingFragment.java +++ b/app/src/main/java/com/zyc/zcontrol/controlItem/tc1/TC1SettingFragment.java @@ -312,6 +312,10 @@ void Receive(String topic, String message) { } else { if (ota_flag) { //todo 显示更新进度 + + if(pd!=null && pd.isShowing()) + pd.setMessage("正在获取最新固件版本,请稍后....\n"+"进度:"+ota_progress+"%"); +// Toast.makeText(getActivity(), "ota进度:"+ota_progress+"%", Toast.LENGTH_SHORT).show(); } } diff --git a/app/src/main/res/layout/fragment_tc1.xml b/app/src/main/res/layout/fragment_tc1.xml index 113635c..fd26606 100644 --- a/app/src/main/res/layout/fragment_tc1.xml +++ b/app/src/main/res/layout/fragment_tc1.xml @@ -25,12 +25,37 @@ android:id="@+id/tbtn_all" style="@style/TC1SwitchStyle" app:layout_constraintBottom_toTopOf="@+id/tbtn_main_button2" - app:layout_constraintEnd_toEndOf="@+id/tbtn_main_button3" + app:layout_constraintEnd_toStartOf="@+id/ll_power" app:layout_constraintStart_toStartOf="@+id/tbtn_main_button1" app:layout_constraintTop_toTopOf="parent" app:layout_goneMarginBottom="8dp" /> + + + + + +