com.actionbarsherlock.app.ActionBar.OnNavigationListener Java Examples

The following examples show how to use com.actionbarsherlock.app.ActionBar.OnNavigationListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ListStyleActivity.java    From android-opensource-library-56 with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list_style);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1);
    for (int i = 0; i < 5; i++) {
        adapter.add("item" + i);
    }
    actionBar.setListNavigationCallbacks(adapter,
            new OnNavigationListener() {
                @Override
                public boolean onNavigationItemSelected(int itemPosition,
                        long itemId) {
                    Toast.makeText(This(), "pos" + itemPosition,
                            Toast.LENGTH_SHORT).show();
                    return false;
                }
            });
}
 
Example #2
Source File: ActionBarView.java    From CSipSimple with GNU General Public License v3.0 4 votes vote down vote up
public void setCallback(OnNavigationListener callback) {
    mCallback = callback;
}
 
Example #3
Source File: ActionBarView.java    From android-apps with MIT License 4 votes vote down vote up
public void setCallback(OnNavigationListener callback) {
    mCallback = callback;
}
 
Example #4
Source File: ActionBarView.java    From zen4android with MIT License 4 votes vote down vote up
public void setCallback(OnNavigationListener callback) {
    mCallback = callback;
}
 
Example #5
Source File: ActionBarView.java    From zhangshangwuda with Apache License 2.0 4 votes vote down vote up
public void setCallback(OnNavigationListener callback) {
    mCallback = callback;
}
 
Example #6
Source File: MagpiMainActivity.java    From magpi-android with MIT License 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_magpi_main);
    
    try {
     GCMRegistrar.checkDevice(this);
     GCMRegistrar.checkManifest(this);
     final String idGcm = GCMRegistrar.getRegistrationId(this);
     if (TextUtils.isEmpty(idGcm)) {
     	Log.e("GCM", "NOT registered");
         GCMRegistrar.register(MagpiMainActivity.this, Config.SENDER_ID);
     } else {
     	Log.e("GCM", "Already registered" + idGcm);
     	if(isTimeToRegister())
     		new MagPiClient().registerDevice(this, idGcm);
     }
    } catch (UnsupportedOperationException ex) {
    	Log.e("GCM", "Google Cloud Messaging not supported - please install Google Apps package!");
    }

    mOnNavigationListener = new OnNavigationListener() {
        @Override
        public boolean onNavigationItemSelected(int position, long itemId) {
            return true;
        }
    };
    
    this.intialiseViewPager();
 
    CompatActionBarNavHandler handler = new CompatActionBarNavHandler(this);
    
    SpinnerAdapter mSpinnerAdapter = ArrayAdapter.createFromResource(this, R.array.dropdown_array,
            android.R.layout.simple_spinner_dropdown_item);
    
    getSupportActionBar().setListNavigationCallbacks(mSpinnerAdapter, mOnNavigationListener);
    getSupportActionBar().setNavigationMode(android.app.ActionBar.NAVIGATION_MODE_TABS);
    
    final String CATEGORIES[] = getResources().getStringArray(R.array.dropdown_array);
    for (int i = 0; i < CATEGORIES.length; i++) {
        this.getSupportActionBar().addTab(this.getSupportActionBar().newTab().setText(
            CATEGORIES[i]).setTabListener(handler));
    }
    getSupportActionBar().setSelectedNavigationItem(0);
    
}
 
Example #7
Source File: ActionBarView.java    From Libraries-for-Android-Developers with MIT License 4 votes vote down vote up
public void setCallback(OnNavigationListener callback) {
    mCallback = callback;
}