Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0a48814 authored by Ethan Chen's avatar Ethan Chen
Browse files

CMFM: Don't show the cancel button if action is non-cancellable

Change-Id: Ic8078d75aa8c5e77f37f3110cdd8cbf5e65fe790
parent a547ad1a
Loading
Loading
Loading
Loading
+16 −24
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.text.Spanned;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
@@ -117,6 +118,8 @@ public class MessageProgressDialog implements DialogInterface.OnClickListener {
                                        iconResourceId,
                                        titleResourceId,
                                        layout);
        this.mDialog.setCancelable(cancellable);
        if (cancellable) {
            this.mDialog.setButton(
                    DialogInterface.BUTTON_NEUTRAL, context.getString(android.R.string.cancel), this);
            this.mDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@@ -137,17 +140,6 @@ public class MessageProgressDialog implements DialogInterface.OnClickListener {
                    }
                }
            });

        // Is cancellable
        this.mDialog.setCancelable(cancellable);
        if (!cancellable) {
            this.mProgress.post(new Runnable() {
                @Override
                public void run() {
                    MessageProgressDialog.this.mDialog.getButton(
                            DialogInterface.BUTTON_NEUTRAL).setEnabled(false);
                }
            });
        }

        //Initialize the progress