本文整理匯總了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();
}