List of usage examples for android.app ActionBar setDisplayShowTitleEnabled
public abstract void setDisplayShowTitleEnabled(boolean showTitle);
From source file:com.tweetlanes.android.view.ProfileActivity.java
boolean configureActionBarView() { if (mScreenName != null) { ActionBar actionBar = getActionBar(); actionBar.setDisplayUseLogoEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(false); LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); int layout = R.layout.profile_title_thin; /*// w w w. ja v a2s . co m * // TODO: This is messy, and likely won't work for large screen devices. Need to come up with a better solution int layout; if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { layout= R.layout.profile_title_thin; } else { layout = R.layout.profile_title; }*/ View profileTitleView = inflator.inflate(layout, null); ((TextView) profileTitleView.findViewById(R.id.screenname)).setText("@" + mScreenName); TextView fullNameTextView = (TextView) profileTitleView.findViewById(R.id.fullname); if (fullNameTextView != null && mUser != null) { fullNameTextView.setText(mUser.getName()); } ImageView verifiedImage = (ImageView) profileTitleView.findViewById(R.id.verifiedImage); verifiedImage.setVisibility(mUser != null && mUser.getVerified() ? View.VISIBLE : View.GONE); actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(profileTitleView); } return true; }
From source file:org.catnut.ui.PluginsActivity.java
private void injectPager(ActionBar bar, Bundle savedInstanceState) { // not show the bar, but not hide, u known what i mean? bar.setDisplayHomeAsUpEnabled(false); bar.setDisplayShowHomeEnabled(false); bar.setDisplayShowTitleEnabled(false); setContentView(R.layout.pager);//from w w w .j a v a 2s. c o m mIds = getIntent().getIntegerArrayListExtra(PLUGINS); if (savedInstanceState == null) { mIds.add(0); // add an alt one... } Collections.shuffle(mIds); // shuffle it :-) mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setOffscreenPageLimit(2); mViewPager.setPageMargin(10); mViewPager.setPageMarginDrawable(new ColorDrawable(getResources().getColor(R.color.tab_selected))); mViewPager.setAdapter(new FragmentPagerAdapter(getFragmentManager()) { @Override public Fragment getItem(int position) { Fragment fragment; switch (mIds.get(position)) { case PluginsPrefFragment.ZHIHU: fragment = ZhihuItemsFragment.getFragment(); break; case PluginsPrefFragment.FANTASY: fragment = FantasyFallFragment.getFragment(); break; default: fragment = new PlaceHolderFragment(); break; } return fragment; } @Override public int getCount() { return mIds.size(); } @Override public CharSequence getPageTitle(int position) { switch (mIds.get(position)) { case PluginsPrefFragment.ZHIHU: return getString(R.string.read_zhihu); case PluginsPrefFragment.FANTASY: return getString(R.string.fantasy); default: return "more plugins..."; } } }); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { getActionBar().setSelectedNavigationItem(position); } }); for (int i = 0; i < mViewPager.getAdapter().getCount(); i++) { bar.addTab(bar.newTab().setText(mViewPager.getAdapter().getPageTitle(i)).setTabListener(this)); } }
From source file:com.shafiq.mytwittle.view.ProfileActivity.java
boolean configureActionBarView() { if (mScreenName != null) { ActionBar actionBar = getActionBar(); actionBar.setDisplayUseLogoEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(false); LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); int layout = R.layout.profile_title_thin; /*/*from w w w . ja v a 2s . c om*/ * // TODO: This is messy, and likely won't work for large screen * devices. Need to come up with a better solution int layout; if * (getResources().getConfiguration().orientation == * Configuration.ORIENTATION_LANDSCAPE) { layout= * R.layout.profile_title_thin; } else { layout = * R.layout.profile_title; } */ View profileTitleView = inflator.inflate(layout, null); ((TextView) profileTitleView.findViewById(R.id.screenname)).setText("@" + mScreenName); TextView fullNameTextView = (TextView) profileTitleView.findViewById(R.id.fullname); if (fullNameTextView != null && mUser != null) { fullNameTextView.setText(mUser.getName()); } ImageView verifiedImage = (ImageView) profileTitleView.findViewById(R.id.verifiedImage); verifiedImage.setVisibility(mUser != null && mUser.getVerified() ? View.VISIBLE : View.GONE); actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(profileTitleView); } return true; }
From source file:com.google.adsensequickstart.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_main); apiController = ApiController.getApiController(this); // Set up the action bar to show a dropdown list. final ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); // Set up the dropdown list navigation in the action bar. actionBar.setListNavigationCallbacks( // Specify a SpinnerAdapter to populate the dropdown list. new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1, android.R.id.text1, new String[] { getString(R.string.title_section1), getString(R.string.title_section2), getString(R.string.title_section3) }), this); }
From source file:com.app.blockydemo.ui.ScriptActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_script); ProjectManager projectManager = ProjectManager.getInstance(); //create project try {/* www. ja va 2s .com*/ projectManager.initializeNewProject("test", this, false); } catch (IOException e) { e.printStackTrace(); } Sprite sprite = new Sprite("Back"); projectManager.addSprite(sprite); projectManager.setCurrentSprite(sprite); setVolumeControlStream(AudioManager.STREAM_MUSIC); currentFragmentPosition = FRAGMENT_SCRIPTS; FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); updateCurrentFragment(currentFragmentPosition, fragmentTransaction); fragmentTransaction.commit(); final ActionBar actionBar = getActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayShowTitleEnabled(true); buttonAdd = (ImageButton) findViewById(R.id.button_add); updateHandleAddButtonClickListener(); }
From source file:com.leo.runningman.ui.ImageDetailActivity.java
@SuppressLint("NewApi") @Override// ww w. java2 s . c o m 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.core.view.ProfileActivity.java
void configureActionBarView() { if (mScreenName != null) { final ActionBar actionBar = getActionBar(); actionBar.setDisplayUseLogoEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle("@" + mScreenName); final LayoutInflater inflator = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); final int layout = R.layout.profile_title_thin; /*/*from ww w . jav a 2 s. com*/ * // TODO: This is messy, and likely won't work for large screen * devices. Need to come up with a better solution int layout; if * (getResources().getConfiguration().orientation == * Configuration.ORIENTATION_LANDSCAPE) { layout= * R.layout.profile_title_thin; } else { layout = * R.layout.profile_title; } */ final View abView = inflator.inflate(layout, null); final ImageView verified = (ImageView) abView.findViewById(R.id.verifiedImage); verified.setVisibility(mUser != null && mUser.getVerified() ? View.VISIBLE : View.GONE); actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(abView); } }
From source file:fr.cph.chicago.activity.BusBoundActivity.java
@Override public final boolean onCreateOptionsMenu(final Menu menu) { super.onCreateOptionsMenu(menu); ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(this.mBusRouteName + " (" + this.mBound + ")"); return true;// ww w.j a v a 2 s . co m }
From source file:com.opensource.bitmaploader.test.ui.ImageDetailActivity.java
@Override 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); // The ImageWorker takes care of loading images into our ImageView children asynchronously // mPicWorker = new ImageFetcher(this, displaymetrics.widthPixels, displaymetrics.heightPixels); mPicWorker = new ImageFetcher(this, getResources().getDisplayMetrics().widthPixels); File cachePath = null;/*from www . j a v a 2s .c om*/ if (Utils.hasExternalStorage()) { File appRoot = new File(Environment.getExternalStorageDirectory(), "BitmapLoader"); cachePath = new File(appRoot, ".cache"); } ImageCache.ImageCacheParams picCacheParams = new ImageCache.ImageCacheParams(cachePath, IMAGE_CACHE_DIR); picCacheParams.memCacheSize = 1024 * 1024 * Utils.getMemoryClass(this) / 3; picCacheParams.diskCacheEnabled = true; mPicWorker.setAdapter(Images.imageWorkerUrlsAdapter); mPicWorker.setImageCache(new ImageCache(this, picCacheParams)); mPicWorker.setImageFadeIn(false); mPicWorker.setLoadingImage(R.drawable.empty_photo); ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(cachePath, THUMB_CACHE_DIR); // ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(cachePath, IMAGE_CACHE_DIR); cacheParams.memCacheSize = 1024 * 1024 * Utils.getMemoryClass(this) / 3; cacheParams.diskCacheEnabled = false; mThumbWorker = new ImageFetcher(this, 150); mThumbWorker.setAdapter(Images.imageWorkerUrlsAdapter); mThumbWorker.setLoadingImage(R.drawable.empty_photo); mThumbWorker.setImageCache(new ImageCache(this, cacheParams)); // Set up ViewPager and backing adapter mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), mPicWorker.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(); if (null != actionBar) { // 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); } }
From source file:com.android.talkback.tutorial.TutorialLessonFragment.java
@Override public void onResume() { super.onResume(); Activity activity = getActivity();//from ww w . j a va2s .c om if (activity != null) { ActionBar actionBar = activity.getActionBar(); actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayShowCustomEnabled(true); actionBar.setDisplayShowTitleEnabled(false); actionBar.setCustomView(R.layout.tutorial_action_bar); actionBar.getCustomView().findViewById(R.id.up).setOnClickListener(this); TextView title = (TextView) actionBar.getCustomView().findViewById(R.id.action_bar_title); title.setText(getTitle()); LocalBroadcastManager.getInstance(activity).registerReceiver(mActionMonitor, GestureActionMonitor.FILTER); } TalkBackService service = TalkBackService.getInstance(); if (service != null) { service.addEventListener(mExercise); } }