Example usage for android.content Intent FLAG_ACTIVITY_REORDER_TO_FRONT

List of usage examples for android.content Intent FLAG_ACTIVITY_REORDER_TO_FRONT

Introduction

In this page you can find the example usage for android.content Intent FLAG_ACTIVITY_REORDER_TO_FRONT.

Prototype

int FLAG_ACTIVITY_REORDER_TO_FRONT

To view the source code for android.content Intent FLAG_ACTIVITY_REORDER_TO_FRONT.

Click Source Link

Document

If set in an Intent passed to Context#startActivity Context.startActivity() , this flag will cause the launched activity to be brought to the front of its task's history stack if it is already running.

Usage

From source file:com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPush.java

public static void openMainActivityOnNotificationClick(Context ctx) {
    Intent intentToLaunch = ctx.getPackageManager().getLaunchIntentForPackage(ctx.getPackageName());

    if (intentToLaunch != null) {
        intentToLaunch.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
        ctx.startActivity(intentToLaunch);
    }//from   ww  w.  j a  va2s.c  o m
}

From source file:com.android.calendar.AllInOneActivity.java

@Override
public void handleEvent(EventInfo event) {
    long displayTime = -1;
    if (event.eventType == EventType.GO_TO) {
        if ((event.extraLong & CalendarController.EXTRA_GOTO_BACK_TO_PREVIOUS) != 0) {
            mBackToPreviousView = true;//from   www.  ja v  a  2s . com
        } else if (event.viewType != mController.getPreviousViewType() && event.viewType != ViewType.EDIT) {
            // Clear the flag is change to a different view type
            mBackToPreviousView = false;
        }

        setMainPane(null, R.id.main_pane, event.viewType, event.startTime.toMillis(false), false);
        if (mSearchView != null) {
            mSearchView.clearFocus();
        }
        if (mShowCalendarControls) {
            int animationSize = (mOrientation == Configuration.ORIENTATION_LANDSCAPE) ? mControlsAnimateWidth
                    : mControlsAnimateHeight;
            boolean noControlsView = event.viewType == ViewType.MONTH || event.viewType == ViewType.AGENDA;
            if (mControlsMenu != null) {
                mControlsMenu.setVisible(!noControlsView);
                mControlsMenu.setEnabled(!noControlsView);
            }
            if (noControlsView || mHideControls) {
                // hide minimonth and calendar frag
                mShowSideViews = false;
                if (!mHideControls) {
                    final ObjectAnimator slideAnimation = ObjectAnimator.ofInt(this, "controlsOffset", 0,
                            animationSize);
                    slideAnimation.addListener(mSlideAnimationDoneListener);
                    slideAnimation.setDuration(mCalendarControlsAnimationTime);
                    ObjectAnimator.setFrameDelay(0);
                    slideAnimation.start();
                } else {
                    mMiniMonth.setVisibility(View.GONE);
                    mCalendarsList.setVisibility(View.GONE);
                    mMiniMonthContainer.setVisibility(View.GONE);
                }
            } else {
                // show minimonth and calendar frag
                mShowSideViews = true;
                mMiniMonth.setVisibility(View.VISIBLE);
                mCalendarsList.setVisibility(View.VISIBLE);
                mMiniMonthContainer.setVisibility(View.VISIBLE);
                if (!mHideControls && (mController.getPreviousViewType() == ViewType.MONTH
                        || mController.getPreviousViewType() == ViewType.AGENDA)) {
                    final ObjectAnimator slideAnimation = ObjectAnimator.ofInt(this, "controlsOffset",
                            animationSize, 0);
                    slideAnimation.setDuration(mCalendarControlsAnimationTime);
                    ObjectAnimator.setFrameDelay(0);
                    slideAnimation.start();
                }
            }
        }
        displayTime = event.selectedTime != null ? event.selectedTime.toMillis(true)
                : event.startTime.toMillis(true);
        if (!mIsTabletConfig) {
            refreshActionbarTitle(displayTime);
        }
    } else if (event.eventType == EventType.VIEW_EVENT) {

        // If in Agenda view and "show_event_details_with_agenda" is "true",
        // do not create the event info fragment here, it will be created by the Agenda
        // fragment

        if (mCurrentView == ViewType.AGENDA && mShowEventDetailsWithAgenda) {
            if (event.startTime != null && event.endTime != null) {
                // Event is all day , adjust the goto time to local time
                if (event.isAllDay()) {
                    Utils.convertAlldayUtcToLocal(event.startTime, event.startTime.toMillis(false), mTimeZone);
                    Utils.convertAlldayUtcToLocal(event.endTime, event.endTime.toMillis(false), mTimeZone);
                }
                mController.sendEvent(this, EventType.GO_TO, event.startTime, event.endTime, event.selectedTime,
                        event.id, ViewType.AGENDA, CalendarController.EXTRA_GOTO_TIME, null, null);
            } else if (event.selectedTime != null) {
                mController.sendEvent(this, EventType.GO_TO, event.selectedTime, event.selectedTime, event.id,
                        ViewType.AGENDA);
            }
        } else {
            // TODO Fix the temp hack below: && mCurrentView !=
            // ViewType.AGENDA
            if (event.selectedTime != null && mCurrentView != ViewType.AGENDA) {
                mController.sendEvent(this, EventType.GO_TO, event.selectedTime, event.selectedTime, -1,
                        ViewType.CURRENT);
            }
            int response = event.getResponse();
            if ((mCurrentView == ViewType.AGENDA && mShowEventInfoFullScreenAgenda)
                    || ((mCurrentView == ViewType.DAY || (mCurrentView == ViewType.WEEK)
                            || mCurrentView == ViewType.MONTH) && mShowEventInfoFullScreen)) {
                // start event info as activity
                Intent intent = new Intent(Intent.ACTION_VIEW);
                Uri eventUri = ContentUris.withAppendedId(Events.CONTENT_URI, event.id);
                intent.setData(eventUri);
                intent.setClass(this, EventInfoActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP);
                intent.putExtra(EXTRA_EVENT_BEGIN_TIME, event.startTime.toMillis(false));
                intent.putExtra(EXTRA_EVENT_END_TIME, event.endTime.toMillis(false));
                intent.putExtra(ATTENDEE_STATUS, response);
                startActivity(intent);
            } else {
                // start event info as a dialog
                EventInfoFragment fragment = new EventInfoFragment(this, event.id,
                        event.startTime.toMillis(false), event.endTime.toMillis(false), response, true,
                        EventInfoFragment.DIALOG_WINDOW_STYLE, null /* No reminders to explicitly pass in. */);
                fragment.setDialogParams(event.x, event.y, mActionBar.getHeight());
                FragmentManager fm = getFragmentManager();
                FragmentTransaction ft = fm.beginTransaction();
                // if we have an old popup replace it
                Fragment fOld = fm.findFragmentByTag(EVENT_INFO_FRAGMENT_TAG);
                if (fOld != null && fOld.isAdded()) {
                    ft.remove(fOld);
                }
                ft.add(fragment, EVENT_INFO_FRAGMENT_TAG);
                ft.commit();
            }
        }
        displayTime = event.startTime.toMillis(true);
    } else if (event.eventType == EventType.UPDATE_TITLE) {
        setTitleInActionBar(event);
        if (!mIsTabletConfig) {
            refreshActionbarTitle(mController.getTime());
        }
    }
    updateSecondaryTitleFields(displayTime);
}

