use of android.support.v7.app.AlertDialog.Builder in project apps-android-commons by commons-app.
the class CategorizationFragment method backButtonDialog.
public void backButtonDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage("Are you sure you want to go back? The image will not have any categories saved.").setTitle("Warning");
builder.setPositiveButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
//No need to do anything, user remains on categorization screen
}
});
builder.setNegativeButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
getActivity().finish();
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
use of android.support.v7.app.AlertDialog.Builder in project MadMax by deviz92.
the class DetailCommentDialogFragment method onCreateDialog.
@Override
@NonNull
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the Builder class for convenient dialog construction
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// Get the layout inflater
LayoutInflater inflater = getActivity().getLayoutInflater();
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout
builder.setTitle("Autore ha commentato:").setView(inflater.inflate(R.layout.detail_comment, null)).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
// Create the AlertDialog object and return it
return builder.create();
}
use of android.support.v7.app.AlertDialog.Builder in project MadMax by deviz92.
the class FirebaseServiceMessage method onMessageReceived.
/* @Override
public void onCreate() {
super.onCreate();
Log.d(TAG, "onCreate");
}*/
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
String body = remoteMessage.getNotification().getBody();
Map<String, String> data = remoteMessage.getData();
Log.d(TAG, "notification body: " + body);
String message[], messageContent = null;
// Creates an explicit intent for an Activity in the app
Intent resultIntent = null;
messageContent = body;
switch(data.get("notificationTitle")) {
case "notification_invite":
resultIntent = new Intent(getApplicationContext(), GroupDetailActivity.class);
resultIntent.putExtra("groupID", data.get("groupID"));
break;
case "notification_expense_added":
resultIntent = new Intent(getApplicationContext(), ExpenseDetailActivity.class);
resultIntent.putExtra("groupID", data.get("groupID"));
resultIntent.putExtra("expenseID", data.get("expenseID"));
break;
case "notification_expense_removed":
resultIntent = new Intent(getApplicationContext(), GroupDetailActivity.class);
resultIntent.putExtra("groupID", data.get("groupID"));
resultIntent.putExtra("expenseID", data.get("expenseID"));
break;
case "notification_proposalExpense_added":
resultIntent = new Intent(getApplicationContext(), PendingExpenseDetailActivity.class);
resultIntent.putExtra("expenseID", data.get("expenseID"));
break;
}
// User provaCurrent = MainActivity.getCurrentUser();
resultIntent.putExtra("userID", getCurrentUser().getID());
NotificationCompat.Builder mBuilder = (NotificationCompat.Builder) new NotificationCompat.Builder(getApplicationContext()).setSmallIcon(R.mipmap.icon).setContentTitle(remoteMessage.getNotification().getTitle()).setContentText(messageContent);
// The stack builder object will contain an artificial back stack for the started Activity.
// This ensures that navigating backward from the Activity leads out of your application to the Home screen.
TaskStackBuilder stackBuilder = TaskStackBuilder.create(getApplicationContext());
// Adds the back stack for the Intent (but not the Intent itself)
stackBuilder.addParentStack(MainActivity.class);
// Adds the Intent that starts the Activity to the top of the stack
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = mBuilder.build();
notification.flags = Notification.FLAG_AUTO_CANCEL;
// mId allows you to update the notification later on.
mNotificationManager.notify(1, notification);
/*String body = remoteMessage.getNotification().getBody();
Log.d(TAG, "notification body: "+body);
Map<String, String> data = remoteMessage.getData();
showNotification(remoteMessage.getNotification().getTitle(), body, data);*/
}
use of android.support.v7.app.AlertDialog.Builder in project FlexibleAdapter by davideas.
the class MessageDialog method onCreateDialog.
@SuppressLint("InflateParams")
@Override
public AlertDialog onCreateDialog(Bundle savedInstanceState) {
View dialogView = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_message, null);
TextView messageView = (TextView) dialogView.findViewById(R.id.message);
messageView.setMovementMethod(LinkMovementMethod.getInstance());
messageView.setText(Html.fromHtml(getArguments().getString(ARG_MESSAGE)));
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AppTheme_AlertDialog);
builder.setTitle(getArguments().getString(ARG_TITLE)).setIcon(getArguments().getInt(ARG_ICON)).setView(dialogView).setPositiveButton(R.string.OK, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
return builder.create();
}
use of android.support.v7.app.AlertDialog.Builder in project android-UniversalMusicPlayer by googlesamples.
the class MediaNotificationManager method addPlayPauseAction.
private void addPlayPauseAction(NotificationCompat.Builder builder) {
LogHelper.d(TAG, "updatePlayPauseAction");
String label;
int icon;
PendingIntent intent;
if (mPlaybackState.getState() == PlaybackStateCompat.STATE_PLAYING) {
label = mService.getString(R.string.label_pause);
icon = R.drawable.uamp_ic_pause_white_24dp;
intent = mPauseIntent;
} else {
label = mService.getString(R.string.label_play);
icon = R.drawable.uamp_ic_play_arrow_white_24dp;
intent = mPlayIntent;
}
builder.addAction(new NotificationCompat.Action(icon, label, intent));
}
Aggregations