use of android.support.v4.app.NotificationCompat.Builder in project mobile-android by photo.
the class NewPhotoObserver method showAutouploadIgnoredNotification.
/**
* Show the autoupload ignored notification
*
* @param file
*/
private void showAutouploadIgnoredNotification(File file) {
NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
int icon = R.drawable.icon;
long when = System.currentTimeMillis();
String contentMessageTitle;
contentMessageTitle = CommonUtils.getStringResource(R.string.upload_limit_reached_message);
NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext);
Notification notification = builder.setContentTitle(CommonUtils.getStringResource(R.string.autoupload_ignored)).setContentText(contentMessageTitle).setWhen(when).setSmallIcon(icon).setAutoCancel(true).build();
notificationManager.notify(file.hashCode(), notification);
}
use of android.support.v4.app.NotificationCompat.Builder in project JamsMusicPlayer by psaravan.
the class CautionEditArtistsDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
parentActivity = getActivity();
dialogFragment = this;
EDIT_TYPE = this.getArguments().getString("EDIT_TYPE");
ARTIST = this.getArguments().getString("ARTIST");
rootView = (View) parentActivity.getLayoutInflater().inflate(R.layout.fragment_caution_edit_artists, null);
cautionText = (TextView) rootView.findViewById(R.id.caution_text);
cautionText.setText(R.string.caution_artists_text);
cautionText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light"));
cautionText.setPaintFlags(cautionText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
sharedPreferences = getActivity().getSharedPreferences("com.jams.music.player", Context.MODE_PRIVATE);
sharedPreferences.edit().putBoolean("SHOW_ARTIST_EDIT_CAUTION", false).commit();
dontShowAgainText = (TextView) rootView.findViewById(R.id.dont_show_again_text);
dontShowAgainText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light"));
dontShowAgainText.setPaintFlags(dontShowAgainText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
dontShowAgainCheckbox = (CheckBox) rootView.findViewById(R.id.dont_show_again_checkbox);
dontShowAgainCheckbox.setChecked(true);
dontShowAgainCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {
if (isChecked == true) {
sharedPreferences.edit().putBoolean("SHOW_ARTIST_EDIT_CAUTION", false).commit();
} else {
sharedPreferences.edit().putBoolean("SHOW_ARTIST_EDIT_CAUTION", true).commit();
}
}
});
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
//Set the dialog title.
builder.setTitle(R.string.caution);
builder.setView(rootView);
builder.setNegativeButton(R.string.no, new OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
dialogFragment.dismiss();
}
});
builder.setPositiveButton(R.string.yes, new OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
dialogFragment.dismiss();
FragmentTransaction ft = getFragmentManager().beginTransaction();
Bundle bundle = new Bundle();
bundle.putString("EDIT_TYPE", EDIT_TYPE);
bundle.putString("ARTIST", ARTIST);
ID3sArtistEditorDialog dialog = new ID3sArtistEditorDialog();
dialog.setArguments(bundle);
dialog.show(ft, "id3ArtistEditorDialog");
}
});
return builder.create();
}
use of android.support.v4.app.NotificationCompat.Builder in project JamsMusicPlayer by psaravan.
the class EditGooglePlayMusicTagsDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final DialogFragment dialog = this;
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
//Set the dialog title.
builder.setTitle(R.string.google_play_music_no_asterisk);
builder.setMessage(getResources().getString(R.string.edit_google_play_music_tags_unsupported));
builder.setNegativeButton(R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
dialog.dismiss();
}
});
return builder.create();
}
use of android.support.v4.app.NotificationCompat.Builder in project weiciyuan by qii.
the class Utility method showExpiredTokenDialogOrNotification.
public static void showExpiredTokenDialogOrNotification() {
final Activity activity = GlobalContext.getInstance().getCurrentRunningActivity();
boolean currentAccountTokenIsExpired = true;
AccountBean currentAccount = GlobalContext.getInstance().getAccountBean();
if (currentAccount != null) {
currentAccountTokenIsExpired = !Utility.isTokenValid(currentAccount);
}
if (currentAccountTokenIsExpired && activity != null && !GlobalContext.getInstance().tokenExpiredDialogIsShowing) {
if (activity.getClass() == AccountActivity.class) {
return;
}
if (activity.getClass() == OAuthActivity.class) {
return;
}
if (activity.getClass() == BlackMagicActivity.class) {
return;
}
if (activity.getClass() == SSOActivity.class) {
return;
}
final AccountBean needRefreshTokenAccount = currentAccount;
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
new AlertDialog.Builder(activity).setTitle(R.string.dialog_title_error).setMessage(R.string.your_token_is_expired).setPositiveButton(R.string.logout_to_login_again, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
activity.startActivity(AccountActivity.newIntent(needRefreshTokenAccount));
activity.finish();
GlobalContext.getInstance().tokenExpiredDialogIsShowing = false;
}
}).setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
//do nothing
}
}).show();
GlobalContext.getInstance().tokenExpiredDialogIsShowing = true;
}
});
} else if (!currentAccountTokenIsExpired || activity == null) {
Intent i = AccountActivity.newIntent();
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(GlobalContext.getInstance(), 0, i, PendingIntent.FLAG_UPDATE_CURRENT);
Notification.Builder builder = new Notification.Builder(GlobalContext.getInstance()).setContentTitle(GlobalContext.getInstance().getString(R.string.login_again)).setContentText(GlobalContext.getInstance().getString(R.string.have_account_whose_token_is_expired)).setSmallIcon(R.drawable.ic_notification).setAutoCancel(true).setContentIntent(pendingIntent).setOnlyAlertOnce(true);
NotificationManager notificationManager = (NotificationManager) GlobalContext.getInstance().getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(NotificationServiceHelper.getTokenExpiredNotificationId(), builder.build());
} else if (GlobalContext.getInstance().tokenExpiredDialogIsShowing) {
NotificationManager notificationManager = (NotificationManager) GlobalContext.getInstance().getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(NotificationServiceHelper.getTokenExpiredNotificationId());
}
}
use of android.support.v4.app.NotificationCompat.Builder in project XposedInstaller by rovo89.
the class NotificationUtil method showModulesUpdatedNotification.
@SuppressWarnings("deprecation")
public static void showModulesUpdatedNotification() {
Intent intent = new Intent(sContext, WelcomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("fragment", 0);
PendingIntent pInstallTab = PendingIntent.getActivity(sContext, PENDING_INTENT_OPEN_INSTALL, intent, PendingIntent.FLAG_UPDATE_CURRENT);
String title = sContext.getString(R.string.xposed_module_updated_notification_title);
String message = sContext.getString(R.string.xposed_module_updated_notification);
NotificationCompat.Builder builder = new NotificationCompat.Builder(sContext).setContentTitle(title).setContentText(message).setTicker(title).setContentIntent(pInstallTab).setVibrate(new long[] { 0 }).setAutoCancel(true).setSmallIcon(R.drawable.ic_notification).setColor(sContext.getResources().getColor(R.color.colorPrimary));
if (Build.VERSION.SDK_INT >= 21)
builder.setPriority(2);
Intent iSoftReboot = new Intent(sContext, RebootReceiver.class);
iSoftReboot.putExtra(RebootReceiver.EXTRA_SOFT_REBOOT, true);
PendingIntent pSoftReboot = PendingIntent.getBroadcast(sContext, PENDING_INTENT_SOFT_REBOOT, iSoftReboot, PendingIntent.FLAG_UPDATE_CURRENT);
Intent iReboot = new Intent(sContext, RebootReceiver.class);
PendingIntent pReboot = PendingIntent.getBroadcast(sContext, PENDING_INTENT_REBOOT, iReboot, PendingIntent.FLAG_UPDATE_CURRENT);
builder.addAction(0, sContext.getString(R.string.reboot), pReboot);
builder.addAction(0, sContext.getString(R.string.soft_reboot), pSoftReboot);
sNotificationManager.notify(null, NOTIFICATION_MODULES_UPDATED, builder.build());
}
Aggregations