From source file:com.csipsimple.service.SipService.java

public static Intent buildCallUiIntent(Context ctxt, SipCallSession callInfo) {
    // Resolve the package to handle call.
    if (UI_CALL_PACKAGE == null) {
        UI_CALL_PACKAGE = ctxt.getPackageName();
        try {//from  ww  w .j  av  a2  s.c o  m
            Map<String, DynActivityPlugin> callsUis = ExtraPlugins.getDynActivityPlugins(ctxt,
                    SipManager.ACTION_SIP_CALL_UI);
            String preferredPackage = SipConfigManager.getPreferenceStringValue(ctxt,
                    SipConfigManager.CALL_UI_PACKAGE, UI_CALL_PACKAGE);
            String packageName = null;
            boolean foundPref = false;
            for (String activity : callsUis.keySet()) {
                packageName = activity.split("/")[0];

                if (preferredPackage.equalsIgnoreCase(packageName)) {
                    UI_CALL_PACKAGE = packageName;
                    foundPref = true;
                    break;
                }
            }
            if (!foundPref && !TextUtils.isEmpty(packageName)) {
                UI_CALL_PACKAGE = packageName;
            }
        } catch (Exception e) {
            Log.e(THIS_FILE, "Error while resolving package", e);
        }
    }
    SipCallSession toSendInfo = new SipCallSession(callInfo);
    Intent intent = new Intent(SipManager.ACTION_SIP_CALL_UI);
    intent.putExtra(SipManager.EXTRA_CALL_INFO, toSendInfo);
    intent.setPackage(UI_CALL_PACKAGE);
    //??
    //intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP );
    intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}

