Project

General

Profile

« Previous | Next » 

Revision ffd68f35

Added by Leszek Koltunski about 4 years ago

Make it so that the Navigation Bar does not re-appear when we pop up a DialogFragment.

Now there's noly 1 case when it still reappears: it's when we pop up a PopupWindow.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogAbout.java
116 116
    if( window!=null )
117 117
      {
118 118
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
119
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
120
      window.getDecorView().setSystemUiVisibility(RubikActivity.FLAGS);
119 121
      }
120 122

  
121 123
    dialog.setOnShowListener(new DialogInterface.OnShowListener()
src/main/java/org/distorted/dialogs/RubikDialogEffects.java
269 269
    if( window!=null )
270 270
      {
271 271
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
272
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
273
      window.getDecorView().setSystemUiVisibility(RubikActivity.FLAGS);
272 274
      }
273 275

  
274 276
    dialog.setOnShowListener(new DialogInterface.OnShowListener()
src/main/java/org/distorted/dialogs/RubikDialogError.java
26 26
import android.util.TypedValue;
27 27
import android.view.LayoutInflater;
28 28
import android.view.View;
29
import android.view.Window;
30
import android.view.WindowManager;
29 31
import android.widget.Button;
30 32
import android.widget.TextView;
31 33

  
......
91 93
    final Dialog dialog = builder.create();
92 94
    dialog.setCanceledOnTouchOutside(false);
93 95

  
96
    Window window = dialog.getWindow();
97

  
98
    if( window!=null )
99
      {
100
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
101
      window.getDecorView().setSystemUiVisibility(RubikActivity.FLAGS);
102
      }
103

  
94 104
    dialog.setOnShowListener(new DialogInterface.OnShowListener()
95 105
      {
96 106
      @Override
src/main/java/org/distorted/dialogs/RubikDialogNewRecord.java
165 165
    if( window!=null )
166 166
      {
167 167
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
168
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
169
      window.getDecorView().setSystemUiVisibility(RubikActivity.FLAGS);
168 170
      }
169 171

  
170 172
    dialog.setOnShowListener(new DialogInterface.OnShowListener()
src/main/java/org/distorted/dialogs/RubikDialogPattern.java
116 116
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
117 117
                      WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
118 118
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
119

  
120
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
121
      window.getDecorView().setSystemUiVisibility(RubikActivity.FLAGS);
119 122
      }
120 123

  
121 124
    dialog.setOnShowListener(new DialogInterface.OnShowListener()
src/main/java/org/distorted/dialogs/RubikDialogPrivacy.java
28 28
import android.util.TypedValue;
29 29
import android.view.LayoutInflater;
30 30
import android.view.View;
31
import android.view.Window;
32
import android.view.WindowManager;
31 33
import android.widget.Button;
32 34
import android.widget.TextView;
33 35

  
......
93 95
    final Dialog dialog = builder.create();
94 96
    dialog.setCanceledOnTouchOutside(false);
95 97

  
98
    Window window = dialog.getWindow();
99

  
100
    if( window!=null )
101
      {
102
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
103
      window.getDecorView().setSystemUiVisibility(RubikActivity.FLAGS);
104
      }
105

  
96 106
    dialog.setOnShowListener(new DialogInterface.OnShowListener()
97 107
      {
98 108
      @Override
src/main/java/org/distorted/dialogs/RubikDialogScores.java
131 131
    if( window!=null )
132 132
      {
133 133
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
134
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
135
      window.getDecorView().setSystemUiVisibility(RubikActivity.FLAGS);
134 136
      }
135 137

  
136 138
    dialog.setOnShowListener(new DialogInterface.OnShowListener()
src/main/java/org/distorted/dialogs/RubikDialogSetName.java
189 189
    if( window!=null )
190 190
      {
191 191
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
192
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
193
      window.getDecorView().setSystemUiVisibility(RubikActivity.FLAGS);
192 194
      }
193 195

  
194 196
    dialog.setOnShowListener(new DialogInterface.OnShowListener()
src/main/java/org/distorted/dialogs/RubikDialogSolved.java
101 101
    if( window!=null )
102 102
      {
103 103
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
104
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
105
      window.getDecorView().setSystemUiVisibility(RubikActivity.FLAGS);
104 106
      }
105 107

  
106 108
    dialog.setOnShowListener(new DialogInterface.OnShowListener()
src/main/java/org/distorted/dialogs/RubikDialogSolverError.java
99 99
    if( window!=null )
100 100
      {
101 101
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
102
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
103
      window.getDecorView().setSystemUiVisibility(RubikActivity.FLAGS);
102 104
      }
103 105

  
104 106
    dialog.setOnShowListener(new DialogInterface.OnShowListener()
src/main/java/org/distorted/main/RubikActivity.java
65 65
    public static final float MENU_MEDIUM_TEXT_SIZE= 0.04f;
66 66
    public static final float MENU_SMALL_TEXT_SIZE = 0.035f;
67 67

  
68
    public static final int FLAGS =  View.SYSTEM_UI_FLAG_LAYOUT_STABLE
69
                                   | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
70
                                   | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
71
                                   | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
72
                                   | View.SYSTEM_UI_FLAG_FULLSCREEN
73
                                   | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
74

  
68 75
    private boolean mJustStarted;
69 76
    private FirebaseAnalytics mFirebaseAnalytics;
70 77
    private static int mScreenWidth, mScreenHeight;
......
101 108
      {
102 109
      mCurrentApiVersion = android.os.Build.VERSION.SDK_INT;
103 110

  
104
      final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
105
                      | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
106
                      | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
107
                      | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
108
                      | View.SYSTEM_UI_FLAG_FULLSCREEN
109
                      | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
110

  
111
      // This work only for android 4.4+
112 111
      if(mCurrentApiVersion >= Build.VERSION_CODES.KITKAT)
113 112
        {
114
        getWindow().getDecorView().setSystemUiVisibility(flags);
113
        getWindow().getDecorView().setSystemUiVisibility(FLAGS);
115 114

  
116
        // Code below is to handle presses of Volume up or Volume down.
117
        // Without this, after pressing volume buttons, the navigation bar will
118
        // show up and won't hide
119 115
        final View decorView = getWindow().getDecorView();
120 116

  
121 117
        decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener()
......
125 121
            {
126 122
            if((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0)
127 123
              {
128
              decorView.setSystemUiVisibility(flags);
124
              decorView.setSystemUiVisibility(FLAGS);
129 125
              }
130 126
            }
131 127
          });
......
141 137

  
142 138
      if(mCurrentApiVersion >= Build.VERSION_CODES.KITKAT && hasFocus)
143 139
        {
144
        getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE
145
                                                        | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
146
                                                        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
147
                                                        | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
148
                                                        | View.SYSTEM_UI_FLAG_FULLSCREEN
149
                                                        | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
140
        getWindow().getDecorView().setSystemUiVisibility(FLAGS);
150 141
        }
151 142
      }
152 143

  

Also available in: Unified diff