增加动态表盘实现(还有bug)
authorCaisking <3449750381@qq.com>
Thu, 28 Dec 2023 06:31:37 +0000 (14:31 +0800)
committerCaisking <3449750381@qq.com>
Thu, 28 Dec 2023 06:31:37 +0000 (14:31 +0800)
code/sdk/application/wearable/nativeapp/nativeui/clock/clock.json [new file with mode: 0644]
code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_video_play/ui_test_video_play.cpp
code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_video_play/ui_test_video_play.h

diff --git a/code/sdk/application/wearable/nativeapp/nativeui/clock/clock.json b/code/sdk/application/wearable/nativeapp/nativeui/clock/clock.json
new file mode 100644 (file)
index 0000000..6a8f5bc
--- /dev/null
@@ -0,0 +1,83 @@
+{
+    "digitalClock": {
+        "digits": {
+            "commonfont": {
+                "time": {
+                    "hours": "12",
+                    "minutes": "30",
+                    "seconds": "45",
+                    "coordinates": {
+                        "left": 155,
+                        "top": 120
+                    },
+                    "fontsize": 60
+                },
+                "data": {
+                    "date": "12月28号",
+                    "week": "星期四",
+                    "coordinates": {
+                        "left": 155,
+                        "top": 300
+                    },
+                    "fontsize": 50
+                },
+                "fonturl": "/user/res/dial/font/common/"
+            }
+        }
+    },
+    "pointerClock": {
+        "hands": {
+            "commonhand": {
+                "centralpoint": {
+                    "POINT_CENTER_X": 25,
+                    "POINT_CENTER_Y": 211,
+                    "POINT_POSITION_X": 202,
+                    "POINT_POSITION_Y": 16
+                },
+                "hourHand": {
+                    "image": "/user/res/dial/hand/common/hour_hand.bin",
+                    "coordinates": {
+                        "SMALLCIRCLE_POSITION_X ": 202,
+                        "SMALLCIRCLE_POSITION_Y": 202
+                    }
+                },
+                "minuteHand": {
+                    "image": "/user/res/dial/hand/common/minute_hand.bin",
+                    "coordinates": {
+                        "MEDCIRCLE_POSITION_X": 202,
+                        "MEDCIRCLE_POSITION_Y": 202
+                    }
+                },
+                "secondHand": {
+                    "image": "/user/res/dial/hand/common/second_hand.bin",
+                    "coordinates": {
+                        "BIGCIRCLE_POSITION_X": 202,
+                        "BIGCIRCLE_POSITION_Y": 202
+                    }
+                }
+            }
+        }
+    },
+    "ClcokBackground": {
+        "staticBackground": {
+            "url": [
+                "/res/dial/staticBackground/diao_user.bin",
+                "/res/dial/staticBackground/diao_momo.bin"
+            ]
+        },
+        "dynamicBackground": {
+            "url": [
+                "/res/dial/dynamicBackground/diao_user.mp4",
+                "/res/dial/dynamicBackground/diao_momo.mp4"
+            ]
+        },
+        "size": {
+            "width": 466,
+            "height": 466
+        },
+        "coordinates": {
+            "left": 0,
+            "top": 0
+        }
+    }
+}
\ No newline at end of file
index faf844e..6cc5a5d 100755 (executable)
 #include "sys/time.h"
 #include "ui_test_video_play.h"
 #include "components/root_view.h"
+#include "components/ui_sweep_clock.h"
 