From source file:co.beem.project.beem.FbTextService.java

private PendingIntent makeChatIntent(User user) {
    Intent chatIntent = new Intent(FbTextService.this, FbTextMainActivity.class);
    chatIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP
            | Intent.FLAG_ACTIVITY_NEW_TASK);
    try {/*from  w  w  w  .  ja  v  a 2 s  .c o  m*/
        chatIntent.setData(user.toUri());
    } catch (Exception e) {
        if (FbTextApplication.isDebug)
            Log.e(TAG, e.getMessage());
    }
    PendingIntent contentIntent = PendingIntent.getActivity(FbTextService.this, 0, chatIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    return contentIntent;
}

From source file:org.mozilla.gecko.BrowserApp.java

@Override
public void handleMessage(String event, JSONObject message) {
    try {/*from   www  . j a va  2 s.c  o m*/
        if (event.equals("Menu:Open")) {
            if (mBrowserToolbar.isEditing()) {
                mBrowserToolbar.cancelEdit();
            }

            openOptionsMenu();
        } else if (event.equals("Menu:Update")) {
            final int id = message.getInt("id") + ADDON_MENU_OFFSET;
            final JSONObject options = message.getJSONObject("options");
            ThreadUtils.postToUiThread(new Runnable() {
                @Override
                public void run() {
                    updateAddonMenuItem(id, options);
                }
            });
        } else if (event.equals("Gecko:DelayedStartup")) {
            ThreadUtils.postToUiThread(new Runnable() {
                @Override
                public void run() {
                    // Force tabs panel inflation once the initial
                    // pageload is finished.
                    ensureTabsPanelExists();
                }
            });

            if (AppConstants.MOZ_MEDIA_PLAYER) {
                // Check if the fragment is already added. This should never be true here, but this is
                // a nice safety check.
                // If casting is disabled, these classes aren't built. We use reflection to initialize them.
                final Class<?> mediaManagerClass = getMediaPlayerManager();

                if (mediaManagerClass != null) {
                    try {
                        final String tag = "";
                        mediaManagerClass.getDeclaredField("MEDIA_PLAYER_TAG").get(tag);
                        Log.i(LOGTAG, "Found tag " + tag);
                        final Fragment frag = getSupportFragmentManager().findFragmentByTag(tag);
                        if (frag == null) {
                            final Method getInstance = mediaManagerClass.getMethod("newInstance",
                                    (Class[]) null);
                            final Fragment mpm = (Fragment) getInstance.invoke(null);
                            getSupportFragmentManager().beginTransaction().disallowAddToBackStack()
                                    .add(mpm, tag).commit();
                        }
                    } catch (Exception ex) {
                        Log.e(LOGTAG, "Error initializing media manager", ex);
                    }
                }
            }

            if (AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED
                    && RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_LOCATION_SERVICE)) {
                // Start (this acts as ping if started already) the stumbler lib; if the stumbler has queued data it will upload it.
                // Stumbler operates on its own thread, and startup impact is further minimized by delaying work (such as upload) a few seconds.
                // Avoid any potential startup CPU/thread contention by delaying the pref broadcast.
                final long oneSecondInMillis = 1000;
                ThreadUtils.getBackgroundHandler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        GeckoPreferences.broadcastStumblerPref(BrowserApp.this);
                    }
                }, oneSecondInMillis);
            }

            super.handleMessage(event, message);
        } else if (event.equals("Gecko:Ready")) {
            // Handle this message in GeckoApp, but also enable the Settings
            // menuitem, which is specific to BrowserApp.
            super.handleMessage(event, message);
            final Menu menu = mMenu;
            ThreadUtils.postToUiThread(new Runnable() {
                @Override
                public void run() {
                    if (menu != null) {
                        menu.findItem(R.id.settings).setEnabled(true);
                        menu.findItem(R.id.help).setEnabled(true);
                    }
                }
            });

            // Display notification for Mozilla data reporting, if data should be collected.
            if (AppConstants.MOZ_DATA_REPORTING) {
                DataReportingNotification.checkAndNotifyPolicy(GeckoAppShell.getContext());
            }

        } else if (event.equals("Search:Keyword")) {
            storeSearchQuery(message.getString("query"));
        } else if (event.equals("LightweightTheme:Update")) {
            ThreadUtils.postToUiThread(new Runnable() {
                @Override
                public void run() {
                    mDynamicToolbar.setVisible(true, VisibilityTransition.ANIMATE);
                }
            });
        } else if (event.equals("Prompt:ShowTop")) {
            // Bring this activity to front so the prompt is visible..
            Intent bringToFrontIntent = new Intent();
            bringToFrontIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
                    AppConstants.MOZ_ANDROID_BROWSER_INTENT_CLASS);
            bringToFrontIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
            startActivity(bringToFrontIntent);
        } else if (event.equals("Accounts:Exist")) {
            final String kind = message.getString("kind");
            final JSONObject response = new JSONObject();

            if ("any".equals(kind)) {
                response.put("exists", SyncAccounts.syncAccountsExist(getContext())
                        || FirefoxAccounts.firefoxAccountsExist(getContext()));
                EventDispatcher.sendResponse(message, response);
            } else if ("fxa".equals(kind)) {
                response.put("exists", FirefoxAccounts.firefoxAccountsExist(getContext()));
                EventDispatcher.sendResponse(message, response);
            } else if ("sync11".equals(kind)) {
                response.put("exists", SyncAccounts.syncAccountsExist(getContext()));
                EventDispatcher.sendResponse(message, response);
            } else {
                response.put("error", "Unknown kind");
                EventDispatcher.sendError(message, response);
            }
        } else {
            super.handleMessage(event, message);
        }
    } catch (Exception e) {
        Log.e(LOGTAG, "Exception handling message \"" + event + "\":", e);
    }
}

