Project

General

Profile

« Previous | Next » 

Revision 85248b04

Added by Leszek Koltunski about 4 years ago

Finally solve the bug on Samsung Android 9 and 10 phones that the Dialogs Main & patterns wouldn't be modeless: move the setting of this flag earlier, to the 'onCreateDialog()' function.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogMain.java
36 36

  
37 37
public class RubikDialogMain extends AppCompatDialogFragment
38 38
  {
39
  @Override
40
  public void onStart()
41
    {
42
    super.onStart();
43

  
44
    Dialog dialog = getDialog();
45

  
46
    if( dialog!=null )
47
      {
48
      dialog.setCanceledOnTouchOutside(false);
49

  
50
      Window window = dialog.getWindow();
51

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

  
61
///////////////////////////////////////////////////////////////////////////////////////////////////
62

  
63 39
  @NonNull
64 40
  @Override
65 41
  public Dialog onCreateDialog(Bundle savedInstanceState)
......
70 46
    final View view = inflater.inflate(R.layout.dialog_main, null);
71 47
    builder.setView(view);
72 48

  
73
    return builder.create();
49
    Dialog dialog = builder.create();
50

  
51
    dialog.setCanceledOnTouchOutside(false);
52

  
53
    Window window = dialog.getWindow();
54

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

  
62
    return dialog;
74 63
    }
75 64

  
76 65
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff