This repository was archived by the owner on Oct 3, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
easypermissions/src/main/java/pub/devrel/easypermissions Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -119,14 +119,13 @@ public void show() {
119
119
/**
120
120
* Show the dialog. {@link #show()} is a wrapper to ensure backwards compatibility
121
121
*/
122
- void showDialog () {
123
- new AlertDialog .Builder (mContext )
122
+ AlertDialog showDialog () {
123
+ return new AlertDialog .Builder (mContext )
124
124
.setCancelable (false )
125
125
.setTitle (mTitle )
126
126
.setMessage (mRationale )
127
127
.setPositiveButton (mPositiveButtonText , this )
128
128
.setNegativeButton (mNegativeButtonText , mNegativeListener )
129
- .create ()
130
129
.show ();
131
130
}
132
131
Original file line number Diff line number Diff line change 6
6
import android .content .Intent ;
7
7
import android .os .Bundle ;
8
8
import android .support .annotation .RestrictTo ;
9
+ import android .support .v7 .app .AlertDialog ;
9
10
import android .support .v7 .app .AppCompatActivity ;
10
11
11
12
@ RestrictTo (RestrictTo .Scope .LIBRARY_GROUP )
12
13
public class AppSettingsDialogHolderActivity extends AppCompatActivity implements DialogInterface .OnClickListener {
14
+ private AlertDialog mDialog ;
15
+
13
16
public static Intent createShowDialogIntent (Context context , AppSettingsDialog dialog ) {
14
17
return new Intent (context , AppSettingsDialogHolderActivity .class )
15
18
.putExtra (AppSettingsDialog .EXTRA_APP_SETTINGS , dialog );
@@ -22,7 +25,15 @@ protected void onCreate(Bundle savedInstanceState) {
22
25
dialog .setContext (this );
23
26
dialog .setActivityOrFragment (this );
24
27
dialog .setNegativeListener (this );
25
- dialog .showDialog ();
28
+ mDialog = dialog .showDialog ();
29
+ }
30
+
31
+ @ Override
32
+ protected void onDestroy () {
33
+ super .onDestroy ();
34
+ if (mDialog != null && mDialog .isShowing ()) {
35
+ mDialog .dismiss ();
36
+ }
26
37
}
27
38
28
39
@ Override
You can’t perform that action at this time.
0 commit comments