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.ubuntuone.android.files.activity.FilesActivity.java
private void signIn() { final Intent intent = new Intent(LoginActivity.ACTION_SIGN_IN); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivityForResult(intent, REQUEST_SIGN_IN); }
From source file:com.denel.facepatrol.MainActivity.java
public void ContactPhone(View view) { Intent phoneIntent = new Intent(Intent.ACTION_DIAL); phoneIntent.setData(Uri.parse("tel:" + contact_phone)); phoneIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(Intent.createChooser(phoneIntent, "Phone Number")); //finish();//from w w w. ja v a 2 s . c o m }
From source file:syncthing.android.ui.sessionsettings.EditDevicePresenter.java
public void startQRScannerActivity(View btn) { Intent intentScan = new Intent("com.google.zxing.client.android.SCAN"); intentScan.addCategory(Intent.CATEGORY_DEFAULT); intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); try {/*from ww w .j a v a 2 s . c om*/ activityResultsController.startActivityForResult(intentScan, ActivityRequestCodes.SCAN_QR, null); } catch (ActivityNotFoundException e) { if (hasView()) { dialogPresenter.showDialog(context -> new AlertDialog.Builder(context).setTitle(R.string.error) .setMessage(R.string.no_qr_scanner_installed).setPositiveButton(android.R.string.ok, null) .create()); } } }
From source file:net.mEmoZz.PopMovies.frags.DetailFragment.java
private Intent createShareForecastIntent() { 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, "Check this movie: " + titleEndPoint + " from #Popular_Movies_APP"); return shareIntent; }
From source file:com.ubuntuone.android.files.activity.FilesActivity.java
private void validate() { final Intent intent = new Intent(LoginActivity.ACTION_VALIDATE); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivityForResult(intent, REQUEST_SIGN_IN); }
From source file:fm.feed.android.playersdk.view.PlayerView.java
private void initializeView() { RelativeLayout rootView = (RelativeLayout) inflate(getContext(), R.layout.view_player, this); mTitle = (TextView) rootView.findViewById(R.id.pu_title); mArtist = (TextView) rootView.findViewById(R.id.pu_artist); mAlbum = (TextView) rootView.findViewById(R.id.pu_album); mPrefix = (TextView) rootView.findViewById(R.id.pu_prefix); mSuffix = (TextView) rootView.findViewById(R.id.pu_suffix); mProgressBar = (ProgressBar) rootView.findViewById(R.id.pu_progress); LinearLayout topContainer = (LinearLayout) rootView.findViewById(R.id.pu_top_icons); LinearLayout bottomContainer = (LinearLayout) rootView.findViewById(R.id.pu_bottom_icons); // We need to create the SVGImageView instances and add them programmatically. mDislike = newSvgImage(1, ImageView.ScaleType.FIT_START); mLike = newSvgImage(2, ImageView.ScaleType.FIT_CENTER); mPlayPause = newSvgImage(2, ImageView.ScaleType.FIT_CENTER); mSkip = newSvgImage(1, ImageView.ScaleType.FIT_END); mVolume = newSvgImage(1, ImageView.ScaleType.FIT_START); mShare = newSvgImage(1, ImageView.ScaleType.FIT_END); // Set the SVG resource to the SVGImageView setSvgResource(mDislike, R.drawable.ic_thumbdown_faded, R.string.accessibility_dislike); setSvgResource(mLike, R.drawable.ic_thumbup_faded, R.string.accessibility_like); setSvgResource(mPlayPause, R.drawable.ic_play_faded, R.string.accessibility_play); setSvgResource(mSkip, R.drawable.ic_skip_disabled, R.string.accessibility_skip_disabled); setSvgResource(mVolume, R.drawable.ic_speakerhigh_faded, R.string.accessibility_volume_muted); setSvgResource(mShare, R.drawable.ic_share_faded, R.string.accessibility_share); // Add SVGImageViews to the layout. topContainer.addView(mDislike);//from w w w. j a va 2 s. c o m topContainer.addView(mLike); topContainer.addView(mPlayPause); topContainer.addView(mSkip); bottomContainer.addView(mVolume); bottomContainer.addView(mShare); mDislike.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!mPlayer.hasPlay()) { return; } Play.LikeState likeState = mPlayer.getPlay().getLikeState(); switch (likeState) { case NONE: setSvgResource(mDislike, R.drawable.ic_thumbdown_normal, R.string.accessibility_disliked); mPlayer.dislike(); break; case LIKED: setSvgResource(mLike, R.drawable.ic_thumbup_faded, R.string.accessibility_like); mPlayer.unlike(); break; case DISLIKED: // Do nothing break; } } }); mLike.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!mPlayer.hasPlay()) { return; } Play.LikeState likeState = mPlayer.getPlay().getLikeState(); switch (likeState) { case NONE: setSvgResource(mLike, R.drawable.ic_thumbup_normal, R.string.accessibility_liked); mPlayer.like(); break; case LIKED: // Do nothing break; case DISLIKED: setSvgResource(mDislike, R.drawable.ic_thumbdown_faded, R.string.accessibility_unlike); setSvgResource(mLike, R.drawable.ic_thumbup_normal, R.string.accessibility_liked); mPlayer.like(); break; } } }); mPlayPause.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mPlayer.getState() == PlayInfo.State.PLAYING) { mPlayer.pause(); } else { mPlayer.play(); } } }); mSkip.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mPlayer.isSkippable()) { setSvgResource(mSkip, R.drawable.ic_skip_normal, R.string.accessibility_skipping); mPlayer.skip(); } } }); mShare.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mPlayer == null || !mPlayer.hasPlay()) { Log.i(TAG, "Cannot share if not playing"); return; } Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); String subject = mShareSubject; String body = mShareBody; if (subject == null) { subject = getContext().getString(R.string.share_subject_template); } if (body == null) { Play play = mPlayer.getPlay(); String title = play.getAudioFile().getTrack().getTitle(); String artist = play.getAudioFile().getArtist().getName(); String album = play.getAudioFile().getRelease().getTitle(); body = getContext().getString(R.string.share_body_template, title, artist, album); } // Add data to the intent, the receiving app will decide what to do with it. intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, body); getContext() .startActivity(Intent.createChooser(intent, getContext().getString(R.string.share_via))); } }); mVolume.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { AudioManager am = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE); int volume = mAudioSettingsContentObserver.getCurrentVolume(); am.setStreamVolume(AudioManager.STREAM_MUSIC, volume, AudioManager.FLAG_SHOW_UI); } }); updateSpeakerUI(); }
From source file:com.e2g.ecocicle.barcode.IntentIntegrator.java
/** * Initiates a scan, using the specified camera, only for a certain set of barcode types, given as strings corresponding * to their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants * like {@link #PRODUCT_CODE_TYPES} for example. * * @param desiredBarcodeFormats names of {@code BarcodeFormat}s to scan for * @param cameraId camera ID of the camera to use. A negative value means "no preference". * @return the {@link android.app.AlertDialog} that was shown to the user prompting them to download the app * if a prompt was needed, or null otherwise *//*from ww w .j ava2 s. c o m*/ public final AlertDialog initiateScan(Collection<String> desiredBarcodeFormats, int cameraId) { Intent intentScan = new Intent(BS_PACKAGE + ".SCAN"); intentScan.addCategory(Intent.CATEGORY_DEFAULT); // check which types of codes to scan for if (desiredBarcodeFormats != null) { // set the desired barcode types StringBuilder joinedByComma = new StringBuilder(); for (String format : desiredBarcodeFormats) { if (joinedByComma.length() > 0) { joinedByComma.append(','); } joinedByComma.append(format); } intentScan.putExtra("SCAN_FORMATS", joinedByComma.toString()); } // check requested camera ID if (cameraId >= 0) { intentScan.putExtra("SCAN_CAMERA_ID", cameraId); } String targetAppPackage = findTargetAppPackage(intentScan); if (targetAppPackage == null) { return showDownloadDialog(); } intentScan.setPackage(targetAppPackage); intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); attachMoreExtras(intentScan); startActivityForResult(intentScan, REQUEST_CODE); return null; }
From source file:com.denel.facepatrol.MainActivity.java
public void ContactEmail(View view) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO); emailIntent.setData(Uri.parse("mailto:")); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { contact_email }); //emailIntent.setType("message/rfc822"); emailIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(Intent.createChooser(emailIntent, "Send Email...")); //finish();//from ww w . ja va 2 s .com }
From source file:org.kontalk.util.SystemUtils.java
public static Intent externalIntent(String action, Uri data) { Intent i = new Intent(action, data); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { i.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); } else {/* ww w .j a v a 2 s. c o m*/ i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); } return i; }
From source file:com.siahmsoft.soundroid.sdk7.services.UploadService.java
/** * Show a notification while this service is running. *//*from w ww . jav a 2 s . c om*/ private void showNotification(String text) { // Set the icon, scrolling text and timestamp Notification notification = new Notification(R.drawable.uploadtocloud, text, System.currentTimeMillis()); // The PendingIntent to launch our activity if the user selects this notification Intent i = new Intent(this, MeActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); /*Bundle bundle = new Bundle(); bundle.putInt("idTrack", soundcloudTrack.getmIdTrack()); i.putExtras(bundle);*/ PendingIntent contentIntent = PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_UPDATE_CURRENT); // Set the info for the views that show in the notification panel. notification.setLatestEventInfo(this, "Uploading...", text, contentIntent); // We show this for as long as our service is processing a command. notification.flags |= Notification.FLAG_ONGOING_EVENT | Notification.FLAG_AUTO_CANCEL; notification.number = totalUploads; // Send the notification. // We use a string id because it is a unique number. We use it later to cancel. mNM.notify(777, notification); }