Wish Full-screen Immersive mode android 4.4

Discussion in 'Bugs & wishlist' started by appie21, Dec 12, 2013.

  1. appie21

    appie21 Active Member Licensed User

  2. Erel

    Erel Administrator Staff Member Licensed User

    Last edited: Mar 21, 2018
  3. appie21

    appie21 Active Member Licensed User

    Last edited: Dec 12, 2013
  4. appie21

    appie21 Active Member Licensed User

    Hello

    I have add that code

    but when I add a imageview and put the folowinng line
    ImageView1.SetLayout(0,0,GetDeviceLayoutValues.Width ,GetDeviceLayoutValues.Height)

    there will be a gray place(where normaly the back and home buttons are) and the imageview will not be gone full screen

    also if I ask sthe values of my screen they will give not the resolution of the real screen size but always the space area

    for example my tablet have a resolution of 1920 by 1200
    then GetDeviceLayoutValues.Height = 1104

    what do I wrong or is it a bug?
     
  5. Erel

    Erel Administrator Staff Member Licensed User

  6. Informatix

    Informatix Expert Licensed User

  7. Erel

    Erel Administrator Staff Member Licensed User

  8. Informatix

    Informatix Expert Licensed User

    If you don't change the orientation, 100%x and 100%y return the right values. If you change the orientation, they are wrong but it's not the only problem. Click on the volume button; the status bar remains visible. You can set the visibility listener to handle this case:
    Code:
    Sub Activity_Create(FirstTime As Boolean)
       
    Dim jo As JavaObject = Activity
       
    Dim e As Object = jo.CreateEvent("android.view.View.OnSystemUiVisibilityChangeListener""VisibilityChanged"Null)
       jo.RunMethod(
    "setOnSystemUiVisibilityChangeListener"Array As Object(e))
       
    Activity.Width = -1
       
    Activity.Height = -1
    End Sub

    Sub Activity_Resume
        
    Activity.Color = Colors.Red
    End Sub

    Sub ForceImmersiveMode
        
    Dim r As Reflector
        r.Target = r.GetActivity
        r.Target = r.RunMethod(
    "getWindow")
        r.Target = r.RunMethod(
    "getDecorView")
        r.RunMethod2(
    "setSystemUiVisibility"5894"java.lang.int")
    End Sub

    Sub VisibilityChanged_Event(MethodName As String, Args() As Object) As Object
        ForceImmersiveMode
    End Sub

    Sub Activity_WindowFocusChanged(HasFocus As Boolean)
        
    If HasFocus Then
            ForceImmersiveMode
        
    End If
    End Sub
    Unfortunately the visibility listener is not always triggered after an orientation change, even if you call ForceImmersiveMode, and I don't know why.
    Note that the solution in post #2 crashes because of Activity being Null. That's why my ForceImmersiveMode sub uses r.GetActivity.
     
  9. Informatix

    Informatix Expert Licensed User

    I'm still unable to make the immersive mode work as expected after a change in screen orientation. I give up.
     
  10. Douglas Farias

    Douglas Farias Expert Licensed User

    @Informatix
    1° i m trying to use your code of post #8 this works my activity go to 100%x 100%y screen
    but i need change all views on the screnn too ?

    my panel is 5%x , 95%x later i user your code my activity go to 100%x but my panel stay on the old place dont change the x values


    2° its correct use this to see if user have kitkat or no?

    Code:
    Try
      
    Dim jo As JavaObject = Activity
      
    Dim e As Object = jo.CreateEvent("android.view.View.OnSystemUiVisibilityChangeListener""VisibilityChanged"Null)
      jo.RunMethod(
    "setOnSystemUiVisibilityChangeListener"Array As Object(e))
      
    Activity.Width = -1
      
    Activity.Height = -1
      
    Catch
      
    Log("....")
      
    End Try
     
  11. Informatix

    Informatix Expert Licensed User

    Your code (or your layout script) is supposed to adjust the position and size of all views according to the screen size, so call it again (or reload your layout) after setting the mode on.

    A cleaner way is to read the Android SDK number:
    Code:
    Dim Ph As Phone
        
    If Ph.SdkVersion >= 19 Then
          
    Dim jo As JavaObject = Activity
         ....
     
    Douglas Farias likes this.
  12. Informatix

    Informatix Expert Licensed User

    @Erel: still no solution for this problem ?
     
  13. Erel

    Erel Administrator Staff Member Licensed User

    appie21 likes this.
  14. appie21

    appie21 Active Member Licensed User

    Do this also work wilth android 4.2 or 4.3
     
  15. Informatix

    Informatix Expert Licensed User

    What is "this" in your sentence ?
    The immersive mode does not work before Kitkat (4.4).
     
    appie21 likes this.
  16. appie21

    appie21 Active Member Licensed User

    this = Full screenmode

    And it work also with 4.2.2

    But only gray are at the bottom. But Buttons are away
     
  17. appie21

    appie21 Active Member Licensed User

  18. NeoTechni

    NeoTechni Well-Known Member Licensed User

    I have a user reporting the overflow button remains in this mode
     

    Attached Files:

  19. Erel

    Erel Administrator Staff Member Licensed User

    What is the value of android:targetSdkVersion? This button shouldn't appear when the value is 14+.
     
  20. NeoTechni

    NeoTechni Well-Known Member Licensed User

    10 cause I need the button for everyone else.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice