--- /dev/null
+#ifndef DROPDOWN_CARD_PAGE_UI_CONFIG_H
+#define DROPDOWN_CARD_PAGE_UI_CONFIG_H
+
+namespace OHOS
+{
+ // viewId
+ static constexpr const char *DROPDOWN_BT_TOGGLEBUTTON_VIEWID = "dropdown_bt"; // 蓝牙
+ static constexpr const char *DROPDOWN_4G_TOGGLEBUTTON_VIEWID = "dropdown_4g"; // 4g
+ static constexpr const char *DROPDOWN_ALIPAY_TOGGLEBUTTON_VIEWID = "dropdown_ALIPAY"; // 支付宝
+ static constexpr const char *DROPDOWN_SAVEPOWER_TOGGLEBUTTON_VIEWID = "dropdown_savepower"; // 省电模式
+ static constexpr const char *DROPDOWN_SLEEP_TOGGLEBUTTON_VIEWID = "dropdown_sleep"; // 睡眠模式
+ static constexpr const char *DROPDOWN_DNOTDISTURB_TOGGLEBUTTON_VIEWID = "dropdown_dnotdisturb"; // 勿扰模式
+ static constexpr const char *DROPDOWN_SETTING_TOGGLEBUTTON_VIEWID = "dropdown_setting"; // 设置
+ static constexpr const char *DROPDOWN_FINDPHONE_TOGGLEBUTTON_VIEWID = "dropdown_findphone"; // 查找手机
+ static constexpr const char *DROPDOWN_LIGHTING_TOGGLEBUTTON_VIEWID = "dropdown_4g"; // 手电筒
+ static constexpr const char *DROPDOWN_APPLIST_DISPLAY_TOGGLEBUTTON_VIEWID = "dropdown_applist_display"; // 列表样式
+
+ // 蓝牙
+ static constexpr const char *DROPDOWN_BT_IMAGE = "/user/res/dropdown/DROPDOWN_BT.bin";
+
+ // 省电模式
+ static constexpr const char *DROPDOWN_SAVEPOWER_ON_IMAGE = "/user/res/dropdown/DROPDOWN_SAVEPOWER_ON.bin";
+ static constexpr const char *DROPDOWN_SAVEPOWER_OFF_IMAGE = "/user/res/dropdown/DROPDOWN_SAVEPOWER_OFF.bin";
+
+ // 睡眠模式
+ static constexpr const char *DROPDOWN_SLEEP_ON_IMAGE = "/user/res/dropdown/DROPDOWN_SLEEP_ON.bin";
+ static constexpr const char *DROPDOWN_SLEEP_OFF_IMAGE = "/user/res/dropdown/DROPDOWN_SLEEP_OFF.bin";
+
+ // 勿扰模式
+ static constexpr const char *DROPDOWN_DNOTDISTURB_ON_IMAGE = "/user/res/dropdown/DROPDOWN_DNOTDISTURB_ON.bin";
+ static constexpr const char *DROPDOWN_DNOTDISTURB_OFF_IMAGE = "/user/res/dropdown/DROPDOWN_DNOTDISTURB_OFF.bin";
+
+ // 设置
+ static constexpr const char *DROPDOWN_SETTING_IMAGE = "/user/res/dropdown/DROPDOWN_SETTING.bin";
+
+ // 查找手机
+ static constexpr const char *DROPDOWN_FINDPHONE_IMAGE = "/user/res/dropdown/DROPDOWN_FINDPHONE.bin";
+
+ // 手电筒
+ static constexpr const char *DROPDOWN_LIGHTING_IMAGE = "/user/res/dropdown/DROPDOWN_LIGHTING.bin";
+
+ // 列表样式
+ static constexpr const char *DROPDOWN_APPLIST_DISPLAY_IMAGE[] =
+ {
+ "/user/res/themestyle/list.bin", // 列表
+ "/user/res/themestyle/arclist.bin", // 弧形列表
+ "/user/res/themestyle/hexagons.bin", // 蜂窝
+ "/user/res/themestyle/dialplate.bin", // 拨号盘
+ "/user/res/themestyle/grid.bin", // 瀑布流
+ };
+}
+
+#endif
\ No newline at end of file
#include <custom_runtime.h>
#include <custom_utils.h>
#include "ConfigModel.h"
+#include "main/include/dropdown/DropDownCardPageUiConfig.h"
+#include "themestyle/include/ThemeStyleModel.h"
extern "C"
{
namespace OHOS
{
- // viewId
- static constexpr const char *DROPDOWN_BT_TOGGLEBUTTON_VIEWID = "dropdown_bt"; // 蓝牙
- static constexpr const char *DROPDOWN_4G_TOGGLEBUTTON_VIEWID = "dropdown_4g"; // 4g
- static constexpr const char *DROPDOWN_ALIPAY_TOGGLEBUTTON_VIEWID = "dropdown_ALIPAY"; // 支付宝
- static constexpr const char *DROPDOWN_SAVEPOWER_TOGGLEBUTTON_VIEWID = "dropdown_savepower"; // 省电模式
- static constexpr const char *DROPDOWN_SLEEP_TOGGLEBUTTON_VIEWID = "dropdown_sleep"; // 睡眠模式
- static constexpr const char *DROPDOWN_DNOTDISTURB_TOGGLEBUTTON_VIEWID = "dropdown_dnotdisturb"; // 勿扰模式
- static constexpr const char *DROPDOWN_SETTING_TOGGLEBUTTON_VIEWID = "dropdown_setting"; // 设置
-
- // Image src
- static constexpr const char *DROPDOWN_BT_CONNECT_IMAGE = "/user/res/dropdown/DROPDOWN_BT_CONNECT.bin";
- static constexpr const char *DROPDOWN_BT_DISCONNECT_IMAGE = "/user/res/dropdown/DROPDOWN_BT_DISCONNECT.bin";
- static constexpr const char *DROPDOWN_BT_IMAGE = "/user/res/dropdown/DROPDOWN_BT.bin";
-
- static constexpr const char *DROPDOWN_4G_ON_IMAGE = "/user/res/dropdown/DROPDOWN_4G_ON.bin";
- static constexpr const char *DROPDOWN_4G_OFF_IMAGE = "/user/res/dropdown/DROPDOWN_4G_OFF.bin";
-
- static constexpr const char *DROPDOWN_ALIPAY_IMAGE = "/user/res/dropdown/DROPDOWN_ALIPAY.bin";
-
- static constexpr const char *DROPDOWN_SAVEPOWER_ON_IMAGE = "/user/res/dropdown/DROPDOWN_SAVEPOWER_ON.bin";
- static constexpr const char *DROPDOWN_SAVEPOWER_OFF_IMAGE = "/user/res/dropdown/DROPDOWN_SAVEPOWER_OFF.bin";
-
- static constexpr const char *DROPDOWN_SLEEP_ON_IMAGE = "/user/res/dropdown/DROPDOWN_SLEEP_ON.bin";
- static constexpr const char *DROPDOWN_SLEEP_OFF_IMAGE = "/user/res/dropdown/DROPDOWN_SLEEP_OFF.bin";
-
- static constexpr const char *DROPDOWN_DNOTDISTURB_ON_IMAGE = "/user/res/dropdown/DROPDOWN_DNOTDISTURB_ON.bin";
- static constexpr const char *DROPDOWN_DNOTDISTURB_OFF_IMAGE = "/user/res/dropdown/DROPDOWN_DNOTDISTURB_OFF.bin";
-
- static constexpr const char *DROPDOWN_SETTING_IMAGE = "/user/res/dropdown/DROPDOWN_SETTING.bin";
-
static DropDownCardPage1 *g_pDropDownCardPage1{nullptr};
DropDownCardPage1::DropDownCardPage1()
{
{
NativeAbility::GetInstance().EnterSlice(VIEW_CLASSIC_BLUETOOTH);
}
- else if (viewId == DROPDOWN_4G_TOGGLEBUTTON_VIEWID) // 4G开关
+ else if (viewId == DROPDOWN_FINDPHONE_TOGGLEBUTTON_VIEWID)
{
- if (ConfigModel::GetInstance()->GetCat1_4Gability() == false)
- {
- NativeAbility::GetInstance().EnterSlice(VIEW_NETWORKANDCALL);
- }
- else
- {
-#if defined(A5133_DEMO_CLIENT) || defined(A5133_DEMO_SERVER)
- uapi_set4GCapability(true);
-#else
- uapi_set4GCapability(false);
-#endif
- state = toggleButton[DropDownCardPage1::toggleButton_4G]->GetState();
-
- Updat4GState(cat1_api_is_cat1_enabled());
- ConfigModel::GetInstance()->SetCat1_4Gability(cat1_api_is_cat1_enabled());
- }
+ NativeAbility::GetInstance().EnterSlice(VIEW_FIND_PHONE);
}
- else if (viewId == DROPDOWN_ALIPAY_TOGGLEBUTTON_VIEWID) // 支付宝
+ else if (viewId == DROPDOWN_APPLIST_DISPLAY_TOGGLEBUTTON_VIEWID)
{
-#ifdef SUPPORT_ALIPAY_SEC
- if (Alipay_is_init() == false)
- {
- return false;
- }
- NativeAbility::GetInstance().EnterSlice(VIEW_MAIN_ALIPAY);
-#endif
+ SetApplistDisplay();
}
else if (viewId == DROPDOWN_SAVEPOWER_TOGGLEBUTTON_VIEWID) // 省电模式开关
{
}
toggleButton->SetPosition(toggleButtonConfig.left, toggleButtonConfig.top, toggleButtonConfig.width, toggleButtonConfig.height);
toggleButton->SetViewId(toggleButtonConfig.viewId);
- toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
- toggleButton->SetStyle(STYLE_BORDER_RADIUS, 200);
+ if (toggleButtonConfig.viewId == DROPDOWN_APPLIST_DISPLAY_TOGGLEBUTTON_VIEWID)
+ {
+ toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ toggleButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+ toggleButton->SetStyle(STYLE_BORDER_RADIUS, 200);
+ }
+ else
+ {
+ toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+ toggleButton->SetStyle(STYLE_BORDER_RADIUS, 200);
+ }
toggleButton->SetImages(toggleButtonConfig.selectImg, toggleButtonConfig.unselectImg);
toggleButton->SetState(toggleButtonConfig.state);
return toggleButton;
}
+ void DropDownCardPage1::SetApplistDisplay(void)
+ {
+ ThemeStyle style = ThemeStyleModel::GetInstance().GetAppListDisplayStyle();
+ if (style == ThemeStyle::APPLIST_STYLE)
+ {
+ toggleButton[2]->SetImages(DROPDOWN_APPLIST_DISPLAY_IMAGE[1], DROPDOWN_APPLIST_DISPLAY_IMAGE[1]); // 切换到弧形列表
+ ThemeStyleModel::GetInstance().SetAppListDisplayStyle(ThemeStyle::ARC_SCALE_LIST_STYLE);
+ }
+ else if (style == ThemeStyle::ARC_SCALE_LIST_STYLE)
+ {
+ toggleButton[2]->SetImages(DROPDOWN_APPLIST_DISPLAY_IMAGE[2], DROPDOWN_APPLIST_DISPLAY_IMAGE[2]);// 切换到蜂窝
+ ThemeStyleModel::GetInstance().SetAppListDisplayStyle(ThemeStyle::HEXAGONS_STYLE);
+ }
+ else if (style == ThemeStyle::HEXAGONS_STYLE)
+ {
+ toggleButton[2]->SetImages(DROPDOWN_APPLIST_DISPLAY_IMAGE[3], DROPDOWN_APPLIST_DISPLAY_IMAGE[3]); // 切换到拨号盘
+ ThemeStyleModel::GetInstance().SetAppListDisplayStyle(ThemeStyle::CIRCLE_LIST_STYLE);
+ }
+ else if (style == ThemeStyle::CIRCLE_LIST_STYLE)
+ {
+ toggleButton[2]->SetImages(DROPDOWN_APPLIST_DISPLAY_IMAGE[4], DROPDOWN_APPLIST_DISPLAY_IMAGE[4]); // 切换到瀑布流
+ ThemeStyleModel::GetInstance().SetAppListDisplayStyle(ThemeStyle::WATERFALL_STYLE);
+ }
+ else if (style == ThemeStyle::WATERFALL_STYLE)
+ {
+ toggleButton[2]->SetImages(DROPDOWN_APPLIST_DISPLAY_IMAGE[0], DROPDOWN_APPLIST_DISPLAY_IMAGE[0]); // 切换到列表
+ ThemeStyleModel::GetInstance().SetAppListDisplayStyle(ThemeStyle::APPLIST_STYLE);
+ }
+
+ return;
+ }
+
bool DropDownCardPage1::InitPage(void)
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DropDownCardPage1::InitPage");
- bool state_bt = ConfigModel::GetInstance()->GetClassicBlueToothState(); // 传统蓝牙开关
- bool state_4g = cat1_api_is_cat1_enabled();
- bool state_savepower = uapi_dev_runtime_get_saveele_status();
+ // 省电模式开关
+ bool state_savepower = uapi_dev_runtime_get_saveele_status();
+ // 睡眠模式开关
bool state_sleep = uapi_sleep_mode_flag_get();
+ // 勿扰模式开关
bool state_dnotdisturb = DnotDisturbModel::GetInstance().GetDoNotDisturbModeEnabled();
+ ThemeStyle style = ThemeStyleModel::GetInstance().GetAppListDisplayStyle();
+ int index = 0;
+ if (style == ThemeStyle::APPLIST_STYLE) // 列表
+ {
+ index = 0;
+ }
+ else if (style == ThemeStyle::ARC_SCALE_LIST_STYLE) // 弧形列表
+ {
+ index = 1;
+ }
+ else if (style == ThemeStyle::HEXAGONS_STYLE) // 蜂窝
+ {
+ index = 2;
+ }
+ else if (style == ThemeStyle::CIRCLE_LIST_STYLE) // 拨号盘
+ {
+ index = 3;
+ }
+ else if (style == ThemeStyle::WATERFALL_STYLE) // 瀑布流
+ {
+ index = 4;
+ }
+
ToggleButtonConfig toggleButtonConfig[] = {
- // {0, 0, 100, 100, DROPDOWN_BT_TOGGLEBUTTON_VIEWID, state_bt ? DROPDOWN_BT_CONNECT_IMAGE : DROPDOWN_BT_DISCONNECT_IMAGE, state_bt ? DROPDOWN_BT_CONNECT_IMAGE : DROPDOWN_BT_DISCONNECT_IMAGE, true, state_bt},
- {0, 0, 100, 100, DROPDOWN_BT_TOGGLEBUTTON_VIEWID, DROPDOWN_BT_IMAGE, DROPDOWN_BT_IMAGE, true, state_bt},
- {110, 0, 100, 100, DROPDOWN_4G_TOGGLEBUTTON_VIEWID, state_4g ? DROPDOWN_4G_ON_IMAGE : DROPDOWN_4G_OFF_IMAGE, state_4g ? DROPDOWN_4G_ON_IMAGE : DROPDOWN_4G_OFF_IMAGE, true, state_4g},
- {220, 0, 100, 100, DROPDOWN_ALIPAY_TOGGLEBUTTON_VIEWID, DROPDOWN_ALIPAY_IMAGE, DROPDOWN_ALIPAY_IMAGE, true, true},
+ {0, 0, 100, 100, DROPDOWN_BT_TOGGLEBUTTON_VIEWID, DROPDOWN_BT_IMAGE, DROPDOWN_BT_IMAGE, true, true},
+ {110, 0, 100, 100, DROPDOWN_FINDPHONE_TOGGLEBUTTON_VIEWID, DROPDOWN_FINDPHONE_IMAGE, DROPDOWN_FINDPHONE_IMAGE, true},
+ {220, 0, 100, 100, DROPDOWN_APPLIST_DISPLAY_TOGGLEBUTTON_VIEWID, DROPDOWN_APPLIST_DISPLAY_IMAGE[index], DROPDOWN_APPLIST_DISPLAY_IMAGE[index], true},
{330, 0, 100, 100, DROPDOWN_SAVEPOWER_TOGGLEBUTTON_VIEWID, state_savepower ? DROPDOWN_SAVEPOWER_ON_IMAGE : DROPDOWN_SAVEPOWER_OFF_IMAGE, state_savepower ? DROPDOWN_SAVEPOWER_ON_IMAGE : DROPDOWN_SAVEPOWER_OFF_IMAGE, true, state_savepower},
{55, 100, 100, 100, DROPDOWN_SLEEP_TOGGLEBUTTON_VIEWID, state_sleep ? DROPDOWN_SLEEP_ON_IMAGE : DROPDOWN_SLEEP_OFF_IMAGE, state_sleep ? DROPDOWN_SLEEP_ON_IMAGE : DROPDOWN_SLEEP_OFF_IMAGE, true, state_sleep},
{165, 100, 100, 100, DROPDOWN_DNOTDISTURB_TOGGLEBUTTON_VIEWID, state_dnotdisturb ? DROPDOWN_DNOTDISTURB_ON_IMAGE : DROPDOWN_DNOTDISTURB_OFF_IMAGE, state_dnotdisturb ? DROPDOWN_DNOTDISTURB_ON_IMAGE : DROPDOWN_DNOTDISTURB_OFF_IMAGE, true, state_dnotdisturb},
return toggleButton[index];
}
- void DropDownCardPage1::UpdateBTState(bool state)
- {
- if (toggleButton[DropDownCardPage1::toggleButton_BT] != nullptr)
- {
- const char *ImageSrc = state ? DROPDOWN_BT_CONNECT_IMAGE : DROPDOWN_BT_DISCONNECT_IMAGE;
- toggleButton[DropDownCardPage1::toggleButton_BT]->SetImages(ImageSrc, ImageSrc);
- }
- }
-
- void DropDownCardPage1::Updat4GState(bool state)
- {
- if (toggleButton[DropDownCardPage1::toggleButton_4G] != nullptr)
- {
- const char *ImageSrc = state ? DROPDOWN_4G_ON_IMAGE : DROPDOWN_4G_OFF_IMAGE;
- toggleButton[DropDownCardPage1::toggleButton_4G]->SetImages(ImageSrc, ImageSrc);
- }
- }
-
- // 刷新4g开关显示
- void DropDownCardPage1::Refresh4GState()
- {
- Updat4GState(cat1_api_is_cat1_enabled());
- }
-
void DropDownCardPage1::UpdateDnotdisturbState(bool state)
{
if (toggleButton[DropDownCardPage1::toggleButton_DNOTDISTURB] != nullptr)
const char *ImageSrc = state ? DROPDOWN_SLEEP_ON_IMAGE : DROPDOWN_SLEEP_OFF_IMAGE;
toggleButton[DropDownCardPage1::toggleButton_SLEEP]->SetImages(ImageSrc, ImageSrc);
}
- // //勿扰icon
- // if (toggleButton[DropDownCardPage1::toggleButton_DNOTDISTURB] != nullptr)
- // {
- // const char *ImageSrc = state ? DROPDOWN_DNOTDISTURB_ON_IMAGE : DROPDOWN_DNOTDISTURB_OFF_IMAGE;
- // toggleButton[DropDownCardPage1::toggleButton_DNOTDISTURB]->SetImages(ImageSrc, ImageSrc);
- // }
}
}
\ No newline at end of file