List of usage examples for android.app ActionBar setDisplayHomeAsUpEnabled
public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp);
From source file:at.florian_lentsch.expirysync.AddProductActivity.java
/** * Set up the {@link android.app.ActionBar}, if the API is available. *//*from w w w .j av a2s . com*/ @TargetApi(Build.VERSION_CODES.HONEYCOMB) private void setupActionBar() { ActionBar actionBar = null; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && (actionBar = getActionBar()) != null) { actionBar.setDisplayHomeAsUpEnabled(true); // TODO: Find out, why // this is not being // done for android 4 // for example } }
From source file:com.msplearning.android.app.EducationalContentDemoActivity.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @SuppressLint("NewApi") public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_educational_content_demo); // Create an adapter that when requested, will return a fragment representing an object in the collection. // ViewPager and its adapters use support library fragments, so we must use getSupportFragmentManager. mDemoCollectionPagerAdapter = new DemoCollectionPagerAdapter(getSupportFragmentManager()); // Set up action bar. final ActionBar actionBar = getActionBar(); actionBar.setSubtitle(getString(R.string.title_view_pager_demo)); // Specify that the Home button should show an "Up" caret, indicating that touching the button will take the user one step up in the application's hierarchy. actionBar.setDisplayHomeAsUpEnabled(true); // Set up the ViewPager, attaching the adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mDemoCollectionPagerAdapter); }
From source file:com.plnyyanks.frcnotebook.activities.ViewEvent.java
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(PreferenceHandler.getTheme()); super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_event); activity = this; if (event == null) { Intent intent = new Intent(this, StartActivity.class); startActivity(intent);// w w w .j a va 2 s. c o m return; } ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setTitle(event.getEventName()); bar.setSubtitle("#" + key); bar.setDisplayHomeAsUpEnabled(true); //tab for team list ActionBar.Tab teamListTab = bar.newTab(); teamListTab.setText("Teams Attending"); teamListTab.setTabListener(this); bar.addTab(teamListTab); //tab for match schedule ActionBar.Tab scheduleTab = bar.newTab(); scheduleTab.setText("Match Schedule"); scheduleTab.setTabListener(this); bar.addTab(scheduleTab); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_NAVIGATION_ITEM, 0)); } else { bar.setSelectedNavigationItem(0); } }
From source file:com.example.swipeapp.CollectionDemoActivity.java
@SuppressWarnings("unchecked") public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_collection_demo); Intent intent = getIntent();//from w ww. j a v a2 s . com arrayList = (ArrayList<HashMap<String, Object>>) intent.getSerializableExtra("array"); // Create an adapter that when requested, will return a fragment representing an object in // the collection. // // ViewPager and its adapters use support library fragments, so we must use // getSupportFragmentManager. mDemoCollectionPagerAdapter = new DemoCollectionPagerAdapter(getSupportFragmentManager()); // Set up action bar. final ActionBar actionBar = getActionBar(); // Specify that the Home button should show an "Up" caret, indicating that touching the // button will take the user one step up in the application's hierarchy. actionBar.setDisplayHomeAsUpEnabled(true); // Set up the ViewPager, attaching the adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mDemoCollectionPagerAdapter); }
From source file:com.leo.runningman.ui.ImageDetailActivity.java
@SuppressLint("NewApi") @Override/* w ww . ja v a2 s .c om*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.image_detail_pager); // Fetch screen height and width, to use as our max size when loading images as this // activity runs full screen final DisplayMetrics displaymetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); final int height = displaymetrics.heightPixels; final int width = displaymetrics.widthPixels; final int longest = height > width ? height : width; // The ImageWorker takes care of loading images into our ImageView children asynchronously mImageWorker = new ImageFetcher(this, longest); mImageWorker.setAdapter(ImageProvider.imageWorkerUrlsAdapter); mImageWorker.setImageCache(ImageCache.findOrCreateCache(this, IMAGE_CACHE_DIR)); mImageWorker.setImageFadeIn(true); // Set up ViewPager and backing adapter mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), mImageWorker.getAdapter().getSize()); mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mAdapter); mPager.setPageMargin((int) getResources().getDimension(R.dimen.image_detail_pager_margin)); // Set up activity to go full screen getWindow().addFlags(LayoutParams.FLAG_FULLSCREEN); // Enable some additional newer visibility and ActionBar features to create a more immersive // photo viewing experience if (Utils.hasActionBar()) { final ActionBar actionBar = getActionBar(); // Enable "up" navigation on ActionBar icon and hide title text actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(false); // Start low profile mode and hide ActionBar mPager.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); actionBar.hide(); // Hide and show the ActionBar as the visibility changes mPager.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() { @Override public void onSystemUiVisibilityChange(int vis) { if ((vis & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0) { actionBar.hide(); } else { // actionBar.show(); } } }); } // Set the current item based on the extra passed in to this activity final int extraCurrentItem = getIntent().getIntExtra(EXTRA_IMAGE, -1); if (extraCurrentItem != -1) { mPager.setCurrentItem(extraCurrentItem); } adView = (AdView) findViewById(R.id.ad_view); }
From source file:com.tweetlanes.android.view.SearchActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { mSearchTerm = getIntent().getStringExtra("query"); if (mSearchTerm == null) { Uri data = getIntent().getData(); if (data != null) { mSearchTerm = data.toString().replace("com.tweetlanes.android.search://", ""); }//from w ww. j a v a 2 s .com } super.onCreate(savedInstanceState); // This could be true if loading back into the app from Multitasking if (mSearchTerm == null) { restartApp(); return; } ActionBar actionBar = getActionBar(); actionBar.setDisplayUseLogoEnabled(true); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(getString(R.string.action_bar_search_title) + " \"" + mSearchTerm + "\""); actionBar.setDisplayHomeAsUpEnabled(true); mViewSwitcher = (ViewSwitcher) findViewById(R.id.rootViewSwitcher); updateViewVisibility(); }
From source file:com.shafiq.mytwittle.view.SearchActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { mSearchTerm = getIntent().getStringExtra("query"); if (mSearchTerm == null) { Uri data = getIntent().getData(); if (data != null) { mSearchTerm = data.toString().replace("com.shafiq.mytwittle.search://", ""); }/*from w w w .j a v a2 s. co m*/ } super.onCreate(savedInstanceState); // This could be true if loading back into the app from Multitasking if (mSearchTerm == null) { restartApp(); return; } ActionBar actionBar = getActionBar(); actionBar.setDisplayUseLogoEnabled(true); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(getString(R.string.action_bar_search_title) + " \"" + mSearchTerm + "\""); actionBar.setDisplayHomeAsUpEnabled(true); mViewSwitcher = (ViewSwitcher) findViewById(R.id.rootViewSwitcher); updateViewVisibility(); }
From source file:com.tweetlanes.android.core.view.SearchActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { mSearchTerm = getIntent().getStringExtra("query"); if (mSearchTerm == null) { Uri data = getIntent().getData(); if (data != null) { mSearchTerm = data.toString().replace("com.tweetlanes.android.core.search://", ""); }/* ww w . j a va 2 s.c o m*/ } super.onCreate(savedInstanceState); // This could be true if loading back into the app from Multitasking if (mSearchTerm == null) { restartApp(); return; } ActionBar actionBar = getActionBar(); actionBar.setDisplayUseLogoEnabled(true); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(getString(R.string.action_bar_search_title) + " \"" + mSearchTerm + "\""); actionBar.setDisplayHomeAsUpEnabled(true); mViewSwitcher = (ViewSwitcher) findViewById(R.id.rootViewSwitcher); updateViewVisibility(); }
From source file:com.commonsware.cwac.cam2.support.ConfirmationFragment.java
@Override public void onHiddenChanged(boolean isHidden) { super.onHiddenChanged(isHidden); if (!isHidden) { ActionBar ab = getActivity().getActionBar(); ab.setBackgroundDrawable(/*from w w w . j ava 2 s . c om*/ getActivity().getResources().getDrawable(R.drawable.cwac_cam2_action_bar_bg_translucent)); ab.setTitle(""); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ab.setDisplayHomeAsUpEnabled(true); ab.setHomeAsUpIndicator(R.drawable.cwac_cam2_ic_close_white); } else { ab.setIcon(R.drawable.cwac_cam2_ic_close_white); ab.setDisplayShowHomeEnabled(true); ab.setHomeButtonEnabled(true); } } }
From source file:de.zell.android.util.activities.MainNavigationActivity.java
private void initActionBar() { ActionBar bar = getActionBar(); // enable ActionBar app icon to behave as action to toggle nav drawer bar.setIcon(getActionBarIcon());/*from w ww. ja v a 2 s .c o m*/ bar.setDisplayHomeAsUpEnabled(true); bar.setHomeButtonEnabled(true); }