Revision 85248b04
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/dialogs/RubikDialogSetName.java | ||
---|---|---|
49 | 49 |
{ |
50 | 50 |
private EditText mEdit; |
51 | 51 |
|
52 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
53 |
|
|
54 |
@Override |
|
55 |
public void onStart() |
|
56 |
{ |
|
57 |
super.onStart(); |
|
58 |
|
|
59 |
AlertDialog dialog = (AlertDialog) getDialog(); |
|
60 |
|
|
61 |
if (dialog != null) |
|
62 |
{ |
|
63 |
dialog.setCanceledOnTouchOutside(false); |
|
64 |
|
|
65 |
Window window = dialog.getWindow(); |
|
66 |
|
|
67 |
if( window!=null ) |
|
68 |
{ |
|
69 |
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); |
|
70 |
} |
|
71 |
|
|
72 |
Button positiveButton = dialog.getButton(Dialog.BUTTON_POSITIVE); |
|
73 |
|
|
74 |
if( positiveButton!=null ) |
|
75 |
{ |
|
76 |
String editName = mEdit.getText().toString(); |
|
77 |
positiveButton.setEnabled(editName.length()>0); |
|
78 |
} |
|
79 |
} |
|
80 |
} |
|
81 |
|
|
82 | 52 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
83 | 53 |
|
84 | 54 |
@NonNull |
... | ... | |
172 | 142 |
} |
173 | 143 |
}); |
174 | 144 |
|
145 |
dialog.setCanceledOnTouchOutside(false); |
|
146 |
|
|
147 |
Window window = dialog.getWindow(); |
|
148 |
|
|
149 |
if( window!=null ) |
|
150 |
{ |
|
151 |
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); |
|
152 |
} |
|
153 |
|
|
154 |
Button positiveButton = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE); |
|
155 |
|
|
156 |
if( positiveButton!=null ) |
|
157 |
{ |
|
158 |
String editName = mEdit.getText().toString(); |
|
159 |
positiveButton.setEnabled(editName.length()>0); |
|
160 |
} |
|
161 |
|
|
175 | 162 |
return dialog; |
176 | 163 |
} |
177 | 164 |
} |
Also available in: Unified diff
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.