Here are the examples of the java api android.app.AlertDialog.setCanceledOnTouchOutside() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
79 Examples
18
Source : PermissionRequestActivity.java
with Apache License 2.0
from tankery
with Apache License 2.0
from tankery
private Dialog showStandardPermissionDialog(String message, @NonNull final DialogResult dialogResult) {
AlertDialog alertDialog = new AlertDialog.Builder(this).setMessage(message).setCancelable(true).setPositiveButton(android.R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
dialogResult.onPositive();
}
}).setNegativeButton(android.R.string.cancel, new OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.cancel();
}
}).setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
dialogInterface.dismiss();
dialogResult.onNegative();
}
}).show();
alertDialog.setCanceledOnTouchOutside(true);
return alertDialog;
}
17
Source : Util.java
with Apache License 2.0
from wuyinlei
with Apache License 2.0
from wuyinlei
public static AlertDialog showConfirmCancelDialog(Context context, String replacedle, String message, DialogInterface.OnClickListener posListener) {
AlertDialog dlg = new AlertDialog.Builder(context).setMessage(message).setPositiveButton("确认", posListener).setNegativeButton("取消", null).create();
dlg.setCanceledOnTouchOutside(false);
dlg.show();
return dlg;
}
17
Source : OnNewIntentActivity.java
with Apache License 2.0
from tinyvampirepudge
with Apache License 2.0
from tinyvampirepudge
private void showAlertDialog() {
AlertDialog alertDialog = new AlertDialog.Builder(this).setreplacedle("OnNewIntent测试").setMessage("我就是测试一下").setNegativeButton("cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
ToastUtils.showSingleToast("放肆,竟然敢点击取消");
}
}).setPositiveButton("ojbk", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
ToastUtils.showSingleToast("你很帅气");
}
}).setCancelable(false).create();
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
}
17
Source : MainActivity.java
with Apache License 2.0
from sofwerx
with Apache License 2.0
from sofwerx
private void checkForLocationServices() {
if (!LocationService.isLocationEnabled(this)) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setreplacedle(R.string.loc_services_needed_replacedle);
builder.setMessage(R.string.loc_services_needed_description);
builder.setPositiveButton(R.string.loc_services_enable, (dialog, which) -> {
try {
startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
} catch (ActivityNotFoundException e) {
Toast.makeText(this, "Sorry, I could not find the location settings", Toast.LENGTH_LONG).show();
}
});
final AlertDialog dialog = builder.create();
dialog.setCanceledOnTouchOutside(false);
dialog.show();
}
}
17
Source : Dlg.java
with GNU General Public License v3.0
from PhilippC
with GNU General Public License v3.0
from PhilippC
// newAlertDlg()
/**
* Creates new {@link AlertDialog}. Set canceled on touch outside to
* {@code true}.
*
* @param context
* the context which uses this library's theme.
* @return {@link AlertDialog}
* @since v4.3 beta
*/
public static AlertDialog newAlertDlg(Context context) {
AlertDialog res = newAlertDlgBuilder(context).create();
res.setCanceledOnTouchOutside(true);
return res;
}
17
Source : MainActivity.java
with Apache License 2.0
from FantasyLWX
with Apache License 2.0
from FantasyLWX
/**
* 提示对话框,带有“确定”按钮
*
* @param message 提示内容
* @param listener “确定”按钮的点击监听器
*/
private void showAlertDialog(String message, DialogInterface.OnClickListener listener) {
AlertDialog dialog = new AlertDialog.Builder(this).setMessage(message).setPositiveButton("确定", listener).create();
dialog.setCanceledOnTouchOutside(false);
dialog.show();
}
16
Source : LatinIME.java
with Apache License 2.0
from VladThodo
with Apache License 2.0
from VladThodo
private void showSubtypeSelectorAndSettings() {
final CharSequence replacedle = getString(R.string.english_ime_input_options);
// TODO: Should use new string "Select active input modes".
final CharSequence languageSelectionreplacedle = getString(R.string.language_selection_replacedle);
final CharSequence[] items = new CharSequence[] { languageSelectionreplacedle, getString(ApplicationUtils.getActivityreplacedleResId(this, SettingsActivity.clreplaced)) };
final String imeId = mRichImm.getInputMethodIdOfThisIme();
final OnClickListener listener = new OnClickListener() {
@Override
public void onClick(DialogInterface di, int position) {
di.dismiss();
switch(position) {
case 0:
final Intent intent = IntentUtils.getInputLanguageSelectionIntent(imeId, Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(Intent.EXTRA_replacedLE, languageSelectionreplacedle);
startActivity(intent);
break;
case 1:
launchSettings(SettingsActivity.EXTRA_ENTRY_VALUE_LONG_PRESS_COMMA);
break;
}
}
};
final AlertDialog.Builder builder = new AlertDialog.Builder(DialogUtils.getPlatformDialogThemeContext(this));
builder.sereplacedems(items, listener).setreplacedle(replacedle);
final AlertDialog dialog = builder.create();
dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true);
showOptionDialog(dialog);
}
16
Source : FireDroidActivity.java
with MIT License
from ugurcany
with MIT License
from ugurcany
/*
* DIALOG HELPERS
*/
public void showProgress(String message) {
hideDialog();
dialog = new ProgressDialog(this);
dialog.setMessage(message);
dialog.setCancelable(false);
dialog.setCanceledOnTouchOutside(false);
dialog.show();
}
16
Source : SettingsDialogFragment.java
with BSD 2-Clause "Simplified" License
from nano-wallet-company
with BSD 2-Clause "Simplified" License
from nano-wallet-company
private void showFingerprintDialog(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setreplacedle(getString(R.string.settings_fingerprint_replacedle));
builder.setMessage(getString(R.string.settings_fingerprint_description));
builder.setView(view);
String negativeText = getString(android.R.string.cancel);
builder.setNegativeButton(negativeText, (dialog, which) -> Reprint.cancelAuthentication());
fingerprintDialog = builder.create();
fingerprintDialog.setCanceledOnTouchOutside(false);
// display dialog
fingerprintDialog.show();
}
16
Source : SendFragment.java
with BSD 2-Clause "Simplified" License
from nano-wallet-company
with BSD 2-Clause "Simplified" License
from nano-wallet-company
private void showFingerprintDialog(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setreplacedle(getString(R.string.send_fingerprint_replacedle));
builder.setMessage(getString(R.string.send_fingerprint_description, !wallet.getSendNanoAmountFormatted().isEmpty() ? wallet.getSendNanoAmountFormatted() : "0"));
builder.setView(view);
String negativeText = getString(android.R.string.cancel);
builder.setNegativeButton(negativeText, (dialog, which) -> Reprint.cancelAuthentication());
fingerprintDialog = builder.create();
fingerprintDialog.setCanceledOnTouchOutside(false);
// display dialog
fingerprintDialog.show();
}
16
Source : DialogCreator.java
with Apache License 2.0
from MissZzz1
with Apache License 2.0
from MissZzz1
/**
* 三按键对话框
*
* @param context
* @param replacedle
* @param msg
* @param btnText1
* @param btnText2
* @param btnText3
* @param positiveListener
* @param neutralListener
* @param negativeListener
* @return
*/
public static AlertDialog createThreeButtonDialog(Context context, String replacedle, String msg, String btnText1, String btnText2, String btnText3, DialogInterface.OnClickListener neutralListener, DialogInterface.OnClickListener negativeListener, DialogInterface.OnClickListener positiveListener) {
/* final EditText et = new EditText(context);*/
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setreplacedle(replacedle);
if (!StringHelper.isEmpty(msg)) {
builder.setMessage(msg);
}
// 第一个按钮
builder.setNeutralButton(btnText1, neutralListener);
// 中间的按钮
builder.setNegativeButton(btnText2, negativeListener);
// 第三个按钮
builder.setPositiveButton(btnText3, positiveListener);
AlertDialog dialog = builder.show();
dialog.setCanceledOnTouchOutside(true);
dialog.setCancelable(true);
// Diglog的显示
return dialog;
}
16
Source : MainActivity.java
with MIT License
from DantSu
with MIT License
from DantSu
public void browseBluetoothDevice() {
final BluetoothConnection[] bluetoothDevicesList = (new BluetoothPrintersConnections()).getList();
if (bluetoothDevicesList != null) {
final String[] items = new String[bluetoothDevicesList.length + 1];
items[0] = "Default printer";
int i = 0;
for (BluetoothConnection device : bluetoothDevicesList) {
items[++i] = device.getDevice().getName();
}
AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity.this);
alertDialog.setreplacedle("Bluetooth printer selection");
alertDialog.sereplacedems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
int index = i - 1;
if (index == -1) {
selectedDevice = null;
} else {
selectedDevice = bluetoothDevicesList[index];
}
Button button = (Button) findViewById(R.id.button_bluetooth_browse);
button.setText(items[i]);
}
});
AlertDialog alert = alertDialog.create();
alert.setCanceledOnTouchOutside(false);
alert.show();
}
}
16
Source : MapActivity.java
with GNU General Public License v2.0
from CrazyRunning
with GNU General Public License v2.0
from CrazyRunning
@Override
protected void OnBindDataWithUi() {
super.OnBindDataWithUi();
ll_back_on_mapactivity.setOnClickListener(this);
fl_mapactivity.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
return imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
}
});
btClear.setOnClickListener(this);
btLoca.setOnClickListener(this);
btSearch.setOnClickListener(this);
alertDialog = new AlertDialog.Builder(this).setPositiveButton("步行", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
initSearch();
isNaviOrWalk = false;
dialog.dismiss();
}
}).setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).setNeutralButton("导航", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// 导航
initSearch();
isNaviOrWalk = true;
dialog.dismiss();
}
}).create();
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.setView(dialog_show);
mSearch = RoutePlanSearch.newInstance();
mSearch.setOnGetRoutePlanResultListener(this);
isShowDialog = new AlertDialog.Builder(MapActivity.this).setreplacedle("是否演示?").setPositiveButton("好的", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
isShow = false;
dialog.dismiss();
if (BaiduNaviManager.isNaviInited()) {
readyNavi();
}
}
}).setNegativeButton("进入导航", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
isShow = true;
dialog.dismiss();
if (BaiduNaviManager.isNaviInited()) {
readyNavi();
}
}
}).create();
alertDialog.setCanceledOnTouchOutside(false);
// 初始化搜索模块
if (initDirs()) {
initNavi();
}
}
15
Source : StringCallback.java
with Apache License 2.0
from xunibidev
with Apache License 2.0
from xunibidev
private void dialogT(String replacedle) {
if (MyApplication.getApp().typeBiaoshi == 0) {
MyApplication.getApp().typeBiaoshi = 1;
AlertDialog dialog = new AlertDialog.Builder(ActivityManage.activities.get(ActivityManage.activities.size() - 1), R.style.no_net_dialog).setreplacedle(MyApplication.app.getResources().getText(R.string.Warm_prompt) + "").setNegativeButton(MyApplication.app.getResources().getText(R.string.tv_quit) + "", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
MyApplication.getApp().typeBiaoshi = 0;
dialog.cancel();
System.exit(0);
}
}).create();
dialog.setMessage(replacedle);
dialog.show();
dialog.setCanceledOnTouchOutside(false);
dialog.setCancelable(false);
}
}
15
Source : MainActivity.java
with Apache License 2.0
from sofwerx
with Apache License 2.0
from sofwerx
private void openBatteryOptimizationDialogIfNeeded() {
if (isOptimizingBattery() && Config.isAllowAskAboutBattery(this)) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setreplacedle(R.string.enable_battery_optimization);
builder.setMessage(R.string.battery_optimizations_narrative);
builder.setPositiveButton(R.string.battery_optimize_yes, (dialog, which) -> {
Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
Uri uri = Uri.parse("package:" + getPackageName());
intent.setData(uri);
try {
startActivityForResult(intent, REQUEST_DISABLE_BATTERY_OPTIMIZATION);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, R.string.does_not_support_battery_optimization, Toast.LENGTH_SHORT).show();
}
});
builder.setOnDismissListener(dialog -> Config.setNeverAskBatteryOptimize(this));
final AlertDialog dialog = builder.create();
dialog.setCanceledOnTouchOutside(false);
dialog.show();
}
}
15
Source : UpdateDialog.java
with Apache License 2.0
from ribuluo000
with Apache License 2.0
from ribuluo000
static void show(final Context context, String content, final String downloadUrl) {
if (isContextValid(context)) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setreplacedle(R.string.android_auto_update_dialog_replacedle);
builder.setMessage(Html.fromHtml(content)).setPositiveButton(R.string.android_auto_update_dialog_btn_download, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
goToDownload(context, downloadUrl);
}
}).setNegativeButton(R.string.android_auto_update_dialog_btn_cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
AlertDialog dialog = builder.create();
// 点击对话框外面,对话框不消失
dialog.setCanceledOnTouchOutside(false);
dialog.show();
}
}
15
Source : IMUIHelper.java
with GNU General Public License v3.0
from masach
with GNU General Public License v3.0
from masach
// ���������Ի���
public void handleContacreplacedemLongClick(Context ctx, final Contact contact) {
if (contact == null || ctx == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(ctx, android.R.style.Theme_Holo_Light_Dialog));
builder.setreplacedle("��Ϣ��ʾ");
String[] items = new String[] { "���ñ�ע����ǩ", "ɾ������" };
builder.sereplacedems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int which) {
switch(which) {
case 0:
break;
case 1:
break;
}
}
});
AlertDialog alertDialog = builder.create();
alertDialog.setCanceledOnTouchOutside(true);
alertDialog.show();
}
15
Source : ChatFragment.java
with Apache License 2.0
from ccfish86
with Apache License 2.0
from ccfish86
// 现在只有群组存在免打扰的
private void handleGroupItemLongClick(final Context ctx, final RecentInfo recentInfo) {
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(ctx, android.R.style.Theme_Holo_Light_Dialog));
builder.setreplacedle(recentInfo.getName());
final boolean isTop = imService.getConfigSp().isTopSession(recentInfo.getSessionKey());
final boolean isForbidden = recentInfo.isForbidden();
int topMessageRes = isTop ? R.string.cancel_top_message : R.string.top_message;
int forbidMessageRes = isForbidden ? R.string.cancel_forbid_group_message : R.string.forbid_group_message;
String[] items = new String[] { ctx.getString(R.string.delete_session), ctx.getString(topMessageRes), ctx.getString(forbidMessageRes) };
builder.sereplacedems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch(which) {
case 0:
imService.getSessionManager().reqRemoveSession(recentInfo);
break;
case 1:
{
imService.getConfigSp().setSessionTop(recentInfo.getSessionKey(), !isTop);
}
break;
case 2:
{
// 底层成功会事件通知
int shieldType = isForbidden ? DBConstant.GROUP_STATUS_ONLINE : DBConstant.GROUP_STATUS_SHIELD;
imService.getGroupManager().reqShieldGroup(recentInfo.getPeerId(), shieldType);
}
break;
}
}
});
AlertDialog alertDialog = builder.create();
alertDialog.setCanceledOnTouchOutside(true);
alertDialog.show();
}
15
Source : ChatFragment.java
with Apache License 2.0
from ccfish86
with Apache License 2.0
from ccfish86
private void handleContacreplacedemLongClick(final Context ctx, final RecentInfo recentInfo) {
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(ctx, android.R.style.Theme_Holo_Light_Dialog));
builder.setreplacedle(recentInfo.getName());
final boolean isTop = imService.getConfigSp().isTopSession(recentInfo.getSessionKey());
int topMessageRes = isTop ? R.string.cancel_top_message : R.string.top_message;
String[] items = new String[] { ctx.getString(R.string.check_profile), ctx.getString(R.string.delete_session), ctx.getString(topMessageRes) };
builder.sereplacedems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch(which) {
case 0:
IMUIHelper.openUserProfileActivity(ctx, recentInfo.getPeerId());
break;
case 1:
imService.getSessionManager().reqRemoveSession(recentInfo);
break;
case 2:
{
imService.getConfigSp().setSessionTop(recentInfo.getSessionKey(), !isTop);
}
break;
}
}
});
AlertDialog alertDialog = builder.create();
alertDialog.setCanceledOnTouchOutside(true);
alertDialog.show();
}
15
Source : SettingsFragment.java
with BSD 2-Clause "Simplified" License
from BananoCoin
with BSD 2-Clause "Simplified" License
from BananoCoin
private void showFingerprintDialog(View view) {
int style = android.os.Build.VERSION.SDK_INT >= 21 ? R.style.AlertDialogCustom : android.R.style.Theme_Holo_Dialog;
AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), style);
builder.setMessage(getString(R.string.settings_fingerprint_replacedle));
builder.setView(view);
SpannableString negativeText = new SpannableString(getString(android.R.string.cancel));
negativeText.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.ltblue)), 0, negativeText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.setNegativeButton(negativeText, (dialog, which) -> Reprint.cancelAuthentication());
fingerprintDialog = builder.create();
fingerprintDialog.setCanceledOnTouchOutside(true);
// display dialog
fingerprintDialog.show();
}
15
Source : ChangeRepDialogFragment.java
with BSD 2-Clause "Simplified" License
from BananoCoin
with BSD 2-Clause "Simplified" License
from BananoCoin
private void showFingerprintDialog(View view) {
int style = android.os.Build.VERSION.SDK_INT >= 21 ? R.style.AlertDialogCustom : android.R.style.Theme_Holo_Dialog;
AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), style);
builder.setMessage(getString(R.string.change_representative_fingerprint));
builder.setView(view);
SpannableString negativeText = new SpannableString(getString(android.R.string.cancel));
negativeText.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.ltblue)), 0, negativeText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.setNegativeButton(negativeText, (dialog, which) -> Reprint.cancelAuthentication());
fingerprintDialog = builder.create();
fingerprintDialog.setCanceledOnTouchOutside(false);
// display dialog
fingerprintDialog.show();
}
15
Source : SendConfirmDialogFragment.java
with BSD 2-Clause "Simplified" License
from BananoCoin
with BSD 2-Clause "Simplified" License
from BananoCoin
private void showFingerprintDialog(View view) {
int style = android.os.Build.VERSION.SDK_INT >= 21 ? R.style.AlertDialogCustom : android.R.style.Theme_Holo_Dialog;
AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), style);
builder.setMessage(getString(R.string.send_fingerprint_description, !wallet.getSendNanoAmountFormatted().isEmpty() ? wallet.getSendNanoAmountFormatted() : "0"));
builder.setView(view);
SpannableString negativeText = new SpannableString(getString(android.R.string.cancel));
negativeText.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.ltblue)), 0, negativeText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.setNegativeButton(negativeText, (dialog, which) -> Reprint.cancelAuthentication());
fingerprintDialog = builder.create();
fingerprintDialog.setCanceledOnTouchOutside(true);
// display dialog
fingerprintDialog.show();
}
15
Source : SettingsFragment.java
with BSD 2-Clause "Simplified" License
from BananoCoin
with BSD 2-Clause "Simplified" License
from BananoCoin
private void showFingerprintDialog(View view) {
int style = android.os.Build.VERSION.SDK_INT >= 21 ? R.style.AlertDialogCustom : android.R.style.Theme_Holo_Dialog;
AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), style);
builder.setMessage(getString(R.string.settings_fingerprint_replacedle));
builder.setView(view);
SpannableString negativeText = new SpannableString(getString(android.R.string.cancel));
negativeText.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.yellow)), 0, negativeText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.setNegativeButton(negativeText, (dialog, which) -> Reprint.cancelAuthentication());
fingerprintDialog = builder.create();
fingerprintDialog.setCanceledOnTouchOutside(true);
// display dialog
fingerprintDialog.show();
}
15
Source : ChangeRepDialogFragment.java
with BSD 2-Clause "Simplified" License
from BananoCoin
with BSD 2-Clause "Simplified" License
from BananoCoin
private void showFingerprintDialog(View view) {
int style = android.os.Build.VERSION.SDK_INT >= 21 ? R.style.AlertDialogCustom : android.R.style.Theme_Holo_Dialog;
AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), style);
builder.setMessage(getString(R.string.change_representative_fingerprint));
builder.setView(view);
SpannableString negativeText = new SpannableString(getString(android.R.string.cancel));
negativeText.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.yellow)), 0, negativeText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.setNegativeButton(negativeText, (dialog, which) -> Reprint.cancelAuthentication());
fingerprintDialog = builder.create();
fingerprintDialog.setCanceledOnTouchOutside(false);
// display dialog
fingerprintDialog.show();
}
15
Source : SendConfirmDialogFragment.java
with BSD 2-Clause "Simplified" License
from BananoCoin
with BSD 2-Clause "Simplified" License
from BananoCoin
private void showFingerprintDialog(View view) {
int style = android.os.Build.VERSION.SDK_INT >= 21 ? R.style.AlertDialogCustom : android.R.style.Theme_Holo_Dialog;
AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), style);
builder.setMessage(getString(R.string.send_fingerprint_description, !wallet.getSendBananoAmountFormatted().isEmpty() ? wallet.getSendBananoAmountFormatted() : "0"));
builder.setView(view);
SpannableString negativeText = new SpannableString(getString(android.R.string.cancel));
negativeText.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.yellow)), 0, negativeText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.setNegativeButton(negativeText, (dialog, which) -> Reprint.cancelAuthentication());
fingerprintDialog = builder.create();
fingerprintDialog.setCanceledOnTouchOutside(true);
// display dialog
fingerprintDialog.show();
}
14
Source : MainActivity.java
with Apache License 2.0
from sofwerx
with Apache License 2.0
from sofwerx
private void checkForTeammateIssues() {
if (nagAboutIncompleteSetup && Config.isWarnIncompleteEnabled()) {
nagAboutIncompleteSetup = false;
if ((sqAnService != null) && (sqAnService.isOnlySdr()))
return;
// check for missing teammate info
ArrayList<SavedTeammate> teammates = Config.getSavedTeammates();
if ((teammates == null) || teammates.isEmpty()) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setreplacedle(R.string.no_teammates_alert);
builder.setMessage(R.string.no_teammates_alert_narrative);
builder.setPositiveButton(R.string.set_teammates, (dialog, which) -> startActivity(new Intent(MainActivity.this, StoredTeammatesActivity.clreplaced)));
builder.setNeutralButton(R.string.ignore, (dialog, which) -> dialog.cancel());
builder.setNegativeButton(R.string.never_ask, (dialog, which) -> {
Config.setWarnIncompleteEnabled(false);
dialog.cancel();
});
final AlertDialog dialog = builder.create();
dialog.setCanceledOnTouchOutside(true);
dialog.show();
} else {
boolean checkBt = true;
boolean checkWiFi = true;
if ((sqAnService != null) && (sqAnService.getManetOps() != null)) {
checkBt = sqAnService.getManetOps().isBtManetSelected();
checkWiFi = sqAnService.getManetOps().isWiFiDirectManetSelected();
}
int teammatesMissing = 0;
int totalTeammates = 0;
synchronized (teammates) {
for (SavedTeammate teammate : teammates) {
if (teammate.isEnabled()) {
totalTeammates++;
if (teammate.isIncomplete(checkBt, checkWiFi))
teammatesMissing++;
}
}
}
if (teammatesMissing > 0) {
final String missing;
if (teammatesMissing == 1)
missing = "one teammate (out of " + totalTeammates + ")";
else
missing = teammatesMissing + " teammates (out of " + totalTeammates + ")";
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setreplacedle(R.string.teammates_fix_alert);
builder.setMessage("SqAN has incomplete info for " + missing + ". Without this info, SqAN could use complete info to make a stronger mesh.");
builder.setPositiveButton(R.string.fix_teammates, (dialog, which) -> startActivity(new Intent(MainActivity.this, StoredTeammatesActivity.clreplaced)));
builder.setNeutralButton(R.string.ignore, (dialog, which) -> dialog.cancel());
builder.setNegativeButton(R.string.never_ask, (dialog, which) -> {
Config.setWarnIncompleteEnabled(false);
dialog.cancel();
});
final AlertDialog dialog = builder.create();
dialog.setCanceledOnTouchOutside(true);
dialog.show();
}
}
}
}
14
Source : ConfirmDialogV4.java
with Apache License 2.0
from saki4510t
with Apache License 2.0
from saki4510t
@NonNull
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final Bundle args = savedInstanceState != null ? savedInstanceState : requireArguments();
final int id_replacedle = args.getInt(ARGS_KEY_ID_replacedLE);
final int id_message = args.getInt(ARGS_KEY_ID_MESSAGE);
final CharSequence message = args.getCharSequence(ARGS_KEY_MESSAGE_STRING);
final boolean canceledOnTouchOutside = args.getBoolean(ARGS_KEY_CANCELED_ON_TOUCH_OUTSIDE);
final AlertDialog.Builder builder = new AlertDialog.Builder(requireContext(), getTheme()).setIcon(android.R.drawable.ic_dialog_alert).setreplacedle(id_replacedle).setPositiveButton(android.R.string.ok, mOnClickListener).setNegativeButton(android.R.string.cancel, mOnClickListener);
if (id_message != 0) {
builder.setMessage(id_message);
} else {
builder.setMessage(message);
}
final AlertDialog dialog = builder.create();
dialog.setCanceledOnTouchOutside(canceledOnTouchOutside);
return dialog;
}
14
Source : DailyNoteEditorActivity.java
with MIT License
from qunarcorp
with MIT License
from qunarcorp
public void choosePictrueSource() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
View view = LayoutInflater.from(this).inflate(R.layout.atom_ui_dialog_choose_picture, (ViewGroup) this.getWindow().getDecorView(), false);
TextView tv_change_gravtar_photos = (TextView) view.findViewById(R.id.tv_change_gravtar_photos);
TextView tv_change_gravtar_camera = (TextView) view.findViewById(R.id.tv_change_gravtar_camera);
tv_change_gravtar_photos.setText(R.string.atom_ui_btn_sel_gravantar_pic);
tv_change_gravtar_photos.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PermissionDispatcher.requestPermissionWithCheck(DailyNoteEditorActivity.this, new int[] { PermissionDispatcher.REQUEST_READ_EXTERNAL_STORAGE, PermissionDispatcher.REQUEST_WRITE_EXTERNAL_STORAGE }, DailyNoteEditorActivity.this, SELECT_PIC);
if (mDialog != null && mDialog.isShowing()) {
mDialog.dismiss();
}
}
});
tv_change_gravtar_camera.setText(R.string.atom_ui_user_camera);
tv_change_gravtar_camera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PermissionDispatcher.requestPermissionWithCheck(DailyNoteEditorActivity.this, new int[] { PermissionDispatcher.REQUEST_CAMERA, PermissionDispatcher.REQUEST_WRITE_EXTERNAL_STORAGE, PermissionDispatcher.REQUEST_READ_EXTERNAL_STORAGE }, DailyNoteEditorActivity.this, SHOW_CAMERA);
if (mDialog != null && mDialog.isShowing()) {
mDialog.dismiss();
}
}
});
builder.setView(view);
mDialog = builder.show();
mDialog.setCanceledOnTouchOutside(true);
}
14
Source : CommonUtil.java
with Apache License 2.0
from dueros
with Apache License 2.0
from dueros
/**
* 展示一个通用的弹出框UI
*
* @param context 展示弹出框的上下文环境
* @param replacedle 警告的replacedle信息
* @param text 警告信息
*/
public static void showAlert(Context context, String replacedle, String text) {
AlertDialog alertDialog = new Builder(context).create();
alertDialog.setreplacedle(replacedle);
alertDialog.setMessage(text);
alertDialog.setCanceledOnTouchOutside(true);
alertDialog.show();
}
14
Source : IMUIHelper.java
with Apache License 2.0
from ccfish86
with Apache License 2.0
from ccfish86
// 在视图中,长按用户信息条目弹出的对话框
public static void handleContacreplacedemLongClick(final UserEnreplacedy contact, final Context ctx) {
if (contact == null || ctx == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(ctx, android.R.style.Theme_Holo_Light_Dialog));
builder.setreplacedle(contact.getMainName());
String[] items = new String[] { ctx.getString(R.string.check_profile), ctx.getString(R.string.start_session) };
final long userId = contact.getPeerId();
builder.sereplacedems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch(which) {
case 0:
IMUIHelper.openUserProfileActivity(ctx, userId);
break;
case 1:
IMUIHelper.openChatActivity(ctx, contact.getSessionKey());
break;
}
}
});
AlertDialog alertDialog = builder.create();
alertDialog.setCanceledOnTouchOutside(true);
alertDialog.show();
}
14
Source : Utils.java
with MIT License
from Alcatraz323
with MIT License
from Alcatraz323
public static AlertDialog getProcessingDialog(Context ctx, List<View> out, boolean cancelable, boolean showProgressBar, boolean needAsync, Runnable async) {
LayoutInflater lf = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@SuppressLint("InflateParams")
View root = lf.inflate(R.layout.dialog_processing, null);
TextView content = root.findViewById(R.id.ad_content);
ProgressBar pb = root.findViewById(R.id.ad_processing_progress);
if (!showProgressBar) {
pb.setVisibility(View.GONE);
}
out.add(content);
out.add(pb);
AlertDialog.Builder builder = new AlertDialog.Builder(ctx).setreplacedle(R.string.ad_processing).setView(root);
if (cancelable) {
builder.setNegativeButton(R.string.ad_nb3, null);
}
AlertDialog alertDialog = builder.create();
alertDialog.setCanceledOnTouchOutside(cancelable);
if (needAsync) {
new Thread(async).start();
}
return alertDialog;
}
13
Source : ImagePreviewActivity.java
with Apache License 2.0
from yushiwo
with Apache License 2.0
from yushiwo
private void showDeleteDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(ImagePreviewActivity.this);
DialogCommonView view = new DialogCommonView(ImagePreviewActivity.this);
builder.setView(view);
final AlertDialog dialog = builder.create();
view.setMessage("确定要删除这张图片吗?");
view.setRightBtn("删除", new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = viewPager.getCurrenreplacedem();
selectImages.remove(position);
images.remove(position);
mDeleteAdapter.updateData(selectImages);
onSelectNumChange();
mreplacedleTextView.setText(viewPager.getCurrenreplacedem() + 1 + "/" + images.size());
// 全部删光,关闭预览界面
if (selectImages.size() <= 0) {
onResult(selectImages);
}
dialog.dismiss();
}
});
view.setLeftBtn("取消", new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.setCanceledOnTouchOutside(true);
dialog.show();
}
13
Source : ChannelDiscoveryActivity.java
with GNU General Public License v3.0
from snikket-im
with GNU General Public License v3.0
from snikket-im
@Override
public void onStart() {
super.onStart();
this.method = getMethod(this);
if (!optedIn && method == ChannelDiscoveryService.Method.JABBER_NETWORK) {
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setreplacedle(R.string.channel_discovery_opt_in_replacedle);
builder.setMessage(Html.fromHtml(getString(R.string.channel_discover_opt_in_message)));
builder.setNegativeButton(R.string.cancel, (dialog, which) -> finish());
builder.setPositiveButton(R.string.confirm, (dialog, which) -> optIn());
builder.setOnCancelListener(dialog -> finish());
final AlertDialog dialog = builder.create();
dialog.setOnShowListener(d -> {
final TextView textView = dialog.findViewById(android.R.id.message);
if (textView == null) {
return;
}
textView.setMovementMethod(LinkMovementMethod.getInstance());
});
dialog.setCanceledOnTouchOutside(false);
dialog.show();
holdLoading();
}
}
13
Source : ConversationFragment.java
with MIT License
from qunarcorp
with MIT License
from qunarcorp
private void showEncryptSessionDialog(final IMMessage message) {
if (getActivity().isFinishing())
return;
dismissEncryptDialog();
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
View view = LayoutInflater.from(getActivity()).inflate(R.layout.atom_ui_dialog_encrypt_seesion, null, false);
final TextView encrypt_text = (TextView) view.findViewById(R.id.encrypt_text);
Button encrypt_button1 = (Button) view.findViewById(R.id.encrypt_button1);
Button encrypt_button2 = (Button) view.findViewById(R.id.encrypt_button2);
ProfileUtils.loadNickName(message.getConversationID(), true, new ProfileUtils.LoadNickNameCallback() {
@Override
public void finish(final String name) {
if (!TextUtils.isEmpty(name))
getHandler().post(new Runnable() {
@Override
public void run() {
encrypt_text.setText(name + getString(R.string.atom_ui_tip_request_encrypt));
}
});
}
});
encrypt_button1.setText(R.string.atom_ui_btn_refuse_encrypt);
encrypt_button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismissEncryptDialog();
sendRefuseEncryptMsg(message.getToID(), message.getConversationID());
}
});
encrypt_button2.setText(R.string.atom_ui_btn_open_encrypt);
encrypt_button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismissEncryptDialog();
Intent intent = new Intent(getActivity(), PbChatActivity.clreplaced);
intent.putExtra(PbChatActivity.KEY_JID, message.getConversationID());
intent.putExtra(PbChatActivity.KEY_IS_CHATROOM, false);
intent.putExtra(PbChatActivity.KEY_ENCRYPT_BODY, message.getBody());
startActivity(intent);
}
});
builder.setView(view);
encryptDialog = builder.show();
encryptDialog.setCanceledOnTouchOutside(false);
return;
}
12
Source : MenuSelectPicker.java
with Apache License 2.0
from tinyvampirepudge
with Apache License 2.0
from tinyvampirepudge
/**
* Show date picker popWindow
*
* @param activity
*/
public void showDialog(Activity activity) {
if (null != activity) {
// 弹出对话框
if (dialog == null) {
dialog = new AlertDialog.Builder(mContext).create();
dialog.setCanceledOnTouchOutside(true);
}
dialog.show();
Window window = dialog.getWindow();
window.setGravity(Gravity.CENTER);
window.setContentView(contentView);
// window.setWindowAnimations(R.style.animation_dialog);
// 下方的代码无用,不需要设置宽和高,只需在dialog的布局中设置父窗体为包裹内容即可。
int width = (int) (getScreenW(mContext) * 5 / 6f);
window.setLayout(width, ViewGroup.LayoutParams.WRAP_CONTENT);
}
}
12
Source : DatePickerDialog.java
with Apache License 2.0
from tinyvampirepudge
with Apache License 2.0
from tinyvampirepudge
/**
* Show date picker popWindow
*
* @param activity
*/
public void showDialog(Activity activity) {
if (null != activity) {
// 弹出对话框
if (dialog == null) {
dialog = new AlertDialog.Builder(mContext).create();
dialog.setCanceledOnTouchOutside(true);
}
dialog.show();
Window window = dialog.getWindow();
window.setGravity(Gravity.CENTER);
window.setContentView(contentView);
// window.setWindowAnimations(R.style.animation_dialog);
// 下方的代码无用,不需要设置宽和高,只需在dialog的布局中设置父窗体为包裹内容即可。
int width = (int) (getScreenW(mContext) * 5 / 6f);
// int height = (int) (getScreenH(mContext) * 1 / 2f);
// int height = dip2px(mContext, px2dip(mContext, paramsLoopviewParent.height) + 45 + 40 + 30);
// int height = dip2px(mContext, px2dip(mContext, (int) (paramsLoopviewParent.height / 8) * 3));
// window.setLayout(width, height);
window.setLayout(width, ViewGroup.LayoutParams.WRAP_CONTENT);
}
}
12
Source : AdBlocker.java
with GNU General Public License v2.0
from hikikomoriphoenix
with GNU General Public License v2.0
from hikikomoriphoenix
public void update(final Context context) {
final SharedPreferences prefs = context.getSharedPreferences("settings", 0);
final String today = new SimpleDateFormat("dd MM yyyy", Locale.getDefault()).format(new Date());
if (!today.equals(prefs.getString(context.getString(R.string.adFiltersLastUpdated), ""))) {
final AlertDialog dialog = new AlertDialog.Builder(context).create();
dialog.setMessage("Updating. Please wait...");
dialog.setCancelable(false);
dialog.setCanceledOnTouchOutside(false);
dialog.show();
new Thread() {
@Override
public void run() {
String easyList = "https://easylist.to/easylist/easylist.txt";
List<String> tempFilters = new ArrayList<>();
try {
URLConnection uCon = new URL(easyList).openConnection();
if (uCon != null) {
InputStream in = uCon.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = reader.readLine()) != null) {
if (line.contains("Last modified")) {
if (line.equals(easylistLastModified)) {
Log.i("loremarTest", "ads filters is already up to date");
reader.close();
in.close();
dialog.dismiss();
return;
} else {
easylistLastModified = line;
}
} else if (!line.startsWith("!") || !line.startsWith("[")) {
tempFilters.add(line);
}
}
if (!tempFilters.isEmpty()) {
filters = tempFilters;
Log.i("loremarTest", "updating ads filters complete. Total: " + filters.size());
}
File file = new File(context.getFilesDir(), "ad_filters.dat");
FileOutputStream fileOutputStream = new FileOutputStream(file);
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
objectOutputStream.writeObject(AdBlocker.this);
objectOutputStream.close();
fileOutputStream.close();
}
dialog.dismiss();
prefs.edit().putString(context.getString(R.string.adFiltersLastUpdated), today).apply();
} catch (IOException e) {
e.printStackTrace();
dialog.dismiss();
}
}
}.start();
}
}
12
Source : RaiseFeeDialogFragment.java
with Apache License 2.0
from guodroid
with Apache License 2.0
from guodroid
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final View view = LayoutInflater.from(activity).inflate(R.layout.raise_fee_dialog, null);
messageView = (TextView) view.findViewById(R.id.raise_fee_dialog_message);
preplacedwordGroup = view.findViewById(R.id.raise_fee_dialog_preplacedword_group);
preplacedwordView = (EditText) view.findViewById(R.id.raise_fee_dialog_preplacedword);
preplacedwordView.setText(null);
badPreplacedwordView = view.findViewById(R.id.raise_fee_dialog_bad_preplacedword);
final DialogBuilder builder = new DialogBuilder(activity);
builder.setreplacedle(R.string.raise_fee_dialog_replacedle);
builder.setView(view);
// dummy, just to make it
builder.setPositiveButton(R.string.raise_fee_dialog_button_raise, null);
// show
builder.setNegativeButton(R.string.button_dismiss, null);
builder.setCancelable(false);
final AlertDialog dialog = builder.create();
dialog.setCanceledOnTouchOutside(false);
dialog.setOnShowListener(new OnShowListener() {
@Override
public void onShow(final DialogInterface d) {
positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
negativeButton = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
positiveButton.setTypeface(Typeface.DEFAULT_BOLD);
positiveButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View v) {
handleGo();
}
});
negativeButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View v) {
dismiss();
}
});
preplacedwordView.addTextChangedListener(texreplacedcher);
RaiseFeeDialogFragment.this.dialog = dialog;
updateView();
}
});
log.info("showing raise fee dialog");
return dialog;
}
12
Source : EncryptKeysDialogFragment.java
with Apache License 2.0
from guodroid
with Apache License 2.0
from guodroid
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final View view = LayoutInflater.from(activity).inflate(R.layout.encrypt_keys_dialog, null);
oldPreplacedwordGroup = view.findViewById(R.id.encrypt_keys_dialog_preplacedword_old_group);
oldPreplacedwordView = (EditText) view.findViewById(R.id.encrypt_keys_dialog_preplacedword_old);
oldPreplacedwordView.setText(null);
newPreplacedwordView = (EditText) view.findViewById(R.id.encrypt_keys_dialog_preplacedword_new);
newPreplacedwordView.setText(null);
badPreplacedwordView = view.findViewById(R.id.encrypt_keys_dialog_bad_preplacedword);
preplacedwordStrengthView = (TextView) view.findViewById(R.id.encrypt_keys_dialog_preplacedword_strength);
showView = (CheckBox) view.findViewById(R.id.encrypt_keys_dialog_show);
final DialogBuilder builder = new DialogBuilder(activity);
builder.setreplacedle(R.string.encrypt_keys_dialog_replacedle);
builder.setView(view);
// dummy, just to make it show
builder.setPositiveButton(R.string.button_ok, null);
builder.setNegativeButton(R.string.button_cancel, null);
builder.setCancelable(false);
final AlertDialog dialog = builder.create();
dialog.setCanceledOnTouchOutside(false);
dialog.setOnShowListener(new OnShowListener() {
@Override
public void onShow(final DialogInterface d) {
positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
negativeButton = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
positiveButton.setTypeface(Typeface.DEFAULT_BOLD);
positiveButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View v) {
handleGo();
}
});
oldPreplacedwordView.addTextChangedListener(texreplacedcher);
newPreplacedwordView.addTextChangedListener(texreplacedcher);
showView = (CheckBox) dialog.findViewById(R.id.encrypt_keys_dialog_show);
showView.setOnCheckedChangeListener(new ShowPreplacedwordCheckListener(newPreplacedwordView, oldPreplacedwordView));
showView.setChecked(true);
EncryptKeysDialogFragment.this.dialog = dialog;
updateView();
}
});
return dialog;
}
12
Source : DocumentActivity.java
with Apache License 2.0
from FantasyLWX
with Apache License 2.0
from FantasyLWX
public void requestPreplacedword(final Bundle savedInstanceState) {
mPreplacedwordView = new EditText(this);
mPreplacedwordView.setInputType(EditorInfo.TYPE_TEXT_VARIATION_PreplacedWORD);
mPreplacedwordView.setTransformationMethod(new PreplacedwordTransformationMethod());
AlertDialog alert = mAlertBuilder.create();
alert.setreplacedle(R.string.enter_preplacedword);
alert.setView(mPreplacedwordView);
alert.setButton(AlertDialog.BUTTON_POSITIVE, getString(R.string.okay), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if (core.authenticatePreplacedword(mPreplacedwordView.getText().toString())) {
createUI(savedInstanceState);
} else {
requestPreplacedword(savedInstanceState);
}
}
});
alert.setButton(AlertDialog.BUTTON_NEGATIVE, getString(R.string.cancel), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
alert.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
finish();
}
});
alert.setCanceledOnTouchOutside(false);
alert.show();
}
12
Source : DialogUtil.java
with MIT License
from citahub
with MIT License
from citahub
public static void showListDialog(Context context, @StringRes int replacedle, List<String> list, String currentName, OnItemClickListener onItemClickListener) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View replacedleView = layoutInflater.inflate(R.layout.dialog_list_replacedle_view, null);
((TextView) replacedleView.findViewById(R.id.dialog_replacedle)).setText(replacedle);
replacedleView.findViewById(R.id.dialog_close_image).setOnClickListener(v -> {
if (dialog != null)
dialog.dismiss();
});
builder.setCustomreplacedle(replacedleView);
String[] contents = new String[list.size()];
list.toArray(contents);
DialogAdapter adapter = new DialogAdapter(context, list, currentName);
builder.setAdapter(adapter, (dialog, which) -> {
if (onItemClickListener != null) {
onItemClickListener.onItemClick(which);
}
});
builder.setCancelable(true);
dialog = builder.create();
dialog.setCanceledOnTouchOutside(true);
dialog.show();
initDialogAttributes(context);
}
11
Source : WXModalUIModule.java
with Apache License 2.0
from weexext
with Apache License 2.0
from weexext
@JSMethod(uiThread = true)
public void confirm(String param, final JSCallback callback) {
if (mWXSDKInstance.getContext() instanceof Activity) {
String message = "";
String okreplacedle = OK;
String cancelreplacedle = CANCEL;
if (!TextUtils.isEmpty(param)) {
try {
param = URLDecoder.decode(param, "utf-8");
JSONObject jsObj = JSON.parseObject(param);
message = jsObj.getString(MESSAGE);
okreplacedle = jsObj.getString(OK_replacedLE);
cancelreplacedle = jsObj.getString(CANCEL_replacedLE);
} catch (Exception e) {
WXLogUtils.e("[WXModalUIModule] confirm param parse error ", e);
}
}
if (TextUtils.isEmpty(message)) {
message = "";
}
AlertDialog.Builder builder = new AlertDialog.Builder(mWXSDKInstance.getContext());
builder.setMessage(message);
final String okreplacedleFinal = TextUtils.isEmpty(okreplacedle) ? OK : okreplacedle;
final String cancelreplacedleFinal = TextUtils.isEmpty(cancelreplacedle) ? CANCEL : cancelreplacedle;
builder.setPositiveButton(okreplacedleFinal, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (callback != null) {
callback.invoke(okreplacedleFinal);
}
}
});
builder.setNegativeButton(cancelreplacedleFinal, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (callback != null) {
callback.invoke(cancelreplacedleFinal);
}
}
});
AlertDialog alertDialog = builder.create();
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
tracking(alertDialog);
} else {
WXLogUtils.e("[WXModalUIModule] when call confirm mWXSDKInstance.getContext() must instanceof Activity");
}
}
11
Source : WXModalUIModule.java
with Apache License 2.0
from weexext
with Apache License 2.0
from weexext
@JSMethod(uiThread = true)
public void alert(String param, final JSCallback callback) {
if (mWXSDKInstance.getContext() instanceof Activity) {
String message = "";
String okreplacedle = OK;
if (!TextUtils.isEmpty(param)) {
try {
param = URLDecoder.decode(param, "utf-8");
JSONObject jsObj = JSON.parseObject(param);
message = jsObj.getString(MESSAGE);
okreplacedle = jsObj.getString(OK_replacedLE);
} catch (Exception e) {
WXLogUtils.e("[WXModalUIModule] alert param parse error ", e);
}
}
if (TextUtils.isEmpty(message)) {
message = "";
}
AlertDialog.Builder builder = new AlertDialog.Builder(mWXSDKInstance.getContext());
builder.setMessage(message);
final String okreplacedle_f = TextUtils.isEmpty(okreplacedle) ? OK : okreplacedle;
builder.setPositiveButton(okreplacedle_f, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (callback != null) {
callback.invoke(okreplacedle_f);
}
}
});
AlertDialog alertDialog = builder.create();
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
tracking(alertDialog);
} else {
WXLogUtils.e("[WXModalUIModule] when call alert mWXSDKInstance.getContext() must instanceof Activity");
}
}
11
Source : StoredTeammatesActivity.java
with Apache License 2.0
from sofwerx
with Apache License 2.0
from sofwerx
private void checkForDiscoveryFailure() {
if (discoveryProblemCheckTimer != null) {
discoveryProblemCheckTimer.cancel();
discoveryProblemCheckTimer.purge();
discoveryProblemCheckTimer = null;
}
runOnUiThread(() -> {
if (Config.getNumberOfSavedTeammates() <= teammateCountBeforeDiscovery) {
// discovery seems to have had no luck
Log.d(Config.TAG, "Discovery doesn't seem to have been successful");
boolean rebootRecommended = SystemClock.elapsedRealtime() > MAX_TIME_BEFORE_REBOOT_RECOMMENDED;
AlertDialog.Builder builder = new AlertDialog.Builder(StoredTeammatesActivity.this);
builder.setreplacedle(R.string.bt_discovery_problem_replacedle);
if (rebootRecommended)
builder.setMessage(getResources().getString(R.string.bt_discovery_problem_narrative_reboot, StringUtil.toDuration(SystemClock.elapsedRealtime())));
else
builder.setMessage(R.string.bt_discovery_problem_narrative);
final AlertDialog dialog = builder.create();
dialog.setCanceledOnTouchOutside(true);
dialog.show();
}
});
}
11
Source : PersonalInfoMyActivity.java
with MIT License
from qunarcorp
with MIT License
from qunarcorp
public void showAlertDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(PersonalInfoMyActivity.this);
View view = LayoutInflater.from(PersonalInfoMyActivity.this).inflate(R.layout.atom_ui_dialog_change_gravatar, null);
TextView tv_check_large_gravtar = (TextView) view.findViewById(R.id.tv_check_large_gravtar);
TextView tv_change_gravtar_photos = (TextView) view.findViewById(R.id.tv_change_gravtar_photos);
TextView tv_change_gravtar_camera = (TextView) view.findViewById(R.id.tv_change_gravtar_camera);
TextView tv_change_gravatar_prompt = (TextView) view.findViewById(R.id.tv_change_gravtar_prompt);
tv_check_large_gravtar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
personalInfoPresenter.showLargeGravatar();
if (mDialog != null && mDialog.isShowing()) {
mDialog.dismiss();
}
}
});
if (CommonConfig.isQtalk) {
tv_change_gravtar_photos.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PermissionDispatcher.requestPermissionWithCheck(PersonalInfoMyActivity.this, new int[] { PermissionDispatcher.REQUEST_WRITE_EXTERNAL_STORAGE, PermissionDispatcher.REQUEST_READ_EXTERNAL_STORAGE }, PersonalInfoMyActivity.this, REQUEST_GRANT_LOCAL);
if (mDialog != null && mDialog.isShowing()) {
mDialog.dismiss();
}
}
});
tv_change_gravtar_camera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PermissionDispatcher.requestPermissionWithCheck(PersonalInfoMyActivity.this, new int[] { PermissionDispatcher.REQUEST_CAMERA }, PersonalInfoMyActivity.this, REQUEST_GRANT_CAMERA);
if (mDialog != null && mDialog.isShowing()) {
mDialog.dismiss();
}
}
});
} else {
tv_change_gravtar_photos.setVisibility(View.GONE);
tv_change_gravtar_camera.setVisibility(View.GONE);
tv_change_gravatar_prompt.setVisibility(View.VISIBLE);
}
builder.setView(view);
mDialog = builder.show();
mDialog.setCanceledOnTouchOutside(true);
}
11
Source : Dialog.java
with Apache License 2.0
from cgutman
with Apache License 2.0
from cgutman
@Override
public void run() {
// If we're dying, don't bother creating a dialog
if (activity.isFinishing())
return;
alert = new AlertDialog.Builder(activity).create();
alert.setreplacedle(replacedle);
alert.setMessage(message);
alert.setCancelable(false);
alert.setCanceledOnTouchOutside(false);
alert.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
alert.dismiss();
rundownDialogs.remove(this);
if (endAfterDismiss)
activity.finish();
}
});
rundownDialogs.add(this);
alert.show();
}
11
Source : MessagesScreen.java
with GNU General Public License v3.0
from Adamant-im
with GNU General Public License v3.0
from Adamant-im
@Override
public void showRenameDialog(String currentName) {
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.AdamantLight_AlertDialogCustom);
builder.setreplacedle(getString(R.string.dialog_rename_contact_replacedle));
View viewInflated = LayoutInflater.from(this).inflate(R.layout.dialog_rename_contact, null);
final TextInputEditText input = viewInflated.findViewById(R.id.dialog_rename_contact_name);
input.setText(currentName);
builder.setView(viewInflated);
final MessagesPresenter localPresenter = presenter;
builder.setPositiveButton(android.R.string.ok, (dialog, which) -> {
dialog.dismiss();
if (input.getText() != null) {
String inputText = input.getText().toString();
AdamantApplication.hideKeyboard(MessagesScreen.this, input);
localPresenter.onClickRenameButton(inputText);
}
});
builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> {
AdamantApplication.hideKeyboard(MessagesScreen.this, input);
dialog.cancel();
});
AlertDialog dialog = builder.show();
dialog.setCanceledOnTouchOutside(false);
input.setOnFocusChangeListener((v, hasFocus) -> {
if (hasFocus) {
Window window = dialog.getWindow();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if ((window != null) && (imm != null)) {
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
}
});
input.requestFocus();
}
10
Source : StoredTeammatesActivity.java
with Apache License 2.0
from sofwerx
with Apache License 2.0
from sofwerx
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.d(Config.TAG, "Result : " + requestCode + " " + resultCode);
switch(requestCode) {
case Discovery.REQUEST_DISCOVERY:
if (resultCode == RESULT_OK) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setreplacedle(R.string.bt_start_discovery_on_other_devices);
builder.setMessage(getResources().getString(R.string.bt_start_discovery_on_other_devices_narrative, StringUtil.toDuration(((long) Discovery.DISCOVERY_DURATION_SECONDS) * 1000l)));
final AlertDialog dialog = builder.create();
dialog.setCanceledOnTouchOutside(true);
dialog.show();
} else if (resultCode == RESULT_CANCELED)
Snackbar.make(coordinatorLayout, R.string.bt_discovery_canx, Snackbar.LENGTH_LONG).show();
updateDisplay();
break;
case Discovery.REQUEST_ENABLE_BLUETOOTH:
if (resultCode == RESULT_OK) {
// ignore for now
} else if (resultCode == RESULT_CANCELED)
Snackbar.make(coordinatorLayout, R.string.bt_needed, Snackbar.LENGTH_LONG).show();
updateDisplay();
break;
}
}
9
Source : WXModalUIModule.java
with Apache License 2.0
from weexext
with Apache License 2.0
from weexext
@JSMethod(uiThread = true)
public void prompt(String param, final JSCallback callback) {
if (mWXSDKInstance.getContext() instanceof Activity) {
String message = "";
String defaultValue = "";
String okreplacedle = OK;
String cancelreplacedle = CANCEL;
if (!TextUtils.isEmpty(param)) {
try {
param = URLDecoder.decode(param, "utf-8");
JSONObject jsObj = JSON.parseObject(param);
message = jsObj.getString(MESSAGE);
okreplacedle = jsObj.getString(OK_replacedLE);
cancelreplacedle = jsObj.getString(CANCEL_replacedLE);
defaultValue = jsObj.getString(DEFAULT);
} catch (Exception e) {
WXLogUtils.e("[WXModalUIModule] confirm param parse error ", e);
}
}
if (TextUtils.isEmpty(message)) {
message = "";
}
AlertDialog.Builder builder = new AlertDialog.Builder(mWXSDKInstance.getContext());
builder.setMessage(message);
final EditText editText = new EditText(mWXSDKInstance.getContext());
editText.setText(defaultValue);
builder.setView(editText);
final String okreplacedleFinal = TextUtils.isEmpty(okreplacedle) ? OK : okreplacedle;
final String cancelreplacedleFinal = TextUtils.isEmpty(cancelreplacedle) ? CANCEL : cancelreplacedle;
builder.setPositiveButton(okreplacedleFinal, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (callback != null) {
Map<String, Object> result = new HashMap<String, Object>();
result.put(RESULT, okreplacedleFinal);
result.put(DATA, editText.getText().toString());
callback.invoke(result);
}
}
}).setNegativeButton(cancelreplacedleFinal, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (callback != null) {
Map<String, Object> result = new HashMap<String, Object>();
result.put(RESULT, cancelreplacedleFinal);
result.put(DATA, editText.getText().toString());
callback.invoke(result);
}
}
});
AlertDialog alertDialog = builder.create();
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
tracking(alertDialog);
} else {
WXLogUtils.e("when call prompt mWXSDKInstance.getContext() must instanceof Activity");
}
}
9
Source : CalendarDialog.java
with MIT License
from hugomfandrade
with MIT License
from hugomfandrade
private void delayedShow() {
if (mAlertDialog.getWindow() != null)
mAlertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
Point size = new Point();
display.getSize(size);
mAlertDialog.setCanceledOnTouchOutside(true);
// alert.setContentView(view);
mAlertDialog.show();
mAlertDialog.setContentView(mView);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
Window window = mAlertDialog.getWindow();
lp.copyFrom(window.getAttributes());
// This makes the dialog take up the full width
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.MATCH_PARENT;
window.setAttributes(lp);
}
See More Examples