use of android.app.ActionBar in project coursera-android by aporter.
the class DialtactsActivity method exitSearchUi.
/**
* Goes back to usual Phone UI with tags. Previously selected Tag and associated Fragment
* should be automatically focused again.
*/
private void exitSearchUi() {
final ActionBar actionBar = getActionBar();
// Hide the search fragment, if exists.
if (mSearchFragment != null) {
mSearchFragment.setUserVisibleHint(false);
final FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.hide(mSearchFragment);
transaction.commitAllowingStateLoss();
}
// We want to hide SearchView and show Tabs. Also focus on previously selected one.
actionBar.setDisplayShowCustomEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
for (int i = 0; i < TAB_INDEX_COUNT; i++) {
sendFragmentVisibilityChange(i, i == mViewPager.getCurrentItem());
}
// Before exiting the search screen, reset swipe state.
mDuringSwipe = false;
mUserTabClick = false;
mViewPager.setVisibility(View.VISIBLE);
hideInputMethod(getCurrentFocus());
// Request to update option menu.
invalidateOptionsMenu();
// See comments in onActionViewExpanded()
mSearchView.onActionViewCollapsed();
mInSearchUi = false;
}
use of android.app.ActionBar in project coursera-android by aporter.
the class TabLayoutActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Put ActionBar in Tab Mode
final ActionBar tabBar = getActionBar();
tabBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
// Create a GridFragment for the Flower thumbnails
GridFragment flowerFrag = new GridFragment();
// Store the list of thumbnails as an argument to the GridFragment
Bundle args = new Bundle();
args.putIntegerArrayList(THUMBNAIL_IDS, mThumbIdsFlowers);
flowerFrag.setArguments(args);
// Configure a tab for the Flower thumbnail GridFragment
tabBar.addTab(tabBar.newTab().setText(FLOWERS_TABSTRING).setTabListener(new TabListener(flowerFrag)));
// Create a GridFragment for the Animal thumbnails
GridFragment animalFrag = new GridFragment();
// Store the list of thumbnails as an argument to the GridFragment
args = new Bundle();
args.putIntegerArrayList(THUMBNAIL_IDS, mThumbIdsAnimals);
animalFrag.setArguments(args);
// Configure a tab for the Animal thumbnail GridFragment
tabBar.addTab(tabBar.newTab().setText(ANIMALS_TABSTRING).setTabListener(new TabListener(animalFrag)));
}
use of android.app.ActionBar in project cw-advandroid by commonsguy.
the class FeedsTabActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_nav);
for (final Feed feed : Feed.getFeeds()) {
addNewFeed(feed);
}
ActionBar bar = getActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
bar.setDisplayHomeAsUpEnabled(true);
int screenLayout = getResources().getConfiguration().screenLayout;
if (((screenLayout & Configuration.SCREENLAYOUT_SIZE_NORMAL) == Configuration.SCREENLAYOUT_SIZE_NORMAL) || ((screenLayout & Configuration.SCREENLAYOUT_SIZE_SMALL) == Configuration.SCREENLAYOUT_SIZE_SMALL)) {
bar.setDisplayShowHomeEnabled(false);
}
if (savedInstanceState != null) {
cleanUpFragments();
}
}
use of android.app.ActionBar in project cw-advandroid by commonsguy.
the class FeedsTabActivity method addNewFeed.
public void addNewFeed(final Feed feed) {
ActionBar bar = getActionBar();
bar.addTab(bar.newTab().setText(feed.toString()).setTabListener(new TabListener(feed)));
}
use of android.app.ActionBar in project presentations by eburke.
the class AccountActivity method onCreate.
@Override
protected void onCreate(Bundle state) {
super.onCreate(state);
setContentView(R.layout.account_activity);
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(R.string.account);
customerImage = (ImageView) findViewById(R.id.customer_image);
customerName = (TextView) findViewById(R.id.customer_name);
}
Aggregations