use of android.content.DialogInterface in project AndroidChromium by JackyAndroid.
the class ItemChooserDialog method showDialogForView.
private void showDialogForView(View view) {
mDialog = new Dialog(mActivity) {
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (!hasFocus)
super.dismiss();
}
};
mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mDialog.setCanceledOnTouchOutside(true);
mDialog.addContentView(view, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
mItemSelectedCallback.onItemSelected("");
}
});
Window window = mDialog.getWindow();
if (!DeviceFormFactor.isTablet(mActivity)) {
// On smaller screens, make the dialog fill the width of the screen,
// and appear at the top.
window.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
window.setGravity(Gravity.TOP);
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
mDialog.show();
}
use of android.content.DialogInterface in project AndroidChromium by JackyAndroid.
the class RepostFormWarningDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme).setMessage(R.string.http_post_warning);
if (savedInstanceState == null) {
assert mTab != null;
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
if (!mTab.isInitialized())
return;
mTab.getWebContents().getNavigationController().cancelPendingReload();
}
});
builder.setPositiveButton(R.string.http_post_warning_resend, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
if (!mTab.isInitialized())
return;
mTab.getWebContents().getNavigationController().continuePendingReload();
}
});
}
Dialog dialog = builder.create();
setCurrentDialogForTesting(dialog);
return dialog;
}
use of android.content.DialogInterface in project AndroidChromium by JackyAndroid.
the class PassphraseDialogFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater inflater = getActivity().getLayoutInflater();
View v = inflater.inflate(R.layout.sync_enter_passphrase, null);
TextView promptText = (TextView) v.findViewById(R.id.prompt_text);
promptText.setText(getPromptText());
TextView resetText = (TextView) v.findViewById(R.id.reset_text);
resetText.setText(getResetText());
resetText.setMovementMethod(LinkMovementMethod.getInstance());
resetText.setVisibility(View.VISIBLE);
mVerifyingTextView = (TextView) v.findViewById(R.id.verifying);
mPassphraseEditText = (EditText) v.findViewById(R.id.passphrase);
mPassphraseEditText.setHint(R.string.sync_enter_custom_passphrase_hint);
mPassphraseEditText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_NEXT) {
handleSubmit();
}
return false;
}
});
// Create a new background Drawable for the passphrase EditText to use when the user has
// entered an invalid potential password.
// https://crbug.com/602943 was caused by modifying the Drawable from getBackground()
// without taking a copy.
mOriginalBackground = mPassphraseEditText.getBackground();
mErrorBackground = mOriginalBackground.getConstantState().newDrawable();
mErrorBackground.mutate().setColorFilter(ApiCompatibilityUtils.getColor(getResources(), R.color.input_underline_error_color), PorterDuff.Mode.SRC_IN);
final AlertDialog d = new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme).setView(v).setPositiveButton(R.string.submit, new Dialog.OnClickListener() {
@Override
public void onClick(DialogInterface d, int which) {
// We override the onclick. This is a hack to not dismiss the dialog after
// click of OK and instead dismiss it after confirming the passphrase
// is correct.
}
}).setNegativeButton(R.string.cancel, this).setTitle(R.string.sign_in_google_account).create();
d.getDelegate().setHandleNativeActionModesEnabled(false);
d.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
Button b = d.getButton(AlertDialog.BUTTON_POSITIVE);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
handleSubmit();
}
});
}
});
return d;
}
use of android.content.DialogInterface in project AndroidChromium by JackyAndroid.
the class AccessibilityUtil method showOldTalkbackVersionAlertOnce.
private static void showOldTalkbackVersionAlertOnce(final Context context) {
if (sOldTalkBackVersionAlertShown)
return;
sOldTalkBackVersionAlertShown = true;
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.AlertDialogTheme).setTitle(R.string.old_talkback_title).setPositiveButton(R.string.update_from_market, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
Uri marketUri = Uri.parse(TALKBACK_MARKET_LINK);
Intent marketIntent = new Intent(Intent.ACTION_VIEW, marketUri);
context.startActivity(marketIntent);
}
}).setNegativeButton(R.string.cancel_talkback_alert, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
// Do nothing, this alert is only shown once either way.
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
use of android.content.DialogInterface in project UltimateAndroid by cymcsg.
the class TeamList method addTeamButtonListener.
protected DialogInterface.OnClickListener addTeamButtonListener() {
return new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
EditText collectedTextView = (EditText) getTextEntryView().findViewById(R.id.collected_text);
String name = collectedTextView.getText().toString();
Team.create(name, TeamList.this);
teamListAdapter.add(name);
}
};
}
Aggregations