本文整理汇总了Java中cn.pedant.SweetAlert.SweetAlertDialog类的典型用法代码示例。如果您正苦于以下问题:Java SweetAlertDialog类的具体用法?Java SweetAlertDialog怎么用?Java SweetAlertDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SweetAlertDialog类属于cn.pedant.SweetAlert包,在下文中一共展示了SweetAlertDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayResult
import cn.pedant.SweetAlert.SweetAlertDialog; //导入依赖的package包/类
private void displayResult(CalculateViewModel.CalculationResult result){
if(result.didFail()){ //Show message if failed to calculate
showToast(result.getMessage());
}else{ //Display result
new SweetAlertDialog(this, result.isApproved() ? SweetAlertDialog.SUCCESS_TYPE : SweetAlertDialog.WARNING_TYPE)
.setTitleText(result.getTitle())
.setContentText(result.getMessage())
.setConfirmText(getString(R.string.text_accept))
.show();
//Notify event to analytics
AnalyticsManager.eventCalculate(this,mCourse,result.getGrade());
}
}
示例2: prePayment
import cn.pedant.SweetAlert.SweetAlertDialog; //导入依赖的package包/类
/**
* 提款
*/
@Click(R.id.btn_payment)
void prePayment() {
String payee = tv_payee.getText().toString();
String receive_bank = tv_receive_bank.getText().toString().trim();
String bankAccount = tv_bankAccount.getText().toString().trim();
String pay_amount = tv_pay_amount.getText().toString().trim();
if (TextUtils.isEmpty(payee)) {
ToastUtil.showToast(this, "请输入收款单位");
} else if (TextUtils.isEmpty(receive_bank)) {
ToastUtil.showToast(this, "请输入收款银行");
} else if (TextUtils.isEmpty(bankAccount)) {
ToastUtil.showToast(this, "请输入银行账号");
} else if (TextUtils.isEmpty(pay_amount)) {
ToastUtil.showToast(this, "请输入支付金额");
} else if (Double.valueOf(pay_amount) > generalAccount) {
ToastUtil.showToast(this, "支付金额超过普通账户余额");
} else {
pDialog = new SweetAlertDialog(T_PaymentActivity.this, SweetAlertDialog.PROGRESS_TYPE).setTitleText("正在提款...");
pDialog.setCancelable(false);
pDialog.show();
payment(payee, receive_bank, bankAccount, pay_amount);
}
}
示例3: clickNotice
import cn.pedant.SweetAlert.SweetAlertDialog; //导入依赖的package包/类
@Click(R.id.btn_notice)
void clickNotice() {
String receiptDate = tv_receiptDate.getText().toString().trim();
String foreignName = tv_foreignName.getText().toString().trim();
if (TextUtils.isEmpty(receiptDate)) {
ToastUtil.showToast(this, "请选择付汇日期");
} else if (TextUtils.isEmpty(receiptTypeValue)) {
ToastUtil.showToast(this, "请选择付汇类型");
} else if (TextUtils.isEmpty(foreignName)) {
ToastUtil.showToast(this, "请选择外商");
} else {
String saleOrder = tv_saleOrder.getText().toString().trim();
String receiptBank = et_receiptBank.getText().toString().trim();
String currency = tv_currency.getText().toString().trim();
String amount = et_amount.getText().toString().trim();
String customerRemark = et_customerRemark.getText().toString().trim();
pDialog = new SweetAlertDialog(T_NewNoticeForeignExchangeActivity.this, SweetAlertDialog.PROGRESS_TYPE).setTitleText("正在创建水单通知...");
pDialog.setCancelable(false);
pDialog.show();
notice(receiptDate, foreignName, receiptTypeValue, saleOrder, receiptBank, currency, amount, customerRemark);
}
}
示例4: onPostExecute
import cn.pedant.SweetAlert.SweetAlertDialog; //导入依赖的package包/类
@Override
protected void onPostExecute(String s)
{
super.onPostExecute(s);
if(ip==null)
{
new SweetAlertDialog(getActivity(), SweetAlertDialog.NORMAL_TYPE)
.setTitleText("Your IP")
.setContentText("Check your internet connection and try again")
.show();
}
else
{
new SweetAlertDialog(getActivity(), SweetAlertDialog.NORMAL_TYPE)
.setTitleText("Your IP")
.setContentText("Your IP Address is : "+ip)
.show();
}
}
示例5: onClick
import cn.pedant.SweetAlert.SweetAlertDialog; //导入依赖的package包/类
@Override
public void onClick(View v) {
if (piece==0){
new SweetAlertDialog(getActivity(), SweetAlertDialog.ERROR_TYPE)
.setTitleText("ADET")
.setContentText("Lütfen seçmiş olduğunuz ürüne adet bilgisi giriniz.")
.show();
}else{
ProductBasket productBasket = new ProductBasket(productID, piece);
databaseReference.push().setValue(productBasket);
new SweetAlertDialog(getActivity(), SweetAlertDialog.SUCCESS_TYPE)
.setTitleText("EKLENDİ")
.setContentText("Ürün sepete eklendi.")
.show();
}
closeKeyword();
}
示例6: onItemClick
import cn.pedant.SweetAlert.SweetAlertDialog; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//Intent ıntent = new Intent(this, DeskBasketActivity.class);
Intent ıntent = new Intent(this, DeskOrdersActivity.class);
ıntent.putExtra("orderId",deskListGlobal.get(position).getOrderId());
String status = deskListGlobal.get(position).getStatus();
if (status.equals("0")){
new SweetAlertDialog(this)
.setTitleText("Masa Boş")
.show();
}else if (status.equals("1")){
startActivity(ıntent);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}else if (status.equals("2")){
new SweetAlertDialog(this)
.setTitleText("Sipariş zaten onaylandı.")
.show();
}
}
示例7: showNote
import cn.pedant.SweetAlert.SweetAlertDialog; //导入依赖的package包/类
private void showNote() {
new SweetAlertDialog(AboutActivity.this, SweetAlertDialog.WARNING_TYPE)
.setTitleText("免责声明")
.setContentText(
"1.本app为非盈利开源项目,任何拷贝复制的相同项目与本app无关" +
"\n2.后台数据储存由Bmob云服务提供,作者承诺不会对后台用户数据进行任何操作" +
"\n3.任何加密技术都有被破解的可能性,由此造成的损失与本app及作者无关" +
"\n4.作为作者,建议用户自己申请Bmob云服务进行私人信息储存,相关教程请点击设置页面【修改签名】")
.setConfirmText("好的我知道啦")
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sDialog) {
SPUtils.put("first_in", "第一次进入app");
sDialog.cancel();
}
})
.show();
}
示例8: findOffLineDate
import cn.pedant.SweetAlert.SweetAlertDialog; //导入依赖的package包/类
private void findOffLineDate() {
pDialog = new SweetAlertDialog(MainActivity.this, SweetAlertDialog.PROGRESS_TYPE);
pDialog.getProgressHelper().setBarColor(Color.parseColor("#A5DC86"));
pDialog.setTitleText("离线数据加载中...");
pDialog.show();
mAccountBeans = SPUtils.getDataList("beans", AccountBean.class);
mTestStackAdapter = new TestStackAdapter(MainActivity.this, mAccountBeans);
mStackView.setAdapter(mTestStackAdapter);
mTestStackAdapter.notifyDataSetChanged();
new Handler().postDelayed(
new Runnable() {
@Override
public void run() {
//为什么不能把TEST_DATA拿出来单独处理一次,会出现ANR
mTestStackAdapter.updateData(Arrays.asList(DesUtil.getRandomFromArray(TEST_DATAS, mAccountBeans.size())));
pDialog.dismiss();
}
}
, 1500
);
}
示例9: confirmSend
import cn.pedant.SweetAlert.SweetAlertDialog; //导入依赖的package包/类
/**
*
*/
public void confirmSend(final String address, final String amount, final String txFee) {
new SweetAlertDialog(getBaseActivity(), SweetAlertDialog.NORMAL_TYPE)
.setTitleText("Confirm Send?")
.setContentText("You want to send " + amount + " (Estimated Fee: "+txFee+") \n to : " + address)
.setConfirmText("Yes, Send!")
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sDialog) {
getBaseActivity().sendCoins(address, amount, CoinManagerFactory.BITCOIN);
sDialog.dismissWithAnimation();
getBaseActivity().showMenuSelection(0);
}
})
.setCancelText("Cancel")
.setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sweetAlertDialog) {
sweetAlertDialog.cancel();
}
})
.show();
}
示例10: clickReply
import cn.pedant.SweetAlert.SweetAlertDialog; //导入依赖的package包/类
/**
* 点击了回复
*/
private void clickReply(final User replyUser, final Comment comment) {
new SweetAlertDialog(this, SweetAlertDialog.EDIT_TYPE)
.setTitleText("回复:" + replyUser.getNickname())
.showConfirmButton(true)
.showCancelButton(true)
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sweetAlertDialog) {
sweetAlertDialog.dismissWithAnimation();
if (!"".equals(sweetAlertDialog.getEditText())) {
presenter.addReply(replyUser, comment, sweetAlertDialog.getEditText());
}
}
})
.show();
}
示例11: uploadArticleSuccess
import cn.pedant.SweetAlert.SweetAlertDialog; //导入依赖的package包/类
@Override
public void uploadArticleSuccess() {
if (dialog != null && dialog.isShowing()) {
dialog.setTitleText(getString(R.string.release_success));
dialog.changeAlertType(SweetAlertDialog.SUCCESS_TYPE);
dialog.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sweetAlertDialog) {
dialog.dismissWithAnimation();
finish();
}
});
}
ToastUtil.getInstance().showLongT(R.string.release_success);
PreferenceData.clearPreference();
mEditViewHolder.title.setText("");
mEditViewHolder.content.setText("");
}
示例12: saveArticleSuccess
import cn.pedant.SweetAlert.SweetAlertDialog; //导入依赖的package包/类
@Override
public void saveArticleSuccess() {
if (dialog != null && dialog.isShowing()) {
dialog.setTitleText(getString(R.string.save_success));
dialog.changeAlertType(SweetAlertDialog.SUCCESS_TYPE);
dialog.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sweetAlertDialog) {
dialog.dismissWithAnimation();
finish();
}
});
}
ToastUtil.getInstance().showLongT(R.string.save_success);
}
示例13: editInfo
import cn.pedant.SweetAlert.SweetAlertDialog; //导入依赖的package包/类
/**
* 编辑昵称/手机号
*/
private void editInfo(final int titleId) {
new SweetAlertDialog(this, SweetAlertDialog.EDIT_TYPE)
.setTitleText(getString(titleId))
.showCancelButton(true)
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sweetAlertDialog) {
sweetAlertDialog.dismissWithAnimation();
switch (titleId) {
case R.string.edit_nickname:
presenter.requestChangeNickname(sweetAlertDialog.getEditText());
break;
case R.string.edit_phone_number:
presenter.requestChangePhone(sweetAlertDialog.getEditText());
break;
case R.string.edit_email:
presenter.requestChangeEmail(sweetAlertDialog.getEditText());
break;
}
}
})
.show();
}
示例14: changeAlertType
import cn.pedant.SweetAlert.SweetAlertDialog; //导入依赖的package包/类
@ReactMethod
public void changeAlertType(String alertType) {
switch (alertType) {
case "normal":
sweetAlertDialog.changeAlertType(SweetAlertDialog.NORMAL_TYPE);
break;
case "error":
sweetAlertDialog.changeAlertType(SweetAlertDialog.ERROR_TYPE);
break;
case "success":
sweetAlertDialog.changeAlertType(SweetAlertDialog.SUCCESS_TYPE);
break;
case "warning":
sweetAlertDialog.changeAlertType(SweetAlertDialog.WARNING_TYPE);
break;
case "progress":
sweetAlertDialog.changeAlertType(SweetAlertDialog.PROGRESS_TYPE);
break;
default:
sweetAlertDialog.changeAlertType(SweetAlertDialog.NORMAL_TYPE);
break;
}
}
示例15: askRestart
import cn.pedant.SweetAlert.SweetAlertDialog; //导入依赖的package包/类
private void askRestart(){
SweetAlertDialog sweetAlertDialog = new SweetAlertDialog(mContext, SweetAlertDialog.WARNING_TYPE)
.setTitleText(getString(R.string.locale_changed))
.setContentText(getString(R.string.locale_changed_need_restart))
.setConfirmText("OK")
.setConfirmClickListener(dialog -> {
Intent intent = getBaseContext().getPackageManager()
.getLaunchIntentForPackage(getBaseContext().getPackageName());
PendingIntent restartIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, PendingIntent.FLAG_ONE_SHOT);
AlarmManager mgr = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
if(Build.VERSION.SDK_INT < 19){
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 500, restartIntent);
}else{
mgr.setExact(AlarmManager.RTC, System.currentTimeMillis() + 500, restartIntent);
}
System.exit(0);
});
sweetAlertDialog.setCancelable(false);
sweetAlertDialog.show();
}