From source file:jmri.enginedriver.throttle.java

@Override
public void onResume() {
    super.onResume();
    mainapp.removeNotification();/*from  w  w w. j a  va  2  s  . co  m*/
    if (mainapp.isForcingFinish()) { // expedite
        mainapp.appIsFinishing = true;
        this.finish();
        overridePendingTransition(0, 0);
        return;
    }
    if (!mainapp.setActivityOrientation(this)) // set screen orientation based on prefs
    {
        Intent in = new Intent().setClass(this, web_activity.class); // if autoWeb and landscape, switch to Web activity
        in.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        navigatingAway = true;
        startActivity(in);
        connection_activity.overridePendingTransition(this, R.anim.fade_in, R.anim.fade_out);
        return;
    }
    navigatingAway = false;
    currentTime = "";
    mainapp.sendMsg(mainapp.comm_msg_handler, message_type.CURRENT_TIME); // request time update

    // format the screen area
    for (int throttleIndex = 0; throttleIndex < mainapp.maxThrottles; throttleIndex++) {
        enable_disable_buttons(throttleIndex);
    }

    gestureFailed = false;
    gestureInProgress = false;

    getCommonPrefs(false);
    getDirectionButtonPrefs();
    setThottleNumLimits();

    clearVolumeAndGamepadAdditionalIndicators();

    getDirectionButtonPrefs();
    setDirectionButtonLabels(); // set all the direction button labels

    setGamepadKeys();

    applySpeedRelatedOptions(); // update all throttles

    set_labels(); // handle labels and update view

    noUrl = getApplicationContext().getResources().getString(R.string.about_page_url);

    if (webView != null) {
        if (!callHiddenWebViewOnResume()) {
            webView.resumeTimers();
        }
        if (noUrl.equals(webView.getUrl()) && webView.canGoBack()) { //unload static url loaded by onPause
            webView.goBack();
        }
    }

    if (mainapp.EStopActivated) {
        speedUpdateAndNotify(0); // update all three throttles
        applySpeedRelatedOptions(); // update all three throttles

        mainapp.EStopActivated = false;
    }

    if (IS_ESU_MCII && isEsuMc2Stopped) {
        if (isEsuMc2AllStopped) {
            // disable buttons for all throttles
            for (int throttleIndex = 0; throttleIndex < mainapp.maxThrottles; throttleIndex++) {
                setEnabledEsuMc2ThrottleScreenButtons(throttleIndex, false);
            }
        } else {
            // disable buttons for current throttle
            setEnabledEsuMc2ThrottleScreenButtons(whichVolume, false);
        }
    }

    // update the direction indicators
    showDirectionIndications();

    if (TMenu != null) {
        for (int throttleIndex = 0; throttleIndex < mainapp.maxThrottles; throttleIndex++) {

            switch (throttleIndex) {
            case 0:
                TMenu.findItem(R.id.EditConsist0_menu).setVisible(mainapp.consists[0].isMulti());
                TMenu.findItem(R.id.EditLightsConsist0_menu).setVisible(mainapp.consists[0].isMulti());
                break;
            case 1:
                TMenu.findItem(R.id.EditLightsConsist1_menu).setVisible(mainapp.consists[1].isMulti());
                TMenu.findItem(R.id.EditConsist1_menu).setVisible(mainapp.consists[1].isMulti());
                break;
            case 2:
                TMenu.findItem(R.id.EditLightsConsist2_menu).setVisible(mainapp.consists[2].isMulti());
                TMenu.findItem(R.id.EditConsist2_menu).setVisible(mainapp.consists[2].isMulti());
                break;
            case 3:
                TMenu.findItem(R.id.EditLightsConsist3_menu).setVisible(mainapp.consists[3].isMulti());
                TMenu.findItem(R.id.EditConsist3_menu).setVisible(mainapp.consists[3].isMulti());
                break;
            case 4:
                TMenu.findItem(R.id.EditLightsConsist4_menu).setVisible(mainapp.consists[4].isMulti());
                TMenu.findItem(R.id.EditConsist4_menu).setVisible(mainapp.consists[4].isMulti());
                break;
            case 5:
                TMenu.findItem(R.id.EditLightsConsist5_menu).setVisible(mainapp.consists[5].isMulti());
                TMenu.findItem(R.id.EditConsist5_menu).setVisible(mainapp.consists[5].isMulti());
                break;
            }
        }
    }

    CookieSyncManager.getInstance().startSync();

    if (!prefAccelerometerShake.equals(ACCELERATOROMETER_SHAKE_NONE)) {
        if (!accelerometerCurrent) { // perference has only just been changed to turn it on
            setupSensor();
        } else {
            sensorManager.registerListener(shakeDetector, accelerometer, SensorManager.SENSOR_DELAY_UI);
        }
    }

    if (((prefKidsTime > 0) && (kidsTimerRunning != KIDS_TIMER_RUNNNING))) {
        mainapp.sendMsg(mainapp.comm_msg_handler, message_type.KIDS_TIMER_ENABLE, "", 0, 0);
    } else {
        if (kidsTimerRunning == KIDS_TIMER_ENDED) {
            mainapp.sendMsg(mainapp.comm_msg_handler, message_type.KIDS_TIMER_END, "", 0, 0);
        }
        if (prefKidsTimer.equals(PREF_KIDS_TIMER_NONE)) {
            kidsTimerActions(KIDS_TIMER_DISABLED, 0);
        }
    }

    setupTts();
}

