Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add page finishing function when over scrolled to SessionDetailActivity #359

Merged

Conversation

chibatching
Copy link
Contributor

Issue

Overview (Required)

  • Finish SessionDetailActivity when page overscrolled

Links

  • none

Screenshot

Before After

@konifar
Copy link
Contributor

konifar commented Feb 17, 2017

Cool 🆒

@konifar
Copy link
Contributor

konifar commented Feb 17, 2017

Interesting implementation 👀
I thought it's better to make custom activity, but your custom CoordinatorLayout also looks good and reasonable. Let me taste this on my device after CI success 👍



@BindingMethods({
@BindingMethod(type = OverScrollLayout.class, attribute = "onOverScroll", method = "setOverScrollListener")
Copy link
Contributor

Choose a reason for hiding this comment

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

🆒

@konifar
Copy link
Contributor

konifar commented Feb 18, 2017

Sorry to be late review 🙇
I checked on my device. It's really awesome! Thank you so much 👍
LGTM! 💯

@konifar konifar merged commit e470424 into DroidKaigi:master Feb 18, 2017
@chibatching
Copy link
Contributor Author

Thank you for your review!! 😄

@Override
public void onStopNestedScroll(View target) {
super.onStopNestedScroll(target);
if (Math.abs(getY()) > overScrollThreshold && overScrollListener != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

overScrollListener != null should be checked first.
Could you please swap?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I see. I'd like to make another PR to fix it.


private int overScrollThreshold;

private PointF originalLocation = new PointF();
Copy link
Contributor

Choose a reason for hiding this comment

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

Rect is better, I think. Then, Rect#getHeight can be used instead of originalHeight.

})
public class OverScrollLayout extends CoordinatorLayout {

private static final float OVER_SCROLL_THRESHOLD = 0.20f;
Copy link
Contributor

Choose a reason for hiding this comment

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

This variable is a scale or ratio to calculate threshold?
Can you add any suitable suffix?

@@ -157,6 +157,10 @@ public void onClickFab(@SuppressWarnings("unused") View view) {
}
}

public void onOverScroll() {
callback.onOverScroll();
Copy link
Contributor

Choose a reason for hiding this comment

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

should check null or not.

}

private boolean isAppBarExpanded(@NonNull AppBarLayout appBarLayout) {
return appBarLayout.getHeight() == appBarLayout.getBottom();
Copy link
Contributor

@jmatsu jmatsu Feb 20, 2017

Choose a reason for hiding this comment

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

Does this really work?
View#getHeight() is calculated by View#getBottom() - View#getTop().
Can isAppBarExpanded and View#getTop() == zero be used equally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

View#getHeight() is calculated by View#getBottom() - View#getTop()

I didn't know this, it may be able to replaced with View#getTop() == zero.
Thanks!

@jmatsu
Copy link
Contributor

jmatsu commented Feb 20, 2017

Oops, I didn't notice this PR was merged 😇
Sorry, please ignore my reviews.

@chibatching
Copy link
Contributor Author

chibatching commented Feb 20, 2017

I'd like to make another PR to fix your comment! 👍

@konifar
Copy link
Contributor

konifar commented Feb 20, 2017

@jmatsu Thanks for great review 😄
@chibatching Appreciate you. Looking forward to next PR 👍

@chibatching chibatching deleted the add_overscroll_dismiss_function branch February 20, 2017 04:55
@chibatching chibatching mentioned this pull request Feb 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants