com.actionbarsherlock.app.ActionBar Java Examples
The following examples show how to use
com.actionbarsherlock.app.ActionBar.
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: ActionBarWrapper.java From android-apps with MIT License | 6 votes |
@Override public void onTabSelected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) { if (mListener != null) { if (mFragmentTransaction == null && mActivity instanceof SherlockFragmentActivity) { mFragmentTransaction = ((SherlockFragmentActivity)mActivity).getSupportFragmentManager().beginTransaction() .disallowAddToBackStack(); } mListener.onTabSelected(this, mFragmentTransaction); if (mFragmentTransaction != null) { if (!mFragmentTransaction.isEmpty()) { mFragmentTransaction.commit(); } mFragmentTransaction = null; } } }
Example #2
Source File: ActionBarImpl.java From android-apps with MIT License | 6 votes |
private void configureTab(Tab tab, int position) { final TabImpl tabi = (TabImpl) tab; final ActionBar.TabListener callback = tabi.getCallback(); if (callback == null) { throw new IllegalStateException("Action Bar Tab must have a Callback"); } tabi.setPosition(position); mTabs.add(position, tabi); final int count = mTabs.size(); for (int i = position + 1; i < count; i++) { mTabs.get(i).setPosition(i); } }
Example #3
Source File: ActionBarWrapper.java From Libraries-for-Android-Developers with MIT License | 6 votes |
@Override public void onTabSelected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) { if (mListener != null) { if (mFragmentTransaction == null && mActivity instanceof FragmentActivity) { mFragmentTransaction = ((FragmentActivity)mActivity).getSupportFragmentManager().beginTransaction() .disallowAddToBackStack(); } mListener.onTabSelected(this, mFragmentTransaction); if (mFragmentTransaction != null) { if (!mFragmentTransaction.isEmpty()) { mFragmentTransaction.commit(); } mFragmentTransaction = null; } } }
Example #4
Source File: MainActivity.java From android-open-project-demo with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mViewPager = (ViewPager) findViewById(R.id.view_pager); final com.actionbarsherlock.app.ActionBar bar = getSupportActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); BarFragment barFrag = new BarFragment(); LineFragment lineFragment = new LineFragment(); PieFragment pieFragment = new PieFragment(); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText("Line"), LineFragment.class, null, lineFragment); mTabsAdapter.addTab(bar.newTab().setText("Pie"), PieFragment.class, null, pieFragment); mTabsAdapter.addTab(bar.newTab().setText("Bar"), BarFragment.class, null, barFrag); mViewPager.setOffscreenPageLimit(mTabsAdapter.getCount()-1); }
Example #5
Source File: ScrollingTabContainerView.java From Libraries-for-Android-Developers with MIT License | 6 votes |
private TabView createTabView(ActionBar.Tab tab, boolean forAdapter) { //Workaround for not being able to pass a defStyle on pre-3.0 final TabView tabView = (TabView)mInflater.inflate(R.layout.abs__action_bar_tab, null); tabView.init(this, tab, forAdapter); if (forAdapter) { tabView.setBackgroundDrawable(null); tabView.setLayoutParams(new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, mContentHeight)); } else { tabView.setFocusable(true); if (mTabClickListener == null) { mTabClickListener = new TabClickListener(); } tabView.setOnClickListener(mTabClickListener); } return tabView; }
Example #6
Source File: ActionBarView.java From zhangshangwuda with Apache License 2.0 | 6 votes |
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mTitleView = null; mSubtitleView = null; mTitleUpView = null; if (mTitleLayout != null && mTitleLayout.getParent() == this) { removeView(mTitleLayout); } mTitleLayout = null; if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) { initTitle(); } if (mTabScrollView != null && mIncludeTabs) { ViewGroup.LayoutParams lp = mTabScrollView.getLayoutParams(); if (lp != null) { lp.width = LayoutParams.WRAP_CONTENT; lp.height = LayoutParams.MATCH_PARENT; } mTabScrollView.setAllowCollapse(true); } }
Example #7
Source File: HybridActivity.java From grilledui with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void initSections(int layout) { fm = getSupportFragmentManager(); sectionAdapter = createSectionAdapter(fm); setContentView(layout); if(findViewById(getSectionDetailContainer()) != null) { hasTwoPanes = true; ((SectionListFragment)fm.findFragmentById(getSectionList())).setActivateOnItemClick(true); } else { actionBar = getSherlock().getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); pager = findViewPager(); pager.setAdapter(sectionAdapter); pager.setOnPageChangeListener(new TabChangeListener(actionBar)); } }
Example #8
Source File: ActionBarWrapper.java From CSipSimple with GNU General Public License v3.0 | 6 votes |
@Override public void onTabSelected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) { if (mListener != null) { if (mFragmentTransaction == null && mActivity instanceof FragmentActivity) { mFragmentTransaction = ((FragmentActivity)mActivity).getSupportFragmentManager().beginTransaction() .disallowAddToBackStack(); } mListener.onTabSelected(this, mFragmentTransaction); if (mFragmentTransaction != null) { if (!mFragmentTransaction.isEmpty()) { mFragmentTransaction.commit(); } mFragmentTransaction = null; } } }
Example #9
Source File: ActionBarWrapper.java From CSipSimple with GNU General Public License v3.0 | 6 votes |
@Override public void onTabReselected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) { if (mListener != null) { FragmentTransaction trans = null; if (mActivity instanceof FragmentActivity) { trans = ((FragmentActivity)mActivity).getSupportFragmentManager().beginTransaction() .disallowAddToBackStack(); } mListener.onTabReselected(this, trans); if (trans != null && !trans.isEmpty()) { trans.commit(); } } }
Example #10
Source File: ActionBarWrapper.java From zen4android with MIT License | 6 votes |
@Override public void onTabReselected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) { if (mListener != null) { FragmentTransaction trans = null; if (mActivity instanceof FragmentActivity) { trans = ((FragmentActivity)mActivity).getSupportFragmentManager().beginTransaction() .disallowAddToBackStack(); } mListener.onTabReselected(this, trans); if (trans != null && !trans.isEmpty()) { trans.commit(); } } }
Example #11
Source File: ActionBarWrapper.java From zen4android with MIT License | 6 votes |
@Override public void onTabSelected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) { if (mListener != null) { if (mFragmentTransaction == null && mActivity instanceof FragmentActivity) { mFragmentTransaction = ((FragmentActivity)mActivity).getSupportFragmentManager().beginTransaction() .disallowAddToBackStack(); } mListener.onTabSelected(this, mFragmentTransaction); if (mFragmentTransaction != null) { if (!mFragmentTransaction.isEmpty()) { mFragmentTransaction.commit(); } mFragmentTransaction = null; } } }
Example #12
Source File: ListStyleActivity.java From android-opensource-library-56 with Apache License 2.0 | 6 votes |
@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 #13
Source File: ActionBarWrapper.java From android-apps with MIT License | 6 votes |
@Override public void onTabReselected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) { if (mListener != null) { FragmentTransaction trans = null; if (mActivity instanceof SherlockFragmentActivity) { trans = ((SherlockFragmentActivity)mActivity).getSupportFragmentManager().beginTransaction() .disallowAddToBackStack(); } mListener.onTabReselected(this, trans); if (trans != null && !trans.isEmpty()) { trans.commit(); } } }
Example #14
Source File: ChatRoomAty.java From Huochexing12306 with Apache License 2.0 | 5 votes |
private void initActionBar() { ActionBar actBar = getSupportActionBar(); actBar.setDisplayShowTitleEnabled(false); //自定义不显示logo actBar.setDisplayShowHomeEnabled(true); actBar.setDisplayHomeAsUpEnabled(true); actBar.setDisplayShowTitleEnabled(true); actBar.setTitle("车友聊天室"); actBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_tab_bg)); }
Example #15
Source File: ActionBarImpl.java From Libraries-for-Android-Developers with MIT License | 5 votes |
private void init(View decor) { mContext = decor.getContext(); mActionView = (ActionBarView) decor.findViewById(R.id.abs__action_bar); mContextView = (ActionBarContextView) decor.findViewById( R.id.abs__action_context_bar); mContainerView = (ActionBarContainer) decor.findViewById( R.id.abs__action_bar_container); mSplitView = (ActionBarContainer) decor.findViewById( R.id.abs__split_action_bar); if (mActionView == null || mContextView == null || mContainerView == null) { throw new IllegalStateException(getClass().getSimpleName() + " can only be used " + "with a compatible window decor layout"); } mActionView.setContextView(mContextView); mContextDisplayMode = mActionView.isSplitActionBar() ? CONTEXT_DISPLAY_SPLIT : CONTEXT_DISPLAY_NORMAL; // Older apps get the home button interaction enabled by default. // Newer apps need to enable it explicitly. boolean homeButtonEnabled = mContext.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.ICE_CREAM_SANDWICH; // If the homeAsUp display option is set, always enable the home button. homeButtonEnabled |= (mActionView.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) != 0; setHomeButtonEnabled(homeButtonEnabled); setHasEmbeddedTabs(getResources_getBoolean(mContext, R.bool.abs__action_bar_embed_tabs)); }
Example #16
Source File: TrainInfoAty.java From Huochexing12306 with Apache License 2.0 | 5 votes |
private void initActionBar() { ActionBar actBar = getSupportActionBar(); actBar.setDisplayShowTitleEnabled(false); // 自定义不显示logo actBar.setDisplayShowHomeEnabled(true); actBar.setDisplayHomeAsUpEnabled(true); actBar.setDisplayShowTitleEnabled(true); actBar.setTitle("我的车次"); actBar.setBackgroundDrawable(getResources().getDrawable( R.drawable.actionbar_tab_bg)); }
Example #17
Source File: ActionBarView.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
public void setSubtitle(CharSequence subtitle) { mSubtitle = subtitle; if (mSubtitleView != null) { mSubtitleView.setText(subtitle); mSubtitleView.setVisibility(subtitle != null ? VISIBLE : GONE); final boolean visible = mExpandedActionView == null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0 && (!TextUtils.isEmpty(mTitle) || !TextUtils.isEmpty(mSubtitle)); mTitleLayout.setVisibility(visible ? VISIBLE : GONE); } }
Example #18
Source File: TabStyleActivity.java From android-opensource-library-56 with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tab_style); ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); for (int i = 0; i < 3; i++) { addTab(actionBar, i + 1); } }
Example #19
Source File: RegisterActivity.java From Huochexing12306 with Apache License 2.0 | 5 votes |
private void initActionBar() { ActionBar actBar = getSupportActionBar(); actBar.setDisplayShowTitleEnabled(false); //自定义不显示logo actBar.setDisplayShowHomeEnabled(true); actBar.setDisplayHomeAsUpEnabled(true); actBar.setDisplayShowTitleEnabled(true); actBar.setTitle("用户注册"); actBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_tab_bg)); }
Example #20
Source File: ActionBarView.java From zen4android with MIT License | 5 votes |
private void setTitleImpl(CharSequence title) { mTitle = title; if (mTitleView != null) { mTitleView.setText(title); final boolean visible = mExpandedActionView == null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0 && (!TextUtils.isEmpty(mTitle) || !TextUtils.isEmpty(mSubtitle)); mTitleLayout.setVisibility(visible ? VISIBLE : GONE); } if (mLogoNavItem != null) { mLogoNavItem.setTitle(title); } }
Example #21
Source File: ScrollingTabContainerView.java From zen4android with MIT License | 5 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = createTabView((ActionBar.Tab) getItem(position), true); } else { ((TabView) convertView).bindTab((ActionBar.Tab) getItem(position)); } return convertView; }
Example #22
Source File: AntiTheftSetupAty.java From Huochexing12306 with Apache License 2.0 | 5 votes |
private void initActionBar() { ActionBar actBar = getSupportActionBar(); actBar.setDisplayShowTitleEnabled(false); actBar.setDisplayShowHomeEnabled(true); actBar.setDisplayHomeAsUpEnabled(true); actBar.setDisplayShowTitleEnabled(true); actBar.setTitle("安全防盗设置"); actBar.setBackgroundDrawable(getResources().getDrawable( R.drawable.actionbar_tab_bg)); }
Example #23
Source File: ReminderSetupAty.java From Huochexing12306 with Apache License 2.0 | 5 votes |
private void initActionBar() { ActionBar actBar = getSupportActionBar(); actBar.setDisplayShowTitleEnabled(false); actBar.setDisplayShowHomeEnabled(true); actBar.setDisplayHomeAsUpEnabled(true); actBar.setDisplayShowTitleEnabled(true); actBar.setTitle("到站提醒设置"); actBar.setBackgroundDrawable(getResources().getDrawable( R.drawable.actionbar_tab_bg)); }
Example #24
Source File: ActionBarSherlockCompat.java From android-apps with MIT License | 5 votes |
@Override public ActionBar getActionBar() { if (DEBUG) Log.d(TAG, "[getActionBar]"); initActionBar(); return aActionBar; }
Example #25
Source File: ActionBarSherlockNative.java From zen4android with MIT License | 5 votes |
@Override public ActionBar getActionBar() { if (ActionBarSherlock.DEBUG) Log.d(TAG, "[getActionBar]"); initActionBar(); return mActionBar; }
Example #26
Source File: IssueDetailsActivity.java From magpi-android with MIT License | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_issue_details); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); issueFragment.setArguments(getIntent().getExtras()); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.fragment_container, issueFragment); transaction.commit(); }
Example #27
Source File: TabsAdapter.java From android-open-project-demo with Apache License 2.0 | 5 votes |
public void addTab(ActionBar.Tab tab,Class<?> clss,Bundle args,Fragment frag){ TabInfo info = new TabInfo(clss,args); tab.setTag(info); tab.setTabListener(this); mTabs.add(info); mFrags.add(frag); mActionBar.addTab(tab); notifyDataSetChanged(); }
Example #28
Source File: ActionBarWrapper.java From android-apps with MIT License | 5 votes |
@Override public void setCustomView(View view, LayoutParams layoutParams) { android.app.ActionBar.LayoutParams lp = new android.app.ActionBar.LayoutParams(layoutParams); lp.gravity = layoutParams.gravity; lp.bottomMargin = layoutParams.bottomMargin; lp.topMargin = layoutParams.topMargin; lp.leftMargin = layoutParams.leftMargin; lp.rightMargin = layoutParams.rightMargin; mActionBar.setCustomView(view, lp); }
Example #29
Source File: ShareContentAty.java From Huochexing12306 with Apache License 2.0 | 5 votes |
/** * 初始化ActionBar */ private void initActionBar() { ActionBar actBar = getSupportActionBar(); actBar.setDisplayShowTitleEnabled(false); //自定义不显示logo actBar.setDisplayShowHomeEnabled(true); actBar.setDisplayHomeAsUpEnabled(true); actBar.setDisplayShowTitleEnabled(true); actBar.setTitle("分享"); actBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_tab_bg)); }
Example #30
Source File: ScrollingTabContainerView.java From zen4android with MIT License | 5 votes |
public void addTab(ActionBar.Tab tab, int position, boolean setSelected) { final TabView tabView = createTabView(tab, false); mTabLayout.addView(tabView, position, new IcsLinearLayout.LayoutParams( 0, LayoutParams.MATCH_PARENT, 1)); if (mTabSpinner != null) { ((TabAdapter) mTabSpinner.getAdapter()).notifyDataSetChanged(); } if (setSelected) { tabView.setSelected(true); } if (mAllowCollapse) { requestLayout(); } }