From source file:jmri.enginedriver.throttle.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    if (webView != null) {
        setImmersiveModeOn(webView);/*from  ww  w  .j a  v  a2 s  .  co m*/
    }

    // Handle all of the possible menu actions.
    Intent in;
    switch (item.getItemId()) {
    case R.id.turnouts_mnu:
        in = new Intent().setClass(this, turnouts.class);
        navigatingAway = true;
        startActivity(in);
        connection_activity.overridePendingTransition(this, R.anim.push_right_in, R.anim.push_right_out);
        break;
    case R.id.routes_mnu:
        in = new Intent().setClass(this, routes.class);
        navigatingAway = true;
        startActivity(in);
        connection_activity.overridePendingTransition(this, R.anim.push_left_in, R.anim.push_left_out);
        break;
    case R.id.web_mnu:
        in = new Intent().setClass(this, web_activity.class);
        in.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        navigatingAway = true;
        mainapp.webMenuSelected = true;
        startActivity(in);
        connection_activity.overridePendingTransition(this, R.anim.fade_in, R.anim.fade_out);
        break;
    case R.id.exit_mnu:
        navigatingAway = true;
        mainapp.checkExit(this);
        break;
    case R.id.power_control_mnu:
        in = new Intent().setClass(this, power_control.class);
        navigatingAway = true;
        startActivity(in);
        connection_activity.overridePendingTransition(this, R.anim.fade_in, R.anim.fade_out);
        break;
    case R.id.preferences_mnu:
        in = new Intent().setClass(this, preferences.class);
        navigatingAway = true;
        startActivityForResult(in, ACTIVITY_PREFS); // reinitialize function buttons and labels on return
        connection_activity.overridePendingTransition(this, R.anim.fade_in, R.anim.fade_out);
        break;
    case R.id.settings_mnu:
        in = new Intent().setClass(this, function_settings.class);
        navigatingAway = true;
        startActivity(in);
        connection_activity.overridePendingTransition(this, R.anim.fade_in, R.anim.fade_out);
        break;
    case R.id.about_mnu:
        in = new Intent().setClass(this, about_page.class);
        navigatingAway = true;
        startActivity(in);
        connection_activity.overridePendingTransition(this, R.anim.fade_in, R.anim.fade_out);
        break;
    case R.id.logviewer_menu:
        Intent logviewer = new Intent().setClass(this, LogViewerActivity.class);
        navigatingAway = true;
        startActivity(logviewer);
        connection_activity.overridePendingTransition(this, R.anim.fade_in, R.anim.fade_out);
        break;
    case R.id.EmerStop:
        mainapp.sendEStopMsg();
        speedUpdate(0); // update all three throttles
        applySpeedRelatedOptions(); // update all three throttles
        if (IS_ESU_MCII) {
            Log.d("Engine_Driver", "ESU_MCII: Move knob request for EStop");
            setEsuThrottleKnobPosition(whichVolume, 0);
        }

        break;
    case R.id.power_layout_button:
        if (!mainapp.isPowerControlAllowed()) {
            AlertDialog.Builder b = new AlertDialog.Builder(this);
            b.setIcon(android.R.drawable.ic_dialog_alert);
            b.setTitle(getApplicationContext().getResources().getString(R.string.powerWillNotWorkTitle));
            b.setMessage(getApplicationContext().getResources().getString(R.string.powerWillNotWork));
            b.setCancelable(true);
            b.setNegativeButton("OK", null);
            AlertDialog alert = b.create();
            alert.show();
            mainapp.displayPowerStateMenuButton(TMenu);
        } else {
            mainapp.powerStateMenuButton();
        }
        break;

    case R.id.EditConsist0_menu:
        Intent consistEdit = new Intent().setClass(this, ConsistEdit.class);

        consistEdit.putExtra("whichThrottle", '0');
        navigatingAway = true;
        startActivityForResult(consistEdit, ACTIVITY_CONSIST);
        connection_activity.overridePendingTransition(this, R.anim.fade_in, R.anim.fade_out);
        break;
    case R.id.EditConsist1_menu:
        Intent consistEdit2 = new Intent().setClass(this, ConsistEdit.class);
        consistEdit2.putExtra("whichThrottle", '1');
        navigatingAway = true;
        startActivityForResult(consistEdit2, ACTIVITY_CONSIST);
        connection_activity.overridePendingTransition(this, R.anim.fade_in, R.anim.fade_out);
        break;

    case R.id.EditConsist2_menu:
        Intent consistEdit3 = new Intent().setClass(this, ConsistEdit.class);
        consistEdit3.putExtra("whichThrottle", '2');
        navigatingAway = true;
        startActivityForResult(consistEdit3, ACTIVITY_CONSIST);
        connection_activity.overridePendingTransition(this, R.anim.fade_in, R.anim.fade_out);
        break;

    case R.id.EditLightsConsist0_menu:
        Intent consistLightsEdit = new Intent().setClass(this, ConsistLightsEdit.class);
        consistLightsEdit.putExtra("whichThrottle", '0');
        navigatingAway = true;
        startActivityForResult(consistLightsEdit, ACTIVITY_CONSIST_LIGHTS);
        connection_activity.overridePendingTransition(this, R.anim.fade_in, R.anim.fade_out);
        break;

    case R.id.EditLightsConsist1_menu:
        Intent consistLightsEdit2 = new Intent().setClass(this, ConsistLightsEdit.class);
        consistLightsEdit2.putExtra("whichThrottle", '1');
        navigatingAway = true;
        startActivityForResult(consistLightsEdit2, ACTIVITY_CONSIST_LIGHTS);
        connection_activity.overridePendingTransition(this, R.anim.fade_in, R.anim.fade_out);
        break;
    case R.id.EditLightsConsist2_menu:
        Intent consistLightsEdit3 = new Intent().setClass(this, ConsistLightsEdit.class);
        consistLightsEdit3.putExtra("whichThrottle", '2');
        navigatingAway = true;
        startActivityForResult(consistLightsEdit3, ACTIVITY_CONSIST_LIGHTS);
        connection_activity.overridePendingTransition(this, R.anim.fade_in, R.anim.fade_out);
        break;

    case R.id.gamepad_test_mnu1:
        in = new Intent().setClass(this, gamepad_test.class);
        in.putExtra("whichGamepadNo", "0");
        navigatingAway = true;
        startActivityForResult(in, ACTIVITY_GAMEPAD_TEST);
        connection_activity.overridePendingTransition(this, R.anim.fade_in, R.anim.fade_out);
        break;

    case R.id.gamepad_test_mnu2:
        in = new Intent().setClass(this, gamepad_test.class);
        in.putExtra("whichGamepadNo", "1");
        navigatingAway = true;
        startActivityForResult(in, ACTIVITY_GAMEPAD_TEST);
        connection_activity.overridePendingTransition(this, R.anim.fade_in, R.anim.fade_out);
        break;

    case R.id.gamepad_test_mnu3:
        in = new Intent().setClass(this, gamepad_test.class);
        in.putExtra("whichGamepadNo", "2");
        navigatingAway = true;
        startActivityForResult(in, ACTIVITY_GAMEPAD_TEST);
        connection_activity.overridePendingTransition(this, R.anim.fade_in, R.anim.fade_out);
        break;

    case R.id.timer_mnu:
        showTimerPasswordDialog();
        break;

    case R.id.flashlight_button:
        mainapp.toggleFlashlight(this, TMenu);
        break;

    case R.id.EsuMc2Knob_button:
        toggleEsuMc2Knob(this, TMenu);
        break;
    }
    return super.onOptionsItemSelected(item);
}