List of usage examples for android.content Intent FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
To view the source code for android.content Intent FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET.
Click Source Link
From source file:com.alley.android.ppi.app.DetailFragment.java
private Intent createSharePropertyIntent() { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, mPropertyDescription + PROPERTY_PRICE_SHARE_HASHTAG); return shareIntent; }
From source file:com.charabia.SmsViewActivity.java
public void buttonOptions(View view) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.setClassName(this, PreferencesActivity.class.getName()); startActivity(intent);//from w w w .j a va2s. c om }
From source file:com.charabia.SmsViewActivity.java
public void buttonHelp(View view) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.setClassName(this, WebViewActivity.class.getName()); intent.setData(Uri.parse(WebViewActivity.getBaseUrl(this, "/help", "index.html"))); startActivity(intent);/*from w ww.j ava2s . c o m*/ }
From source file:net.kourlas.voipms_sms.notifications.Notifications.java
/** * Shows a notification with the specified details. * * @param contact The contact that the notification is from. * @param shortText The short form of the message text. * @param longText The long form of the message text. *//*w ww . j a va2 s.c o m*/ private void showNotification(String contact, String shortText, String longText) { String title = Utils.getContactName(applicationContext, contact); if (title == null) { title = Utils.getFormattedPhoneNumber(contact); } NotificationCompat.Builder notification = new NotificationCompat.Builder(applicationContext); notification.setContentTitle(title); notification.setContentText(shortText); notification.setSmallIcon(R.drawable.ic_chat_white_24dp); notification.setPriority(Notification.PRIORITY_HIGH); String notificationSound = Preferences.getInstance(applicationContext).getNotificationSound(); if (!notificationSound.equals("")) { notification.setSound(Uri.parse(Preferences.getInstance(applicationContext).getNotificationSound())); } String num = Utils.getFormattedPhoneNumber(contact); Log.v("prior", num); SharedPreferences sharedPreferences = applicationContext.getSharedPreferences("ledData", Context.MODE_PRIVATE); String cNm = sharedPreferences.getString(title, "3000"); SharedPreferences sharedPref = applicationContext.getSharedPreferences("color", Context.MODE_PRIVATE); int clr = sharedPref.getInt(title, 0xFF02ffff); Log.v("saved rate of ", cNm + " for " + title); int ledSpeed = 3000; int color = 0xFF02ffff; if (cNm.equals("500") || cNm.equals("3000")) { ledSpeed = Integer.parseInt(cNm); color = clr; } notification.setLights(color, ledSpeed, ledSpeed); if (Preferences.getInstance(applicationContext).getNotificationVibrateEnabled()) { notification.setVibrate(new long[] { 0, 250, 250, 250 }); } else { notification.setVibrate(new long[] { 0 }); } notification.setColor(0xFF546e7a); notification.setAutoCancel(true); notification.setStyle(new NotificationCompat.BigTextStyle().bigText(longText)); Bitmap largeIconBitmap; try { largeIconBitmap = MediaStore.Images.Media.getBitmap(applicationContext.getContentResolver(), Uri.parse(Utils.getContactPhotoUri(applicationContext, contact))); largeIconBitmap = Bitmap.createScaledBitmap(largeIconBitmap, 256, 256, false); largeIconBitmap = Utils.applyCircularMask(largeIconBitmap); notification.setLargeIcon(largeIconBitmap); } catch (Exception ignored) { // Do nothing. } Intent intent = new Intent(applicationContext, ConversationActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra(applicationContext.getString(R.string.conversation_extra_contact), contact); TaskStackBuilder stackBuilder = TaskStackBuilder.create(applicationContext); stackBuilder.addParentStack(ConversationActivity.class); stackBuilder.addNextIntent(intent); notification.setContentIntent(stackBuilder.getPendingIntent(0, PendingIntent.FLAG_CANCEL_CURRENT)); Intent replyIntent = new Intent(applicationContext, ConversationQuickReplyActivity.class); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { replyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); } else { //noinspection deprecation replyIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); } replyIntent.putExtra(applicationContext.getString(R.string.conversation_extra_contact), contact); PendingIntent replyPendingIntent = PendingIntent.getActivity(applicationContext, 0, replyIntent, PendingIntent.FLAG_CANCEL_CURRENT); NotificationCompat.Action.Builder replyAction = new NotificationCompat.Action.Builder( R.drawable.ic_reply_white_24dp, applicationContext.getString(R.string.notifications_button_reply), replyPendingIntent); notification.addAction(replyAction.build()); Intent markAsReadIntent = new Intent(applicationContext, MarkAsReadReceiver.class); markAsReadIntent.putExtra(applicationContext.getString(R.string.conversation_extra_contact), contact); PendingIntent markAsReadPendingIntent = PendingIntent.getBroadcast(applicationContext, 0, markAsReadIntent, PendingIntent.FLAG_CANCEL_CURRENT); NotificationCompat.Action.Builder markAsReadAction = new NotificationCompat.Action.Builder( R.drawable.ic_drafts_white_24dp, applicationContext.getString(R.string.notifications_button_mark_read), markAsReadPendingIntent); notification.addAction(markAsReadAction.build()); int id; if (notificationIds.get(contact) != null) { id = notificationIds.get(contact); } else { id = notificationIdCount++; notificationIds.put(contact, id); } NotificationManager notificationManager = (NotificationManager) applicationContext .getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(id, notification.build()); }
From source file:com.tanmay.blip.fragments.RandomFragment.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.open_in_browser: Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://xkcd.com/" + comic.getNum())); startActivity(intent);/* www.j av a2 s.co m*/ break; case R.id.transcript: String content = comic.getTranscript(); if (content.equals("")) { content = getResources().getString(R.string.message_no_transcript); } final String speakingContent = content; new MaterialDialog.Builder(getActivity()).title(R.string.title_dialog_transcript).content(content) .negativeText(R.string.negative_text_dialog).neutralText(R.string.neutral_text_dialog_speak) .autoDismiss(false).callback(new MaterialDialog.ButtonCallback() { @Override public void onNegative(MaterialDialog dialog) { super.onNegative(dialog); dialog.dismiss(); } @Override public void onNeutral(MaterialDialog dialog) { super.onNeutral(dialog); SpeechSynthesizer.getInstance().convertToSpeechFlush(speakingContent); } }).dismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { SpeechSynthesizer.getInstance().stopSpeaking(); } }).show(); break; case R.id.img_container: ImageActivity.launch((AppCompatActivity) getActivity(), img, comic.getNum()); break; case R.id.favourite: boolean fav = comic.isFavourite(); comic.setFavourite(!fav); databaseManager.setFavourite(comic.getNum(), !fav); if (fav) { //remove from fav favourite.setColorFilter(getResources().getColor(R.color.icons_dark)); } else { //make fav favourite.setColorFilter(getResources().getColor(R.color.accent)); } break; case R.id.help: Intent explainIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.explainxkcd.com/wiki/index.php/" + comic.getNum())); startActivity(explainIntent); break; case R.id.share: Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("text/plain"); if (BlipUtils.isLollopopUp()) { shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); } else { shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); } shareIntent.putExtra(Intent.EXTRA_SUBJECT, comic.getTitle()); shareIntent.putExtra(Intent.EXTRA_TEXT, comic.getImg()); startActivity(Intent.createChooser(shareIntent, getActivity().getResources().getString(R.string.tip_share_image_url))); break; } }
From source file:gov.wa.wsdot.android.wsdot.ui.camera.CameraImageFragment.java
private Intent createShareIntent() { File f = new File(getActivity().getFilesDir(), mCameraName); ContentValues values = new ContentValues(2); values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg"); values.put(MediaStore.Images.Media.DATA, f.getAbsolutePath()); Uri uri = getActivity().getContentResolver().insert(MediaStore.Images.Media.INTERNAL_CONTENT_URI, values); Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); shareIntent.setType("image/jpeg"); shareIntent.putExtra(Intent.EXTRA_TEXT, mTitle); shareIntent.putExtra(Intent.EXTRA_SUBJECT, mTitle); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); return shareIntent; }
From source file:se.droidgiro.scanner.CaptureActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.about: { Intent intent = new Intent(this, About.class); startActivity(intent);// w ww. j a v a2s. co m break; } case R.id.settings: { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.setClassName(this, PreferencesActivity.class.getName()); startActivity(intent); break; } } return super.onOptionsItemSelected(item); }
From source file:com.denel.facepatrol.MainActivity.java
public void onGroupEmail(String[] email_grp) { // enter code here Intent emailIntent = new Intent(Intent.ACTION_SENDTO); emailIntent.setData(Uri.parse("mailto:")); emailIntent.putExtra(Intent.EXTRA_EMAIL, email_grp); //emailIntent.setType("message/rfc822"); emailIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(Intent.createChooser(emailIntent, "Send Group Email...")); }
From source file:com.android.mail.browse.AttachmentActionHandler.java
public void shareAttachment() { if (mAttachment.contentUri == null) { return;//from w w w.j av a 2 s . c om } Intent intent = new Intent(Intent.ACTION_SEND); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); final Uri uri = Utils.normalizeUri(mAttachment.contentUri); intent.putExtra(Intent.EXTRA_STREAM, uri); intent.setType(Utils.normalizeMimeType(mAttachment.getContentType())); try { mContext.startActivity(intent); } catch (ActivityNotFoundException e) { // couldn't find activity for SEND intent LogUtils.e(LOG_TAG, "Couldn't find Activity for intent", e); } }