List of usage examples for android.app ActionBar setDisplayHomeAsUpEnabled
public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp);
From source file:com.xortech.map.MapsWithMe.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // REMOVE THE TITLE BAR FROM THE ACTIONBAR ActionBar actionbar = getActionBar(); actionbar.setDisplayHomeAsUpEnabled(true); actionbar.setDisplayShowTitleEnabled(false); gps = new GPSTracker(this); // MAP TAGS IF THEY ARE AVAILABLE MapMyTags();//from w ww . j a v a 2s .c om }
From source file:com.is.ui.filechooser.FileChooserActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { if (HAS_ACTIONBAR) { boolean hasBackStack = mFragmentManager.getBackStackEntryCount() > 0; ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(hasBackStack); //actionBar.setHomeButtonEnabled(hasBackStack); }// www. j a v a2s . c o m return true; }
From source file:org.iotivity.base.examples.DrawerFragment.java
public void setUp(int fragmentId, DrawerLayout drawerLayout) { mFragmentContainerView = getActivity().findViewById(fragmentId); mDrawerLayout = drawerLayout;// w ww . j a v a 2s. c om mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); mDrawerToggle = new ActionBarDrawerToggle(getActivity(), mDrawerLayout, R.drawable.ic_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); if (!isAdded()) { return; } getActivity().invalidateOptionsMenu(); } @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); if (!isAdded()) { return; } getActivity().invalidateOptionsMenu(); } }; mDrawerLayout.post(new Runnable() { @Override public void run() { mDrawerToggle.syncState(); } }); mDrawerLayout.setDrawerListener(mDrawerToggle); }
From source file:us.rader.tapset.ItemDetailActivity.java
/** * Work around bugs in backward-compatibility library *//*from w ww .j av a 2 s .co m*/ @SuppressLint("NewApi") @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void setupActionBar() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // Show the Up button in the action bar. ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); } }
From source file:answer.example.answer.activity.FileChooserActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { if (HAS_ACTIONBAR) { boolean hasBackStack = mFragmentManager.getBackStackEntryCount() > 0; ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(hasBackStack); actionBar.setHomeButtonEnabled(hasBackStack); }/*from w ww .ja v a2 s . c o m*/ return true; }
From source file:co.nerdart.ourss.activity.EntriesListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { UiUtils.setPreferenceTheme(this); super.onCreate(savedInstanceState); ActionBar actionBar = getActionBar(); if (actionBar != null) actionBar.setDisplayHomeAsUpEnabled(true); Intent intent = getIntent();//from w w w . j av a2 s. c o m long feedId = intent.getLongExtra(FeedColumns._ID, 0); String title = null; if (feedId > 0) { Cursor cursor = getContentResolver().query(FeedColumns.CONTENT_URI(feedId), FEED_PROJECTION, null, null, null); if (cursor.moveToFirst()) { title = cursor.isNull(0) ? cursor.getString(1) : cursor.getString(0); iconBytes = cursor.getBlob(2); } cursor.close(); } if (title != null) { setTitle(title); } if (savedInstanceState == null) { EntriesListFragment fragment = new EntriesListFragment(); Bundle args = new Bundle(); args.putParcelable(EntriesListFragment.ARG_URI, intent.getData()); fragment.setArguments(args); fragment.setHasOptionsMenu(true); getSupportFragmentManager().beginTransaction().add(android.R.id.content, fragment, "fragment").commit(); } if (iconBytes != null && iconBytes.length > 0) { int bitmapSizeInDip = UiUtils.dpToPixel(24); Bitmap bitmap = BitmapFactory.decodeByteArray(iconBytes, 0, iconBytes.length); if (bitmap != null) { if (bitmap.getHeight() != bitmapSizeInDip) { bitmap = Bitmap.createScaledBitmap(bitmap, bitmapSizeInDip, bitmapSizeInDip, false); } getActionBar().setIcon(new BitmapDrawable(getResources(), bitmap)); } } if (MainActivity.mNotificationManager == null) { MainActivity.mNotificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); } }
From source file:org.ounl.lifelonglearninghub.learntracker.gis.ou.swipe.SubjectsActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_section_subjects); final ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); intent = new Intent(this, TimeLineActivity.class); lview = (ListView) findViewById(R.id.listviewSubjects); lview.setOnItemClickListener(new OnItemClickListener() { @Override/*from w ww .ja v a2s . com*/ public void onItemClick(AdapterView<?> parent, View view, int position, long id) { intent.putExtra("POSITION", "" + position); startActivity(intent); } }); }
From source file:com.poloure.simplerss.FragmentNavigationDrawer.java
void setUp(DrawerLayout drawerLayout) { final FeedsActivity activity = (FeedsActivity) getActivity(); // Set up the action bar. ActionBar actionBar = activity.getActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); s_drawerToggle = new ActionBarDrawerToggle(getActivity(), drawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) { @Override// ww w . j a v a2s. c o m public void onDrawerSlide(View drawerView, float slideOffset) { super.onDrawerSlide(drawerView, slideOffset); activity.m_showMenuItems = 0.0F == slideOffset; activity.invalidateOptionsMenu(); } @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); if (!m_userLearnedDrawer) { m_userLearnedDrawer = true; SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).commit(); } } }; // Open the drawer if the user has never opened it manually before. if (!m_userLearnedDrawer) { drawerLayout.openDrawer(Gravity.START); } drawerLayout.post(new SyncPost()); drawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); drawerLayout.setDrawerListener(s_drawerToggle); }
From source file:me.nereo.gztsg.ui.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // setup shadow for drawer mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // setup content modal color mDrawerLayout.setScrimColor(Color.argb(100, 0, 0, 0)); final ActionBar mActionBar = getActionBar(); // display left to icon mActionBar.setDisplayHomeAsUpEnabled(true); // enable icon click mActionBar.setHomeButtonEnabled(true); mActionBar.setDisplayShowTitleEnabled(true); mActionBar.setTitle(R.string.app_name); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) {/*from ww w .j a v a 2 s . c o m*/ @Override public void onDrawerClosed(View drawerView) { mActionBar.setTitle(R.string.app_name); // recreate option menu invalidateOptionsMenu(); } @Override public void onDrawerOpened(View drawerView) { mActionBar.setTitle(R.string.setting_title); // recreate option menu invalidateOptionsMenu(); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { attachSearchBookFragment(); } }
From source file:de.da_sense.moses.client.SurveyActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_surveyactivity); if (mAPKID == null) if (savedInstanceState == null) mAPKID = getIntent().getStringExtra(ExternalApplication.KEY_APK_ID); else//from w w w . ja va 2 s. com mAPKID = savedInstanceState.getString(ExternalApplication.KEY_APK_ID, null); if (mAPKID == null) Log.e(LOG_TAG, "onCreate() apkid was not in the bundle nor in the intent"); int belongsTo = getIntent().getIntExtra(WelcomeActivity.KEY_BELONGS_TO, WelcomeActivityPagerAdapter.TAB_RUNNING); ExternalApplication apk; if (belongsTo == WelcomeActivityPagerAdapter.TAB_HISTORY) apk = HistoryExternalApplicationsManager.getInstance().getAppForId(mAPKID); else apk = InstalledExternalApplicationsManager.getInstance().getAppForId(mAPKID); // get ActionBar and set AppIcon to direct to the "home screen" ActionBar ab = getActionBar(); ab.setTitle(String.format(getString(R.string.actionbar_title_survey), apk.getName())); ab.setDisplayHomeAsUpEnabled(true); // set the adapter mAdapter = new SurveyActivityPagerAdapter(getSupportFragmentManager(), apk); mViewPager = (ViewPager) findViewById(R.id.surveyActivityPager); mViewPager.setAdapter(mAdapter); }