DroidFS icon indicating copy to clipboard operation
DroidFS copied to clipboard

Do not show fullscreen indicator when using fullscreen gestures

Open Xenourii opened this issue 2 years ago • 25 comments

Xenourii avatar Apr 27 '22 23:04 Xenourii

In fact, I'd like to keep the navigation bar visible even in fullscreen mode. I find this makes it easier to navigate the UI. Perhaps we could make your changes optional via a switch in the app settings?

hardcore-sushi avatar May 02 '22 12:05 hardcore-sushi

You are right...

In my opinion, it would be even better to switch to fullscreen (without navigation bar) only when the controls are not visible. If the controls are visible, then the navigation and status bar will appear. For example, NewPipe do it well.

What do you think of it?

Xenourii avatar May 02 '22 20:05 Xenourii

Yes that's a great idea.

hardcore-sushi avatar May 03 '22 11:05 hardcore-sushi

Cool but the video frame jumps when navigation bar appears and disappears and it doesn't work for ImageViewer. Also, I think we can keep the navigation bar visible in AudioPlayer since controls are never hidden.

hardcore-sushi avatar May 04 '22 07:05 hardcore-sushi

Thank you for your feedback. Actually, I haven't finished to handle all cases (I will message you when it will be OK)

So, to sum up, we want:

  • video and image: hide navigation bar when controls are hidden. Show navigation bar when controls are visible.
  • audio: the navigation bar remains

Regarding the video frame jumps issue, it shouldn't happen with the legacy fullscreen mode (since we use the SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN and the SYSTEM_UI_FLAG_LAYOUT_STABLE) It only occurs with WindowInsetsController, right?

There are still remaining issues:

  • I don't think we handle correctly displays that have a DisplayCutout (I'll test it)
  • When we use the 3-button navigation on Android, the navigation bar hides the rotate button. I will try to fix that.

Xenourii avatar May 04 '22 09:05 Xenourii

@hardcore-sushi I have implemented the fullscreen on the image viewer and fixed the "jump" issue.

But I am still having hard time figuring out why fitSystemWindows do not behave as expected on the activity_video_viewer (unlike the activity_image_viewer). FitSystemWindows is useful to set the ui layout size correctly to always see it when the navigation bar appears. For now, I have edited the exo_styled_player_control_view as a workaround. But with the 3-button navigation, the nav bar can hide either the rotate button or some part of the video title, depending of the screen orientation.

If you have any ideas, I am more than interrested! (otherwise, I will continue to investigate)

Xenourii avatar May 05 '22 07:05 Xenourii

The jumping issue is only fixed for me in legacy fullscreen mode. I tried to fix the problem but I can't find a way to hide then show the navigation bar with the WindowInsetsControllerCompat API without making the video jump. Maybe that's why NewPipe only uses the deprecated API.

hardcore-sushi avatar May 05 '22 11:05 hardcore-sushi

What is the version of Android you are testing with?

For example, Just Video Player uses the new API starting Android 12 https://github.com/moneytoo/Player/blob/8ec8fd5ca91dc9c59b9eb6f98b612d8024c47cce/app/src/main/java/com/brouken/player/Utils.java#L120-L147

Xenourii avatar May 05 '22 22:05 Xenourii

You're right in fact the old API is used up to API level 29: WindowInsetsControllerCompat.java I think we need to set legacy fullscreen mode automatically, not with a switch in settings.

So the jumping issue seems to have been fixed, at least up to Android 10. However I still have this problems:

  • the rotate button is hidden in landscape mode when the navigation bar is visible
  • when showing the status bar by scrolling down from the top it overlaps the title

hardcore-sushi avatar May 07 '22 11:05 hardcore-sushi

Indeed, I think it's a good idea to remove the switch in the settings, too. I will do it (if API <= 29, use legacy mode)

Those problems are the same. It's related to the fitSystemWindows (I mention it in my previous message). I'm working on it. I will try to see how it works with Just (Video) Player.

Xenourii avatar May 09 '22 21:05 Xenourii

