use of android.app.AlertDialog in project XPrivacy by M66B.
the class WhitelistTask method onPostExecute.
@Override
@SuppressLint({ "DefaultLocale", "InflateParams" })
protected void onPostExecute(Object result) {
if (!mContext.isFinishing()) {
// Build dialog
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(mContext);
alertDialogBuilder.setTitle(R.string.menu_whitelists);
alertDialogBuilder.setIcon(mContext.getThemed(R.attr.icon_launcher));
if (mListWhitelist.keySet().size() > 0) {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View llWhitelists = inflater.inflate(R.layout.whitelists, null);
int index = 0;
int selected = -1;
final List<String> localizedType = new ArrayList<String>();
for (String type : mListWhitelist.keySet()) {
String name = "whitelist_" + type.toLowerCase().replace("/", "");
int id = mContext.getResources().getIdentifier(name, "string", mContext.getPackageName());
if (id == 0)
localizedType.add(name);
else
localizedType.add(mContext.getResources().getString(id));
if (type.equals(mType))
selected = index;
index++;
}
Spinner spWhitelistType = (Spinner) llWhitelists.findViewById(R.id.spWhitelistType);
ArrayAdapter<String> whitelistTypeAdapter = new ArrayAdapter<String>(mContext, android.R.layout.simple_spinner_dropdown_item, localizedType);
spWhitelistType.setAdapter(whitelistTypeAdapter);
spWhitelistType.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
mWhitelistAdapter.setType(mListWhitelist.keySet().toArray(new String[0])[position]);
}
@Override
public void onNothingSelected(AdapterView<?> view) {
}
});
if (selected >= 0)
spWhitelistType.setSelection(selected);
ListView lvWhitelist = (ListView) llWhitelists.findViewById(R.id.lvWhitelist);
lvWhitelist.setAdapter(mWhitelistAdapter);
int position = spWhitelistType.getSelectedItemPosition();
if (position != AdapterView.INVALID_POSITION)
mWhitelistAdapter.setType(mListWhitelist.keySet().toArray(new String[0])[position]);
alertDialogBuilder.setView(llWhitelists);
}
alertDialogBuilder.setPositiveButton(mContext.getString(R.string.msg_done), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Do nothing
}
});
// Show dialog
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
super.onPostExecute(result);
}
use of android.app.AlertDialog 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.app.AlertDialog 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();
}
use of android.app.AlertDialog in project jmonkeyengine by jMonkeyEngine.
the class JmeAndroidSystem method showErrorDialog.
@Override
public void showErrorDialog(String message) {
final String finalMsg = message;
final String finalTitle = "Error in application";
final Context context = JmeAndroidSystem.getView().getContext();
view.getHandler().post(new Runnable() {
@Override
public void run() {
AlertDialog dialog = new AlertDialog.Builder(context).setTitle(finalTitle).setMessage(finalMsg).create();
dialog.show();
}
});
}
use of android.app.AlertDialog in project Klyph by jonathangerbaud.
the class StreamButtonBar method delete.
private void delete(View button, final Stream stream) {
final Context context = getContext(button);
final AlertDialog dialog = AlertUtil.showAlert(context, R.string.delete, R.string.deleting);
new AsyncRequest(Query.DELETE_POST, stream.getPost_id(), "", new AsyncRequest.Callback() {
@Override
public void onComplete(Response response) {
Log.d("onComplete", "" + response.getError());
dialog.dismiss();
if (response.getError() != null) {
AlertUtil.showAlert(context, R.string.error, R.string.delete_post_error, R.string.ok);
} else {
Toast.makeText(context, R.string.post_deleted, Toast.LENGTH_SHORT).show();
getParentAdapter().remove(stream, true);
}
}
}).execute();
}
Aggregations