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:in.sundar.unitconverter.FormulaeListActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // Expression evaluator screen case R.id.action_expreval: { Intent i = new Intent(this, ExprEvalActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(i);/*from w w w. j a v a 2 s . c om*/ } break; // New user defined formula addition screen case R.id.action_add_formula: { Intent i = new Intent(this, AddModifyFormulaActivity.class); startActivityForResult(i, FORMULA_ADD); } } return super.onOptionsItemSelected(item); }
From source file:com.commonsware.android.sawmonitor.PackageReceiver.java
private void seeSAW(Context ctxt, String pkg, boolean isReplace) { if (hasSAW(ctxt, pkg)) { Uri pkgUri = Uri.parse("package:" + pkg); Intent manage = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION); manage.setData(pkgUri);/*from w ww.j a v a2s .c om*/ Intent whitelist = new Intent(ctxt, WhitelistReceiver.class); whitelist.setData(pkgUri); Intent main = new Intent(ctxt, MainActivity.class); main.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); NotificationCompat.Builder b = new NotificationCompat.Builder(ctxt); String text = String.format(ctxt.getString(R.string.msg_requested), isReplace ? ctxt.getString(R.string.msg_upgraded) : ctxt.getString(R.string.msg_installed), pkg); b.setAutoCancel(true).setDefaults(Notification.DEFAULT_ALL).setWhen(System.currentTimeMillis()) .setContentTitle(ctxt.getString(R.string.msg_detected)).setContentText(text) .setSmallIcon(android.R.drawable.stat_notify_error) .setTicker(ctxt.getString(R.string.msg_detected)) .setContentIntent(PendingIntent.getActivity(ctxt, 0, manage, PendingIntent.FLAG_UPDATE_CURRENT)) .addAction(R.drawable.ic_verified_user_24dp, ctxt.getString(R.string.msg_whitelist), PendingIntent.getBroadcast(ctxt, 0, whitelist, 0)) .addAction(R.drawable.ic_settings_24dp, ctxt.getString(R.string.msg_settings), PendingIntent.getActivity(ctxt, 0, main, 0)); NotificationManager mgr = (NotificationManager) ctxt.getSystemService(Context.NOTIFICATION_SERVICE); mgr.notify(NOTIFY_ID, b.build()); } }
From source file:io.github.hidroh.materialistic.DrawerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setContentView(R.layout.activity_drawer); mDrawer = findViewById(R.id.drawer); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerAccount = (TextView) findViewById(R.id.drawer_account); mDrawerLogout = findViewById(R.id.drawer_logout); mDrawerUser = findViewById(R.id.drawer_user); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.open_drawer, R.string.close_drawer) {/*from w w w . ja va 2s.c o m*/ @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); if (drawerView.equals(mDrawer) && mPendingNavigation != null) { final Intent intent = new Intent(DrawerActivity.this, mPendingNavigation); if (mPendingNavigationExtras != null) { intent.putExtras(mPendingNavigationExtras); mPendingNavigationExtras = null; } // TODO M bug https://code.google.com/p/android/issues/detail?id=193822 intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); mPendingNavigation = null; } } }; mDrawerLayout.addDrawerListener(mDrawerToggle); PreferenceManager.getDefaultSharedPreferences(this) .registerOnSharedPreferenceChangeListener(mLoginListener); setUpDrawer(); setUsername(); }
From source file:cz.muni.fi.japanesedictionary.main.DisplaySentenceInfoActivity.java
/** * Listener for menu item selected./* w w w . j a va2s . c om*/ * * @param item - home item selected, restarts main activity * - settings item selceted, launches new MypreferenceActivity * - other item, default behavior */ @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.settings: Log.i(LOG_TAG, "Lauching preference Activity"); Intent intentSetting = new Intent(this.getApplicationContext(), MyPreferencesActivity.class); intentSetting.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intentSetting); return true; case R.id.about: Log.i(LOG_TAG, "Lauching About Activity"); Intent intentAbout = new Intent(this.getApplicationContext(), AboutActivity.class); intentAbout.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intentAbout); return true; case android.R.id.home: finish(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:cz.muni.fi.japanesedictionary.main.DisplayCharacterInfoActivity.java
/** * Listener for menu item selected./*from w w w . j av a2 s.co m*/ * * @param item - home item selected, restarts main activity * - settings item selceted, launches new MypreferenceActivity * - other item, default behavior */ @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.settings: Log.i(LOG_TAG, "Lauching preference Activity"); Intent intentSetting = new Intent(this.getApplicationContext(), cz.muni.fi.japanesedictionary.main.MyPreferencesActivity.class); intentSetting.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intentSetting); return true; case R.id.about: Log.i(LOG_TAG, "Lauching About Activity"); Intent intentAbout = new Intent(this.getApplicationContext(), cz.muni.fi.japanesedictionary.main.AboutActivity.class); intentAbout.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intentAbout); return true; case android.R.id.home: Log.i(LOG_TAG, "home: finish"); finish(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.maryplasez.spicemeapp.MyFirebaseMessagingService.java
/** * Create and show a simple notification containing the received FCM message. * * @param messageBody FCM message body received. */// www. ja v a 2 s .c om private void sendNotification(String messageBody) { String title = "I want to lick you till you swear allegiance to the empire"; Intent intent = new Intent(this, ChatActivity.class); intent.putExtra("PUSH", title); intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.mipmap.icon).setContentTitle(title).setContentText(messageBody).setAutoCancel(true) .setSound(defaultSoundUri).setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); }
From source file:org.voidsink.anewjkuapp.activity.MainActivity.java
public static void StartMyCurricula(Context context) { ///*from w w w . ja va 2s .c om*/ Intent i = new Intent(context, MainActivity.class) .putExtra(MainActivity.ARG_SHOW_FRAGMENT_ID, R.id.nav_curricula) .addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); context.startActivity(i); }
From source file:com.projects.utils.GcmIntentService.java
private void sendNotification(String msg, Bundle extras) { mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); Intent thisintent = new Intent(this, SyncActivity.class); thisintent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) // .setSmallIcon(R.drawable.ic_stat_gcm) .setContentTitle("Treckon").setSmallIcon(R.drawable.ic_launcher) .setStyle(new NotificationCompat.BigTextStyle().bigText(msg)).setContentText(msg) .setAutoCancel(true);// w w w . ja v a 2 s .c o m if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { PendingIntent contentIntent = PendingIntent.getActivity(this, 0, thisintent, PendingIntent.FLAG_UPDATE_CURRENT, extras); mBuilder.setContentIntent(contentIntent); } Notification nf = mBuilder.build(); nf.defaults = Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE; mNotificationManager.notify(NOTIFICATION_ID, nf); }
From source file:pl.kodujdlapolski.na4lapy.ui.drawer.DrawerActivityHandler.java
protected boolean onNavigationItemSelected(MenuItem item) { Intent intent = null;/*w w w. j a v a 2 s .c o m*/ int id = item.getItemId(); Class<?> clazz = activity.getClass(); if (id == R.id.browser && !(clazz.equals(SingleBrowseActivity.class))) { intent = new Intent(context, SingleBrowseActivity.class); } else if (id == R.id.favourites && !(clazz.equals(ListBrowseActivity.class))) { intent = new Intent(context, ListBrowseActivity.class); } else if (id == R.id.preferences && !(clazz.equals(PreferencesActivity.class))) { intent = new Intent(context, PreferencesActivity.class); } else if (id == R.id.aboutShelter && !(clazz.equals(AboutShelterActivity.class))) { intent = new Intent(context, AboutShelterActivity.class); Shelter shelter = new Shelter(); shelter.setId(1L); intent.putExtra(AboutShelterActivity.EXTRA_SHELTER_ID, 1l); } else if (id == R.id.makePayment && !(clazz.equals(PaymentActivity.class))) { intent = new Intent(context, PaymentActivity.class); intent.putExtra(PaymentContract.KEY_SHELTER_ID, 1L); } else if (id == R.id.settings && !(clazz.equals(SettingsActivity.class))) { intent = new Intent(context, SettingsActivity.class); } if (intent != null) { int flags = Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT; if (clazz.equals(SingleBrowseActivity.class)) { flags = flags | (Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); } intent.setFlags(flags); activity.startActivity(intent); activity.overridePendingTransition(0, 0); } return true; }
From source file:com.bonsai.btcreceive.BaseWalletActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items Intent intent;/*from w w w . java2 s .c o m*/ switch (item.getItemId()) { case R.id.action_settings: intent = new Intent(this, SettingsActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); return true; case R.id.action_about: intent = new Intent(this, AboutActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); return true; case R.id.action_exit: doExit(); return true; default: return super.onOptionsItemSelected(item); } }