Ver Fonte

Cancelling the progress dialog example will interrupt the worker thread

Aidan Follestad há 10 anos atrás
pai
commit
e081e0fb64

+ 7 - 0
sample/src/main/java/com/afollestad/materialdialogssample/MainActivity.java

@@ -640,6 +640,13 @@ public class MainActivity extends AppCompatActivity implements
                     .content(R.string.please_wait)
                     .contentGravity(GravityEnum.CENTER)
                     .progress(false, 150, true)
+                    .cancelListener(new DialogInterface.OnCancelListener() {
+                        @Override
+                        public void onCancel(DialogInterface dialog) {
+                            if (mThread != null)
+                                mThread.interrupt();
+                        }
+                    })
                     .showListener(new DialogInterface.OnShowListener() {
                         @Override
                         public void onShow(DialogInterface dialogInterface) {