From 62f503448486bc98a392285817731ae45803bf61 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Thu, 29 Jan 2026 19:05:13 +0800 Subject: [PATCH] =?utf8?q?=E7=9B=B4=E7=BA=BF=E5=88=97=E8=A1=A8=E4=BF=AE?= =?utf8?q?=E6=94=B9=E4=B8=BA=E5=B1=85=E4=B8=AD=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/applist/include/ApplistView.h | 1 + .../nativeui/applist/src/ApplistView.cpp | 50 ++++++++++++------- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/applist/include/ApplistView.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/applist/include/ApplistView.h index 546696221..fbe463ba0 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/applist/include/ApplistView.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/applist/include/ApplistView.h @@ -126,6 +126,7 @@ public: private: /* for list style */ void ListStyleOnStart(); + void ListStyleOnSetUpView(); void ListStyleOnStop(); ApplistAdapter *listAdapter_{nullptr}; UIList *contentList_{nullptr}; diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/applist/src/ApplistView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/applist/src/ApplistView.cpp index b92725759..d36c98cf2 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/applist/src/ApplistView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/applist/src/ApplistView.cpp @@ -897,6 +897,37 @@ void ApplistView::ListStyleOnStart() AddViewToRootContainer(contentList_); } +void ApplistView::ListStyleOnSetUpView(void) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ListStyleOnSetUpView [%d]", __LINE__); + uint16_t startIndex = 0; + int16_t headY = 0; + if (presenter_->GetStartIndex() >= presenter_->GetListItemNum()) { + startIndex = presenter_->GetListItemNum() - 1; + headY = VERTICAL_RESOLUTION / NUM_2; + } else { + uint16_t presliceId = NativeAbility::GetInstance().GetPreSliceId(); + if (presliceId == VIEW_MAIN) //如果是从主页进入的,那么startIndex = 0,headY = 0 + { + startIndex = 0; + headY = 68; + } else { //如果是从其他页面进入的,那么startIndex = presenter_->GetArcListStartIndex(),headY = presenter_->GetArcListHeadItemY() + startIndex = presenter_->GetArcListStartIndex(); + headY = presenter_->GetArcListHeadItemY(); + } + if (headY == 0) { + headY = VERTICAL_RESOLUTION / NUM_2; + } + } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "startIndex = %d, headY = %d\n", startIndex, headY); + contentList_->SetAdapter(listAdapter_); + contentList_->ScrollTo(startIndex); + contentList_->ScrollBy(headY); + contentList_->RefreshList(); + return; +} + + void ApplistView::ResumeWaterFallDraggable() { if (waterfallList_ != nullptr) { @@ -1058,23 +1089,8 @@ void ApplistView::RefreshAppList(void) ArcScaleListStyleOnSetUpView(); } else if (style == AppListStyle::CIRCLE_LIST_STYLE) { // 拨号盘 - } else { - uint16_t startIndex = 0; - int16_t headY = 0; - if (presenter_->GetStartIndex() >= presenter_->GetListItemNum()) { - startIndex = presenter_->GetListItemNum() - 1; - headY = VERTICAL_RESOLUTION / NUM_2; - } else { - startIndex = presenter_->GetStartIndex(); - headY = presenter_->GetHeadItemY(); - if (headY == 0) { - headY = VERTICAL_RESOLUTION / NUM_2; - } - } - contentList_->SetAdapter(listAdapter_); - contentList_->ScrollTo(startIndex); - contentList_->ScrollBy(headY); - contentList_->RefreshList(); + } else if (style == AppListStyle::APPLIST_STYLE) { + ListStyleOnSetUpView(); } } -- 2.17.1