Sentaroh / SMBSync2

This application performs file synchronization between an Android device and a PC/NAS via wireless LAN using SMB v1/v2/v3 protocol.
MIT License
262 stars 49 forks source link

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

Closed PhilZ-cwm6 closed 3 years ago

PhilZ-cwm6 commented 3 years ago

Pull request: https://github.com/Sentaroh/SMBSync2/pull/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 commented 3 years ago

Thank you.

I've Merged.

Best regards.

PhilZ-cwm6 commented 3 years ago

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:

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

Here it is: https://github.com/Sentaroh/SMBSync2/pull/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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

Hi,

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

Best regards.

PhilZ-cwm6 commented 3 years ago

Sure, no problem Bedt regards