Example usage for android.app Dialog setCanceledOnTouchOutside

List of usage examples for android.app Dialog setCanceledOnTouchOutside

Introduction

In this page you can find the example usage for android.app Dialog setCanceledOnTouchOutside.

Prototype

public void setCanceledOnTouchOutside(boolean cancel) 

Source Link

Document

Sets whether this dialog is canceled when touched outside the window's bounds.

Usage

From source file:com.dspot.declex.example.expenses.fragment.LoginFragment.java

@Click
void btnLogin() {

    Dialog progressDialog = $ProgressDialog().message("Logging In...").dialog();
    progressDialog.setCanceledOnTouchOutside(false);

    $PutModel(login);//  w w  w. j  a  va 2  s  . c o  m
    if ($PutModel.Failed) {
        progressDialog.dismiss();
        $Toast("An error occurred");
    }

    progressDialog.dismiss();

    if (login.getSuccess() == 1) {
        $MainActivity();
        getActivity().finish();
    } else {
        $Toast(login.getMessage());
    }
}

From source file:com.dspot.declex.example.expenses.fragment.ProfileFragment.java

@Click
void btnSave() {/*from w w w  . ja  v  a  2  s .co  m*/
    Dialog progressDialog = $ProgressDialog().message("Saving...").dialog();
    progressDialog.setCanceledOnTouchOutside(false);

    $PutModel(user).fields("name, email").orderBy("update");
    if ($PutModel.Failed) {
        progressDialog.dismiss();
        $Toast("An error occurred");
    }

    progressDialog.dismiss();
}

From source file:com.dspot.declex.example.expenses.fragment.ProfileFragment.java

@Click
void btnSavePassword() {
    Dialog progressDialog = $ProgressDialog().message("Saving...").dialog();
    progressDialog.setCanceledOnTouchOutside(false);

    $PutModel(user).fields("password, confirmedPassword").orderBy("update");
    if ($PutModel.Failed) {
        progressDialog.dismiss();//from ww w.j a  v a2 s . c  o  m
        $Toast("An error occurred");
    }

    $Toast("Password updated");

    progressDialog.dismiss();
    hideDialog();
}

From source file:com.jaspersoft.android.jaspermobile.dialog.SortDialogFragment.java

@NonNull
@Override/*from   w  w  w .  jav a2  s.c  o m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    builder.setTitle(R.string.s_ab_sort_by);

    CharSequence[] options = { getString(R.string.s_fd_sort_label), getString(R.string.s_fd_sort_date) };

    int position = 0;
    if (mSortOrder.equals(SortOrder.LABEL)) {
        position = BY_LABEL;
    }
    if (mSortOrder.equals(SortOrder.CREATION_DATE)) {
        position = BY_CREATION_DATE;
    }

    builder.setSingleChoiceItems(options, position, this);

    Dialog dialog = builder.create();
    dialog.setCanceledOnTouchOutside(true);
    return dialog;
}

From source file:com.amazon.appstream.fireclient.ErrorDialogFragment.java

/**
 * Standard initialization. Sets up the dialog to quit the
 * activity on clicking its only button.
 *///from w  w  w  .  ja  v  a 2  s  .c o  m
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    final Dialog dialog = new Dialog(getActivity());

    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setCancelable(false);
    dialog.getWindow().setBackgroundDrawable(ConnectDialogFragment.mEmpty);
    dialog.setContentView(R.layout.fatal_error);

    final Button signin = (Button) dialog.findViewById(R.id.signin);
    final TextView message = (TextView) dialog.findViewById(R.id.message);

    message.setText(mMessage);

    signin.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            dialog.dismiss();

            ((FireClientActivity) getActivity()).openConnectDialog(null);
        }
    });

    return dialog;
}

From source file:com.amazon.appstream.sampleclient.ErrorDialogFragment.java

/**
 * Standard initialization. Sets up the dialog to quit the
 * activity on clicking its only button.
 *///from   www . ja  v  a  2  s . c  o  m
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    final Dialog dialog = new Dialog(getActivity());

    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setCancelable(false);
    dialog.getWindow().setBackgroundDrawable(ConnectDialogFragment.mEmpty);
    dialog.setContentView(R.layout.fatal_error);

    final Button signin = (Button) dialog.findViewById(R.id.signin);
    final TextView message = (TextView) dialog.findViewById(R.id.message);

    message.setText(mMessage);

    signin.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            dialog.dismiss();

            ((SampleClientActivity) getActivity()).openConnectDialog(null);
        }
    });

    return dialog;
}

From source file:cn.stj.fphealth.views.dialog.DeviceBindDialog.java

/**
 * Set the dialog edit text and other attribute
 *///from  w  w  w . j a  v  a  2  s.  c  o  m
@Override
public void onResume() {
    super.onResume();

    Dialog dialog = getDialog();
    dialog.setCanceledOnTouchOutside(false);
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE
            | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
    dialog.setOnKeyListener(new SaveDialogKeyListener());
}

From source file:com.zapp.library.merchant.ui.fragment.PBBAPopup.java

@NonNull
@Override/*from  w ww.  jav  a2  s .com*/
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.setCanceledOnTouchOutside(false);
    return dialog;
}

From source file:com.dspot.declex.example.expenses.fragment.ExpenseDetailsFragment.java

@Click
void btnSave() {/*w  ww.  j  a  v a2 s .c o m*/
    hideDialog();

    Dialog progressDialog = $ProgressDialog().message("Saving...").dialog();
    progressDialog.setCanceledOnTouchOutside(false);

    $PutModel(expense).orderBy("update").fields("description, comment, amount, date, time");
    if ($PutModel.Failed) {
        progressDialog.dismiss();
        $Toast("An error occurred");
    }

    progressDialog.dismiss();
}

From source file:com.dspot.declex.example.expenses.fragment.ExpenseDetailsFragment.java

@Click
void deleteExpense() {
    $AlertDialog().title("Are you sure?").message("Are you sure you want to remove this expense?")
            .negativeButton("Cancel").positiveButton("Ok");

    Dialog progressDialog = $ProgressDialog().message("Removing...").dialog();
    progressDialog.setCanceledOnTouchOutside(false);

    $PutModel(expense).query("delete").orderBy("delete");
    if ($PutModel.Failed) {
        progressDialog.dismiss();//from  w w w. j a v  a2s. c o m
        $Toast("An error occurred");
    }

    progressDialog.dismiss();

    $ExpensesListFragment();
}