use of de.danoeh.antennapod.databinding.EditTextDialogBinding in project AntennaPod by AntennaPod.
the class AddFeedFragment method showAddViaUrlDialog.
private void showAddViaUrlDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle(R.string.add_podcast_by_url);
View content = View.inflate(getContext(), R.layout.edit_text_dialog, null);
EditTextDialogBinding alertViewBinding = EditTextDialogBinding.bind(content);
alertViewBinding.urlEditText.setHint(R.string.add_podcast_by_url_hint);
ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
String clipboardContent = clipboard.getText() != null ? clipboard.getText().toString() : "";
if (clipboardContent.trim().startsWith("http")) {
alertViewBinding.urlEditText.setText(clipboardContent.trim());
}
builder.setView(alertViewBinding.getRoot());
builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> addUrl(alertViewBinding.urlEditText.getText().toString()));
builder.setNegativeButton(R.string.cancel_label, null);
builder.show();
}
use of de.danoeh.antennapod.databinding.EditTextDialogBinding in project AntennaPod by AntennaPod.
the class RenameItemDialog method show.
public void show() {
Activity activity = activityRef.get();
if (activity == null) {
return;
}
View content = View.inflate(activity, R.layout.edit_text_dialog, null);
EditTextDialogBinding alertViewBinding = EditTextDialogBinding.bind(content);
String title = feed != null ? feed.getTitle() : drawerItem.getTitle();
alertViewBinding.urlEditText.setText(title);
AlertDialog dialog = new AlertDialog.Builder(activity).setView(content).setTitle(feed != null ? R.string.rename_feed_label : R.string.rename_tag_label).setPositiveButton(android.R.string.ok, (d, input) -> {
String newTitle = alertViewBinding.urlEditText.getText().toString();
if (feed != null) {
feed.setCustomTitle(newTitle);
DBWriter.setFeedCustomTitle(feed);
} else {
renameTag(newTitle);
}
}).setNeutralButton(de.danoeh.antennapod.core.R.string.reset, null).setNegativeButton(de.danoeh.antennapod.core.R.string.cancel_label, null).show();
// To prevent cancelling the dialog on button click
dialog.getButton(AlertDialog.BUTTON_NEUTRAL).setOnClickListener((view) -> alertViewBinding.urlEditText.setText(title));
}
Aggregations