-namespace OHOS {
-static constexpr int16_t VIDEO_WIDTH = 466;
-static constexpr int16_t VIDEO_HEIGHT = 466;
-static constexpr int16_t STRIDE_ALIGNMENT_VALUE = 64;
-static constexpr int16_t BUFFER_QUEUE_SIZE = 3;
-static constexpr int16_t JPEG_HEIGHT_DIVISOR = 2;
-static constexpr int16_t JPEG_WIDTH_BYTE_ALIGNMENT = 128;
-static constexpr int16_t JPEG_HEIGHT_BYTE_ALIGNMENT = 16;
-static constexpr int16_t USEC_TO_MILLI = 1000;
-static constexpr int16_t TIME_CONVERT = 60; // sec to min, and min to hor
-static constexpr int16_t TEXT_BUFFER_SIEZ = 20;
-static constexpr int16_t TEXT_FONT_SIEZ = 40;
-static const int32_t WAIT_MEDIA_EXIT_SUCCESS_US = 10000;
-static const uint32_t WAIT_MEDIA_EXIT_MAX_RETRY_COUNT = 100;
-
-static void GetTime(char* buf, int len)
+namespace OHOS
 {
-    struct timeval tv;
-    gettimeofday(&tv, NULL);
-    uint32_t second = tv.tv_sec % TIME_CONVERT;
-    uint32_t minute = tv.tv_sec / TIME_CONVERT;
-    uint32_t hour = (minute / TIME_CONVERT) % 24; // 24: 24 hours per day
-    uint32_t realMilliSecond = tv.tv_usec / USEC_TO_MILLI;
-    minute = minute % TIME_CONVERT;
-
-    sprintf_s(buf, len, "%02d : %02d : %02d : %03d", hour, minute, second, realMilliSecond);
-}
+    class SweepClockCallback : public AnimatorCallback
+    {
+    public:
+        explicit SweepClockCallback(UISweepClock *clock) : sweepClock(clock) {}
+        ~SweepClockCallback() {}
 
-void VideoAnimatorCallback::Callback(UIView *view)
-{
-    (void)view;
-    char buf[TEXT_BUFFER_SIEZ] = {0};
-    GetTime(buf, TEXT_BUFFER_SIEZ);
-    label_->SetText(buf);
-    RootView::GetInstance()->Invalidate();
-}
+        virtual void Callback(UIView *view)
+        {
+            // UNUSED(view);
+            struct timeval tv;
+            gettimeofday(&tv, NULL);
+            uint64_t second = tv.tv_sec;
+            uint64_t uSecond = tv.tv_usec;
+            uint64_t minute = second / MIN_TO_HOUR;
+            uint64_t hour = minute / MIN_TO_HOUR;
+            uint8_t realHour = static_cast<uint8_t>(hour % HOURLY_SYSTEM);
+            uint8_t realMinute = static_cast<uint8_t>(minute % MIN_TO_HOUR);
+            uint16_t realMilliSecond = static_cast<uint16_t>((second % MIN_TO_HOUR) *
+                                                                 SEC_TO_MILLI +
+                                                             uSecond / USEC_TO_MILLI);
+            sweepClock->SetSweepTime12Hour(realHour, realMinute, realMilliSecond, 1);
+        }
 
-void UITestVideoPlay::SetUp()
-{
-    container_ = new UIScrollView();
-    container_->SetThrowDrag(true);
-    container_->SetHorizontalScrollState(false);
-    container_->Resize(VIDEO_WIDTH, VIDEO_HEIGHT);
-    container_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Yellow().full);
-    container_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
-
-    label_ = new UILabel();
-    char filePath[PATH_MAX];
-    if (realpath("/user/video/dial.mp4", filePath) == nullptr) {
-        label_->SetPosition(60, 227, 330, 70); // 60, 227, 330, 70: Left, right, width, height.
-        label_->SetText("please upload video resource.");
-        label_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff505050);
-        label_->SetStyle(STYLE_TEXT_COLOR, Color::White().full);
-        label_->SetStyle(STYLE_BORDER_RADIUS, 20); // 20: Radius for label border.
-        label_->SetStyle(STYLE_BACKGROUND_OPA, 150); // 150: Opacity for background.
-        label_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 25); // 25: Font size.
-        label_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
-        container_->Add(label_);
-        GRAPHIC_LOGE("no video resource\n");
-        return;
+    private:
+        static constexpr int16_t SEC_TO_MILLI = 1000;
+        static constexpr int16_t USEC_TO_MILLI = 1000;
+        static constexpr int16_t MIN_TO_HOUR = 60;
+        static constexpr int16_t HOURLY_SYSTEM = 24;
+        static constexpr int16_t INTERVAL = 30;
+        UISweepClock *sweepClock{nullptr};
+    };
+
+    static constexpr int16_t VIDEO_WIDTH = 466;
+    static constexpr int16_t VIDEO_HEIGHT = 466;
+    static constexpr int16_t STRIDE_ALIGNMENT_VALUE = 64;
+    static constexpr int16_t BUFFER_QUEUE_SIZE = 3;
+    static constexpr int16_t JPEG_HEIGHT_DIVISOR = 2;
+    static constexpr int16_t JPEG_WIDTH_BYTE_ALIGNMENT = 128;
+    static constexpr int16_t JPEG_HEIGHT_BYTE_ALIGNMENT = 16;
+    static constexpr int16_t USEC_TO_MILLI = 1000;
+    static constexpr int16_t TIME_CONVERT = 60; // sec to min, and min to hor
+    static constexpr int16_t TEXT_BUFFER_SIEZ = 20;
+    static constexpr int16_t TEXT_FONT_SIEZ = 40;
+    static const int32_t WAIT_MEDIA_EXIT_SUCCESS_US = 10000;
+    static const uint32_t WAIT_MEDIA_EXIT_MAX_RETRY_COUNT = 100;
+
+    static void GetTime(char *buf, int len)
+    {
+        struct timeval tv;
+        gettimeofday(&tv, NULL);
+        uint32_t second = tv.tv_sec % TIME_CONVERT;
+        uint32_t minute = tv.tv_sec / TIME_CONVERT;
+        uint32_t hour = (minute / TIME_CONVERT) % 24; // 24: 24 hours per day
+        uint32_t realMilliSecond = tv.tv_usec / USEC_TO_MILLI;
+        minute = minute % TIME_CONVERT;
+
+        sprintf_s(buf, len, "%02d : %02d : %02d : %03d", hour, minute, second, realMilliSecond);
     }
 
