List of usage examples for android.content Intent FLAG_ACTIVITY_REORDER_TO_FRONT
int FLAG_ACTIVITY_REORDER_TO_FRONT
To view the source code for android.content Intent FLAG_ACTIVITY_REORDER_TO_FRONT.
Click Source Link
From source file:com.jelly.music.player.NowPlayingQueueActivity.NowPlayingQueueActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { mContext = this; sharedPreferences = getSharedPreferences("com.jelly.music.player", Context.MODE_PRIVATE); //Get the screen's parameters. DisplayMetrics displayMetrics = new DisplayMetrics(); this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int screenWidth = displayMetrics.widthPixels; //Set the UI theme. if (sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME").equals("DARK_THEME") || sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME") .equals("DARK_CARDS_THEME")) { setTheme(R.style.AppTheme);// w ww.j a v a 2 s . com } else { setTheme(R.style.AppThemeLight); } super.onCreate(savedInstanceState); if (getOrientation().equals("PORTRAIT")) { //Finish this activity and relaunch the activity that called this one. Intent intent = new Intent(this, (Class<?>) getIntent().getSerializableExtra("CALLING_CLASS")); intent.putExtras(getIntent()); intent.putExtra("NEW_PLAYLIST", false); intent.putExtra("CALLED_FROM_FOOTER", true); intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); finish(); startActivity(intent); return; } else { setContentView(R.layout.activity_now_playing_queue); final Fragment nowPlayingQueueFragment = new NowPlayingQueueFragment(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.now_playing_queue_container, nowPlayingQueueFragment, "nowPlayingQueueFragment"); transaction.commit(); SpannableString s = new SpannableString(getResources().getString(R.string.current_queue)); s.setSpan(new TypefaceSpan(this, "RobotoCondensed-Light"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // Update the action bar title with the TypefaceSpan instance. ActionBar actionBar = getActionBar(); actionBar.setTitle(s); actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.holo_gray_selector)); } }
From source file:com.commonsware.cwac.cam2.playground.VideoFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.take_picture) { takePicture();//from w w w . j ava 2s.c o m return (true); } else if (item.getItemId() == R.id.picture_activity) { startActivity(new Intent(getActivity(), PictureActivity.class) .addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)); } return super.onOptionsItemSelected(item); }
From source file:com.aniruddhc.acemusic.player.NowPlayingQueueActivity.NowPlayingQueueActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { mContext = this; sharedPreferences = getSharedPreferences("com.aniruddhc.acemusic.player", Context.MODE_PRIVATE); //Get the screen's parameters. DisplayMetrics displayMetrics = new DisplayMetrics(); this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int screenWidth = displayMetrics.widthPixels; //Set the UI theme. if (sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME").equals("DARK_THEME") || sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME") .equals("DARK_CARDS_THEME")) { setTheme(R.style.AppTheme);/* w ww . j a v a2 s. co m*/ } else { setTheme(R.style.AppThemeLight); } super.onCreate(savedInstanceState); if (getOrientation().equals("PORTRAIT")) { //Finish this activity and relaunch the activity that called this one. Intent intent = new Intent(this, (Class<?>) getIntent().getSerializableExtra("CALLING_CLASS")); intent.putExtras(getIntent()); intent.putExtra("NEW_PLAYLIST", false); intent.putExtra("CALLED_FROM_FOOTER", true); intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); finish(); startActivity(intent); return; } else { setContentView(R.layout.activity_now_playing_queue); final Fragment nowPlayingQueueFragment = new NowPlayingQueueFragment(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.now_playing_queue_container, nowPlayingQueueFragment, "nowPlayingQueueFragment"); transaction.commit(); SpannableString s = new SpannableString(getResources().getString(R.string.current_queue)); s.setSpan(new TypefaceSpan(this, "RobotoCondensed-Light"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // Update the action bar title with the TypefaceSpan instance. ActionBar actionBar = getActionBar(); actionBar.setTitle(s); actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.holo_gray_selector)); } }
From source file:io.selendroid.ServerInstrumentation.java
public void startActivity(Class activity) { if (activity == null) { SelendroidLogger.log("activity class is empty", new NullPointerException("Activity class to start is null.")); return;/* w w w .ja v a 2 s .com*/ } finishAllActivities(); // start now the new activity Intent intent = new Intent(getTargetContext(), activity); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setAction(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); Activity a = startActivitySync(intent); }
From source file:com.commonsware.cwac.cam2.playground.PictureFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.take_picture) { takePicture();/*w ww .j a v a 2 s.com*/ return (true); } else if (item.getItemId() == R.id.video_activity) { startActivity( new Intent(getActivity(), VideoActivity.class).addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)); } return super.onOptionsItemSelected(item); }
From source file:org.voidsink.anewjkuapp.notification.CalendarChangedNotification.java
public void show() { if (PreferenceWrapper.getNotifyCalendar(mContext) && (mInserts.size() > 0 || mUpdates.size() > 0 || mDeletes.size() > 0)) { PendingIntent pendingIntent = PendingIntent.getActivity(mContext, NOTIFICATION_CALENDAR_CHANGED, new Intent(mContext, MainActivity.class) .putExtra(MainActivity.ARG_SHOW_FRAGMENT_ID, R.id.nav_cal) .addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT), 0);//w ww . ja va2 s .c o m NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mContext) .setSmallIcon(R.drawable.ic_stat_notify_kusss) // .setLargeIcon( // BitmapFactory.decodeResource( // mContext.getResources(), // R.drawable.ic_launcher_grey)) .setContentIntent(pendingIntent) .setContentTitle( String.format(mContext.getString(R.string.notification_events_changed_title), mName)) .setContentText(String.format(mContext.getString(R.string.notification_events_changed), (mInserts.size() + mUpdates.size() + mDeletes.size()), mName)) .setContentIntent(pendingIntent).setAutoCancel(true) .setNumber(mInserts.size() + mUpdates.size() + mDeletes.size()); // creates big view with all grades in inbox style NotificationCompat.InboxStyle inBoxStyle = new NotificationCompat.InboxStyle(); inBoxStyle.setBigContentTitle(String.format(mContext.getString(R.string.notification_events_changed), (mInserts.size() + mUpdates.size() + mDeletes.size()), mName)); Collections.sort(mInserts); for (String text : mInserts) { inBoxStyle.addLine(text); } Collections.sort(mUpdates); for (String text : mUpdates) { inBoxStyle.addLine(text); } Collections.sort(mDeletes); for (String text : mDeletes) { inBoxStyle.addLine(text); } // Moves the big view style object into the notification object. mBuilder.setStyle(inBoxStyle); ((NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE)) .notify(NOTIFICATION_CALENDAR_CHANGED + mName.hashCode(), mBuilder.build()); } }
From source file:com.maryplasez.spicemeapp.MyFirebaseMessagingService.java
/** * Called when message is received.// ww w. j a va 2 s . co m * * @param remoteMessage Object representing the message received from Firebase Cloud Messaging. */ // [START receive_message] @Override public void onMessageReceived(RemoteMessage remoteMessage) { // [START_EXCLUDE] // There are two types of messages data messages and notification messages. Data messages are handled // here in onMessageReceived whether the app is in the foreground or background. Data messages are the type // traditionally used with GCM. Notification messages are only received here in onMessageReceived when the app // is in the foreground. When the app is in the background an automatically generated notification is displayed. // When the user taps on the notification they are returned to the app. Messages containing both notification // and data payloads are treated as notification messages. The Firebase console always sends notification // messages. For more see: https://firebase.google.com/docs/cloud-messaging/concept-options // [END_EXCLUDE] // TODO(developer): Handle FCM messages here. // Not getting messages here? See why this may be: https://goo.gl/39bRNJ Log.d(TAG, "From: " + remoteMessage.getFrom()); // Check if message contains a data payload. if (remoteMessage.getData().size() > 0) { Log.d(TAG, "Message data payload: " + remoteMessage.getData()); } // Check if message contains a notification payload. if (remoteMessage.getNotification() != null) { Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody()); } Intent intent = new Intent(getBaseContext(), ChatActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); // Also if you intend on generating your own notifications as a result of a received FCM // message, here is where that should be initiated. See sendNotification method below. }
From source file:com.android.calendar.selectcalendars.SelectVisibleCalendarsActivity.java
public void handleSelectSyncedCalendarsClicked(View v) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClass(this, SelectSyncedCalendarsMultiAccountActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(intent);/* w ww .ja v a2 s.c om*/ }
From source file:net.zionsoft.obadiah.BookSelectionActivity.java
public static Intent newStartReorderToTopIntent(Context context) { final Intent startIntent = newStartIntent(context); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { // there's some horrible issue with FLAG_ACTIVITY_REORDER_TO_FRONT for KitKat and above // ref. https://code.google.com/p/android/issues/detail?id=63570 startIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); }/*from w ww. j a v a 2 s . c o m*/ return startIntent; }
From source file:com.commontime.plugin.notification.notification.AbstractActionClickActivity.java
/** * Launch main intent from package.//w w w. j a v a2 s.c om */ public void launchApp() { Context context = getApplicationContext(); String pkgName = context.getPackageName(); Intent intent = context.getPackageManager().getLaunchIntentForPackage(pkgName); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP); context.startActivity(intent); }