use of android.app.AlertDialog.Builder in project ignition by mttkay.
the class IgnitedDialogs method newYesNoDialog.
/**
* Builds a new Yes/No AlertDialog
*
* @param context
* @param title
* @param message
* @param positiveButtonMessage
* @param negativeButtonMessage
* @param iconId
* @param listener
* @return
*/
public static AlertDialog.Builder newYesNoDialog(final Context context, String title, String message, String positiveButtonMessage, String negativeButtonMessage, int iconId, OnClickListener listener) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setCancelable(false);
builder.setPositiveButton(positiveButtonMessage, listener);
builder.setNegativeButton(negativeButtonMessage, listener);
builder.setTitle(title);
builder.setMessage(message);
builder.setIcon(iconId);
return builder;
}
use of android.app.AlertDialog.Builder in project ignition by mttkay.
the class IgnitedDialogs method newListDialog.
public static <T> AlertDialog.Builder newListDialog(final Activity context, String title, final List<T> elements, final DialogClickListener<T> listener, final boolean closeOnSelect, int selectedItem) {
final int entriesSize = elements.size();
String[] entries = new String[entriesSize];
for (int i = 0; i < entriesSize; i++) {
entries[i] = elements.get(i).toString();
}
Builder builder = new AlertDialog.Builder(context);
if (title != null) {
builder.setTitle(title);
}
builder.setSingleChoiceItems(entries, selectedItem, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (closeOnSelect) {
dialog.dismiss();
}
listener.onClick(which, elements.get(which));
}
});
return builder;
}
use of android.app.AlertDialog.Builder in project android_frameworks_base by ResurrectionRemix.
the class TileAdapter method showAccessibilityDialog.
private void showAccessibilityDialog(final int position, final View v) {
final TileInfo info = mTiles.get(position);
CharSequence[] options = new CharSequence[] { mContext.getString(R.string.accessibility_qs_edit_move_tile, info.state.label), mContext.getString(R.string.accessibility_qs_edit_remove_tile, info.state.label) };
AlertDialog dialog = new Builder(mContext).setItems(options, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == 0) {
startAccessibleDrag(position);
} else {
move(position, info.isSystem ? mEditIndex : mTileDividerIndex, v);
notifyItemChanged(mTileDividerIndex);
notifyDataSetChanged();
}
}
}).setNegativeButton(android.R.string.cancel, null).create();
SystemUIDialog.setShowForAllUsers(dialog, true);
SystemUIDialog.applyFlags(dialog);
dialog.show();
}
use of android.app.AlertDialog.Builder in project android_frameworks_base by ResurrectionRemix.
the class KeyguardSimPinView method getSimRemainingAttemptsDialog.
private Dialog getSimRemainingAttemptsDialog(int remaining) {
String msg = getPinPasswordErrorMessage(remaining, false);
if (mRemainingAttemptsDialog == null) {
Builder builder = new AlertDialog.Builder(mContext);
builder.setMessage(msg);
builder.setCancelable(false);
builder.setNeutralButton(R.string.ok, null);
mRemainingAttemptsDialog = builder.create();
mRemainingAttemptsDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
} else {
mRemainingAttemptsDialog.setMessage(msg);
}
return mRemainingAttemptsDialog;
}
use of android.app.AlertDialog.Builder in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ShortcutPickHelper method processShortcut.
private void processShortcut(final Intent intent, int requestCodeApplication, int requestCodeShortcut) {
// Handle case where user selected "Applications"
String applicationName = mParent.getString(R.string.profile_applist_title);
String application2name = mParent.getString(R.string.picker_activities);
String shortcutName = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
if (applicationName != null && applicationName.equals(shortcutName)) {
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
pickIntent.putExtra(Intent.EXTRA_INTENT, mainIntent);
startFragmentOrActivity(pickIntent, requestCodeApplication);
} else if (application2name != null && application2name.equals(shortcutName)) {
final List<PackageInfo> pInfos = mPackageManager.getInstalledPackages(PackageManager.GET_ACTIVITIES);
ExpandableListView appListView = new ExpandableListView(mParent);
AppExpandableAdapter appAdapter = new AppExpandableAdapter(pInfos, mParent);
appListView.setAdapter(appAdapter);
appListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
Intent shortIntent = new Intent(Intent.ACTION_MAIN);
String pkgName = ((GroupInfo) parent.getExpandableListAdapter().getGroup(groupPosition)).info.packageName;
String actName = ((GroupInfo) parent.getExpandableListAdapter().getGroup(groupPosition)).info.activities[childPosition].name;
shortIntent.setClassName(pkgName, actName);
completeSetCustomApp(shortIntent);
mAlertDialog.dismiss();
return true;
}
});
Builder builder = new Builder(mParent);
builder.setView(appListView);
mAlertDialog = builder.create();
mAlertDialog.setTitle(mParent.getString(R.string.select_custom_activity_title));
mAlertDialog.show();
mAlertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
mListener.shortcutPicked(null, null, false);
}
});
} else {
startFragmentOrActivity(intent, requestCodeShortcut);
}
}
Aggregations