-    char buf[TEXT_BUFFER_SIEZ] = {0};
-    GetTime(buf, TEXT_BUFFER_SIEZ);
-    label_->SetText(buf);
-    label_->SetPosition(60, 50, 330, 70); // 60, 50, 330, 70: Left, right, width, height.
-    label_->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full);
-    label_->SetStyle(STYLE_TEXT_COLOR, Color::Silver().full);
-    label_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TEXT_FONT_SIEZ); // 25: Font size.
-    label_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
-
-    callBack_ = new VideoAnimatorCallback(label_);
-    animator_ = new Animator(callBack_, label_, 0, true);
-    animator_->Start();
-
-    button1_ = new UILabelButton();
-    button1_->SetPosition(130, 360, 80, 40); // 130: x, 360: y, 80: width, 40: height
-    button1_->SetText("Play");
-    button1_->SetTextColor(Color::Silver());
-    button1_->SetOnClickListener(this);
-
-    button2_ = new UILabelButton();
-    button2_->SetPosition(240, 360, 80, 40); // 240: x, 360: y, 80: width, 40: height
-    button2_->SetText("Stop");
-    button2_->SetTextColor(Color::Silver());
-    button2_->SetOnClickListener(this);
-
-    surfaceView_ = new UILiteSurfaceView();
-    if (surfaceView_ == nullptr) {
-        GRAPHIC_LOGE("surfaceView is nullptr\n");
-        return;
+    void VideoAnimatorCallback::Callback(UIView *view)
+    {
+        (void)view;
+        char buf[TEXT_BUFFER_SIEZ] = {0};
+        GetTime(buf, TEXT_BUFFER_SIEZ);
+        label_->SetText(buf);
+        RootView::GetInstance()->Invalidate();
     }
-    colorKey_.full = 0xff202020;
-    surfaceView_->SetViewId("sur");
-    surfaceView_->SetPosition(0, 0, VIDEO_WIDTH, VIDEO_HEIGHT);
-    surfaceView_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
-    surfaceView_->SetSurfaceColorkey(colorKey_);
-    container_->Add(surfaceView_);
-    container_->Add(label_);
-    container_->Add(button1_);
-    container_->Add(button2_);
-
-    Surface *surface = surfaceView_->GetSurface();
-    surface->SetStrideAlignment(STRIDE_ALIGNMENT_VALUE);
-    surface->SetWidthAndHeight(VIDEO_WIDTH, VIDEO_HEIGHT);
-    surface->SetQueueSize(BUFFER_QUEUE_SIZE);
-    surface->SetFormat(PIXEL_FMT_YCBCR_420_SP);
-
-    // jpeg decoder output buffer size calculation formula
-    int32_t ySize = ALIGN_BYTE(VIDEO_WIDTH, JPEG_WIDTH_BYTE_ALIGNMENT) * VIDEO_HEIGHT;
-    int32_t uvSize = ALIGN_BYTE(VIDEO_WIDTH, JPEG_WIDTH_BYTE_ALIGNMENT) *
-        ALIGN_BYTE(VIDEO_HEIGHT, JPEG_HEIGHT_BYTE_ALIGNMENT) / JPEG_HEIGHT_DIVISOR;
-    int32_t bufferSize = ySize + uvSize;
-    surface->SetSize(bufferSize);
-    if (videoPlay_ == nullptr) {
-        std::string uri("/user/video/dial.mp4");
-        videoPlay_ = new MediaVideoPlay(surface, button1_, uri);
-        if (videoPlay_ == nullptr) {
-            GRAPHIC_LOGE("videoPlay_ is nullptr\n");
+
+    void UITestVideoPlay::SetUp()
+    {
+        container_ = new UIScrollView();
+        container_->SetThrowDrag(true);
+        container_->SetHorizontalScrollState(false);
+        container_->Resize(VIDEO_WIDTH, VIDEO_HEIGHT);
+        container_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Yellow().full);
+        container_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
+
+        label_ = new UILabel();
+        char filePath[PATH_MAX];
+        if (realpath("/user/video/dial.mp4", filePath) == nullptr)
+        {
+            label_->SetPosition(60, 227, 330, 70); // 60, 227, 330, 70: Left, right, width, height.
+            label_->SetText("please upload video resource.");
+            label_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff505050);
+            label_->SetStyle(STYLE_TEXT_COLOR, Color::White().full);
+            label_->SetStyle(STYLE_BORDER_RADIUS, 20);         // 20: Radius for label border.
+            label_->SetStyle(STYLE_BACKGROUND_OPA, 150);       // 150: Opacity for background.
+            label_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 25); // 25: Font size.
+            label_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            container_->Add(label_);
+            GRAPHIC_LOGE("no video resource\n");
             return;
         }
-    }
-}
 
