Project

General

Profile

« Previous | Next » 

Revision 584585d0

Added by Leszek Koltunski over 4 years ago

(Hopefully) make the Dialogs NOT disappear on clicks outside (previously this wasn't working on Android 9).
Lower API requirements to 21.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogAbout.java
43 43
    {
44 44
    super.onStart();
45 45

  
46
    Window window = getDialog().getWindow();
47
    window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
48
                    WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
49
    window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
46
    Dialog dialog = getDialog();
47
    dialog.setCanceledOnTouchOutside(false);
48

  
49
    Window window = dialog.getWindow();
50

  
51
    if( window!=null )
52
      {
53
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
54
                      WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
55
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
56
      }
50 57
    }
51 58

  
52 59
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/dialogs/RubikDialogEffects.java
90 90
    textView.setLayoutParams(textParams);
91 91
    textView.setGravity(Gravity.CENTER);
92 92
    textView.setPadding(padding,0,padding,0);
93
    textView.setTextAppearance(android.R.style.TextAppearance_Small);
93
    textView.setTextAppearance(act,android.R.style.TextAppearance_Small);
94 94
    outerLayout.addView(textView);
95 95

  
96 96
    ///// INNER LAYOUT1 //////////////////////////////////////////////////////////////////
......
114 114
    text1View.setLayoutParams(text1LayoutParams);
115 115
    text1View.setGravity(Gravity.START|Gravity.CENTER);
116 116
    text1View.setPadding(text1Padding,0,text1Padding,0);
117
    text1View.setTextAppearance(android.R.style.TextAppearance_Small);
117
    text1View.setTextAppearance(act,android.R.style.TextAppearance_Small);
118 118
    innerLayout1.addView(text1View);
119 119
    //////////////////////////////////////////////////////////////////
120 120
    int text2Padding = (int)(scale*5 + 0.5f);
......
124 124
    mDurationText[index].setLayoutParams(text2LayoutParams);
125 125
    mDurationText[index].setGravity(Gravity.END|Gravity.CENTER);
126 126
    mDurationText[index].setPadding(text2Padding,0,text2Padding,0);
127
    mDurationText[index].setTextAppearance(android.R.style.TextAppearance_Small);
127
    mDurationText[index].setTextAppearance(act,android.R.style.TextAppearance_Small);
128 128
    innerLayout1.addView(mDurationText[index]);
129 129
    //////////////////////////////////////////////////////////////////
130 130
    int seekPadding = (int)(scale*10 + 0.5f);
......
160 160
    text3View.setLayoutParams(text3LayoutParams);
161 161
    text3View.setGravity(Gravity.START|Gravity.CENTER);
162 162
    text3View.setPadding(text3Padding,0,text3Padding,0);
163
    text3View.setTextAppearance(android.R.style.TextAppearance_Small);
163
    text3View.setTextAppearance(act,android.R.style.TextAppearance_Small);
164 164
    innerLayout2.addView(text3View);
165 165
    //////////////////////////////////////////////////////////////////
166 166
    int spinnerPadding = (int)(scale*10 + 0.5f);
......
204 204
    {
205 205
    super.onStart();
206 206

  
207
    Window window = getDialog().getWindow();
208
    window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
209
                    WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
210
    window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
207
    Dialog dialog = getDialog();
208
    dialog.setCanceledOnTouchOutside(false);
209

  
210
    Window window = dialog.getWindow();
211

  
212
    if( window!=null )
213
      {
214
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
215
                      WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
216
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
217
      }
211 218
    }
212 219

  
213 220
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/dialogs/RubikDialogMain.java
41 41
    {
42 42
    super.onStart();
43 43

  
44
    Window window = getDialog().getWindow();
45
    window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
46
                    WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
47
    window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
44
    Dialog dialog = getDialog();
45
    dialog.setCanceledOnTouchOutside(false);
46

  
47
    Window window = dialog.getWindow();
48

  
49
    if( window!=null )
50
      {
51
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
52
                      WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
53
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
54
      }
48 55
    }
49 56

  
50 57
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/dialogs/RubikDialogNewRecord.java
48 48
    {
49 49
    super.onStart();
50 50

  
51
    Window window = getDialog().getWindow();
52
    window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
53
                    WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
54
    window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
51
    Dialog dialog = getDialog();
52
    dialog.setCanceledOnTouchOutside(false);
53

  
54
    Window window = dialog.getWindow();
55

  
56
    if( window!=null )
57
      {
58
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
59
                      WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
60
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
61
      }
55 62
    }
56 63

  
57 64
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/dialogs/RubikDialogPattern.java
53 53
    {
54 54
    super.onStart();
55 55

  
56
    Window window = getDialog().getWindow();
57
    window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
58
                    WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
59
    window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
56
    Dialog dialog = getDialog();
57
    dialog.setCanceledOnTouchOutside(false);
58

  
59
    Window window = dialog.getWindow();
60

  
61
    if( window!=null )
62
      {
63
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
64
                      WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
65
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
66
      }
60 67
    }
61 68

  
62 69
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/dialogs/RubikDialogScores.java
51 51
    {
52 52
    super.onStart();
53 53

  
54
    Window window = getDialog().getWindow();
55
    window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
56
                    WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
57
    window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
54
    Dialog dialog = getDialog();
55
    dialog.setCanceledOnTouchOutside(false);
56

  
57
    Window window = dialog.getWindow();
58

  
59
    if( window!=null )
60
      {
61
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
62
                      WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
63
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
64
      }
58 65
    }
59 66

  
60 67
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/dialogs/RubikDialogSetName.java
52 52
    {
53 53
    super.onStart();
54 54

  
55
    Window window = getDialog().getWindow();
56
    window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
57
                    WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
58
    window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
59

  
60 55
    AlertDialog dialog = (AlertDialog) getDialog();
56

  
61 57
    if (dialog != null)
62 58
      {
63 59
      Button positiveButton = dialog.getButton(Dialog.BUTTON_POSITIVE);
64 60
      positiveButton.setEnabled(false);
61
      dialog.setCanceledOnTouchOutside(false);
62

  
63
      Window window = dialog.getWindow();
64

  
65
      if( window!=null )
66
        {
67
        window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
68
                        WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
69
        window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
70
        }
65 71
      }
66 72
    }
67 73

  
src/main/java/org/distorted/dialogs/RubikDialogSolved.java
45 45
    {
46 46
    super.onStart();
47 47

  
48
    Window window = getDialog().getWindow();
49
    window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
50
                    WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
51
    window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
48
    Dialog dialog = getDialog();
49
    dialog.setCanceledOnTouchOutside(false);
50

  
51
    Window window = dialog.getWindow();
52

  
53
    if( window!=null )
54
      {
55
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
56
                      WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
57
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
58
      }
52 59
    }
53 60

  
54 61
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/dialogs/RubikDialogSolverError.java
43 43
    {
44 44
    super.onStart();
45 45

  
46
    Window window = getDialog().getWindow();
47
    window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
48
                    WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
49
    window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
46
    Dialog dialog = getDialog();
47
    dialog.setCanceledOnTouchOutside(false);
48

  
49
    Window window = dialog.getWindow();
50

  
51
    if( window!=null )
52
      {
53
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
54
                      WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
55
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
56
      }
50 57
    }
51 58

  
52 59
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff