use of android.content.DialogInterface.OnClickListener in project JamsMusicPlayer by psaravan.
the class SmallWidgetConfigActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
setTheme(android.R.style.Theme_Holo_Dialog);
super.onCreate(savedInstanceState);
setResult(RESULT_CANCELED, new Intent());
sharedPreferences = this.getSharedPreferences("com.jams.music.player", Context.MODE_PRIVATE);
//Retrieve the id of the widget that called this activity.
Intent intent = getIntent();
Bundle extras = intent.getExtras();
if (extras != null) {
mAppWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
}
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.select_widget_color);
builder.setCancelable(false);
builder.setSingleChoiceItems(R.array.widget_color_options, -1, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == 0) {
//Light theme.
sharedPreferences.edit().putString("" + mAppWidgetId, "LIGHT").commit();
} else if (which == 1) {
//Dark theme.
sharedPreferences.edit().putString("" + mAppWidgetId, "DARK").commit();
}
updateWidgetConfig();
}
});
builder.create().show();
}
use of android.content.DialogInterface.OnClickListener in project qksms by moezbhatti.
the class LogTag method warnPossibleRecipientMismatch.
public static void warnPossibleRecipientMismatch(final String msg, final Activity activity) {
Log.e(TAG, "WARNING!!!! " + msg, new RuntimeException());
if (SHOW_SEVERE_WARNING_DIALOG) {
dumpInternalTables(activity);
activity.runOnUiThread(new Runnable() {
public void run() {
new AlertDialog.Builder(activity).setIconAttribute(android.R.attr.alertDialogIcon).setTitle(R.string.error_state).setMessage(msg + "\n\n" + activity.getString(R.string.error_state_text)).setPositiveButton(R.string.yes, new OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).show();
}
});
}
}
use of android.content.DialogInterface.OnClickListener in project qksms by moezbhatti.
the class MessageUtils method handleReadReport.
public static void handleReadReport(final Context context, final Collection<Long> threadIds, final int status, final Runnable callback) {
StringBuilder selectionBuilder = new StringBuilder(Mms.MESSAGE_TYPE + " = " + PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF + " AND " + Mms.READ + " = 0" + " AND " + Mms.READ_REPORT + " = " + PduHeaders.VALUE_YES);
String[] selectionArgs = null;
if (threadIds != null) {
String threadIdSelection = null;
StringBuilder buf = new StringBuilder();
selectionArgs = new String[threadIds.size()];
int i = 0;
for (long threadId : threadIds) {
if (i > 0) {
buf.append(" OR ");
}
buf.append(Mms.THREAD_ID).append("=?");
selectionArgs[i++] = Long.toString(threadId);
}
threadIdSelection = buf.toString();
selectionBuilder.append(" AND (" + threadIdSelection + ")");
}
final Cursor c = SqliteWrapper.query(context, context.getContentResolver(), Mms.Inbox.CONTENT_URI, new String[] { Mms._ID, Mms.MESSAGE_ID }, selectionBuilder.toString(), selectionArgs, null);
if (c == null) {
return;
}
final Map<String, String> map = new HashMap<>();
try {
if (c.getCount() == 0) {
if (callback != null) {
callback.run();
}
return;
}
while (c.moveToNext()) {
Uri uri = ContentUris.withAppendedId(Mms.CONTENT_URI, c.getLong(0));
map.put(c.getString(1), AddressUtils.getFrom(context, uri));
}
} finally {
c.close();
}
OnClickListener positiveListener = new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
for (final Map.Entry<String, String> entry : map.entrySet()) {
MmsMessageSender.sendReadRec(context, entry.getValue(), entry.getKey(), status);
}
if (callback != null) {
callback.run();
}
dialog.dismiss();
}
};
OnClickListener negativeListener = new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (callback != null) {
callback.run();
}
dialog.dismiss();
}
};
OnCancelListener cancelListener = new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
if (callback != null) {
callback.run();
}
dialog.dismiss();
}
};
confirmReadReportDialog(context, positiveListener, negativeListener, cancelListener);
}
use of android.content.DialogInterface.OnClickListener in project openkit-android by OpenKit.
the class OKLoginFragment method showLoginErrorMessage.
private void showLoginErrorMessage(String message) {
AlertDialog.Builder builder = new AlertDialog.Builder(OKLoginFragment.this.getActivity());
builder.setTitle("Error");
builder.setMessage(message);
builder.setNegativeButton("OK", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialogDelegate.onLoginFailed();
}
});
builder.setCancelable(false);
// create alert dialog
AlertDialog alertDialog = builder.create();
// show it
alertDialog.show();
}
use of android.content.DialogInterface.OnClickListener in project openkit-android by OpenKit.
the class FacebookUtilities method showErrorMessage.
public static void showErrorMessage(String message, Context context) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Error");
builder.setMessage(message);
builder.setNegativeButton("OK", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
// create alert dialog
AlertDialog alertDialog = builder.create();
// show it
alertDialog.show();
}
Aggregations