Example usage for android.app ActionBar NAVIGATION_MODE_LIST

List of usage examples for android.app ActionBar NAVIGATION_MODE_LIST

Introduction

In this page you can find the example usage for android.app ActionBar NAVIGATION_MODE_LIST.

Prototype

int NAVIGATION_MODE_LIST

To view the source code for android.app ActionBar NAVIGATION_MODE_LIST.

Click Source Link

Document

List navigation mode.

Usage

From source file:io.indy.drone.activity.StrikeDetailActivity.java

private void configureActionBar() {
    // Show the Up button in the action bar.
    ActionBar actionBar = getActionBar();

    mSpinnerAdapter = ArrayAdapter.createFromResource(this, R.array.locations_array,
            android.R.layout.simple_spinner_dropdown_item);

    mOnNavigationListener = new ActionBar.OnNavigationListener() {
        public boolean onNavigationItemSelected(int itemPosition, long itemId) {
            onRegionSelected(itemPosition);
            return true;
        }//  ww w .  java 2  s  .com
    };

    actionBar.setTitle("");
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setListNavigationCallbacks(mSpinnerAdapter, mOnNavigationListener);

    try {
        actionBar.setSelectedNavigationItem(SQLDatabase.indexFromRegion(mRegion));
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.tweetlanes.android.view.HomeActivity.java

@Override
protected void onResume() {
    super.onResume();

    AccountDescriptor account = getApp().getCurrentAccount();

    if (account.getDisplayedLaneDefinitionsDirty()) {
        onLaneDataSetChanged();/*from   w  w  w. ja  v  a2 s .co m*/
        account.setDisplayedLaneDefinitionsDirty(false);
    }

    if (account.shouldRefreshLists() == true) {
        mRefreshListsHandler.removeCallbacks(mRefreshListsTask);
        mRefreshListsHandler.postDelayed(mRefreshListsTask, Constant.REFRESH_LISTS_WAIT_TIME);
    }

    if (isComposing() == false) {
        // Check we are using List navigation on the ActionBar. This will not be the case when ComposeTweet is present.
        if (getActionBar().getNavigationMode() == android.app.ActionBar.NAVIGATION_MODE_LIST) {
            /*
            Integer accountIndex = mSpinnerAdapter.getIndexOfAccount(getApp().getCurrentAccount());
            if (accountIndex != null) {
               getActionBar().setSelectedNavigationItem(accountIndex);
            }*/
        }
    }
}

From source file:com.shafiq.mytwittle.view.HomeActivity.java

@Override
protected void onResume() {
    super.onResume();

    AccountDescriptor account = getApp().getCurrentAccount();

    if (account.getDisplayedLaneDefinitionsDirty()) {
        onLaneDataSetChanged();//  w  ww .  j  a  va  2s.  co m
        account.setDisplayedLaneDefinitionsDirty(false);
    }

    if (account.shouldRefreshLists() == true) {
        mRefreshListsHandler.removeCallbacks(mRefreshListsTask);
        mRefreshListsHandler.postDelayed(mRefreshListsTask, Constant.REFRESH_LISTS_WAIT_TIME);
    }

    if (isComposing() == false) {
        // Check we are using List navigation on the ActionBar. This will
        // not be the case when ComposeTweet is present.
        if (getActionBar().getNavigationMode() == android.app.ActionBar.NAVIGATION_MODE_LIST) {
            /*
             * Integer accountIndex =
             * mSpinnerAdapter.getIndexOfAccount(getApp
             * ().getCurrentAccount()); if (accountIndex != null) {
             * getActionBar().setSelectedNavigationItem(accountIndex); }
             */
        }
    }
}

From source file:com.tweetlanes.android.core.view.HomeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    AccountDescriptor account = getApp().getCurrentAccount();

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        // Notifications
        String accountKey = extras.getString("account_key");
        String notificationType = extras.getString("notification_type");
        long notificationPostId = extras.getLong("notification_post_id");
        String laneName = extras.getString("lane");
        final String urlToLoad = extras.getString("urlToLoad");

        if (accountKey != null) {
            getIntent().removeExtra("account_key");
            getIntent().removeExtra("notification_type");
            AccountDescriptor notificationAccount = getApp().getAccountByKey(accountKey);

            Notifier.saveLastNotificationActioned(this, accountKey, notificationType, notificationPostId);

            Constant.LaneType notificationLaneType = notificationType.equals(
                    SharedPreferencesConstants.NOTIFICATION_TYPE_MENTION) ? Constant.LaneType.USER_MENTIONS
                            : Constant.LaneType.DIRECT_MESSAGES;

            if (notificationAccount != null) {
                long notificationAccountId = notificationAccount.getId();
                long currentAccountId = account.getId();
                if (notificationAccountId == currentAccountId) {
                    int index = account.getCurrentLaneIndex(notificationLaneType);
                    if (index > -1) {
                        mDefaultLaneOverride = index;
                    }/*from   ww w .  ja  va2s .  c  o m*/
                } else {
                    showAccount(notificationAccount, notificationLaneType);
                }
            }
        } else if (laneName != null) {
            getIntent().removeExtra("lane");
            int index = account.getCurrentLaneIndex(Constant.LaneType.valueOf(laneName.trim().toUpperCase()));
            if (index > -1) {
                mDefaultLaneOverride = index;
            }
        } else if (urlToLoad != null) {
            getIntent().removeExtra("urlToLoad");
            AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
            alertDialogBuilder.setMessage(getString(R.string.unknown_intent));
            alertDialogBuilder.setPositiveButton(getString(R.string.yes),
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            Intent viewIntent = new Intent("android.intent.action.VIEW",
                                    Uri.parse(urlToLoad.trim()));
                            startActivity(viewIntent);
                        }
                    });
            alertDialogBuilder.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
            alertDialogBuilder.create().show();
        }
    }

    super.onCreate(savedInstanceState);

    // Attempt at fixing a crash found in HomeActivity
    if (account == null) {
        Toast.makeText(getApplicationContext(), "No cached account found, restarting",
                Constant.DEFAULT_TOAST_DISPLAY_TIME).show();
        restartApp();
        return;
    }

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setTitle(null);
    actionBar.setDisplayShowTitleEnabled(false);

    mSpinnerAdapter = new AccountAdapter(this, getApp().getAccounts());

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setListNavigationCallbacks(mSpinnerAdapter, mOnNavigationListener);
    actionBar.setSelectedNavigationItem(0);

    onCreateNavigationListener();
    configureListNavigation();

    mViewSwitcher = (ViewSwitcher) findViewById(R.id.rootViewSwitcher);
    updateViewVisibility();

    onCreateHandleIntents();

    account.setDisplayedLaneDefinitionsDirty(false);

    Notifier.setNotificationAlarm(this);

    clearTempFolder();

    cacheFollowers();

    //Launch change log dialog
    final WhatsNewDialog whatsNewDialog = new WhatsNewDialog(this);
    whatsNewDialog.show();
}

