android-app icon indicating copy to clipboard operation
android-app copied to clipboard

WIP: added autohiding statusbar with scrollView.SetOnScrollChangeListener()

Open bezmi opened this issue 5 years ago • 8 comments

This addresses #114. I have tried to add the auto-hide functionality to the action bar by using scrollView.setOnScrollChangeListener(). I tried to do it with the webViewContent, but due to its nesting within the scrollview, it was really buggy.

The only issue I can see is that when the bar is showing/hiding, there is artificating at the bottom of the screen.

The system status bar doesn't get hidden, but I believe that would be relatively simple to implement.

On a side note, when playing around with the fling gestures to switch articles, I found that they were pretty unreliable. Changing them to apply on the scrollView seemed to make them much more reliable but this isn't something I've tested or fully understand...I am an android development newbie.

bezmi avatar Sep 29 '18 08:09 bezmi

Checks are failing because the method I've implemented requires API level 23 and minimum is set to 14. To fix the flickering I think it would require the action bar to be overlayed on the content.

bezmi avatar Sep 29 '18 08:09 bezmi

So what can we do about the API level problem? I would not like to merge this PR until travis is happy.

API level 14 means Android 4.0. API Level 23 would mean Android 6.0. A quick check of the stats of the installations of wallabag in Gplay reveals that about 15% of all users are using an API level below 23. This means 85% use Android API level 23 and above anyways.

From my point of view i would just increase the minimum API level. But what do the other developers think about it? //CC @wallabag/android

Strubbl avatar Sep 29 '18 08:09 Strubbl

Can anyone provide advice on how to allow the Toolbar to overlay the content so that there is no flickering when scrolling? I have tried adding requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY) in the ReadArticleActivity class' onCreate method, however, this doesn't seem to change anything.

EDIT: I think it is solved. I added: <item name="windowActionBarOverlay">true</item> to styles.xml, which draws the action bar as an overlay, then added padding equal to the size of the action bar to the webview. No more flicker. I will push changes after looking into implementing autohide with backward compatibility to API level 14.

bezmi avatar Sep 29 '18 10:09 bezmi

@Strubbl I believe it is now ready for review. I have tested this code with the theme fixes in #730 and it fixes the action bar colour. Seems I was mistaken. I was incorrectly grabbing properties before the activity was fully loaded, which set the actionbar colour to the default. It is fixed now.

Do you think we still need #678 after this is merged?

Overview of changes:

  1. Added option to autohide system and app bar on scroll (default = on)
  2. Implemented hiding of system and app bar on tap in center of screen
  3. Added extra padding to the header in the CSS so the system and app bar do not overlay the displayed text.

bezmi avatar Sep 30 '18 18:09 bezmi

Hi @di72nn and all, it would be great to get something like this merged, providing a fullscreen reading experience without losing the ability to easily bring up the UI. Was there feedback on this PR and why it wasn't merged? I gave it a quick spin just now and it seems quite good.

Or are there other ideas about what is desired for fullscreen on scroll? #114.

cheywood avatar Sep 06 '21 02:09 cheywood

Coming in for a re-nudge (sorry!). I'm guessing there was discussion somewhere about this not getting merged but I haven't been able to find that. @di72nn @Strubbl ?

@bezmi if this is believed ready to merge should WIP be removed?

cheywood avatar Jan 12 '22 00:01 cheywood

Sorry, I still can't find the time to properly look into it.

I was against approaches like that, because I think it should be implemented using layouts. But seeing that no progress in the layout department has been made, approaches like the one in this PR may be acceptable. I haven't checked the PR though.

di72nn avatar Jan 18 '22 17:01 di72nn

Thanks for following up. That's great, that explains the logic behind it not moving along at least.

cheywood avatar Jan 31 '22 02:01 cheywood