Project

General

Profile

« Previous | Next » 

Revision c9556e1e

Added by Leszek Koltunski about 4 years ago

Apply a hack so that the App enters fullscreen modee on some Huawei devices.

View differences:

src/main/java/org/distorted/main/RubikActivity.java
28 28

  
29 29
import android.util.DisplayMetrics;
30 30
import android.view.View;
31
import android.view.WindowManager;
31 32

  
32 33
import com.google.firebase.analytics.FirebaseAnalytics;
33 34

  
......
100 101
      mIsChinese = localeIsChinese();
101 102

  
102 103
      hideNavigationBar();
104
      huaweiHack();
103 105

  
104 106
      // askForPermissions();
105 107
      }
......
108 110

  
109 111
    private void hideNavigationBar()
110 112
      {
111
      mCurrentApiVersion = android.os.Build.VERSION.SDK_INT;
113
      mCurrentApiVersion = Build.VERSION.SDK_INT;
112 114

  
113 115
      if(mCurrentApiVersion >= Build.VERSION_CODES.KITKAT)
114 116
        {
115
        getWindow().getDecorView().setSystemUiVisibility(FLAGS);
116

  
117 117
        final View decorView = getWindow().getDecorView();
118 118

  
119
        decorView.setSystemUiVisibility(FLAGS);
120

  
119 121
        decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener()
120 122
          {
121 123
          @Override
......
130 132
        }
131 133
      }
132 134

  
135
///////////////////////////////////////////////////////////////////////////////////////////////////
136
// on some Huawei devices ( P40, P40 Pro, Mate 30 Pro, Mate 30, Nova 5T, P30 ) this has to be called
137
// so that the App enters fullscreen mode. Otherwise there's a black bar at the top. See
138
// https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201361898979080302&fid=0101246461018590361
139

  
140
    private void huaweiHack()
141
      {
142
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
143
        {
144
        getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
145
        }
146
      }
147

  
133 148
///////////////////////////////////////////////////////////////////////////////////////////////////
134 149

  
135 150
    @Override

Also available in: Unified diff