#include "traing/include/TraingModel.h"
#include "components/ui_hexagons_list.h"
#include "TransitionType.h"
+#include "AppViewIDs.h"
namespace OHOS {
ApplistPresenter::ApplistPresenter()
AppViewId viewId = itemView->GetViewId();
if (FloatMore(hexagonsView->GetGlobalScale(), 2.0f)) { // 2.0 threshold for beginning transition
hexagonsView->StopRotateAnimator();
- NativeAbility::GetInstance().ChangeSlice(viewId, TransitionType::TRANSITION_HEXAGONS);
+ //NativeAbility::GetInstance().ChangeSlice(viewId, TransitionType::TRANSITION_HEXAGONS);
+ NativeAbility::GetInstance().EnterSlice(viewId, TransitionType::TRANSITION_HEXAGONS);
hexagonsView->ClearFocus();
}
return true;
hexagonsView->Scale(1.0f, itemView->GetViewIndex()); // switch focus to click view
type = TransitionType::TRANSITION_HEXAGONS;
}
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick viewid = %d", viewId);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick viewid = %d type = %d", viewId,type);
if (viewId < VIEW_MAX_INTER_APP) {
//NativeAbility::GetInstance().ChangeSlice(viewId, type);
NativeAbility::GetInstance().EnterSlice(viewId, type);
/*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: MainCompassPresenter.h
- * Author:
- * Create: 2021-12-21
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-06-07 09:21:47
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-06-07 20:18:32
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/compass/include/MainCompassPresenter.h
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
#ifndef COMPASS_MAINPRESENTER_H
#define COMPASS_MAINPRESENTER_H
static MainCompassPresenter *GetInstance(void);
bool OnDrag(UIView& view, const DragEvent& event) override;
+ bool OnDragEnd(UIView& view, const DragEvent& event) override;
bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件
void Notify() override;
+ bool X_DRAG_FLAG{false};
};
}
#endif
\ No newline at end of file
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-03-14 15:02:03
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-07 10:33:16
+ * @LastEditTime: 2024-06-07 20:23:18
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
#include "wearable_log.h"
#include "common/key_code.h"
#include "custom_utils.h"
+#include "UiConfig.h"
namespace OHOS
{
static MainCompassPresenter *g_pMainView = nullptr;
*/
bool MainCompassPresenter::OnDrag(UIView &view, const DragEvent &event)
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCompassPresenter::OnDrag");
UNUSED(view);
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)
+ if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动
{
- NativeAbility::GetInstance().Back();
+ MainCompassPresenter::X_DRAG_FLAG = true;
+ }
+ return true;
+ }
+
+ bool MainCompassPresenter::OnDragEnd(UIView& view, const DragEvent& event)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCompassPresenter::OnDragEnd");
+ UNUSED(view);
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && MainCompassPresenter::X_DRAG_FLAG)
+ {
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
}
return true;
}
// 如果是power键就返回上一级
if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0)
{
- NativeAbility::GetInstance().Back();
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
}
return true;
}
* @Author: luozheng 1732036298@qq.com\r
* @Date: 2024-04-07 18:15:53\r
* @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-04-09 15:40:05\r
+ * @LastEditTime: 2024-06-07 19:57:56\r
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownPresenter.h\r
*/\r
#ifndef MAIN_COUNTDOWN_PRESENTER_H\r
\r
std::string countdowntime{0};\r
std::string ringtime{0};\r
+ bool X_DRAG_FLAG{false};\r
};\r
}\r
\r
#include "AppViewIDs.h"\r
#include "NativeAbility.h"\r
+#include "UiConfig.h"\r
#include "countdown/include/MainCountDownPresenter.h"\r
#include "countdown/include/CountDownModel.h"\r
#include "common/key_code.h"\r
{\r
Presenter<MainCountDownView>::OnStop();\r
ScreenAlwaysOnCtr(0); // 取消长亮屏\r
-\r
}\r
\r
bool MainCountDownPresenter::OnDrag(UIView &view, const DragEvent &event)\r
{\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCountDownPresenter::OnDrag");\r
UNUSED(view);\r
- UNUSED(event);\r
+ if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动\r
+ {\r
+ MainCountDownPresenter::X_DRAG_FLAG = true;\r
+ }\r
return true;\r
}\r
\r
bool MainCountDownPresenter::OnDragEnd(UIView &view, const DragEvent &event)\r
{\r
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && strcmp(view.GetViewId(), MAINCOUNTDOWNVIEW) == 0)\r
- {\r
- NativeAbility::GetInstance().Back();\r
- }\r
- else if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && strcmp(view.GetViewId(), COUNTDOWN_TIMECONFIG_VIEW) == 0)\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCountDownPresenter::OnDragEnd");\r
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && MainCountDownPresenter::X_DRAG_FLAG)\r
{\r
- MainCountDownView::GetInstance()->ChangeView(TIMECONFIG_COUNTDOWN, MAIN_COUNTDOWN);\r
+ if (strcmp(view.GetViewId(), MAINCOUNTDOWNVIEW) == 0)\r
+ {\r
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);\r
+ }\r
+ else if (strcmp(view.GetViewId(), COUNTDOWN_TIMECONFIG_VIEW) == 0)\r
+ {\r
+ MainCountDownView::GetInstance()->ChangeView(TIMECONFIG_COUNTDOWN, MAIN_COUNTDOWN);\r
+ }\r
+ MainCountDownPresenter::X_DRAG_FLAG = false;\r
}\r
return true;\r
}\r
// 如果是power键就返回上一级\r
if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0)\r
{\r
- NativeAbility::GetInstance().Back();\r
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);\r
}\r
return true;\r
}\r
scrollView[MAIN_COUNTDOWN]->Add(COUNTDOWN_THIRTY_MINUTE_BUTTON);\r
group->Add(scrollView[MAIN_COUNTDOWN]);\r
RootView::GetInstance()->Add(group);\r
+ container_ = group;\r
Draw();\r
}\r
\r
* @Author: luozheng 1732036298@qq.com\r
* @Date: 2024-02-18 09:10:05\r
* @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-04-18 15:53:53\r
+ * @LastEditTime: 2024-06-07 19:25:27\r
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h\r
*/\r
#ifndef _DISPLAY_BRIGHTNESS_PRESENTER_H\r
bool OnDragEnd(UIView &view, const DragEvent &event) override;\r
bool OnChange(UICheckBox::UICheckBoxState state) override;\r
bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件\r
+ bool X_DRAG_FLAG{false};\r
};\r
} // namespace OHOS\r
\r
* @Author: luozheng 1732036298@qq.com\r
* @Date: 2024-03-30 09:14:38\r
* @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-06-07 10:38:25\r
+ * @LastEditTime: 2024-06-07 19:55:47\r
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp\r
*/\r
#include "AppViewIDs.h"\r
+#include "UiConfig.h"\r
#include "components/ui_label_ext.h"\r
#include "language/font/ui_resource_string.h"\r
#include "NativeAbility.h"\r
\r
bool DisplayBrightnessPresenter::OnClick(UIView &view, const ClickEvent &event)\r
{\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DisplayBrightnessPresenter::OnClick");\r
DisplayBrightnessView *p_DisplayBrightnessView = DisplayBrightnessView::GetInstance();\r
- // 根据控件id查找是哪个控件触发了点击回调\r
+ if (p_DisplayBrightnessView == nullptr)\r
+ {\r
+ return false;\r
+ }\r
if (strcmp(view.GetViewId(), BRINGHTNESSCONTROLBUTTON_VIEW) == 0)\r
{\r
NativeAbility::GetInstance().EnterSlice(VIEW_BRIGHTNESSLEVEL);\r
- return true;\r
}\r
- if (strcmp(view.GetViewId(), SCREENDURATIONBUTTON_VIEWID) == 0)\r
+ else if (strcmp(view.GetViewId(), SCREENDURATIONBUTTON_VIEWID) == 0)\r
{\r
p_DisplayBrightnessView->ChangeView(DISPLAYBRIGHTNESSVIEW, SCREENDURATIONVIEW); // 切换到亮屏时长视图\r
- return true;\r
}\r
- return false;\r
+ return true;\r
}\r
\r
bool DisplayBrightnessPresenter::OnDrag(UIView &view, const DragEvent &event)\r
{\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DisplayBrightnessPresenter::OnDrag");\r
UNUSED(view);\r
- UNUSED(event);\r
+ if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动\r
+ {\r
+ DisplayBrightnessPresenter::X_DRAG_FLAG = true;\r
+ }\r
return true;\r
}\r
\r
bool DisplayBrightnessPresenter::OnDragEnd(UIView &view, const DragEvent &event)\r
{\r
DisplayBrightnessView *p_DisplayBrightnessView = DisplayBrightnessView::GetInstance();\r
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)\r
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && DisplayBrightnessPresenter::X_DRAG_FLAG)\r
{\r
if (strcmp(view.GetViewId(), SCREENDURATIONSCROLLVIEW) == 0)\r
{\r
}\r
else if (strcmp(view.GetViewId(), DISPLAY_BRIGHTNESS_VIEW) == 0)\r
{\r
- NativeAbility::GetInstance().Back();\r
- return true;\r
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);\r
+ \r
}\r
+ DisplayBrightnessPresenter::X_DRAG_FLAG = false;\r
}\r
return true;\r
}\r
DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->Add(RaiseToBrightnessLabel);\r
DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->Add(RaiseToBrightnessCheckBoxButton);\r
RootView::GetInstance()->Add(DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]);\r
+ container_ = DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW];\r
Draw();\r
}\r
\r
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-10 11:58:32
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-10 16:26:47
+ * @LastEditTime: 2024-06-07 18:54:26
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbPresenter.h
*/
bool OnDrag(UIView &view, const DragEvent &event) override;
bool OnDragEnd(UIView &view, const DragEvent &event) override;
bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件
+ bool X_DRAG_FLAG{false};
};
}
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-10 11:58:15
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-10 15:42:00
+ * @LastEditTime: 2024-06-07 18:46:54
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbView.h
*/
#ifndef DNOTDISTURB_VIEW_H
void DnotDisturbViewInit(void);
void ClearAll(void);
UIScrollView *scrollView = nullptr;
- UILabelExt *showTimeLabel{nullptr}; // 显示系统时间的标签
+ UILabelExt *showTitleLabel{nullptr};
UIImageView *background{nullptr};
UIImageView *DnotDisturbImage{nullptr};
UILabel *AttentionLabel{nullptr};
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-10 11:58:37
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-25 16:39:57
+ * @LastEditTime: 2024-06-07 18:54:14
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp
*/
#include "AppViewIDs.h"
#include "NativeAbility.h"
+#include "UiConfig.h"
#include "dnotdisturb/include/DnotDisturbView.h"
#include "dnotdisturb/include/DnotDisturbPresenter.h"
#include "dnotdisturb/include/DnotDisturbModel.h"
bool DnotDisturbPresenter::OnDrag(UIView &view, const DragEvent &event)
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbPresenter::OnDrag");
UNUSED(view);
- UNUSED(event);
+ if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动
+ {
+ DnotDisturbPresenter::X_DRAG_FLAG = true;
+ }
return true;
}
bool DnotDisturbPresenter::OnDragEnd(UIView &view, const DragEvent &event)
{
- UNUSED(view);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbPresenter::OnDragEnd");
UNUSED(event);
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && DnotDisturbPresenter::X_DRAG_FLAG)
+ {
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+ DnotDisturbPresenter::X_DRAG_FLAG = false;
+ }
return true;
}
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::GetInstance fail!!");
return false;
}
- if (&view == p_DnotDisturbView->GetButtonOn())//开启勿扰模式
+ if (&view == p_DnotDisturbView->GetButtonOn()) // 开启勿扰模式
{
DnotDisturbModel::GetInstance().SetDoNotDisturbModeEnabled(true);
- NativeAbility::GetInstance().Back();
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
}
else if (&view == p_DnotDisturbView->GetButtonOff())
{
- NativeAbility::GetInstance().Back();
+ // NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
}
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
return true;
}
// 如果是power键就返回上一级
if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0)
{
- NativeAbility::GetInstance().Back();
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
}
return true;
}
void DnotDisturbPresenter::Notify()
{
- DnotDisturbView::GetInstance()->UpdataTime();
+ // DnotDisturbView::GetInstance()->UpdataTime();
}
}
\ No newline at end of file
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-10 11:58:21
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-10 15:43:25
+ * @LastEditTime: 2024-06-07 18:51:22
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbView.cpp
*/
#include "dnotdisturb/include/DnotDisturbView.h"
{
scrollView->RemoveAll();
- if (showTimeLabel != nullptr)
+ if (showTitleLabel != nullptr)
{
- delete showTimeLabel;
- showTimeLabel = nullptr;
+ delete showTitleLabel;
+ showTitleLabel = nullptr;
}
if (background != nullptr)
}
scrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
scrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ scrollView->SetTouchable(true);
+ scrollView->SetDraggable(true);
+ UIView::OnDragListener *dragListener = static_cast<UIView::OnDragListener *>(DnotDisturbPresenter::GetInstance());
+ if (dragListener == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::dragListener new fail!!");
+ return;
+ }
+ scrollView->SetOnDragListener(dragListener);
/* -------------------------------------------------------------------------- */
- showTimeLabel = new UILabelExt();
- if (showTimeLabel == nullptr)
+ showTitleLabel = new UILabelExt();
+ if (showTitleLabel == nullptr)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::showTimeLabel new fail!!");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::showTitleLabel new fail!!");
return;
}
- showTimeLabel->SetPosition(83, 52, 300, 46);
- showTimeLabel->SetStyle(STYLE_TEXT_FONT, 40);
- showTimeLabel->SetStyle(STYLE_LINE_HEIGHT, 46);
- showTimeLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
- showTimeLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- showTimeLabel->SetRollSpeed(40);
- showTimeLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);
+ showTitleLabel->SetPosition(83, 52, 300, 35);
+ showTitleLabel->SetStyle(STYLE_TEXT_FONT, 30);
+ showTitleLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+ showTitleLabel->SetTextId(STR_DO_NOT_DISTURB);
+ showTitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+ showTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ showTitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
/* -------------------------------------------------------------------------- */
background = new UIImageView();
if (background == nullptr)
AttentionLabel->SetPosition(33, 228, 400, 70);
AttentionLabel->SetStyle(STYLE_TEXT_FONT, 30);
AttentionLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
- //AttentionLabel->SetText("开启勿扰模式,手表将不会发出震动与铃声,是否开启");
+ // AttentionLabel->SetText("开启勿扰模式,手表将不会发出震动与铃声,是否开启");
SetLabelId(AttentionLabel, STR_DO_NOT_DISTURB_MODE);
AttentionLabel->SetLineBreakMode(UILabelExt::LINE_BREAK_WRAP);
AttentionLabel->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));
/*更新当前时间*/
void DnotDisturbView::UpdataTime()
{
+#if 0
// 获取当前时间
struct tm pTM;
time_t seconds;
// 将时间和日期转换为字符串
std::string stringtime = (hour < 10 ? "0" : "") + std::to_string(hour) + ":" + (minute < 10 ? "0" : "") + std::to_string(minute);
- showTimeLabel->SetText(stringtime.c_str());
+ showTitleLabel->SetText(stringtime.c_str());
+#endif
}
UILabelButtonExt *DnotDisturbView::GetButtonOn(void)
void DnotDisturbView::OnSetUpView()
{
View<DnotDisturbPresenter>::OnSetUpView();
- scrollView->Add(showTimeLabel);
+ scrollView->Add(showTitleLabel);
scrollView->Add(background);
scrollView->Add(DnotDisturbImage);
scrollView->Add(AttentionLabel);
scrollView->Add(ButtonOn);
scrollView->Add(ButtonOff);
RootView::GetInstance()->Add(scrollView);
+ container_ = scrollView;
Draw();
}
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-03-27 10:47:24
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-10 16:22:33
+ * @LastEditTime: 2024-06-07 18:18:38
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhonePresenter.h
*/
class FindPhoneView;
class FindPhonePresenter : public Presenter<FindPhoneView>,
public UIView::OnClickListener,
- public RootView::OnKeyActListener
+ public RootView::OnKeyActListener,
+ public UIView::OnDragListener
{
public:
FindPhonePresenter();
private:
bool OnClick(UIView &view, const ClickEvent &event) override;
+ bool OnDrag(UIView &view, const DragEvent &event) override;
+ bool OnDragEnd(UIView &view, const DragEvent &event) override;
bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件
+ bool X_DRAG_FLAG{false};
};
}
#endif
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-03-27 10:47:40
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-10 16:29:37
+ * @LastEditTime: 2024-06-07 18:21:37
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp
*/
#include "AppViewIDs.h"
+#include "UiConfig.h"
#include "components/ui_label_ext.h"
#include "language/font/ui_resource_string.h"
#include "NativeAbility.h"
bool FindPhonePresenter::OnClick(UIView &view, const ClickEvent &event)
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindPhonePresenter::OnClick");
UNUSED(event);
if (strcmp(view.GetViewId(), FINDPHONE_LABELBUTTON) == 0)
{
{
senfindphoneSend(FINDPHONE_STOP);
}
- NativeAbility::GetInstance().Back();
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+ }
+ return true;
+ }
+
+ bool FindPhonePresenter::OnDrag(UIView &view, const DragEvent &event)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindPhonePresenter::OnDrag");
+ UNUSED(view);
+ if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动
+ {
+ FindPhonePresenter::X_DRAG_FLAG = true;
+ }
+ return true;
+ }
+
+ bool FindPhonePresenter::OnDragEnd(UIView &view, const DragEvent &event)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindPhonePresenter::OnDragEnd");
+ UNUSED(event);
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && FindPhonePresenter::X_DRAG_FLAG)
+ {
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+ FindPhonePresenter::X_DRAG_FLAG = false;
}
return true;
}
{
senfindphoneSend(FINDPHONE_STOP);
}
- NativeAbility::GetInstance().Back();
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
}
return true;
}
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-03-27 10:47:46
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-10 16:36:28
+ * @LastEditTime: 2024-06-07 18:33:39
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp
*/
#include "findphone/include/FindPhoneView.h"
{
FindPhoneViewInit_BlueToothDisConnected();
}
+
+ FindPhoneGroupView->SetTouchable(true);
+ FindPhoneGroupView->SetDraggable(true);
+ UIView::OnDragListener *dragListener = static_cast<UIView::OnDragListener *>(FindPhonePresenter::GetInstance());
+ FindPhoneGroupView->SetOnDragListener(dragListener);
+
// 增加按键监听
RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::FindPhonePresenter::GetInstance();
RootView::GetInstance()->SetOnKeyActListener(keyactListener);
{
View<FindPhonePresenter>::OnSetUpView();
RootView::GetInstance()->Add(FindPhoneGroupView);
+ container_ = FindPhoneGroupView;
Draw();
}
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-10 17:32:31
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-10 19:36:50
+ * @LastEditTime: 2024-06-07 17:52:25
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/flashligh/include/FlashlightPresenter.h
*/
bool OnDrag(UIView &view, const DragEvent &event) override;
bool OnDragEnd(UIView &view, const DragEvent &event) override;
bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件
+ bool X_DRAG_FLAG{false};
};
}
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-10 17:32:38
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-07 10:37:20
+ * @LastEditTime: 2024-06-07 17:56:29
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/flashligh/src/FlashlightPresenter.cpp
*/
#include "AppViewIDs.h"
#include "NativeAbility.h"
+#include "UiConfig.h"
#include "flashlight/include/FlashlightPresenter.h"
#include "flashlight/include/FlashlightModel.h"
#include "common/key_code.h"
bool FlashlightPresenter::OnDrag(UIView &view, const DragEvent &event)
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbPresenter::OnDrag");
UNUSED(view);
- UNUSED(event);
+ if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动
+ {
+ FlashlightPresenter::X_DRAG_FLAG = true;
+ }
return true;
}
bool FlashlightPresenter::OnDragEnd(UIView &view, const DragEvent &event)
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbPresenter::OnDragEnd");
UNUSED(view);
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && FlashlightPresenter::X_DRAG_FLAG)
{
- NativeAbility::GetInstance().Back();
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+ X_DRAG_FLAG = false;
}
return true;
}
bool FlashlightPresenter::OnClick(UIView &view, const ClickEvent &event)
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbPresenter::OnClick");
UNUSED(event);
if (&view == FlashlightView::GetInstance()->GetGroupView())
{
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-10 17:32:08
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-10 21:22:43
+ * @LastEditTime: 2024-06-07 18:04:33
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/flashligh/src/FlashlightView.cpp
*/
#include "flashlight/include/FlashlightView.h"
group->Add(FlashlightVector);
group->Add(LineImage);
RootView::GetInstance()->Add(group);
+ container_ = group;
Draw();
}
/*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: SetDesktopModel.h
- * Author:
- * Create: 2021-11-23
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-06-07 09:21:47
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-06-07 15:03:40
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopModel.h
*/
#ifndef SET_DESKTOP_MODEL_H
#include "SetDesktopPresenter.h"
typedef enum {
- APPLIST_STYLE,
- HEXAGONS_STYLE,
+ APPLIST_STYLE, //列表显示
+ HEXAGONS_STYLE, //蜂窝显示
} DesktopStyle;
namespace OHOS {
/*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: SettingModel.cpp
- * Author:
- * Create: 2021-11-23
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-06-07 09:21:47
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-06-07 11:17:14
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopModel.cpp
*/
#include "SetDesktopModel.h"
return instance;
}
+ //获取applist的显示样式
DesktopStyle SetDesktopModel::GetDesktopStyle(void)
{
DesktopStyle style;
* @Author: luozheng 1732036298@qq.com\r
* @Date: 2024-04-04 15:13:51\r
* @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-04-07 17:22:21\r
+ * @LastEditTime: 2024-06-07 17:07:38\r
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/stopwatch/include/MainStopWatchPresenter.h\r
*/\r
#ifndef MAIN_STOPWATCH_PRESENTER_H\r
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
bool OnClick(UIView &view, const ClickEvent &event) override;\r
bool OnDrag(UIView &view, const DragEvent &event) override;\r
+ bool OnDragEnd(UIView &view, const DragEvent &event) override;\r
bool OnChange(UICheckBox::UICheckBoxState state) override;\r
bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件\r
private:\r
List<const char *> *m_listdata = nullptr;\r
uint64_t lastRecordTime = 0; // 上次记录时间\r
int RecordCycleNumber{0}; // 用来记录计时圈数\r
+ bool X_DRAG_FLAG{false};\r
};\r
} // namespace OHOS\r
\r
#include "AppViewIDs.h"\r
#include "NativeAbility.h"\r
+#include "UiConfig.h"\r
#include "stopwatch/include/MainStopWatchPresenter.h"\r
#include "stopwatch/include/StopWatchModel.h"\r
#include "common/key_code.h"\r
\r
bool MainStopWatchPresenter::OnDrag(UIView &view, const DragEvent &event)\r
{\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainStopWatchPresenter::OnDrag");\r
UNUSED(view);\r
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
- (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
+ if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动\r
{\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);\r
+ MainStopWatchPresenter::X_DRAG_FLAG = true;\r
+ }\r
+ return true;\r
+ }\r
+\r
+ bool MainStopWatchPresenter::OnDragEnd(UIView &view, const DragEvent &event)\r
+ {\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainStopWatchPresenter::OnDragEnd");\r
+ UNUSED(view);\r
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && MainStopWatchPresenter::X_DRAG_FLAG)\r
+ {\r
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);\r
+ X_DRAG_FLAG = false;\r
}\r
return true;\r
}\r
// 如果是power键就返回上一级\r
if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0)\r
{\r
- uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();\r
- NativeAbility::GetInstance().ChangeSlice(preSlice);\r
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);\r
}\r
- return true;\r
+ return false;\r
}\r
\r
}
\ No newline at end of file
scrollView[MAIN_STOPWATCH]->Add(ResetOrMarkbutton);\r
group->Add(scrollView[MAIN_STOPWATCH]);\r
RootView::GetInstance()->Add(group);\r
+ container_ = group;\r
Draw();\r
}\r
\r