void ApplistView::HexagonsStyleOnStart()
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnStart start...");
- if (hexagonsList_ == nullptr) {
+ if (hexagonsList_ == nullptr)
+ {
hexagonsList_ = new UICustomHexagonsList();
+ hexagonsList_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+ imgDistance_ = hexagonsList_->GetWidth() * 0.25991; // 0.25991, empirical coefficient
+ imgSize_ = hexagonsList_->GetWidth() * 0.23348; // 0.23348, empirical coefficient
+ hexagonsList_->SetImageDistance(imgDistance_);
+ hexagonsList_->SetImageSizeInCenter(imgSize_);
+ int16_t blankSize = hexagonsList_->GetRelativeRect().GetWidth() > hexagonsList_->GetRelativeRect().GetHeight() ?
+ hexagonsList_->GetRelativeRect().GetWidth() / 2 : hexagonsList_->GetRelativeRect().GetHeight() / 2; // 2, half
+ hexagonsList_->SetScrollBlankSize(blankSize);
+ hexagonsList_->SetReboundSize(blankSize);
+ hexagonsList_->SetThrowDrag(true);
+ hexagonsList_->SetOnRotateListener(presenter_);
+ hexagonsList_->RequestFocus();
+ SetContainerView(hexagonsList_);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnStart start...");
}
- hexagonsList_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
- imgDistance_ = hexagonsList_->GetWidth() * 0.25991; // 0.25991, empirical coefficient
- imgSize_ = hexagonsList_->GetWidth() * 0.23348; // 0.23348, empirical coefficient
- hexagonsList_->SetImageDistance(imgDistance_);
- hexagonsList_->SetImageSizeInCenter(imgSize_);
- int16_t blankSize = hexagonsList_->GetRelativeRect().GetWidth() > hexagonsList_->GetRelativeRect().GetHeight() ?
- hexagonsList_->GetRelativeRect().GetWidth() / 2 : hexagonsList_->GetRelativeRect().GetHeight() / 2; // 2, half
- hexagonsList_->SetScrollBlankSize(blankSize);
- hexagonsList_->SetReboundSize(blankSize);
- hexagonsList_->SetThrowDrag(true);
- hexagonsList_->SetOnRotateListener(presenter_);
- hexagonsList_->RequestFocus();
- SetContainerView(hexagonsList_);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnStart start...");
}
//列表OnStart
if (listGroup == nullptr){
return;
}
+ SetContainerView(listGroup);
+ container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
}
- SetContainerView(listGroup);
- container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+ /* ------------------------------ listAdapter_ ------------------------------ */
if(listAdapter_== nullptr) {
listAdapter_ = new ApplistAdapter();
if (listAdapter_ == nullptr){
return;
}
+ listAdapter_->SetItemClickListener(presenter_);
}
- listAdapter_->SetItemClickListener(presenter_);
+ /* ------------------------------ contentList_ ------------------------------ */
if(contentList_ == nullptr) {
contentList_ = new UIList(UIList::VERTICAL);
if (contentList_ == nullptr){
return;
}
+ contentList_->SetPosition(0, 0);
+ contentList_->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+ contentList_->SetScrollBlankSize(VERTICAL_RESOLUTION / NUM_2);
+ contentList_->SetSelectPosition(VERTICAL_RESOLUTION / NUM_2); // middle position
+ contentList_->SetDraggable(true);
+ contentList_->SetThrowDrag(true);
+ contentList_->EnableAutoAlign(true);
+ contentList_->SetScrollStateListener(presenter_);
+ contentList_->SetMaxScrollDistance(MAX_SCROLL_DIS);
+ contentList_->SetYScrollBarVisible(true);
+ contentList_->SetRotateFactor(ROTATE_FACTOR_2); // 增加表冠控制
+ contentList_->RequestFocus();
+ container_->Add(contentList_);
+ /* ------------------------------ dragListener ------------------------------ */
+ if(dragListener == nullptr){
+ dragListener = new AppListOnDragListener();
+ if (dragListener == nullptr) {
+ return;
+ }
+ }
+ contentList_->SetOnDragListener(dragListener);
}
- contentList_->SetPosition(0, 0);
- contentList_->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
- contentList_->SetScrollBlankSize(VERTICAL_RESOLUTION / NUM_2);
- contentList_->SetSelectPosition(VERTICAL_RESOLUTION / NUM_2); // middle position
- contentList_->SetDraggable(true);
- contentList_->SetThrowDrag(true);
- contentList_->EnableAutoAlign(true);
- contentList_->SetScrollStateListener(presenter_);
- contentList_->SetMaxScrollDistance(MAX_SCROLL_DIS);
- contentList_->SetYScrollBarVisible(true);
- contentList_->SetRotateFactor(ROTATE_FACTOR_2); // 增加表冠控制
- contentList_->RequestFocus();
- container_->Add(contentList_);
-
- dragListener = new AppListOnDragListener();
- if (dragListener == nullptr) {
- return;
- }
- contentList_->SetOnDragListener(dragListener);
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ListStyleOnStart end...");
}
void ApplistView::OnSetUpView()
{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnSetUpView");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ApplistView::OnSetUpView");
View<ApplistPresenter>::OnSetUpView();
AppListStyle style = presenter_->GetCurrentStyle();
if (style == AppListStyle::FOOTBALL_STYLE) {
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-06-07 09:21:47
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-17 15:35:23
+ * @LastEditTime: 2024-08-02 09:55:52
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/ThemeStyleModel.cpp
*/
#include "securec.h"
#include "wearable_log.h"
#include <ohos_errno.h>
+#include "ConfigModel.h"
namespace OHOS
{
static const int STYLE_VALUE_LEN = 32;
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThemeStyleModel::GetAppListDisplayStyle");
- char temp[STYLE_VALUE_LEN] = {0};
- int ret = UtilsGetValue(THEMESTYLE_KEY, temp, STYLE_VALUE_LEN); // 从文件系统或缓存中获取与指定键匹配的值。
- if (ret < 0)
- {
- UtilsSetValue(THEMESTYLE_KEY, THEMESTYLE_VALUE_LIST); // 设置默认值
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UtilsGetValue error,temp:%s,ret = %d", temp, ret);
- return ThemeStyle::APPLIST_STYLE;
- }
-
// 检查是否存在对应的样式选项
- auto it = ReverseThemeStyleMap.find(std::string(temp));
+ auto it = ReverseThemeStyleMap.find(OHOS::ConfigModel::GetInstance()->get_configData_string(OHOS::ConfigModel::CONFIGMODEL_ITEM_APPLIST_STYLE));
if (it != ReverseThemeStyleMap.end())
{
return it->second;
// 检查是否存在对应的样式选项
if (ThemeStyleMap.find(style) != ThemeStyleMap.end())
{
- const char *value = THEMESTYLE_KEY;
- const char *key = ThemeStyleMap.at(style).c_str();
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "value:%s,key:%s", value, key);
+ const char *value = ThemeStyleMap.at(style).c_str();
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "value:%s", value);
// 根据映射设置显示样式值
- int ret = UtilsSetValue(value, key);
- if (ret != EC_SUCCESS)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UtilsSetValue error,ret = %d", ret);
- return;
- }
+ OHOS::ConfigModel::GetInstance()->set_condigData_String(OHOS::ConfigModel::CONFIGMODEL_ITEM_APPLIST_STYLE, value);
}
else
{