Java Examples for cn.pedant.SweetAlert.SweetAlertDialog

The following java examples will help you to understand the usage of cn.pedant.SweetAlert.SweetAlertDialog. These source code samples are taken from different open source projects.

Example 1
Project: BGARefreshLayout-Android-master  File: BaseActivity.java View source code
public void showLoadingDialog() {
    if (mLoadingDialog == null) {
        mLoadingDialog = new SweetAlertDialog(this, SweetAlertDialog.PROGRESS_TYPE);
        mLoadingDialog.getProgressHelper().setBarColor(getResources().getColor(R.color.colorPrimary));
        mLoadingDialog.setCancelable(false);
        mLoadingDialog.setTitleText("数据加载中...");
    }
    mLoadingDialog.show();
}
Example 2
Project: S2TDroid-master  File: HomeFragment.java View source code
@Override
public void run() {
    pDialog.hide();
    // trigger SAF or in kikat.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        final SweetAlertDialog sdcardDialog = new SweetAlertDialog(getActivity(), SweetAlertDialog.ERROR_TYPE);
        sdcardDialog.setTitleText(getString(R.string.oops)).setContentText(getString(R.string.oops_sdcard_detail)).setConfirmText("OK").setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {

            @Override
            public void onClick(SweetAlertDialog sweetAlertDialog) {
                triggerStorageAccessFramework();
                sdcardDialog.dismiss();
            }
        }).show();
    } else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
        final SweetAlertDialog sdcardDialog = new SweetAlertDialog(getActivity(), SweetAlertDialog.ERROR_TYPE);
        sdcardDialog.setTitleText(getString(R.string.oops)).setContentText(getString(R.string.oops_sdcard_kitkat_detail)).setConfirmText("OK").setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {

            @Override
            public void onClick(SweetAlertDialog sweetAlertDialog) {
                sdcardDialog.dismiss();
            }
        }).show();
    }
}
Example 3
Project: phphub-android-master  File: TopicDetailsActivity.java View source code
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    switch(id) {
        case R.id.menu_share:
            onShareItemSelected();
            break;
        case R.id.menu_report:
            SweetAlertDialog successDialog = new SweetAlertDialog(this, SweetAlertDialog.SUCCESS_TYPE);
            successDialog.setTitleText(getString(R.string.success_title));
            successDialog.setContentText(getString(R.string.report_success));
            successDialog.show();
            break;
    }
    return super.onOptionsItemSelected(item);
}
Example 4
Project: bleYan-master  File: DeviceCommandAdapter.java View source code
@Override
public boolean onLongClick(View v) {
    final int position = mRecyclerView.getChildAdapterPosition(v);
    final BleCommandInfo bleDevice = getItem(position);
    new SweetAlertDialog(mContext, SweetAlertDialog.NORMAL_TYPE).setTitleText("delete").setContentText("delete it?").setCancelText("CANCEL").setConfirmText("OK").setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {

        @Override
        public void onClick(SweetAlertDialog sDialog) {
            remove(position);
            notifyItemRemoved(position);
            bleDevice.delete();
            sDialog.dismissWithAnimation();
        }
    }).show();
    return true;
}
Example 5
Project: sweet-alert-dialog-master  File: SampleActivity.java View source code
@Override
public void onClick(SweetAlertDialog sDialog) {
    // reuse previous dialog instance, keep widget user state, reset them if you need
    sDialog.setTitleText("Cancelled!").setContentText("Your imaginary file is safe :)").setConfirmText("OK").showCancelButton(false).setCancelClickListener(null).setConfirmClickListener(null).changeAlertType(SweetAlertDialog.ERROR_TYPE);
// or you can new a SweetAlertDialog to show
/* sDialog.dismiss();
                                new SweetAlertDialog(SampleActivity.this, SweetAlertDialog.ERROR_TYPE)
                                        .setTitleText("Cancelled!")
                                        .setContentText("Your imaginary file is safe :)")
                                        .setConfirmText("OK")
                                        .show();*/
}
Example 6
Project: MusicUU-master  File: SearchActivity.java View source code
private void firstUse() {
    boolean isFirst = (boolean) SPUtils.get(this, Constants.IS_FIRST_SEARCH, true);
    if (isFirst) {
        SweetAlertDialog sweetAlertDialog = new SweetAlertDialog(this);
        sweetAlertDialog.setTitleText(getString(R.string.start_info));
        sweetAlertDialog.setContentText(getString(R.string.description_search)).setConfirmText(getString(R.string.i_know));
        sweetAlertDialog.setCancelable(false);
        sweetAlertDialog.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {

            @Override
            public void onClick(SweetAlertDialog sweetAlertDialog) {
                SPUtils.put(SearchActivity.this, Constants.IS_FIRST_SEARCH, false);
                sweetAlertDialog.dismissWithAnimation();
            }
        });
        sweetAlertDialog.show();
    }
}
Example 7
Project: Ummo-master  File: SelectableItemHolder.java View source code
@Override
public void onClick(SweetAlertDialog sDialog) {
    parent.joinSelectedQ();
    tabTitle = selecHeader + " " + text;
    qNameServiceId = db.getQService_id(text);
    //String serviceid_string = qNameServiceId.get(0);
    //int serviceid = Integer.parseInt(serviceid_string);
    //db.insertQ(serviceid, text, tabPos, pos);
    //select = true;
    //Intent i = new Intent();
    //i.setClass(context, Qs.class);
    //i.putExtra("tab", "tabTitle");
    //String positionTab = Integer.toString(tabPos);
    //String int_serviceid = Integer.toString(serviceid);
    //i.putExtra("serviceid", "int_serviceid");
    //i.putExtra("tabPos", positionTab);
    sDialog.dismiss();
    nodeSelector.setChecked(true);
    exit_q_menu.setVisibility(View.VISIBLE);
    nodeSelector.setClickable(false);
    //context.startActivity(i);
    /*final String qpos_string = Integer.toString(qpos);*/
    ((SelectableTreeFragment) c).getUser().updateJoinedQs();
    //Intent i = new Intent(c, Main_Activity.class);
    //Log.e("++tabPos", "" + tabPos);
    //context.startActivity(i);
    pDialog.dismiss();
    db.close();
}
Example 8
Project: MediaNote-Android-master  File: VitamioActivity.java View source code
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
    if (what == MediaPlayer.MEDIA_ERROR_UNKNOWN) {
        SweetAlertDialog dialog = new SweetAlertDialog(VitamioActivity.this, SweetAlertDialog.ERROR_TYPE).setTitleText("提示").setContentText("播放出错");
        dialog.setCancelable(false);
        dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {

            @Override
            public void onDismiss(DialogInterface dialog) {
                backward();
            }
        });
        dialog.show();
    }
    // 返回true自己处理
    return true;
}
Example 9
Project: Sweet-master  File: SampleActivity.java View source code
@Override
public void onClick(SweetAlertDialog sDialog) {
    // reuse previous dialog instance, keep widget user state, reset them if you need
    sDialog.setTitleText("Cancelled!").setContentText("Your imaginary file is safe :)").setConfirmText("OK").showCancelButton(false).setCancelClickListener(null).setConfirmClickListener(null).changeAlertType(SweetAlertDialog.ERROR_TYPE);
// or you can new a SweetAlertDialog to show
/* sDialog.dismiss();
                                new SweetAlertDialog(SampleActivity.this, SweetAlertDialog.ERROR_TYPE)
                                        .setTitleText("Cancelled!")
                                        .setContentText("Your imaginary file is safe :)")
                                        .setConfirmText("OK")
                                        .show();*/
}
Example 10
Project: xmpp-master  File: DialogView.java View source code
public static void Initial(Context context, String message) {
    pDialog = new SweetAlertDialog(context, SweetAlertDialog.PROGRESS_TYPE);
    pDialog.getProgressHelper().setBarColor(Color.parseColor("#1ed6ff"));
    pDialog.setTitleText(message);
    pDialog.setCancelable(false);
}