提交 a41d63bb 编写于 作者: Y YueBiang

fix codestyle bugs

上级 97a5cc07
...@@ -220,7 +220,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords) ...@@ -220,7 +220,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords)
switch (direction_) { switch (direction_) {
case Direction::DIR_LEFT_TO_RIGHT: { case Direction::DIR_LEFT_TO_RIGHT: {
length = GetCurrentPos(progressWidth_ - 1); 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; left = startPoint.x - radius - 1;
right = left + length; right = left + length;
...@@ -229,7 +230,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords) ...@@ -229,7 +230,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords)
} }
case Direction::DIR_RIGHT_TO_LEFT: { case Direction::DIR_RIGHT_TO_LEFT: {
length = GetCurrentPos(progressWidth_ - 1); 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; right = startPoint.x + progressWidth + radius + 1;
left = right - length; left = right - length;
...@@ -238,7 +240,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords) ...@@ -238,7 +240,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords)
} }
case Direction::DIR_TOP_TO_BOTTOM: { case Direction::DIR_TOP_TO_BOTTOM: {
length = GetCurrentPos(progressHeight_ - 1); 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; top = startPoint.y - radius + 1;
bottom = top + length; bottom = top + length;
...@@ -247,7 +250,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords) ...@@ -247,7 +250,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords)
} }
case Direction::DIR_BOTTOM_TO_TOP: { case Direction::DIR_BOTTOM_TO_TOP: {
length = GetCurrentPos(progressHeight_ - 1); 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; bottom = startPoint.y + progressHeight + radius + 1;
top = bottom - length; top = bottom - length;
......
...@@ -18,11 +18,7 @@ ...@@ -18,11 +18,7 @@
namespace OHOS { namespace OHOS {
UISwipeView::UISwipeView(uint8_t direction) UISwipeView::UISwipeView(uint8_t direction)
: swipeListener_(nullptr), : swipeListener_(nullptr), curIndex_(0), blankSize_(DEFAULT_BLANK_SIZE), curView_(nullptr), loop_(false)
curIndex_(0),
blankSize_(DEFAULT_BLANK_SIZE),
curView_(nullptr),
loop_(false)
{ {
#if ENABLE_ROTATE_INPUT #if ENABLE_ROTATE_INPUT
rotateFactor_ = 1; rotateFactor_ = 1;
...@@ -177,7 +173,7 @@ bool UISwipeView::OnRotateEvent(const RotateEvent& event) ...@@ -177,7 +173,7 @@ bool UISwipeView::OnRotateEvent(const RotateEvent& event)
return UIView::OnRotateEvent(event); return UIView::OnRotateEvent(event);
} }
if (event.GetRotate() != 0) { 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 // 4 : need to fit for the device
if (MATH_ABS(event.GetRotate()) > blankSize_ / (4 * static_cast<uint16_t>(MATH_ABS(rotateFactor_)))) { if (MATH_ABS(event.GetRotate()) > blankSize_ / (4 * static_cast<uint16_t>(MATH_ABS(rotateFactor_)))) {
SwitchToPage(curIndex_ - sign * event.GetRotate()); SwitchToPage(curIndex_ - sign * event.GetRotate());
...@@ -306,8 +302,9 @@ void UISwipeView::SortChild() ...@@ -306,8 +302,9 @@ void UISwipeView::SortChild()
loop_ = tmpLoop; loop_ = tmpLoop;
} }
void UISwipeView::RefreshCurrentViewInner(int16_t distance, int16_t (UIView::*pfnGetXOrY)() const, void UISwipeView::RefreshCurrentViewInner(int16_t distance,
int16_t(UIView::*pfnGetWidthOrHeight)()) int16_t (UIView::*pfnGetXOrY)() const,
int16_t (UIView::*pfnGetWidthOrHeight)())
{ {
if (childrenHead_ == nullptr) { if (childrenHead_ == nullptr) {
curIndex_ = 0; curIndex_ = 0;
...@@ -356,8 +353,8 @@ void UISwipeView::RefreshCurrentViewInner(int16_t distance, int16_t (UIView::*pf ...@@ -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. * that is, the x or y coordinate plus 7/10 width or height.
*/ */
if (((curView_->*pfnGetXOrY)() + ((curView_->*pfnGetWidthOrHeight)() >> 1) < swipeMid) && if (((curView_->*pfnGetXOrY)() + ((curView_->*pfnGetWidthOrHeight)() >> 1) < swipeMid) &&
((curView_->*pfnGetXOrY)() + ((curView_->*pfnGetWidthOrHeight)() * 7 / 10) - ((curView_->*pfnGetXOrY)() + ((curView_->*pfnGetWidthOrHeight)() * 7 / 10) - accelerationOffset <
accelerationOffset < swipeMid)) { swipeMid)) {
curIndex_++; curIndex_++;
} }
} else if (distance > 0) { } else if (distance > 0) {
...@@ -366,8 +363,8 @@ void UISwipeView::RefreshCurrentViewInner(int16_t distance, int16_t (UIView::*pf ...@@ -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. * that is, the x or y coordinate plus 3/10 width or height.
*/ */
if (((curView_->*pfnGetXOrY)() + ((curView_->*pfnGetWidthOrHeight)() >> 1) > swipeMid) && if (((curView_->*pfnGetXOrY)() + ((curView_->*pfnGetWidthOrHeight)() >> 1) > swipeMid) &&
((curView_->*pfnGetXOrY)() + ((curView_->*pfnGetWidthOrHeight)() * 3 / 10) + ((curView_->*pfnGetXOrY)() + ((curView_->*pfnGetWidthOrHeight)() * 3 / 10) + accelerationOffset >
accelerationOffset > swipeMid)) { swipeMid)) {
curIndex_--; curIndex_--;
} }
} else { } else {
......
...@@ -37,7 +37,7 @@ static int16_t g_sliderW = 40; ...@@ -37,7 +37,7 @@ static int16_t g_sliderW = 40;
static int16_t g_sliderH = 300; static int16_t g_sliderH = 300;
static int16_t g_testButtonW = 80; static int16_t g_testButtonW = 80;
static int16_t g_testButtonH = 40; 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 #if ENABLE_MOTOR
void Print(MotorType motorType) void Print(MotorType motorType)
...@@ -190,7 +190,7 @@ void UITestRotateInput::UIKit_Rotate_Event_List_001() ...@@ -190,7 +190,7 @@ void UITestRotateInput::UIKit_Rotate_Event_List_001()
list_->SetOnTouchListener(this); list_->SetOnTouchListener(this);
list_->SetThrowDrag(true); list_->SetThrowDrag(true);
list_->SetRotateFactor(10); // 10 : rotate factor list_->SetRotateFactor(10); // 10 : rotate factor
list_->SetReboundSize(50); // 50 : rebound size list_->SetReboundSize(50); // 50 : rebound size
container_->Add(list_); container_->Add(list_);
SetLastPos(list_); SetLastPos(list_);
} }
......
...@@ -432,9 +432,9 @@ bool UITestSlider::OnClick(UIView& view, const ClickEvent& event) ...@@ -432,9 +432,9 @@ bool UITestSlider::OnClick(UIView& view, const ClickEvent& event)
slider_->SetBackgroundStyle(StyleDefault::GetProgressBackgroundStyle()); slider_->SetBackgroundStyle(StyleDefault::GetProgressBackgroundStyle());
slider_->SetForegroundStyle(StyleDefault::GetProgressForegroundStyle()); slider_->SetForegroundStyle(StyleDefault::GetProgressForegroundStyle());
#if ENABLE_SLIDER_KNOB #if ENABLE_SLIDER_KNOB
slider_->SetKnobStyle(StyleDefault::GetSliderKnobStyle()); slider_->SetKnobStyle(StyleDefault::GetSliderKnobStyle());
slider_->SetImage(static_cast<ImageInfo*>(nullptr), static_cast<ImageInfo*>(nullptr), slider_->SetImage(static_cast<ImageInfo*>(nullptr), static_cast<ImageInfo*>(nullptr),
static_cast<ImageInfo*>(nullptr)); static_cast<ImageInfo*>(nullptr));
#endif #endif
slider_->EnableBackground(true); slider_->EnableBackground(true);
} else if (&view == incProgressBtn_) { } else if (&view == incProgressBtn_) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册