*/
#include "components/ui_view_group.h"
-#include "ApplistView.h"
+#include "applist/include/AppItemView.h"
#include "ApplistPresenter.h"
#include "AppItemView.h"
#include "common/image_cache_manager.h"
#include "hal_tick.h"
+#include "themestyle/include/ThemeStyleModel.h"
namespace OHOS {
static constexpr int16 NUM_2 = 2;
ApplistView::~ApplistView()
{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::~ApplistView ");
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::~ApplistView start...");
+ if(listGroup != nullptr)
+ {
+ delete listGroup;
+ listGroup = nullptr;
+ }
if (listAdapter_ != nullptr) {
delete listAdapter_;
listAdapter_ = nullptr;
callback_ = nullptr;
}
enterAnimator_ = nullptr;
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::~ApplistView end...");
}
void ApplistView::OnStart()
{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnStart ");
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnStart start...");
View<ApplistPresenter>::OnStart();
AppListStyle style = presenter_->GetCurrentStyle();
if (style == AppListStyle::FOOTBALL_STYLE) {
} else {
ListStyleOnStart();
}
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnStart end...");
}
//足球OnStart
//蜂窝OnStart
void ApplistView::HexagonsStyleOnStart()
{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnStart ");
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnStart start...");
if (hexagonsList_ == nullptr) {
hexagonsList_ = new UICustomHexagonsList();
}
hexagonsList_->SetOnRotateListener(presenter_);
hexagonsList_->RequestFocus();
SetContainerView(hexagonsList_);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnStart start...");
}
//列表OnStart
void ApplistView::ListStyleOnStart()
{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ListStyleOnStart");
- SetContainerView(new UIViewGroup());
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ListStyleOnStart start...");
+ if(listGroup == nullptr) {
+ listGroup = new UIViewGroup();
+ if (listGroup == nullptr){
+ return;
+ }
+ }
+ SetContainerView(listGroup);
container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
- listAdapter_ = new ApplistAdapter();
- if (listAdapter_ == nullptr) {
- return;
+ if(listAdapter_== nullptr) {
+ listAdapter_ = new ApplistAdapter();
+ if (listAdapter_ == nullptr){
+ return;
+ }
}
listAdapter_->SetItemClickListener(presenter_);
-
- contentList_ = new UIList(UIList::VERTICAL);
- if (contentList_ == nullptr) {
- return;
+ if(contentList_ == nullptr) {
+ contentList_ = new UIList(UIList::VERTICAL);
+ if (contentList_ == nullptr){
+ return;
+ }
}
contentList_->SetPosition(0, 0);
contentList_->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
return;
}
contentList_->SetOnDragListener(dragListener);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ListStyleOnStart end...");
}
void ApplistView::OnSetUpView()
void ApplistView::OnStop()
{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnStop");
- AppListStyle style = presenter_->GetCurrentStyle();
- if (style == AppListStyle::FOOTBALL_STYLE) {
- FootballStyleOnStop();
- RootView::GetInstance()->ClearOnKeyActListener();
- } else if (style == AppListStyle::HEXAGONS_STYLE) {
- HexagonsStyleOnStop();
- } else {
- ListStyleOnStop();
- RootView::GetInstance()->ClearOnKeyActListener();
- }
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnStop start...");
View<ApplistPresenter>::OnStop();
if (container_ != nullptr) {
container_->RemoveAll();
- delete container_;
container_ = nullptr;
}
- //RootView::GetInstance()->ClearOnKeyActListener();
- //FocusManager::GetInstance()->ClearFocus();
- return;
+ if(!ThemeStyleModel::GetInstance().GetTheSameSliceChangeFlag()) {
+ AppListStyle style = presenter_->GetCurrentStyle();
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnStop GetPreApplistStyleFlag == false");
+ if (style == AppListStyle::FOOTBALL_STYLE) {
+ FootballStyleOnStop();//足球
+ RootView::GetInstance()->ClearOnKeyActListener();
+ } else if (style == AppListStyle::HEXAGONS_STYLE) {
+ HexagonsStyleOnStop();//蜂窝
+ } else {
+ ListStyleOnStop();//list
+ RootView::GetInstance()->ClearOnKeyActListener();
+ }
+ } else {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnStop GetPreApplistStyleFlag == true");
+ if(ThemeStyleModel::GetInstance().GetPreApplistStyle() == AppListStyle::HEXAGONS_STYLE)
+ {
+ HexagonsStyleOnStop();
+ }
+ else if(ThemeStyleModel::GetInstance().GetPreApplistStyle() == AppListStyle::APPLIST_STYLE)
+ {
+ ListStyleOnStop();
+ }
+ ThemeStyleModel::GetInstance().SetTheSameSliceChangeFlag(false);
+ }
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnStop end...");
}
//足球OnStop
//蜂窝OnStop
void ApplistView::HexagonsStyleOnStop()
{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnStop");
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnStop start...");
if (hexagonsList_ != nullptr) {
hexagonsList_->RemoveAll();
}
viewNode = viewNode->next_;
}
listHexagonsView_.Clear();
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnStop end ...");
}
//列表OnStop
void ApplistView::ListStyleOnStop()
{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ListStyleOnStop");
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ListStyleOnStop start...");
+ if(listGroup != nullptr) {
+ listGroup->RemoveAll();
+ }
int16_t listHeadY = contentList_->GetChildrenHead()->GetY();
int16_t listHeadIndex = contentList_->GetChildrenHead()->GetViewIndex();
presenter_->SetHeadItemY(listHeadY);
presenter_->SetStartIndex(listHeadIndex);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ListStyleOnStop end...");
}
void ApplistView::AddAppItemToList(const AppItem &item)