I fixed the button overlap issue by programmatically setting a margin equal to the height of the navigation bar in landscape mode. Not elegant but it does the job.

Also, I have noticed that images and videos are no longer centered in the screen, I think this is due to my display cutout.

hardcore-sushi avatar May 10 '22 10:05 hardcore-sushi

Okay, great! (I was thinking of that idea too but I hope we will find a better way)

Can you commit your work so I can test on my smartphone?

Xenourii avatar May 10 '22 22:05 Xenourii

It's just this code in VideoPlayer.kt:

override fun onConfigurationChanged(newConfig: Configuration) {                                                                                                                            
    super.onConfigurationChanged(newConfig)                                                                                                                                                
    binding.topBar.updateLayoutParams {                                                                                                                                                    
        (this as RelativeLayout.LayoutParams).marginEnd =                                                                                                                                  
            if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {                                                                                                            
                resources.getDimensionPixelSize(                                                                                                                                 
                    resources.getIdentifier(                                                                                                                                                           
                        "navigation_bar_height",                                                                                                                                                       
                        "dimen",                                                                                                                                                                       
                        "android"                                                                                                                                                                      
                    )                                                                                                                                                                                  
                )                                                                                                                                                        
            } else {                                                                                                                                                                       
                0                                                                                                                                                                          
            }                                                                                                                                                                              
    }                                                                                                                                                                                      
}

hardcore-sushi avatar May 12 '22 10:05 hardcore-sushi

Thank you.

I have still some issues with fullscreen using gestures, so I will use the same logic as Just Video Player by using the windowInsetsController when Build.VERSION.SDK_INT >= 31.

Xenourii avatar May 16 '22 23:05 Xenourii

I tested your latest changes and it looks good. However the left margin of the title in video player is not the same as the right margin of the rotate button in portrait mode, and the status bar still overlaps the title when it shows up. The image viewer is almost perfect, I just have to try to fix the centering bug due to the display cutout. We also have to test on Android 12 before merging.

hardcore-sushi avatar May 24 '22 11:05 hardcore-sushi

OK, I'll take a look Can you take a screenshot when the status bar overlaps the title when it shows up, please

Xenourii avatar May 28 '22 06:05 Xenourii

I get this when the title is visible and I pull down to show the status bar. overlap

hardcore-sushi avatar May 28 '22 08:05 hardcore-sushi

Great, the issues seem to have been resolved. However, why did you change the video player UI?

hardcore-sushi avatar Jun 05 '22 13:06 hardcore-sushi

Thank you. Actually, it was a code I had worked on about two months ago, to modernize the video UI a little bit.

Should I revert the UI? 😅

Xenourii avatar Jun 05 '22 14:06 Xenourii

Yes please. I created this custom layout so that we can see the video even when the controls are visible.

hardcore-sushi avatar Jun 05 '22 14:06 hardcore-sushi

Is it OK for you?

Xenourii avatar Jun 05 '22 15:06 Xenourii

Great! I tested on Android 12 and it also works fine. I will just make some edits, try to fix the display cutout issue, and then merge your PR. Thanks a lot for your work!

hardcore-sushi avatar Jun 06 '22 12:06 hardcore-sushi

Unfortunately, I just found another bug. In landscape mode, the ImageViewer controls are a bit offset from the image. It looks like they are centered considering the height of the navbar while the image is centered ignoring it.

hardcore-sushi avatar Jun 07 '22 14:06 hardcore-sushi

OK, I'll look into it

Xenourii avatar Jun 12 '22 20:06 Xenourii

I am working on a fix, but I have a weird behavior when the ImageView goes in fullscreen. The ImageView shifts down (y coordinate = 75dp instead of 0).

I'm still trying to figure out why.

image image

Xenourii avatar Jun 20 '22 12:06 Xenourii

I implemented the feature with 821c853a226ac2bdffb77b39f98123cc3cede5c2. The implementation is not perfect but it does the job. Your contribution has helped me a lot, thank you very much.

hardcore-sushi avatar Apr 20 '23 14:04 hardcore-sushi