${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingWinView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingWinPresenter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/traing_card/Traing_CardView.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/traing_card/Traing_CardPresenter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traingrecord/src/TraingRecordView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traingrecord/src/TraingRecordPresenter.cpp
#include "DialModelTime.h"
#include "DialModelPower.h"
#include "gfx_utils/mem_check.h"
+#include "traing/traing_card/Traing_CardView.h"
#if USE_OFFLINE_DIAL
#include "DialViewGroup.h"
#endif
return;
}
}
-
HorizontalViewInit();
HorViewLoad();
VerticalViewInit();
}
void MainViewSample::SetPage(int16_t page)
{
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetPage is %d", page);
if (mainSwipeGroup != nullptr)
{
mainSwipeGroup->SetHorCurrentPage(page);
+\r
#ifndef _TraingCard_PRESENTER_H\r
#define _TraingCard_PRESENTER_H\r
\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
};\r
} // namespace OHOS\r
\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
};\r
} // namespace OHOS\r
\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
};\r
} // namespace OHOS\r
\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
};\r
} // namespace OHOS\r
\r
+/***
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-03-19 17:37:18
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-03-22 15:32:34
+ * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/include/TraingEnddataPresenter.h
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
+
#ifndef _TraingEnddata_PRESENTER_H
#define _TraingEnddata_PRESENTER_H
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ //bool OnDragEnd(UIView& view, const DragEvent& event) override;
};
} // namespace OHOS
+/***
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-03-19 17:37:18
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-03-22 15:31:56
+ * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnote2Presenter.h
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
#ifndef _TraingEndnote2_PRESENTER_H
#define _TraingEndnote2_PRESENTER_H
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ // bool OnDragEnd(UIView& view, const DragEvent& event) override;
};
} // namespace OHOS
+
#ifndef _TraingEndnote_PRESENTER_H
#define _TraingEndnote_PRESENTER_H
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ //bool OnDragEnd(UIView& view, const DragEvent& event) override;
};
} // namespace OHOS
+/***
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-03-19 17:37:18
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-03-22 15:16:06
+ * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSPresenter.h
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
#ifndef _TraingGPS_PRESENTER_H
#define _TraingGPS_PRESENTER_H
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ bool OnDragEnd(UIView& view, const DragEvent& event) override;
};
} // namespace OHOS
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ //bool OnDragEnd(UIView& view, const DragEvent& event) override;
};
} // namespace OHOS
+/***
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-03-19 17:37:18
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-03-22 15:34:08
+ * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSlackPresenter.h
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE/
+ */
#ifndef _TraingGPSlack_PRESENTER_H
#define _TraingGPSlack_PRESENTER_H
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ bool OnDragEnd(UIView& view, const DragEvent& event) override;
};
} // namespace OHOS
+
#ifndef _TraingGPSlost_PRESENTER_H
#define _TraingGPSlost_PRESENTER_H
class TraingGPSlostView;
class TraingGPSlostPresenter : public Presenter<TraingGPSlostView>,
- public UIView::OnClickListener,
- public UIView::OnDragListener
+ public UIView::OnClickListener,
+ public UIView::OnDragListener
{
public:
TraingGPSlostPresenter();
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ //bool OnDragEnd(UIView &view, const DragEvent &event) override;
};
} // namespace OHOS
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ bool OnDragEnd(UIView& view, const DragEvent& event) override;
};
} // namespace OHOS
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ bool OnDragEnd(UIView& view, const DragEvent& event) override;
};
} // namespace OHOS
+
#ifndef _TraingLimit_PRESENTER_H
#define _TraingLimit_PRESENTER_H
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ bool OnDragEnd(UIView& view, const DragEvent& event) override;
+
};
} // namespace OHOS
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ bool OnDragEnd(UIView& view, const DragEvent& event) override;
};
} // namespace OHOS
+
#ifndef _TraingNomal_PRESENTER_H
#define _TraingNomal_PRESENTER_H
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ bool OnDragEnd(UIView& view, const DragEvent& event) override;
};
} // namespace OHOS
+/***
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-03-19 18:18:30
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-03-22 15:24:40
+ * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/include/TraingPresenter.h
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
#ifndef _Traing_PRESENTER_H
#define _Traing_PRESENTER_H
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ bool OnDragEnd(UIView &view, const DragEvent &event) override;
};
} // namespace OHOS
// 因为继承了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
};\r
} // namespace OHOS\r
\r
+/***
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-03-19 17:37:18
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-03-22 15:16:44
+ * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetDistPresenter.h
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
#ifndef _TraingSetDist_PRESENTER_H
#define _TraingSetDist_PRESENTER_H
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ //bool OnDragEnd(UIView& view, const DragEvent& event) override;
};
} // namespace OHOS
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ //bool OnDragEnd(UIView& view, const DragEvent& event) override;
};
} // namespace OHOS
+
#ifndef _TraingSetSept_PRESENTER_H
#define _TraingSetSept_PRESENTER_H
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ //bool OnDragEnd(UIView& view, const DragEvent& event) override;
};
} // namespace OHOS
+/***
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-03-19 17:37:18
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-03-22 15:30:44
+ * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetTimePresenter.h
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE/
+ */
#ifndef _TraingSetTime_PRESENTER_H
#define _TraingSetTime_PRESENTER_H
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ //bool OnDragEnd(UIView& view, const DragEvent& event) override;
};
} // namespace OHOS
+
#ifndef _TraingStrong_PRESENTER_H
#define _TraingStrong_PRESENTER_H
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ bool OnDragEnd(UIView& view, const DragEvent& event) override;
+
};
} // namespace OHOS
// 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ //bool OnDragEnd(UIView& view, const DragEvent& event) override;
};
} // namespace OHOS
+/*** \r
+ * @Author: Caisking 3449750381@qq.com\r
+ * @Date: 2024-03-19 17:37:19\r
+ * @LastEditors: Caisking 3449750381@qq.com\r
+ * @LastEditTime: 2024-03-22 14:55:18\r
+ * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/src/TraingCardPresenter.cpp\r
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE\r
+ */\r
#include "AppViewIDs.h"\r
#include "NativeAbility.h"\r
\r
\r
Presenter<TraingControlView>::OnStop();\r
}\r
-\r
bool TraingControlPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+ {\r
+ return true;\r
+ }\r
+ bool TraingControlPresenter::OnDragEnd(UIView &view, const DragEvent &event)\r
{\r
\r
if (event.GetDragDirection() == DragEvent::DIRECTION_RIGHT_TO_LEFT)\r
{\r
Presenter<TraingDataView>::OnStop();\r
}\r
-\r
bool TraingDataPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+ {\r
+ return true;\r
+ }\r
+ bool TraingDataPresenter::OnDragEnd(UIView &view, const DragEvent &event)\r
{\r
\r
if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
+/*** \r
+ * @Author: Caisking 3449750381@qq.com\r
+ * @Date: 2024-03-19 17:37:19\r
+ * @LastEditors: Caisking 3449750381@qq.com\r
+ * @LastEditTime: 2024-03-22 15:23:15\r
+ * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/src/TraingDetailPresenter.cpp\r
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE\r
+ */\r
+\r
#include "AppViewIDs.h"\r
#include "NativeAbility.h"\r
\r
\r
Presenter<TraingDetailView>::OnStop();\r
}\r
-\r
bool TraingDetailPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+ {\r
+ return true;\r
+ }\r
+ bool TraingDetailPresenter::OnDragEnd(UIView &view, const DragEvent &event)\r
{\r
\r
if (event.GetDragDirection() == DragEvent::DIRECTION_TOP_TO_BOTTOM)\r
+
#include "AppViewIDs.h"
#include "NativeAbility.h"
Presenter<TraingGPSView>::OnStop();
}
-
bool TraingGPSPresenter::OnDrag(UIView &view, const DragEvent &event)
+ {
+ return true;
+ }
+ bool TraingGPSPresenter::OnDragEnd(UIView &view, const DragEvent &event)
{
if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&
* @Author: Caisking 3449750381@qq.com
* @Date: 2023-12-12 16:55:28
* @LastEditors: Caisking 3449750381@qq.com
- * @LastEditTime: 2024-01-16 15:44:47
+ * @LastEditTime: 2024-03-22 15:40:56
* @FilePath: /1.FD230/FD230/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSlackPresenter.cpp
* @Description:
* @
Presenter<TraingGPSlackView>::OnStop();
}
-
bool TraingGPSlackPresenter::OnDrag(UIView &view, const DragEvent &event)
+ {
+ return true;
+ }
+ bool TraingGPSlackPresenter::OnDragEnd(UIView &view, const DragEvent &event)
{
if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&
Presenter<TraingGPSnoteView>::OnStop();
}
-
bool TraingGPSnotePresenter::OnDrag(UIView &view, const DragEvent &event)
+ {
+ return true;
+ }
+ bool TraingGPSnotePresenter::OnDragEnd(UIView &view, const DragEvent &event)
{
if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&
Presenter<TraingGPSsetView>::OnStop();
}
-
bool TraingGPSsetPresenter::OnDrag(UIView &view, const DragEvent &event)
+ {
+ return true;
+ }
+ bool TraingGPSsetPresenter::OnDragEnd(UIView &view, const DragEvent &event)
{
if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&
+/*** \r
+ * @Author: Caisking 3449750381@qq.com\r
+ * @Date: 2024-03-19 17:37:19\r
+ * @LastEditors: Caisking 3449750381@qq.com\r
+ * @LastEditTime: 2024-03-22 15:20:33\r
+ * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/src/TraingLimitPresenter.cpp\r
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE\r
+ */\r
#include "AppViewIDs.h"\r
#include "NativeAbility.h"\r
\r
\r
Presenter<TraingLimitView>::OnStop();\r
}\r
-\r
bool TraingLimitPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+ {\r
+ return true;\r
+ }\r
+ bool TraingLimitPresenter::OnDragEnd(UIView &view, const DragEvent &event)\r
{\r
\r
if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
#include <chrono>\r
#include <thread>\r
#include "traing/include/TraingMorePresenter.h"\r
+#include "MainViewSample.h"\r
+#include "ScreenModels.h"\r
// #include "TraingMoreView.h"\r
\r
namespace OHOS\r
\r
Presenter<TraingMoreView>::OnStop();\r
}\r
-\r
bool TraingMorePresenter::OnDrag(UIView &view, const DragEvent &event)\r
+ {\r
+ return true;\r
+ }\r
+ bool TraingMorePresenter::OnDragEnd(UIView &view, const DragEvent &event)\r
{\r
\r
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
- (event.GetDeltaX() > 40) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)\r
{\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING);\r
+ uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Id:[%d]", preSlice);\r
+ if (preSlice == VIEW_MAIN)\r
+ {\r
+ NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);\r
+ // MainViewSample::GetInstance()->SetPage(CardId::TRAINING);\r
+ return true;\r
+ }\r
+ NativeAbility::GetInstance().ChangeSlice(preSlice);\r
}\r
UNUSED(view);\r
return true;\r
\r
Presenter<TraingNomalView>::OnStop();\r
}\r
-\r
bool TraingNomalPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+ {\r
+ return true;\r
+ }\r
+ bool TraingNomalPresenter::OnDragEnd(UIView &view, const DragEvent &event)\r
{\r
\r
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
- (event.GetDeltaX() > 40) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
+ uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Id:[%d]", preSlice);\r
+ if (preSlice == VIEW_MAIN)\r
{\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGMORE);\r
+ NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);\r
+ // MainViewSample::GetInstance()->SetPage(CardId::TRAINING);\r
+ return true;\r
}\r
+ NativeAbility::GetInstance().ChangeSlice(preSlice);\r
UNUSED(view);\r
return true;\r
}\r
+/***
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-03-19 18:18:50
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-03-22 15:22:11
+ * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/src/TraingPresenter.cpp
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
#include "AppViewIDs.h"
#include "NativeAbility.h"
{
Presenter<TraingView>::OnStop();
}
-
bool TraingPresenter::OnDrag(UIView &view, const DragEvent &event)
+ {
+ return true;
+ }
+ bool TraingPresenter::OnDragEnd(UIView &view, const DragEvent &event)
{
UNUSED(view);
if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)
Presenter<TraingStrongView>::OnStop();
}
-
bool TraingStrongPresenter::OnDrag(UIView &view, const DragEvent &event)
+ {
+ return true;
+ }
+ bool TraingStrongPresenter::OnDragEnd(UIView &view, const DragEvent &event)
{
if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&
+/***
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-03-19 17:37:19
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-03-22 15:21:30
+ * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/src/TraingWinPresenter.cpp
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
#include "AppViewIDs.h"
#include "NativeAbility.h"
--- /dev/null
+
+#include "traing/traing_card/Traing_CardPresenter.h"
+#include "traing/traing_card/Traing_CardView.h"
+
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+#include "UiConfig.h"
+#include "wearable_log.h"
+namespace OHOS
+{
+
+ bool TraingOnClickListener::OnClick(UIView &view, const ClickEvent &event)
+ {
+ UNUSED(event);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Traing_CardView::OnClick %s", view.GetViewId());
+ Traing_CardView *cardpage = Traing_CardView::GetInstance();
+ if (cardpage == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Traing_CardView::GetInstance");
+ return false;
+ }
+ if (strcmp(view.GetViewId(), BUTTON1) == 0)
+ {
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGNOMAL);
+ }
+ if (strcmp(view.GetViewId(), BUTTON2) == 0)
+ {
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGNOMAL);
+ }
+ if (strcmp(view.GetViewId(), BUTTON3) == 0)
+ {
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGNOMAL);
+ }
+ if (strcmp(view.GetViewId(), BUTTONMORE) == 0)
+ {
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGMORE);
+ }
+ return true;
+ }
+} // namespace OHOS
\ No newline at end of file
--- /dev/null
+
+#ifndef TRAING_CARD_PRESENTER_H
+#define TRAING_CARD_PRESENTER_H
+#include "components/ui_view.h"
+namespace OHOS
+{
+ class TraingOnClickListener : public UIView::OnClickListener
+ {
+ public:
+ TraingOnClickListener() {}
+ TraingOnClickListener(UIView *view) : view_(view) {}
+ ~TraingOnClickListener(){};
+ static TraingOnClickListener *GetInstance()
+ {
+ static TraingOnClickListener instance;
+ return &instance;
+ }
+ bool OnClick(UIView &view, const ClickEvent &event) override;
+
+ private:
+ UIView *view_{nullptr};
+ };
+}
+#endif
\ No newline at end of file
#include "components/ui_button.h"\r
#include "components/ui_view_group.h"\r
#include "common/image_cache_manager.h"\r
-\r
+#include "MainPresenterSample.h"\r
+#include "traing/traing_card/Traing_CardPresenter.h"\r
namespace OHOS\r
{\r
static Traing_CardView *g_pTraing_CardView{nullptr};\r
struct ButtonInfo\r
{\r
std::string text;\r
+ char *viewid;\r
uint32_t defaultImgSrc;\r
UILabelButtonExt *button;\r
uint16_t posX;\r
};\r
\r
ButtonInfo buttons[] = {\r
- {"健走", TRAINING_BUTTONGROUND2, Button1, 86, 118},\r
- {"骑行", TRAINING_BOUTTONGROUND, Button2, 236, 118},\r
- {"跑步", TRAINING_BOUTTONGROUND, Button3, 86, 268},\r
- {"更多", TRAINING_MORE, ButtonMore, 236, 268}};\r
+ {"健走", BUTTON1, TRAINING_BUTTONGROUND2, Button1, 86, 118},\r
+ {"骑行", BUTTON2, TRAINING_BOUTTONGROUND, Button2, 236, 118},\r
+ {"跑步", BUTTON3, TRAINING_BOUTTONGROUND, Button3, 86, 268},\r
+ {"更多", BUTTONMORE, TRAINING_MORE, ButtonMore, 236, 268}};\r
\r
for (auto &buttonInfo : buttons)\r
{\r
\r
buttonInfo.button->SetPosition(buttonInfo.posX, buttonInfo.posY);\r
buttonInfo.button->Resize(140, 140);\r
+ //WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Id:[%s]", buttonInfo.viewid);\r
buttonInfo.button->SetText(buttonInfo.text.c_str());\r
buttonInfo.button->SetLabelPosition(0, 70);\r
buttonInfo.button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
buttonInfo.button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff19ff41, UIButton::PRESSED);\r
buttonInfo.button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
+ buttonInfo.button->SetViewId(buttonInfo.viewid);\r
+ UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::TraingOnClickListener::GetInstance();\r
+ if (clickListener == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AddButton::OnStart clickListener NULL");\r
+ return false;\r
+ }\r
+ buttonInfo.button->SetOnClickListener(clickListener);\r
Add(buttonInfo.button);\r
}\r
\r