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.sinelead.car.club.map.NaviMainFragmentBottom.java
void init() { // // ww w. ja v a 2 s . c o m View navView = view.findViewById(R.id.layout_nav); navView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // activity Intent intent = new Intent(getActivity(), PositionSearchActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); return; } }); }
From source file:com.kasungunathilaka.sarigama.service.PlayerService.java
private static void startIntent(Context context, Class<?> cls) { Intent intent = new Intent(context, cls); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);//w w w .j a v a 2 s . c om }
From source file:org.voidsink.anewjkuapp.notification.PoiNotification.java
public void show() { if (mInserts.size() > 0 || mUpdates.size() > 0) { PendingIntent pendingIntent = PendingIntent.getActivity(mContext, NOTIFICATION_POI_CHANGED, new Intent(mContext, MainActivity.class) .putExtra(MainActivity.ARG_SHOW_FRAGMENT_ID, R.id.nav_map) .addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT), 0);//w ww . ja va 2 s .co 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(mContext.getText(R.string.notification_poi_changed_title)) .setContentText(String.format(mContext.getString(R.string.notification_poi_changed), (mInserts.size() + mUpdates.size()))) .setContentIntent(pendingIntent).setAutoCancel(true) .setNumber(mInserts.size() + mUpdates.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_poi_changed), (mInserts.size() + mUpdates.size()))); Collections.sort(mInserts); for (String text : mInserts) { inBoxStyle.addLine(text); } Collections.sort(mUpdates); for (String text : mUpdates) { inBoxStyle.addLine(text); } // Moves the big view style object into the notification object. mBuilder.setStyle(inBoxStyle); ((NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE)) .notify(NOTIFICATION_POI_CHANGED, mBuilder.build()); } }
From source file:com.aegiswallet.actions.CurrencyActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.currency_view); prefs = PreferenceManager.getDefaultSharedPreferences(this); getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); getActionBar().setCustomView(R.layout.aegis_send_actionbar); TextView titleTextView = (TextView) findViewById(R.id.action_bar_title_text); titleTextView.setText(getString(R.string.currencies_activity_label)); ImageButton backButton = (ImageButton) findViewById(R.id.action_bar_icon_back); backButton.setOnClickListener(new View.OnClickListener() { @Override/*from w w w. ja v a 2 s. c om*/ public void onClick(View view) { Intent openMainActivity = new Intent(context, MainActivity.class); openMainActivity.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); context.startActivity(openMainActivity); finish(); } }); ArrayList<CurrencyPojo> currencies = new ArrayList<CurrencyPojo>(); JSONObject jsonObject = BasicUtils.parseJSONData(getApplicationContext(), Constants.BLOCKCHAIN_CURRENCY_FILE_NAME); if (jsonObject != null) { Iterator i = jsonObject.keys(); while (i.hasNext()) { try { String currency = (String) i.next(); JSONObject detailObj = jsonObject.getJSONObject(currency); CurrencyPojo newPojo = new CurrencyPojo(currency, detailObj.getDouble("last"), detailObj.getString("symbol")); currencies.add(newPojo); } catch (JSONException e) { Log.e("Currency Activity", "JSON Exception " + e.getMessage()); } } String currentCurrency = prefs.getString(Constants.CURRENCY_PREF_KEY, null); CurrencyPojo firstPojo = currencies.get(0); for (int j = 0; j < currencies.size(); j++) { CurrencyPojo pojo = currencies.get(j); if (pojo.getCurrency().equals(currentCurrency)) { currencies.set(0, pojo); currencies.set(j, firstPojo); } } } CurrencyAdapter currencyAdapter = new CurrencyAdapter(this, R.layout.currency_list_item, currencies, prefs); ListView transactionListView = (ListView) findViewById(R.id.currency_list); transactionListView.setAdapter(currencyAdapter); }
From source file:net.callmeike.android.mojowire.ui.MainActivity.java
@Override public void onAddPodcast() { Intent i = new Intent(this, PodcastDetailActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(i);// w w w . ja v a2s. com }
From source file:org.voidsink.anewjkuapp.notification.NewExamNotification.java
public void show() { if (PreferenceWrapper.getNotifyExam(mContext) && (mInserts.size() > 0 || mUpdates.size() > 0)) { PendingIntent pendingIntent = PendingIntent.getActivity(mContext, NOTIFICATION_NEW_EXAM, new Intent(mContext, MainActivity.class) .putExtra(MainActivity.ARG_SHOW_FRAGMENT_ID, R.id.nav_exams) .addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT), 0);// ww w . j a va2s .co 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(mContext.getText(R.string.notification_new_exams_title)) .setContentText(String.format(mContext.getString(R.string.notification_new_exams), (mInserts.size() + mUpdates.size()))) .setContentIntent(pendingIntent).setAutoCancel(true) .setNumber(mInserts.size() + mUpdates.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_new_exams), (mInserts.size() + mUpdates.size()))); Collections.sort(mInserts); for (String text : mInserts) { inBoxStyle.addLine(text); } Collections.sort(mUpdates); for (String text : mUpdates) { inBoxStyle.addLine(text); } // Moves the big view style object into the notification object. mBuilder.setStyle(inBoxStyle); ((NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE)) .notify(NOTIFICATION_NEW_EXAM, mBuilder.build()); } }
From source file:org.voidsink.anewjkuapp.notification.AssessmentChangedNotification.java
public void show() { if (PreferenceWrapper.getNotifyGrade(mContext) && (mInserts.size() > 0 || mUpdates.size() > 0)) { PendingIntent pendingIntent = PendingIntent.getActivity(mContext, NOTIFICATION_GRADES_CHANGED, new Intent(mContext, MainActivity.class) .putExtra(MainActivity.ARG_SHOW_FRAGMENT_ID, R.id.nav_grades) .addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT), 0);//from w w w . j a va2 s . co 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(mContext.getText(R.string.notification_grades_changed_title)) .setContentText(String.format(mContext.getString(R.string.notification_grades_changed), (mInserts.size() + mUpdates.size()))) .setContentIntent(pendingIntent).setAutoCancel(true) .setNumber(mInserts.size() + mUpdates.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_grades_changed), (mInserts.size() + mUpdates.size()))); Collections.sort(mInserts); for (String text : mInserts) { inBoxStyle.addLine(text); } Collections.sort(mUpdates); for (String text : mUpdates) { inBoxStyle.addLine(text); } // Moves the big view style object into the notification object. mBuilder.setStyle(inBoxStyle); ((NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE)) .notify(NOTIFICATION_GRADES_CHANGED, mBuilder.build()); } }
From source file:com.example.google.location.GeoFenceIntentReceiver.java
@Override public void onReceive(Context context, Intent intent) { if (!intent.getAction().equals(LocationActivity.ACTION_GEOFENCE)) { return;//from w w w. ja v a 2 s. c o m } boolean hasError = LocationClient.hasError(intent); if (hasError) { // This is an intent that indicates error. Log.v(LocationActivity.TAG, "hasError == true"); return; } int transition = LocationClient.getGeofenceTransition(intent); List<Geofence> list = LocationClient.getTriggeringGeofences(intent); if (transition == -1 || list == null) { Log.v(LocationActivity.TAG, "list == null OR " + transition); return; } Log.v(LocationActivity.TAG, "geo_fence transition == " + transition); ArrayList<String> requestIds = new ArrayList<String>(); for (Geofence geoFence : list) { requestIds.add(geoFence.getRequestId()); } Bundle bundle = new Bundle(); bundle.putStringArrayList("request_ids", requestIds); // Create a new intent and set extra arguments which contain the // request_ids of geofences triggered and corresponding transition. Intent myIntent = new Intent(context, LocationActivity.class); myIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK); myIntent.putExtra("RECEIVER_STARTED", true); myIntent.putExtra("geo_fences", bundle); myIntent.putExtra("transition", transition); if (LocationActivity.isAppForeground) { context.startActivity(myIntent); } else { // Send a notification when the app is in the background String transitionText = transition == Geofence.GEOFENCE_TRANSITION_ENTER ? context.getResources().getString(R.string.enter) : context.getResources().getString(R.string.leave); Bitmap genFenceBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.geofence); Notification n = new NotificationCompat.Builder(context) .setContentTitle(context.getResources().getString(R.string.app_name)) .setSmallIcon(R.drawable.ic_notify).setDefaults(Notification.DEFAULT_SOUND) .setStyle(new NotificationCompat.BigPictureStyle() .bigPicture(genFenceBitmap).setSummaryText(transitionText)) .setContentText(transitionText) .setContentIntent( PendingIntent.getActivity(context, 0, myIntent, PendingIntent.FLAG_UPDATE_CURRENT)) .setAutoCancel(true).build(); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(1, n); } }
From source file:com.juick.android.XMPPMessageReceiver.java
@Override public void onReceive(final Context context, final Intent intent) { if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) { context.startService(new Intent(context, XMPPService.class)); }/*w ww. j a v a2 s. c o m*/ if (intent.getAction().equals(XMPPService.ACTION_MESSAGE_RECEIVED)) { int nMessages = intent.getIntExtra("messagesCount", 0); boolean sound = intent.getBooleanExtra("sound", true); XMPPService.IncomingMessage messag = (XMPPService.IncomingMessage) intent .getSerializableExtra("message"); if (nMessages == 0) return; ArrayList<MessageReceiverListener> allListeners = (ArrayList<MessageReceiverListener>) listeners .clone(); boolean handled = false; for (MessageReceiverListener listener : allListeners) { handled |= listener.onMessageReceived(messag); } if (!handled) { updateInfo(context, nMessages, !sound); } } if (intent.getAction().equals(XMPPService.ACTION_LAUNCH_MESSAGELIST)) { Intent nintent = new Intent(context, XMPPIncomingMessagesActivity.class); nintent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); nintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(nintent); } }
From source file:com.Duo.music.player.NowPlayingQueueActivity.NowPlayingQueueActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { mContext = this; sharedPreferences = getSharedPreferences("com.jams.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);//from ww w . j a v a2s. 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)); } }