Last Updated on : 2024-11-18 11:33:13download
The air conditioning native control panel is a control panel developed by native code, which supports all kinds of air conditioning equipment.
Lightweight, no React Native or other frameworks required.
Support all types of devices. The new products can be supported in advance, without submitting a new app version.
Easy for debugging in the developing stage.
dependencies
implementation 'com.tuya.smart:TuyaAirConditionerPanel:1.0.1'
Interface description
void openDefaultPanel(Context context, String devId, MenuBean menuBean);
Parameter description
Parameters | Description |
---|---|
context | Context for opening the Activity |
devId | Device Id |
menuBean | Used to create and display custom menus and events |
Note:
menuBean
is used to create and display custom menus and events, you can set it null if you don’t need it.
MenuBean data model
Filed | Type | Description |
---|---|---|
menuRes | Int | Custom menu resource id |
menuItemId | Int | Item id in custom menu |
bundle | Bundle | Custom bundle can be obtained in custom Activity by IDefaultPanelController.BUNDLE_KEY |
activityClassName | String | Custom activity ClassName,like TestActivity.class.getName() |
Sample code
MenuBean menuBean = new MenuBean();
menuBean.setMenuRes(R.menu.common_menu);
menuBean.setMenuItemId(R.id.check);
Bundle bundle = new Bundle();
bundle.putString("DEV_ID_KEY", devId);
menuBean.setBundle(bundle);
menuBean.setActivityClassName(TestActivity.class.getName());
IDefaultPanelController defaultPanelController = PluginManager.service(IDefaultPanelController.class);
defaultPanelController.usePanel(new HomeSDKPanel());
defaultPanelController.openDefaultPanel(context, devId, menuBean);
Note: The native control panel uses
startActivityForResult(Intent, IDefaultPanelController.REQUEST_CODE_DEFAULT_PANEL)
to enable the custom activity. If theonActivityResult
shows that the(requestCode == IDefaultPanelController.REQUEST_CODE_DEFAULT_PANEL && resultCode == RESULT_OK)
istrue
, the default panel will be closed.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback