训练:修改训练”更多“列表样式
authorCaisking <3449750381@qq.com>
Fri, 4 Oct 2024 12:57:21 +0000 (20:57 +0800)
committerCaisking <3449750381@qq.com>
Fri, 4 Oct 2024 12:57:21 +0000 (20:57 +0800)
1  2 
code/sdk/application/wearable/fd230app/nativeui/traing/training_list_more/include/TraingMoreModel.h
code/sdk/application/wearable/fd230app/nativeui/traing/training_list_more/include/TraingMoreView.h
code/sdk/application/wearable/fd230app/nativeui/traing/training_list_more/src/TraingMoreItemView.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/training_list_more/src/TraingMoreModel.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/training_list_more/src/TraingMoreView.cpp

@@@ -35,7 -35,7 +35,7 @@@ namespace OHO
          TraingMoreModel(const TraingMoreModel &);
          TraingMoreModel &operator=(const TraingMoreModel &);
          virtual ~TraingMoreModel();
--        static const uint16_t TraingMoreListMaxNum = 7;
++        static const uint16_t TraingMoreListMaxNum = 9;
          TraingMoreItem TraingMores[TraingMoreListMaxNum] = {VIEW_INVALID, STR_ICE_SPORTS, nullptr};
          // std::map<int, AppViewId> TraingMoreIdToViewId;
          bool btConnectStatus{false};
@@@ -40,7 -40,7 +40,7 @@@ namespace OHO
  
      private:
          UIScrollView *scrollView = nullptr;
--        UILabelExt *title{nullptr};
++        // UILabelExt *title{nullptr};
          TraingMoreAdapter *p_TraingMoreListAdapter{nullptr};
          UIList *TraingMoreList = nullptr;
          UIView::OnDragListener *draglistener{nullptr};
@@@ -43,8 -43,8 +43,40 @@@ namespace OHO
      void TraingMoreItemView::SetItemInfo(const TraingMoreItem itemInfo)
      {
          sItemInfo = itemInfo;
--        sLabel.SetTextId(itemInfo.labelid);
--        slogo.SetSrc(itemInfo.logo);
++        if(itemInfo.id == VIEW_TRAININGMORE)
++        {
++            sLabel.SetTextId(STR_TRAINING);
++            sLabel.SetPosition(90, 50, 200, 35);
++
++            sicon.SetVisible(false);
++            sbackground.SetVisible(false);
++            slogo.SetVisible(false);
++            sLabel.SetVisible(true);
++            sLabel.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
++            SetHeight(120);
++        }
++        else if(itemInfo.id == VIEW_INVALID)
++        {
++            sLabel.SetVisible(false);
++            sicon.SetVisible(false);
++            sbackground.SetVisible(false);
++            slogo.SetVisible(false);
++            sLabel.SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
++            SetHeight(60);
++        }
++        else
++        {
++            sLabel.SetTextId(itemInfo.labelid);
++            slogo.SetSrc(itemInfo.logo);
++            sLabel.SetPosition(105, 33, 200, 35);
++
++            sbackground.SetVisible(true);
++            sLabel.SetVisible(true);
++            sicon.SetVisible(true);
++            slogo.SetVisible(true);
++            sLabel.SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
++            SetHeight(120);
++        }
      }
  
      /// @brief 设置每一个itemview上的组件
@@@ -60,9 -60,9 +92,9 @@@
          sicon.SetStyle(STYLE_IMAGE_OPA, OPA_OPAQUE);
  
          sLabel.SetPosition(105, 33, 200, 35);
--        sLabel.SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
++        sLabel.SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
          // sLabel.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
--        sLabel.SetRollSpeed(0);
++        sLabel.SetRollSpeed(70);
          sLabel.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
      }
  
