diff --git a/frameworks/components/ui_slider.cpp b/frameworks/components/ui_slider.cpp index a0ab0ae0800f18d0a250d202fb655f788b2a07ff..a1bf3dd6ffcd4c240253ec3a1af1da77d62b4678 100755 --- a/frameworks/components/ui_slider.cpp +++ b/frameworks/components/ui_slider.cpp @@ -220,7 +220,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords) switch (direction_) { case Direction::DIR_LEFT_TO_RIGHT: { length = GetCurrentPos(progressWidth_ - 1); - coords.SetRect(startPoint.x, startPoint.y, startPoint.x + progressWidth - 1, startPoint.y + progressHeight_ - 1); + coords.SetRect(startPoint.x, startPoint.y, startPoint.x + progressWidth - 1, + startPoint.y + progressHeight_ - 1); left = startPoint.x - radius - 1; right = left + length; @@ -229,7 +230,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords) } case Direction::DIR_RIGHT_TO_LEFT: { length = GetCurrentPos(progressWidth_ - 1); - coords.SetRect(startPoint.x, startPoint.y, startPoint.x + progressWidth - 1, startPoint.y + progressHeight_ - 1); + coords.SetRect(startPoint.x, startPoint.y, startPoint.x + progressWidth - 1, + startPoint.y + progressHeight_ - 1); right = startPoint.x + progressWidth + radius + 1; left = right - length; @@ -238,7 +240,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords) } case Direction::DIR_TOP_TO_BOTTOM: { length = GetCurrentPos(progressHeight_ - 1); - coords.SetRect(startPoint.x, startPoint.y, startPoint.x + progressWidth_ - 1, startPoint.y + progressHeight - 1); + coords.SetRect(startPoint.x, startPoint.y, startPoint.x + progressWidth_ - 1, + startPoint.y + progressHeight - 1); top = startPoint.y - radius + 1; bottom = top + length; @@ -247,7 +250,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords) } case Direction::DIR_BOTTOM_TO_TOP: { length = GetCurrentPos(progressHeight_ - 1); - coords.SetRect(startPoint.x, startPoint.y, startPoint.x + progressWidth_ - 1, startPoint.y + progressHeight - 1); + coords.SetRect(startPoint.x, startPoint.y, startPoint.x + progressWidth_ - 1, + startPoint.y + progressHeight - 1); bottom = startPoint.y + progressHeight + radius + 1; top = bottom - length; diff --git a/frameworks/components/ui_swipe_view.cpp b/frameworks/components/ui_swipe_view.cpp index 4518b3268aebe83d1bcf1ba7eb76493beeeffb67..e3406ef9c0fae4d7ba219d4d05e7427368dc6c07 100755 --- a/frameworks/components/ui_swipe_view.cpp +++ b/frameworks/components/ui_swipe_view.cpp @@ -18,11 +18,7 @@ namespace OHOS { UISwipeView::UISwipeView(uint8_t direction) - : swipeListener_(nullptr), - curIndex_(0), - blankSize_(DEFAULT_BLANK_SIZE), - curView_(nullptr), - loop_(false) + : swipeListener_(nullptr), curIndex_(0), blankSize_(DEFAULT_BLANK_SIZE), curView_(nullptr), loop_(false) { #if ENABLE_ROTATE_INPUT rotateFactor_ = 1; @@ -177,7 +173,7 @@ bool UISwipeView::OnRotateEvent(const RotateEvent& event) return UIView::OnRotateEvent(event); } if (event.GetRotate() != 0) { - int8_t sign = rotateFactor_ < 0 ? -1 : 1; + int8_t sign = (rotateFactor_ < 0) ? -1 : 1; // 4 : need to fit for the device if (MATH_ABS(event.GetRotate()) > blankSize_ / (4 * static_cast(MATH_ABS(rotateFactor_)))) { SwitchToPage(curIndex_ - sign * event.GetRotate()); @@ -306,8 +302,9 @@ void UISwipeView::SortChild() loop_ = tmpLoop; } -void UISwipeView::RefreshCurrentViewInner(int16_t distance, int16_t (UIView::*pfnGetXOrY)() const, - int16_t(UIView::*pfnGetWidthOrHeight)()) +void UISwipeView::RefreshCurrentViewInner(int16_t distance, + int16_t (UIView::*pfnGetXOrY)() const, + int16_t (UIView::*pfnGetWidthOrHeight)()) { if (childrenHead_ == nullptr) { curIndex_ = 0; @@ -356,8 +353,8 @@ void UISwipeView::RefreshCurrentViewInner(int16_t distance, int16_t (UIView::*pf * that is, the x or y coordinate plus 7/10 width or height. */ if (((curView_->*pfnGetXOrY)() + ((curView_->*pfnGetWidthOrHeight)() >> 1) < swipeMid) && - ((curView_->*pfnGetXOrY)() + ((curView_->*pfnGetWidthOrHeight)() * 7 / 10) - - accelerationOffset < swipeMid)) { + ((curView_->*pfnGetXOrY)() + ((curView_->*pfnGetWidthOrHeight)() * 7 / 10) - accelerationOffset < + swipeMid)) { curIndex_++; } } else if (distance > 0) { @@ -366,8 +363,8 @@ void UISwipeView::RefreshCurrentViewInner(int16_t distance, int16_t (UIView::*pf * that is, the x or y coordinate plus 3/10 width or height. */ if (((curView_->*pfnGetXOrY)() + ((curView_->*pfnGetWidthOrHeight)() >> 1) > swipeMid) && - ((curView_->*pfnGetXOrY)() + ((curView_->*pfnGetWidthOrHeight)() * 3 / 10) + - accelerationOffset > swipeMid)) { + ((curView_->*pfnGetXOrY)() + ((curView_->*pfnGetWidthOrHeight)() * 3 / 10) + accelerationOffset > + swipeMid)) { curIndex_--; } } else { diff --git a/test/uitest/test_rotate_input/ui_test_rotate_input.cpp b/test/uitest/test_rotate_input/ui_test_rotate_input.cpp index 47acbbd1fbcdecf3452e65739b9abac22b1b1511..7c194f214d2a9ca5f899a3021ecd413a7a666100 100644 --- a/test/uitest/test_rotate_input/ui_test_rotate_input.cpp +++ b/test/uitest/test_rotate_input/ui_test_rotate_input.cpp @@ -37,7 +37,7 @@ static int16_t g_sliderW = 40; static int16_t g_sliderH = 300; static int16_t g_testButtonW = 80; static int16_t g_testButtonH = 40; -static const char* g_pickerRange[] = { "A0", "B1", "C2", "D3", "E4", "F5", "G6", "H7", "I8", "J9", "K10", "L11" }; +static const char* g_pickerRange[] = {"A0", "B1", "C2", "D3", "E4", "F5", "G6", "H7", "I8", "J9", "K10", "L11"}; #if ENABLE_MOTOR void Print(MotorType motorType) @@ -190,7 +190,7 @@ void UITestRotateInput::UIKit_Rotate_Event_List_001() list_->SetOnTouchListener(this); list_->SetThrowDrag(true); list_->SetRotateFactor(10); // 10 : rotate factor - list_->SetReboundSize(50); // 50 : rebound size + list_->SetReboundSize(50); // 50 : rebound size container_->Add(list_); SetLastPos(list_); } diff --git a/test/uitest/test_slider/ui_test_slider.cpp b/test/uitest/test_slider/ui_test_slider.cpp index ac85d73beda8311cff528363bbf29e894b011d37..16544cb47c56902fa21a7d5eb4cc8a51a48b3a71 100755 --- a/test/uitest/test_slider/ui_test_slider.cpp +++ b/test/uitest/test_slider/ui_test_slider.cpp @@ -432,9 +432,9 @@ bool UITestSlider::OnClick(UIView& view, const ClickEvent& event) slider_->SetBackgroundStyle(StyleDefault::GetProgressBackgroundStyle()); slider_->SetForegroundStyle(StyleDefault::GetProgressForegroundStyle()); #if ENABLE_SLIDER_KNOB - slider_->SetKnobStyle(StyleDefault::GetSliderKnobStyle()); - slider_->SetImage(static_cast(nullptr), static_cast(nullptr), - static_cast(nullptr)); + slider_->SetKnobStyle(StyleDefault::GetSliderKnobStyle()); + slider_->SetImage(static_cast(nullptr), static_cast(nullptr), + static_cast(nullptr)); #endif slider_->EnableBackground(true); } else if (&view == incProgressBtn_) {