diff --git a/launcher/launcher/src/main/cpp/swipe_view.cpp b/launcher/launcher/src/main/cpp/swipe_view.cpp index 0b50dcb49c3052853b156532b2a0ed24ad866c42..56e14447d787ac3212161aa0b883b436ce066224 100755 --- a/launcher/launcher/src/main/cpp/swipe_view.cpp +++ b/launcher/launcher/src/main/cpp/swipe_view.cpp @@ -113,54 +113,61 @@ void SwipeView::OnSetUpView() AddFirstViewGroup(); AddViewGroup(); AddViewGroup(); + double scale0 = 0.6; + double scale1 = 0.69; // Reserved. Touch and hold to add a page. arrPage_[0]->SetMatrix(APP_ROW_COUNT, APP_COL_COUNT); - arrPage_[0]->SetScale(0.6); // 0.6 blank/icon width + arrPage_[0]->SetScale(scale0); for (int16_t i = 1; i < groupCount_; i++) { arrPage_[i]->SetMatrix(APP_ROW_COUNT, 2 * APP_COL_COUNT); // 2 scale of first view's col count - arrPage_[i]->SetScale(0.69); // 0.69 blank/icon width + arrPage_[i]->SetScale(scale1); // 0.69 blank/icon width } AppEvent::GetInstance(this); AppManage::SetViewGroup(AppEvent::ClickEvent, AppEvent::LongPressEvent, arrPage_, groupCount_); BundleInfo* pBundleInfos = nullptr; int count = 0; if (appManage_->LauncherApp(&pBundleInfos, count)) { - for (int j = 0; j < count; j++) { - for (int i = 0; i < groupCount_; i++) { - if (memcmp(LAUNCHER_BUNDLE_NAME, pBundleInfos[j].bundleName, strlen(pBundleInfos[j].bundleName)) == 0) { - break; - } - if (memcmp(SCREENSAVER_BUNDLE_NAME, pBundleInfos[j].bundleName, strlen(pBundleInfos[j].bundleName)) == 0) { - break; - } - if (pBundleInfos[j].abilityInfos->abilityType == SERVICE) { - break; - } - AppInfo* app = new AppInfo(); - app->funcclick_ = AppEvent::ClickEvent; - app->funclPress_ = AppEvent::LongPressEvent; - if (pBundleInfos[j].bundleName) { - (void)memcpy_s(app->appName_, sizeof(app->appName_), pBundleInfos[j].bundleName, - strlen(pBundleInfos[j].bundleName)); - app->appName_[strlen(pBundleInfos[j].bundleName)] = 0; - } - if (pBundleInfos[j].abilityInfos[0].name) { - (void)memcpy_s(app->abilityName_, sizeof(app->abilityName_), pBundleInfos[j].abilityInfos[0].name, - strlen(pBundleInfos[j].abilityInfos[0].name)); - app->abilityName_[strlen(pBundleInfos[j].abilityInfos[0].name)] = 0; - } - if (pBundleInfos[j].bigIconPath) { - (void)memcpy_s(app->appIconDir_, sizeof(app->appIconDir_), pBundleInfos[j].bigIconPath, - strlen(pBundleInfos[j].bigIconPath)); - app->appIconDir_[strlen(pBundleInfos[j].bigIconPath)] = 0; - } - if (arrPage_[i]->AddApp(app)) { - break; - } + BundleInfoScan(pBundleInfos, count); + } + swipe_->SetCurrentPage(0); +} + +void SwipeView::BundleInfoScan(BundleInfo* pBundleInfos, int count) +{ + for (int j = 0; j < count; j++) { + for (int i = 0; i < groupCount_; i++) { + if (memcmp(LAUNCHER_BUNDLE_NAME, pBundleInfos[j].bundleName, strlen(pBundleInfos[j].bundleName)) == 0) { + break; + } + if (memcmp(SCREENSAVER_BUNDLE_NAME, pBundleInfos[j].bundleName, strlen(pBundleInfos[j].bundleName)) == 0) { + break; + } + if (pBundleInfos[j].abilityInfos->abilityType == SERVICE) { + break; + } + AppInfo* app = new AppInfo(); + app->funcclick_ = AppEvent::ClickEvent; + app->funclPress_ = AppEvent::LongPressEvent; + if (pBundleInfos[j].bundleName) { + (void)memcpy_s(app->appName_, sizeof(app->appName_), pBundleInfos[j].bundleName, + strlen(pBundleInfos[j].bundleName)); + app->appName_[strlen(pBundleInfos[j].bundleName)] = 0; + } + if (pBundleInfos[j].abilityInfos[0].name) { + (void)memcpy_s(app->abilityName_, sizeof(app->abilityName_), pBundleInfos[j].abilityInfos[0].name, + strlen(pBundleInfos[j].abilityInfos[0].name)); + app->abilityName_[strlen(pBundleInfos[j].abilityInfos[0].name)] = 0; + } + if (pBundleInfos[j].bigIconPath) { + (void)memcpy_s(app->appIconDir_, sizeof(app->appIconDir_), pBundleInfos[j].bigIconPath, + strlen(pBundleInfos[j].bigIconPath)); + app->appIconDir_[strlen(pBundleInfos[j].bigIconPath)] = 0; + } + if (arrPage_[i]->AddApp(app)) { + break; } } } - swipe_->SetCurrentPage(0); } void SwipeView::StartApp(AppInfo* app) diff --git a/launcher/launcher/src/main/cpp/swipe_view.h b/launcher/launcher/src/main/cpp/swipe_view.h index 03147d20a6a6ec0d7cc0da93c803634645052c4e..69ab8acbe90dd6fadebf333399e61a57f4aec07c 100755 --- a/launcher/launcher/src/main/cpp/swipe_view.h +++ b/launcher/launcher/src/main/cpp/swipe_view.h @@ -75,6 +75,7 @@ public: SwipeView(UILabel* titlellable, UILabel* taillable); virtual ~SwipeView(); void OnSetUpView(); + void BundleInfoScan(BundleInfo* pBundleInfos, int count); void StartApp(AppInfo* app); void ShowLongPressView(AppInfo* app); void UninstallApp(AppInfo* app);