@@@ -38,14 -38,14 +38,17 @@@ namespace OHO
  
      void TraingMoreModel::InitTraingMoreListItem()
      {
--        TraingMores[0] = {VIEW_TRAININGFITNESS, STR_EXERCISE_LIST, FITNESS_IMAGE};
--        TraingMores[1] = {VIEW_TRAININGDANCE, STR_DANCING_LIST, DANCE_IMAGE};
--        TraingMores[2] = {VIEW_TRAININGREST, STR_RECREATIONAL_LIST, REST_IMAGE};
--        TraingMores[3] = {VIEW_TRAININGBALL, STR_BALL_LIST, BALL_IMAGE};
++        int index = 0;
++        TraingMores[index++] = {VIEW_TRAININGMORE, STR_TRAINING, nullptr};
++        TraingMores[index++] = {VIEW_TRAININGFITNESS, STR_EXERCISE_LIST, FITNESS_IMAGE};
++        TraingMores[index++] = {VIEW_TRAININGDANCE, STR_DANCING_LIST, DANCE_IMAGE};
++        TraingMores[index++] = {VIEW_TRAININGREST, STR_RECREATIONAL_LIST, REST_IMAGE};
++        TraingMores[index++] = {VIEW_TRAININGBALL, STR_BALL_LIST, BALL_IMAGE};
          // TraingMores[4] = {VIEW_TRAININGAQUATIC, STR_WATER_LIST, SWIMMING_IMAGE};水上运动
--        TraingMores[4] = {VIEW_TRAININGICE, STR_ICE_LIST, ICE_IMAGE};
--        TraingMores[5] = {VIEW_TRAININGLIMIT, STR_EXTREME_LIST, LIMIT_IMAGE};
--        TraingMores[6] = {VIEW_TRAININGOTHER, STR_OTHER_LIST, OTHER_IMAGE};
++        TraingMores[index++] = {VIEW_TRAININGICE, STR_ICE_LIST, ICE_IMAGE};
++        TraingMores[index++] = {VIEW_TRAININGLIMIT, STR_EXTREME_LIST, LIMIT_IMAGE};
++        TraingMores[index++] = {VIEW_TRAININGOTHER, STR_OTHER_LIST, OTHER_IMAGE};
++        TraingMores[index++] = {VIEW_INVALID, STR_TRAINING, nullptr};
      }
  
      const TraingMoreItem *TraingMoreModel::GetTraingMorelistItems() const
@@@ -70,15 -70,15 +70,15 @@@ namespace OHO
          scrollView->SetDraggable(true);\r
          scrollView->SetDirection(1);\r
          // scrollView->SetReboundSize(50); // 设置空白大小\r
--        scrollView->SetScrollBlankSize(75);\r
++        // scrollView->SetScrollBlankSize(75);\r
          scrollView->SetHorizontalScrollState(false); // 设置横向不可滑动\r
  \r
          // 设置拖动监听器\r
          scrollView->SetOnDragListener(presenter_);\r
  \r
          // 初始化 label\r
--        InitLabelExt(title, 125, 52, 200, 60, "label1", STR_TRAINING, DEFAULT_VECTOR_FONT_FILENAME, 30);\r
--        scrollView->Add(title);\r
++        // InitLabelExt(title, 125, 52, 200, 60, "label1", STR_TRAINING, DEFAULT_VECTOR_FONT_FILENAME, 30);\r
++        // scrollView->Add(title);\r
  \r
          // 初始化适配器\r
          p_TraingMoreListAdapter = new TraingMoreAdapter();\r
@@@ -90,7 -90,7 +90,7 @@@
              TraingMoreList = new UIList();\r
          }\r
  \r
--        TraingMoreList->SetPosition(More_LIST_POSITION_X, More_LIST_POSITION_Y, 466, 466);\r
++        TraingMoreList->SetPosition(More_LIST_POSITION_X, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);\r
          TraingMoreList->SetThrowDrag(true);\r
          TraingMoreList->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);\r
          TraingMoreList->SetMaxScrollDistance(1000);\r
          scrollView->SetYScrollBarVisible(true);\r
  \r
          // 增加表冠控制\r
--        TraingMoreList->SetRotateFactor(2);\r
++        TraingMoreList->SetRotateFactor(1);\r
          TraingMoreList->RequestFocus();\r
  \r
          // 设置键盘事件监听\r
      {\r
          // scrollView-> RemoveAll();\r
          scrollView->RemoveAll();\r
--        delete title;\r
--        title = nullptr;\r
++        // delete title;\r
++        // title = nullptr;\r
  \r
          TraingMoreList->RemoveAll();\r
          delete TraingMoreList;\r