Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

[CD-51] Close pop with gesture, add animation #32

Merged
merged 25 commits into from
Sep 19, 2019
Merged

Conversation

realwind2048
Copy link

  • ExitView 에 애니메이션 추가
    나타날때, 사라질때, 종료영역 진입/이탈 시
  • HoverViewStateCollapsed. onDroppedByUser 에 gesture 추가
    좌/우 스와이프: Pop 위치 변경
    아래로 스와이프: Pop 종료
    TargetY 포지션은 x 가 0 or screen.width 일 때, 스와이프 한 방향과 만나는 지점으로 계산했습니다.


@Override
public void onAnimationEnd(Animator animator) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

필요없는 빈줄은 지워주세요~

PropertyValuesHolder enterAnimationScaleY = PropertyValuesHolder.ofFloat("scaleY", EXIT_ICON_DEFAULT_SCALE_Y, EXIT_ICON_TARGET_SCALE_Y);
PropertyValuesHolder enterAnimationRotate = PropertyValuesHolder.ofFloat("rotation", EXIT_ICON_DEFAULT_ROTATION, EXIT_ICON_TARGET_ROTATION);
PropertyValuesHolder enterAnimationAlpha = PropertyValuesHolder.ofFloat("alpha", EXIT_ICON_DEFAULT_ALPHA, EXIT_ICON_TARGET_ALPHA);
enterAnimation = ObjectAnimator.ofPropertyValuesHolder(mExitIcon, enterAnimationScaleX, enterAnimationScaleY, enterAnimationRotate, enterAnimationAlpha);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기 this 붙여주세요~

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전체적으로 this 를 붙이려다보니 가독성이 떨어지는 거 같아서, checkStyle 룰에 따라서 enterAnimation 을 private 으로 변경하고 m을 붙여 봤는데 어떤가요?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저희 처음 할당할때 this를 붙여서 local variable이 아닌 member라고 명시하기로 했던것 같은데 예전에 했던 얘기라 기억이 잘 안나네요ㅋ m을 붙이면 리뷰볼때는 쉬울거 같긴한데 IDE에서 멤버들은 잘 표시를 해줘서 꼭 필요한건가 싶기도 하고!

Copy link
Author

@realwind2048 realwind2048 Sep 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

맞아요 this 를 붙이기로 했었는데 m을 붙인 이유는 checkStyle 이 private 변수일 때 m 을 강제해서 그렇게 적용이 됐어요

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

키보드가 '요'를 빼먹음 ㅠㅠ

@@ -71,4 +173,70 @@ private double calculateDistance(@NonNull Point p1, @NonNull Point p2) {
Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)
);
}

public void startEnterExitAnim() {
if (enterAnimation != null && !enterAnimation.isRunning() && !isExitAnimated) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enterAnimation.isRunning만으로는 안되나요? isExitAnimated 이것도 필요한건가 해서요~

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isRunning 은 enterAnimation이 동작중인지 체크, isExitAnimated 는 현재 view 상태를 체크하는 건데, 가독성이 떨어지는 것 같아서 isExitAnimated -> isShowing 으로 변경했습니다

@@ -71,4 +171,70 @@ private double calculateDistance(@NonNull Point p1, @NonNull Point p2) {
Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)
);
}

public void startShowAnimation() {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@toc2menow 리뷰해주신 부분 간단하게 show / hide 로 표현이 가능할 것 같아서 변경했는데 의미가 바뀌었네요. 수정후 다시 리뷰 요청드릴게요 😢

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@toc2menow start 를 없애고 show 로만 표현되도록 수정했습니다. showEnterAnimation, showExitAnimation

* @return targetPoint
*/
private float getTargetYPosition(@NonNull Point point1, @NonNull Point point2) {
// STEP 1: get liner line equation from 2 points (ax + by = c)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment에 오타가 있네요 liner -> linear


return exitArea.contains(position.x, position.y)
&& !excludedXExitAreaLeft.contains(position.x, position.y)
&& !excludedXExitAreaRight.contains(position.x, position.y);
}

private Point getExitZoneCenter() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isInExitZone method가 생기면서 사용을 안하는 것 같은데 없애도 되지 않을까요?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제거했습니다

@@ -71,4 +171,70 @@ private double calculateDistance(@NonNull Point p1, @NonNull Point p2) {
Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 method도 위치가 옮겨져서 사용을 안하는 것 같네요

@@ -54,6 +55,10 @@
private Handler mHandler = new Handler();
private Runnable mIdleActionRunnable;
private Runnable mOnStateChanged;
private Point mStartPoint = null;
private long mDragStartMillis = -1L;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mStartPoint, mDragStartMillis 이 두개는 추가가 되었는데 사용되는 곳이 없네요.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 제거했습니다

Copy link

@josh-yun josh-yun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link

@toc2menow toc2menow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@realwind2048 realwind2048 merged commit 1174bf4 into master Sep 19, 2019
@delete-merged-branch delete-merged-branch bot deleted the feature/close_pop branch September 19, 2019 05:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants