Search in sources :

Example 1 with OnNavigationListener

use of com.actionbarsherlock.app.ActionBar.OnNavigationListener in project httpclient by pixmob.

the class MainActivity method onCreate.

/**
 * Called when the activity is first created.
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    final ActionBar ab = getSupportActionBar();
    // set defaults for logo & home up
    ab.setDisplayHomeAsUpEnabled(showHomeUp);
    ab.setDisplayUseLogoEnabled(useLogo);
    // set up tabs nav
    for (int i = 1; i < 4; i++) {
        ab.addTab(ab.newTab().setText("Tab " + i).setTabListener(this));
    }
    // set up list nav
    ab.setListNavigationCallbacks(ArrayAdapter.createFromResource(this, R.array.sections, R.layout.sherlock_spinner_dropdown_item), new OnNavigationListener() {

        public boolean onNavigationItemSelected(int itemPosition, long itemId) {
            // FIXME add proper implementation
            rotateLeftFrag();
            return false;
        }
    });
    // default to tab navigation
    showTabsNav();
    // create a couple of simple fragments as placeholders
    final int MARGIN = 16;
    leftFrag = new RoundedColourFragment(getResources().getColor(R.color.android_green), 1f, MARGIN, MARGIN / 2, MARGIN, MARGIN);
    rightFrag = new RoundedColourFragment(getResources().getColor(R.color.honeycombish_blue), 2f, MARGIN / 2, MARGIN, MARGIN, MARGIN);
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    ft.add(R.id.root, leftFrag);
    ft.add(R.id.root, rightFrag);
    ft.commit();
}
Also used : OnNavigationListener(com.actionbarsherlock.app.ActionBar.OnNavigationListener) FragmentTransaction(android.support.v4.app.FragmentTransaction) ActionBar(com.actionbarsherlock.app.ActionBar)

Example 2 with OnNavigationListener

use of com.actionbarsherlock.app.ActionBar.OnNavigationListener in project ActionBarSherlock by JakeWharton.

the class MainActivity method onCreate.

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    final ActionBar ab = getSupportActionBar();
    // set defaults for logo & home up
    ab.setDisplayHomeAsUpEnabled(showHomeUp);
    ab.setDisplayUseLogoEnabled(useLogo);
    // set up tabs nav
    for (int i = 1; i < 4; i++) {
        ab.addTab(ab.newTab().setText("Tab " + i).setTabListener(this));
    }
    // set up list nav
    ab.setListNavigationCallbacks(ArrayAdapter.createFromResource(this, R.array.sections, R.layout.sherlock_spinner_dropdown_item), new OnNavigationListener() {

        public boolean onNavigationItemSelected(int itemPosition, long itemId) {
            // FIXME add proper implementation
            rotateLeftFrag();
            return false;
        }
    });
    // default to tab navigation
    showTabsNav();
    // create a couple of simple fragments as placeholders
    final int MARGIN = 16;
    leftFrag = new RoundedColourFragment(getResources().getColor(R.color.android_green), 1f, MARGIN, MARGIN / 2, MARGIN, MARGIN);
    rightFrag = new RoundedColourFragment(getResources().getColor(R.color.honeycombish_blue), 2f, MARGIN / 2, MARGIN, MARGIN, MARGIN);
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    ft.add(R.id.root, leftFrag);
    ft.add(R.id.root, rightFrag);
    ft.commit();
}
Also used : OnNavigationListener(com.actionbarsherlock.app.ActionBar.OnNavigationListener) FragmentTransaction(android.support.v4.app.FragmentTransaction) ActionBar(com.actionbarsherlock.app.ActionBar)

Aggregations

FragmentTransaction (android.support.v4.app.FragmentTransaction)2 ActionBar (com.actionbarsherlock.app.ActionBar)2 OnNavigationListener (com.actionbarsherlock.app.ActionBar.OnNavigationListener)2