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

Feature/david/pull to refresh #750

Closed
wants to merge 5 commits into from

Conversation

malmstein
Copy link
Contributor

Task/Issue URL: https://app.asana.com/0/488551667048375/1168653724774521

Description:
Pull to Refresh is a very common pattern on Android when it comes to refresh the content in screen. This PR enables this mechanism, without removing the current option for refreshing**Steps to test

Screencast:

Pull to Refresh Refresh from Menu
device-2020-03-27-142605 device-2020-03-27-143149

@@ -19,8 +19,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rootView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these flags don't affect the behaviour, it's set manually by OmnibarScrolling

@CDRussell CDRussell self-assigned this Mar 27, 2020
@@ -23,20 +23,37 @@ import android.annotation.SuppressLint
import android.app.Activity.RESULT_OK
import android.app.ActivityOptions
import android.appwidget.AppWidgetManager
import android.content.*
import android.content.ClipData
Copy link
Member

Choose a reason for hiding this comment

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

There shouldn't be all of these changes to the import statements; when i format this file it reverts them back again and this is going to create lots of noisy PRs.

Can you check your code formatting settings to ensure they match the team settings? I can work with you offline if they're out of sync.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm afraid those guidelines don't mention anything about Imports. On the other hand, Unused imports is a well know PMD warning (https://pmd.github.io/latest/pmd_rules_java_bestpractices.html#unusedimports) Wildcard imports are unnecessary, why is that better?

Copy link
Member

Choose a reason for hiding this comment

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

Wildcard imports are unnecessary, why is that better?

It's not a case of which is better; it's about not generating a ton of changes every time the code is touched by different people. I've no strong opinions on whether to wildcard imports or not, per se, but i've a very strong opinion we all need to be doing the same thing.

Copy link
Member

@CDRussell CDRussell left a comment

Choose a reason for hiding this comment

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

There's something not right with the UX here;

  • the swipe gesture is overly sensitive; the slightest scroll down rapidly brings the indicator down fully. It doesn't smoothly correlate with the number of pixels dragged
  • once initiated, it can't be cancelled

Compare the UX with Chrome, where the indicator is much smoother and can be cancelled. (attached a video to try demonstrate the difference; first app is chrome then ours. Available here: https://app.asana.com/0/414730916066338/1168653724774521)

@@ -462,6 +558,7 @@ class BrowserTabFragment : Fragment(), FindListener, CoroutineScope {
}

fun refresh() {
swipeContainer.isRefreshing = true
Copy link
Member

Choose a reason for hiding this comment

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

Do not call this when refresh is triggered by a swipe gesture.

The documentation on SwipeRefreshLayout suggests we shouldn't set this here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is triggered when the button in the Popup Menu is pressed, so it's necessary.

this.canWebViewScrollUpCallback = canWebViewScrollUpCallback
}

override fun canChildScrollUp(): Boolean {
Copy link
Member

Choose a reason for hiding this comment

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

Instead of the !!, what about if changed the function like this?

 override fun canChildScrollUp(): Boolean {
    return canWebViewScrollUpCallback?.canSwipeRefreshChildScrollUp() ?: super.canChildScrollUp()
}

@malmstein
Copy link
Contributor Author

Closing this until we agree on UX flow with Design. Thanks for the review @CDRussell!

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

2 participants