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

Show classic scroll bar at rest in History and Messages #191 #192

Closed
PhilZ-cwm6 opened this issue Oct 11, 2020 · 10 comments
Closed

Show classic scroll bar at rest in History and Messages #191 #192

PhilZ-cwm6 opened this issue Oct 11, 2020 · 10 comments

Comments

@PhilZ-cwm6
Copy link
Contributor

PhilZ-cwm6 commented Oct 11, 2020

Pull request: #191

Look at the details in comment and test it if you like to try
Feel free to ignore/close it and I will also revert it in my repo

I made it on the early changes to the page up/page down buttons when the ListView did not have the fast scroll bar. Also because I found many posts on stackoverflow about the lack of customisation in the Android fastScroll bar + the few cosmetic limitations. I never found a proper fix, so I wanted to try one.

Now, with the scroll buttons implemented, I do not see much the use of it except showing the classic bar when there is a scroll view at rest. It also enables the first touch to select ListView entry on the area of the scroll bar, which fastScroll bar doesn't allow. However, we can also consider that first touch on the fast scroll bar is a good feature to reach the middle of the list in one click.

Since it was in my internal code, I push to share it. But feel free to close this pull request and keep the current code as is.

Best regards

@Sentaroh
Copy link
Owner

Thank you.

I've Merged.

Best regards.

@PhilZ-cwm6
Copy link
Contributor Author

Oh, I really did not think you'd like it and I was already thinking at another possibility.
Let me know after you test it, if you think it is not a good idea, here's the other possibility:

  • on tab change, display the FastScroll if it should be displayed (tot/showed items >=4 as per android source) by force showing it then disable force show
  • this will make the fast scroll bar briefly show for 1500 msec when user selects the tab, before fading out. It will only happen if there is enough elements to activate the fast scroll. User will be aware that there are items to scroll

However, it will not "fix" the touchable area on the fast scroll bar and when we click near the bar it will directly scroll to that position even outside the scrolling gestures instead of selecting the item. Depends if you consider it a feature or an annoyance.

Let me know and best regards

@Sentaroh
Copy link
Owner

Sentaroh commented Oct 11, 2020

Hi,

FastScrollBar disappears when I switch to the Message tab and the ScrollBar doesn't appear immediately.

Trying to improve this area would require a complicated process, so why not undo it?
Edit1:
(Because the behavior may change with the version of Android and support package)
Edit2:
This occurs when "Exit Cleanly" is enabled in the settings or when the process is killed.

Best regards.

@PhilZ-cwm6
Copy link
Contributor Author

PhilZ-cwm6 commented Oct 11, 2020

It is because of scroll by code. I did the code before the scroll buttons
In Messages, there is a scroll by code to the bottom of the list on start. Same issue with scroll buttons because it scrolls by code

It doesn't really rely on Android changes more than other code because it uses the basic calls, not a custom touch code

Pushing a simple fix now

But again, feel free to revert it, it was really something I did at first because I wanted to workaround the Fast Scroll Bar particular specs (complete fadeout, large touch zone...)

Best regards

@PhilZ-cwm6
Copy link
Contributor Author

PhilZ-cwm6 commented Oct 11, 2020

Here it is: #193

The main change is:
if (mLastVisibleItem != firstVisibleItem && mCurrentState == SCROLL_STATE_TOUCH_SCROLL)

instead of

if (mLastVisibleItem != firstVisibleItem || mCurrentState == SCROLL_STATE_TOUCH_SCROLL)

All the other changes I did are cosmetic and code cleanup
mCurrentState == SCROLL_STATE_TOUCH_SCROLL ensures the scroll is done by touch on the listView and not by code

Again, I am really ok if you revert it.
But in that case, it will be better to fix the fast scroll bar in Messages on first app start

Best regards

@PhilZ-cwm6
Copy link
Contributor Author

I mean: revert it and either let it as it is or I add the fix I proposed above on TAB change so that it works the same as on app start when we select the Messages TAB the first time (Fast scroll bar shows before fading)
Or let it like it is and just ensure on start we disable all scroll bars before move to bottom of messages, then enable it again

Anyway, let me know and I will look at it tomorrow if you like,

best regards

@PhilZ-cwm6
Copy link
Contributor Author

Just pushed a last patch I omitted. I forgot to check for the ACTION_CANCEL in onTouch. It was properly checked in the handler but not on touch enter

Now, it is really proper and cannot be fooled I think even when scrolling out of the list view

PS: It is ok for me if you drop it, really. It was more for the fun to code it.

Best regards

@PhilZ-cwm6
Copy link
Contributor Author

Ok,
There were small issues in my previous patch: I forgot that the onScroll() mCurrentState == SCROLL_STATE_TOUCH_SCROLL was there to detect that the list is scrolling very fast while we lifted up the finger

I implemented an independent runnable handler that will properly monitor the ListView. This fixes all the issues and the code is much simpler. It also enables the fast scroll bar for the context bottom buttons while being able to reset the classic bar after it is done.

I also properly fixed the current bug present even without my patch in the Messages tab: when we enter the first time the Messages tab, or when we toggle the AutoScroll button, the fast scroll bar is no more shown

I really think this is now a proper code. I will test it more in the next days

best regards

@Sentaroh
Copy link
Owner

Hi,

I still don't want to complicate the process, so I'll revert back to the original code.

Best regards.

@PhilZ-cwm6
Copy link
Contributor Author

Sure, no problem
Bedt regards

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

No branches or pull requests

2 participants