From: 罗正yun <1732036298@qq.com> Date: Sat, 20 Jan 2024 04:05:01 +0000 (+0800) Subject: 1.删除视图ID为 VIEW_MAIN的文件slice X-Git-Tag: release_V1.2.70_20241020_135402~1351^2~5^2 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=3a7503b309aede41792210f56e2da124beb27687;p=mirrors%2FFD230.git 1.删除视图ID为 VIEW_MAIN的文件slice --- diff --git a/code/sdk/application/wearable/nativeapp/CMakeLists.txt b/code/sdk/application/wearable/nativeapp/CMakeLists.txt index 794e7e867..ac1109e35 100755 --- a/code/sdk/application/wearable/nativeapp/CMakeLists.txt +++ b/code/sdk/application/wearable/nativeapp/CMakeLists.txt @@ -5,7 +5,6 @@ set(UI_SAMPLE_ROOT ${ROOT_DIR}/middleware/services/gui/uikit/sample/uitest) set(PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/nativelauncher/include - ${CMAKE_CURRENT_SOURCE_DIR}/nativelauncher/include/slices/main ) set(PRIVATE_HEADER @@ -77,8 +76,6 @@ set(PRIVATE_HEADER set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativelauncher/src/NativeLauncher.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativelauncher/src/slices/main/MainPresenter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativelauncher/src/slices/main/MainView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/MainViewSample.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/MainPresenterSample.cpp diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h index 1af2dd963..4b742739c 100755 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h @@ -22,15 +22,15 @@ * 基础应用的view id,与MVP的V一一对应 * 枚举命名要求:参考View名字,名字尽量简短 */ -typedef enum : uint16_t { - VIEW_INVALID = 0, - VIEW_MAIN = 1, - VIEW_SETTING = 2, - VIEW_APPLIST = 3, - VIEW_SETTING_FIRST = 4, - VIEW_MAIN_SAMPLE = 5, - VIEW_MAIN_ALARM = 6, - VIEW_MAIN_ACTIVITY = 7, +typedef enum : uint16_t +{ + VIEW_INVALID = 0, // 无效视图 + VIEW_MAIN_SAMPLE = 1, // 主界面 + VIEW_SETTING, // 设置 + VIEW_APPLIST, // App应用 + VIEW_MAIN_ALARM, // 闹钟 + VIEW_SETTING_FIRST, + VIEW_MAIN_ACTIVITY, VIEW_ALARM_POP_UP, VIEW_CALLER_SAMPLE, VIEW_MAEKPHONE_SAMPLE, @@ -45,14 +45,13 @@ typedef enum : uint16_t { VIEW_INDOORWALK, VIEW_REBOOT, VIEW_UISAMPLE, - VIEW_DIAL,//切换表盘 - + VIEW_DIAL, // 切换表盘 VIEW_WEATHER, // 天气 VIEW_WEATHER_REPORT, // 气象报告 VIEW_FUTURE_WEATHER, // 未来天气 VIEW_GET_WEATHER_DATA_ERROR, // 获取天气数据失败 - - VIEW_MAX_INTER_APP, // 在此之前添加native应用ID. + /* -------------------------------------------------------------------------- */ + VIEW_MAX_INTER_APP, // 在此之前添加native应用ID. VIEW_EXTERN_APP = 0xFFFE, // 三方应用 VIEW_INVALIDE_APP = 0xFFFF, } AppViewId; @@ -60,7 +59,8 @@ typedef enum : uint16_t { /* * Slice页面优先级,越小优先级越高 */ -typedef enum : uint16_t { +typedef enum : uint16_t +{ PRIO_0 = 0, PRIO_1, PRIO_2, diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h index 8870ce8fc..e5bc6349b 100755 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h @@ -21,7 +21,6 @@ namespace OHOS public: static NativeLauncher &GetInstance(void); void InitNativeLauncher(void); - void InitMainSlice(void); void InitMainSampleSlice(void); void InitSettingSlice(void); void InitApplistSlice(void); diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/slices/main/MainPresenter.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/slices/main/MainPresenter.h deleted file mode 100755 index 7e25bbdbe..000000000 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/slices/main/MainPresenter.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2020-2021 CompanyNameMagicTag. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MAIN_PRESENTER_H -#define MAIN_PRESENTER_H - -#include "Presenter.h" - -namespace OHOS { -class MainView; -class MainPresenter : public Presenter { -public: - MainPresenter(); - virtual ~MainPresenter(); - - void OnStart() override; - void OnPause() override; - void OnResume() override; - void OnStop() override; -}; -} - -#endif // MAIN_PRESENTER_H diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/slices/main/MainView.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/slices/main/MainView.h deleted file mode 100755 index 6a13caea8..000000000 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/slices/main/MainView.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2020-2021 CompanyNameMagicTag. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MAIN_VIEW_H -#define MAIN_VIEW_H - -#include - -#include "View.h" -#include "window/window.h" -#include "components/ui_label.h" -#include "components/root_view.h" -#include "components/ui_view_group.h" -#include "components/ui_image_view.h" -#include "components/ui_button.h" -#include "components/ui_label_button.h" - -#include "BaseView.h" -#include "ChangeSliceListener.h" - -namespace OHOS { -#define LA_HORIZONTAL_RESOLUTION 400 // watch width -#define LA_VERTICAL_RESOLUTION 400 // watch height -#define NORMAL_BUTTON_WIDTH 100 // normal button width -#define NORMAL_BUTTON_HEIGHT 50 // normal button height -#define UN_OPACITY 255 // UN_OPACITY -#define FONT_COMMON 20 // 20px - -class MainPresenter; -class MainView : public View { -public: - MainView(); - virtual ~MainView(); - - void OnStart() override; - void OnSetUpView() override; - void OnTearDownView() override; - void OnStop() override; -}; -} // namespace OHOS -#endif // MAIN_VIEW_H \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp index 3f47fcef7..d9e9e2048 100755 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp @@ -14,8 +14,6 @@ */ #include "NativeLauncher.h" -#include "MainView.h" -#include "MainPresenter.h" #include "SliceProxy.h" #include "AbilitySliceProxy.h" #include "wearable_log.h" @@ -91,7 +89,6 @@ namespace OHOS }; static const AppViewMapper SLICE_MAPPER[] = { - {VIEW_MAIN, &NativeLauncher::InitMainSlice}, {VIEW_SETTING, &NativeLauncher::InitSettingSlice}, {VIEW_APPLIST, &NativeLauncher::InitApplistSlice}, {VIEW_MAIN_SAMPLE, &NativeLauncher::InitMainSampleSlice}, @@ -117,7 +114,6 @@ namespace OHOS {VIEW_UISAMPLE, &NativeLauncher::InitUISampleSlice}}; static const ViewIdToString VIEW_MAPPER[] = { - {VIEW_MAIN, "main"}, {VIEW_SETTING, "setting"}, {VIEW_APPLIST, "applist"}, {VIEW_MAIN_SAMPLE, "mainViewSample"}, @@ -179,15 +175,6 @@ namespace OHOS return; } - void NativeLauncher::InitMainSlice(void) - { - SliceProxy *mainSlice = new AbilitySliceProxy; - if (mainSlice != nullptr) - { - NativeAbility::GetInstance().AddSliceProxy(VIEW_MAIN, mainSlice); - } - } - void NativeLauncher::InitMainSampleSlice(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitMainSampleSlice"); diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/src/slices/main/MainPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativelauncher/src/slices/main/MainPresenter.cpp deleted file mode 100755 index dbfac37c0..000000000 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/src/slices/main/MainPresenter.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2020-2021 CompanyNameMagicTag. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "MainPresenter.h" -#include "MainView.h" - -namespace OHOS { - -MainPresenter::MainPresenter() {} - -MainPresenter::~MainPresenter() {} - -void MainPresenter::OnStart() -{ - Presenter::OnStart(); -} - -void MainPresenter::OnPause(void) -{ -} - -void MainPresenter::OnResume(void) -{ -} - -void MainPresenter::OnStop(void) -{ -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/src/slices/main/MainView.cpp b/code/sdk/application/wearable/nativeapp/nativelauncher/src/slices/main/MainView.cpp deleted file mode 100755 index f180f6eed..000000000 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/src/slices/main/MainView.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2020-2021 CompanyNameMagicTag. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "MainView.h" -#include "AppViewIDs.h" - -#include "wearable_log.h" - -namespace OHOS { -MainView::MainView(){} - -MainView::~MainView(){} - -void MainView::OnStart() -{ - WEARABLE_LOGI(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "MainView::OnStart"); - View::OnStart(); - - BaseView::RootView(Color::Black().full); - - UILabel *goSettings = new UILabel(); - goSettings->SetText("Settings"); - goSettings->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_COMMON); - goSettings->SetPosition(35, LA_VERTICAL_RESOLUTION); - goSettings->Resize(NORMAL_BUTTON_WIDTH, NORMAL_BUTTON_HEIGHT); - goSettings->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - goSettings->SetStyle(STYLE_TEXT_OPA, OPA_OPAQUE); - goSettings->SetStyle(STYLE_TEXT_COLOR, Color::Black().full); - goSettings->SetStyle(STYLE_BACKGROUND_COLOR, Color::Green().full); - goSettings->SetStyle(STYLE_BACKGROUND_OPA, UN_OPACITY); - goSettings->SetStyle(STYLE_BORDER_RADIUS, 4); - goSettings->SetTouchable(true); - goSettings->SetOnTouchListener(new ChangeSliceListener(VIEW_MAIN)); - - UILabel *goAppList = new UILabel(); - goAppList->SetText("App List"); - goAppList->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_COMMON); - goAppList->SetPosition(165, LA_VERTICAL_RESOLUTION); - goAppList->Resize(NORMAL_BUTTON_WIDTH, NORMAL_BUTTON_HEIGHT); - goAppList->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - goAppList->SetStyle(STYLE_TEXT_OPA, OPA_OPAQUE); - goAppList->SetStyle(STYLE_TEXT_COLOR, Color::Black().full); - goAppList->SetStyle(STYLE_BACKGROUND_COLOR, Color::Green().full); - goAppList->SetStyle(STYLE_BACKGROUND_OPA, UN_OPACITY); - goAppList->SetStyle(STYLE_BORDER_RADIUS, 4); - goAppList->SetTouchable(true); - goAppList->SetOnTouchListener(new ChangeSliceListener(VIEW_MAIN)); - - RootView::GetInstance()->Add(goSettings); - RootView::GetInstance()->Add(goAppList); -} - -void MainView::OnSetUpView() -{ - WEARABLE_LOGI(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "MainView::OnSetUpView"); - View::OnSetUpView(); - - UIViewGroup *group = new UIViewGroup(); - group->SetPosition(0, 0, LA_HORIZONTAL_RESOLUTION, LA_VERTICAL_RESOLUTION); - group->SetStyle(STYLE_BACKGROUND_OPA, UN_OPACITY); - group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); - - RootView::GetInstance()->Add(group); - Draw(); -} - -void MainView::OnTearDownView() -{ - WEARABLE_LOGI(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "MainView::OnTearDownView"); - View::OnTearDownView(); - return; -} - -void MainView::OnStop() -{ - WEARABLE_LOGI(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "MainView::OnStop"); - View::OnStop(); - - if (container_ != nullptr) { - container_->RemoveAll(); - delete container_; - container_ = nullptr; - } - - RootView::GetInstance()->ClearOnKeyActListener(); - RootView::GetInstance()->RemoveAll(); - return; -} -} \ No newline at end of file