| | |
| | | package com.hdl.sdk.hdl_sdk.activity; |
| | | |
| | | import android.os.Bundle; |
| | | import android.text.TextUtils; |
| | | import android.view.View; |
| | | import android.widget.Button; |
| | | import android.widget.EditText; |
| | |
| | | mRGBBackInfo = new RGBBackInfo(appliancesInfo); |
| | | |
| | | //读取状态 |
| | | HDLCommand.getRGBCCTStateFromNetwork(appliancesInfo); |
| | | HDLCommand.getRgbOrCctStateFromNetwork(appliancesInfo); |
| | | |
| | | } |
| | | |
| | |
| | | btnRGB.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | | int rStatus = Integer.parseInt(etR.getText().toString()); |
| | | int gStatus = Integer.parseInt(etG.getText().toString()); |
| | | int bStatus = Integer.parseInt(etB.getText().toString()); |
| | | if (rStatus < 0 || rStatus > 255 || gStatus < 0 || gStatus > 255 || bStatus < 0 || bStatus > 255) { |
| | | showToast("RGB值范围 0~255"); |
| | | return; |
| | | if (TextUtils.isEmpty(etR.getText().toString()) || TextUtils.isEmpty(etG.getText().toString()) || TextUtils.isEmpty(etB.getText().toString())) { |
| | | showToast("RGB值 不能为空"); |
| | | } else { |
| | | int rStatus = Integer.parseInt(etR.getText().toString()); |
| | | int gStatus = Integer.parseInt(etG.getText().toString()); |
| | | int bStatus = Integer.parseInt(etB.getText().toString()); |
| | | if (rStatus < 0 || rStatus > 255 || gStatus < 0 || gStatus > 255 || bStatus < 0 || bStatus > 255) { |
| | | showToast("RGB值范围 0~255"); |
| | | return; |
| | | } |
| | | int brightness = settingBrightness == 0 ? 100 : settingBrightness; |
| | | HDLCommand.lightRGBCtrl(appliancesInfo, brightness, rStatus, gStatus, bStatus); |
| | | } |
| | | |
| | | int brightness = settingBrightness == 0 ? 100 : settingBrightness; |
| | | HDLCommand.lightRGBCtrl(appliancesInfo, brightness, rStatus, gStatus, bStatus); |
| | | } |
| | | }); |
| | | |