-void UITestVideoPlay::TearDown()
-{
-    if (animator_ != nullptr) {
-        animator_->Stop();
-        delete animator_;
-        animator_ = nullptr;
-    }
+        // char buf[TEXT_BUFFER_SIEZ] = {0};
+        // GetTime(buf, TEXT_BUFFER_SIEZ);
+        // label_->SetText(buf);
+        // label_->SetPosition(60, 50, 330, 70); // 60, 50, 330, 70: Left, right, width, height.
+        // label_->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full);
+        // label_->SetStyle(STYLE_TEXT_COLOR, Color::Silver().full);
+        // label_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TEXT_FONT_SIEZ); // 25: Font size.
+        // label_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
 
-    if (callBack_ != nullptr) {
-        delete callBack_;
-        callBack_ = nullptr;
-    }
+        // callBack_ = new VideoAnimatorCallback(label_);
+        // animator_ = new Animator(callBack_, label_, 0, true);
+        // animator_->Start();
+
+        button1_ = new UILabelButton();
+        button1_->SetPosition(130, 360, 80, 40); // 130: x, 360: y, 80: width, 40: height
+        button1_->SetText("Play");
+        button1_->SetTextColor(Color::Silver());
+        button1_->SetOnClickListener(this);
+
+        button2_ = new UILabelButton();
+        button2_->SetPosition(240, 360, 80, 40); // 240: x, 360: y, 80: width, 40: height
+        button2_->SetText("Stop");
+        button2_->SetTextColor(Color::Silver());
+        button2_->SetOnClickListener(this);
+
+        surfaceView_ = new UILiteSurfaceView();
+        if (surfaceView_ == nullptr)
+        {
+            GRAPHIC_LOGE("surfaceView is nullptr\n");
+            return;
+        }
+        colorKey_.full = 0xff202020;
+        surfaceView_->SetViewId("sur");
+        surfaceView_->SetPosition(0, 0, VIDEO_WIDTH, VIDEO_HEIGHT);
+        surfaceView_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+        surfaceView_->SetSurfaceColorkey(colorKey_);
+        container_->Add(surfaceView_);
+        container_->Add(label_);
+        container_->Add(button1_);
+        container_->Add(button2_);
 
-    if (videoPlay_ != nullptr) {
-        videoPlay_->needSendBackgroundFrame_ = false;
-        videoPlay_->StopVideoPlay();
-        uint32_t count = 0;
-        while (!videoPlay_->IsExitCompletely()) {
-            count++;
-            if (count == WAIT_MEDIA_EXIT_MAX_RETRY_COUNT) {
-                GRAPHIC_LOGE("media video play exit timeout\n");
-                DeleteChildren(container_);
+        Surface *surface = surfaceView_->GetSurface();
+        surface->SetStrideAlignment(STRIDE_ALIGNMENT_VALUE);
+        surface->SetWidthAndHeight(VIDEO_WIDTH, VIDEO_HEIGHT);
+        surface->SetQueueSize(BUFFER_QUEUE_SIZE);
+        surface->SetFormat(PIXEL_FMT_YCBCR_420_SP);
+
+        // jpeg decoder output buffer size calculation formula
+        int32_t ySize = ALIGN_BYTE(VIDEO_WIDTH, JPEG_WIDTH_BYTE_ALIGNMENT) * VIDEO_HEIGHT;
+        int32_t uvSize = ALIGN_BYTE(VIDEO_WIDTH, JPEG_WIDTH_BYTE_ALIGNMENT) *
+                         ALIGN_BYTE(VIDEO_HEIGHT, JPEG_HEIGHT_BYTE_ALIGNMENT) / JPEG_HEIGHT_DIVISOR;
+        int32_t bufferSize = ySize + uvSize;
+        surface->SetSize(bufferSize);
+        if (videoPlay_ == nullptr)
+        {
+            std::string uri("/user/video/dial.mp4");
+            videoPlay_ = new MediaVideoPlay(surface, button1_, uri);
+            if (videoPlay_ == nullptr)
+            {
+                GRAPHIC_LOGE("videoPlay_ is nullptr\n");
                 return;
             }
-            usleep(WAIT_MEDIA_EXIT_SUCCESS_US);
         }
-        delete videoPlay_;
-        videoPlay_ = nullptr;
+
+        // Add SweepClock to App
+        if (sweepClock1_ == nullptr)
+        {
+            sweepClock1_ = new UISweepClock();
+        }
+        sweepClock1_->SetPosition(0, 0);        // widget's left position and top position
+        sweepClock1_->Resize(466, 466);         // widget's width and height
+        sweepClock1_->SetViewId("sweepClock1"); // Set style
+        sweepClock1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+        sweepClock1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+
+        // Set additional property
+        sweepClock1_->SetWorkMode(UISweepClock::WorkMode::NORMAL);
+        sweepClock1_->SetHandLine(UISweepClock::HandType::HOUR_HAND, {233, 101}, {0, 132}, Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff), 5, 132, 255);
+        sweepClock1_->SetHandLine(UISweepClock::HandType::MINUTE_HAND, {233, 56}, {0, 177}, Color::GetColorFromRGBA(0x00, 0xff, 0x00, 0xff), 3, 177, 255);
+        sweepClock1_->SetHandLine(UISweepClock::HandType::SECOND_HAND, {233, 10}, {0, 223}, Color::GetColorFromRGBA(0xff, 0x00, 0x00, 0xff), 1, 223, 255);
+        uint16_t sweepClock1realMilliSecond = 40 * 1000;
+        sweepClock1_->SetSweepTime12Hour(10, 20, sweepClock1realMilliSecond, true);
+
+        sweepClock1callback_ = new SweepClockCallback(sweepClock1_);
+        sweepClock1animator_ = new Animator(sweepClock1callback_, sweepClock1_, 0, true);
+        sweepClock1animator_->Start();
+
+        // Add to rootView
+        container_->Add(sweepClock1_);
+        sweepClock1_->SetVisible(true);
     }
-    DeleteChildren(container_);
-}
 
-const UIView* UITestVideoPlay::GetTestView()
-{
-    return container_;
-}
+    void UITestVideoPlay::TearDown()
+    {
+        if (animator_ != nullptr)
+        {
+            animator_->Stop();
+            delete animator_;
+            animator_ = nullptr;
+        }
 
-bool UITestVideoPlay::OnClick(UIView& view, const ClickEvent& event)
-{
-    int32_t ret = 0;
-    if (videoPlay_ == nullptr) {
-        GRAPHIC_LOGE("videoPlay_ is nullptr!\n");
-        return false;
+        if (callBack_ != nullptr)
+        {
+            delete callBack_;
+            callBack_ = nullptr;
+        }
+        if (sweepClock1callback_ != nullptr)
+        {
+            delete sweepClock1callback_;
+            sweepClock1callback_ = nullptr;
+        }
+        if (sweepClock1animator_ != nullptr)
+        {
+            delete sweepClock1animator_;
+            sweepClock1animator_ = nullptr;
+        }
+        if (videoPlay_ != nullptr)
+        {
+            videoPlay_->needSendBackgroundFrame_ = false;
+            videoPlay_->StopVideoPlay();
+            uint32_t count = 0;
+            while (!videoPlay_->IsExitCompletely())
+            {
+                count++;
+                if (count == WAIT_MEDIA_EXIT_MAX_RETRY_COUNT)
+                {
+                    GRAPHIC_LOGE("media video play exit timeout\n");
+                    DeleteChildren(container_);
+                    return;
+                }
+                usleep(WAIT_MEDIA_EXIT_SUCCESS_US);
+            }
+            delete videoPlay_;
+            videoPlay_ = nullptr;
+        }
+        DeleteChildren(container_);
     }
-    if (&view == button1_) {
-        if (videoPlay_->isExited_ || !videoPlay_->isEntered_) {
-            ret = videoPlay_->StartVideoPlay();
-            return true;
+
+    const UIView *UITestVideoPlay::GetTestView()
+    {
+        return container_;
+    }
+
+    bool UITestVideoPlay::OnClick(UIView &view, const ClickEvent &event)
+    {
+        int32_t ret = 0;
+        if (videoPlay_ == nullptr)
+        {
+            GRAPHIC_LOGE("videoPlay_ is nullptr!\n");
+            return false;
         }
-        if (videoPlay_->isPause_) {
-            ret = videoPlay_->ResumeVideoPlay();
-            if (ret == 0) {
-                button1_->SetText("Pause");
+        if (&view == button1_)
+        {
+            if (videoPlay_->isExited_ || !videoPlay_->isEntered_)
+            {
+                ret = videoPlay_->StartVideoPlay();
+                return true;
+            }
+            if (videoPlay_->isPause_)
+            {
+                ret = videoPlay_->ResumeVideoPlay();
+                if (ret == 0)
+                {
+                    button1_->SetText("Pause");
+                }
             }
-        } else {
-            ret = videoPlay_->PauseVideoPlay();
-            if (ret == 0) {
-                button1_->SetText("Play");
+            else
+            {
+                ret = videoPlay_->PauseVideoPlay();
+                if (ret == 0)
+                {
+                    button1_->SetText("Play");
+                }
             }
         }
-    } else if (&view == button2_) {
-        videoPlay_->StopVideoPlay();
+        else if (&view == button2_)
+        {
+            videoPlay_->StopVideoPlay();
+        }
+        return true;
     }
-    return true;
-}
 }
index 22ea0ac..889d37d 100755 (executable)
 #include "animator/animator.h"
 #include "media_video_play.h"
 
-namespace OHOS {
-class VideoAnimatorCallback : public AnimatorCallback {
-public:
-    explicit VideoAnimatorCallback(UILabel *label) : label_(label) {}
-    ~VideoAnimatorCallback() override {}
-    void Callback(UIView *view) override;
+namespace OHOS
+{
+    class VideoAnimatorCallback : public AnimatorCallback
+    {
+    public:
+        explicit VideoAnimatorCallback(UILabel *label) : label_(label) {}
+        ~VideoAnimatorCallback() override {}
+        void Callback(UIView *view) override;
 
-private:
-    UILabel* label_ = nullptr;
-};
+    private:
+        UILabel *label_ = nullptr;
+    };
 
-class UITestVideoPlay : public UITest, public UIView::OnClickListener {
-public:
-    UITestVideoPlay() {}
-    ~UITestVideoPlay() override {}
-    void SetUp() override;
-    void TearDown() override;
-    const UIView* GetTestView() override;
-    bool OnClick(UIView& view, const ClickEvent& event) override;
+    class UITestVideoPlay : public UITest, public UIView::OnClickListener
+    {
+    public:
+        UITestVideoPlay() {}
+        ~UITestVideoPlay() override {}
+        void SetUp() override;
+        void TearDown() override;
+        const UIView *GetTestView() override;
+        bool OnClick(UIView &view, const ClickEvent &event) override;
 
-private:
-    ColorType colorKey_;
-    UIScrollView *container_ = nullptr;
-    UILabel *label_ = nullptr;
-    UILabelButton *button1_ = nullptr; // Refer to start and stop
-    UILabelButton *button2_ = nullptr; // Refer to pause and resume
-    Surface *surface_ = nullptr;
-    UILiteSurfaceView *surfaceView_ = nullptr;
-    VideoAnimatorCallback *callBack_ = nullptr;
-    Animator *animator_ = nullptr;
-    MediaVideoPlay *videoPlay_ = nullptr;
-};
+    private:
+        ColorType colorKey_;
+        UIScrollView *container_ = nullptr;
+        UILabel *label_ = nullptr;
+        UILabelButton *button1_ = nullptr; // Refer to start and stop
+        UILabelButton *button2_ = nullptr; // Refer to pause and resume
+        Surface *surface_ = nullptr;
+        UILiteSurfaceView *surfaceView_ = nullptr;
+        VideoAnimatorCallback *callBack_ = nullptr;
+        Animator *animator_ = nullptr;
+        MediaVideoPlay *videoPlay_ = nullptr;
+        UISweepClock *sweepClock1_ = nullptr;
+        AnimatorCallback *sweepClock1callback_ = nullptr;
+        Animator *sweepClock1animator_ = nullptr;
+    };
 }
 #endif // UI_TEST_VIDEO_PLAY_H