From source file:com.actionbarsherlock.sample.styled.MainActivityICS.java

private void showDropDownNav() {
    ActionBar ab = getActionBar();/*w w  w .  ja v a  2 s. c  o  m*/
    if (ab.getNavigationMode() != ActionBar.NAVIGATION_MODE_LIST) {
        ab.setDisplayShowTitleEnabled(false);
        ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    }
}

From source file:com.example.app_2.activities.ImageGridActivity.java

private void setActionBar() {
    mActionBar = getActionBar();/*from  w  w  w  .  jav a 2  s .  co  m*/
    mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    if (mEditMode) {
        mActionBar.setBackgroundDrawable(new ColorDrawable(0xff0084b3));
        mActionBar.setDisplayShowTitleEnabled(false);
        mActionBar.setDisplayShowTitleEnabled(true);
    } else {
        mActionBar.setBackgroundDrawable(new ColorDrawable(0xff4d055e));
        mActionBar.setDisplayShowTitleEnabled(false);
        mActionBar.setDisplayShowTitleEnabled(true);
        Uri uri = Uri.parse(UserContract.CONTENT_URI + "/" + logged_user_id);
        Cursor c = getContentResolver().query(uri, new String[] { UserContract.Columns.IMG_FILENAME }, null,
                null, null);
        c.moveToFirst();
        if (!c.isAfterLast()) {
            String path = Storage.getPathToScaledBitmap(c.getString(0), 50);
            Bitmap user_icon = ScalingUtilities.decodeFile(path, 50, 50, ScalingLogic.FIT);
            mActionBar.setIcon(new BitmapDrawable(getResources(), user_icon));
        }
        c.close();
    }

    navSpinner = new ArrayList<SpinnerNavItem>();
    navSpinner.add(new SpinnerNavItem("Alfabetycznie", R.drawable.sort_ascend));
    navSpinner.add(new SpinnerNavItem("Ostatnio zmodyfikowane", R.drawable.clock));
    navSpinner.add(new SpinnerNavItem("Najczciej uywane", R.drawable.favourites));

    title_nav_adapter = new TitleNavigationAdapter(getApplicationContext(), navSpinner);
    mActionBar.setListNavigationCallbacks(title_nav_adapter, this);
}

From source file:org.floens.chan.ui.activity.BoardActivity.java

private void setActionBarListMode() {
    ActionBar actionBar = getActionBar();
    if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_LIST)
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
}

From source file:com.google.adsensequickstart.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_main);

    apiController = ApiController.getApiController(this);

    // Set up the action bar to show a dropdown list.
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    // Set up the dropdown list navigation in the action bar.
    actionBar.setListNavigationCallbacks(
            // Specify a SpinnerAdapter to populate the dropdown list.
            new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1,
                    android.R.id.text1, new String[] { getString(R.string.title_section1),
                            getString(R.string.title_section2), getString(R.string.title_section3) }),
            this);
}

From source file:com.geotrackin.gpslogger.GpsMainActivity.java

public void SetUpActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    SpinnerAdapter spinnerAdapter = ArrayAdapter.createFromResource(actionBar.getThemedContext(),
            R.array.gps_main_views, android.R.layout.simple_spinner_dropdown_item);

    actionBar.setListNavigationCallbacks(spinnerAdapter, this);

    //Reload the user's previously selected view f73
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    actionBar.setSelectedNavigationItem(prefs.getInt("dropdownview", 0));

    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle("");
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME
            | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_CUSTOM);
    actionBar.setCustomView(R.layout.actionbar);

    ImageButton helpButton = (ImageButton) actionBar.getCustomView().findViewById(R.id.imgHelp);
    helpButton.setOnClickListener(new View.OnClickListener() {
        @Override/*w  ww.  ja va  2 s . c  o m*/
        public void onClick(View view) {
            Intent faqtivity = new Intent(getApplicationContext(), Faqtivity.class);
            startActivity(faqtivity);
        }
    });

}