List of usage examples for android.app ActionBar setDisplayShowTitleEnabled
public abstract void setDisplayShowTitleEnabled(boolean showTitle);
From source file:com.imobilize.blogposts.fragments.SubscribeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ActionBar actionBar = getActivity().getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); rootView = inflater.inflate(R.layout.login, container, false); context = getActivity().getApplicationContext(); declareCheckBoxes();/*from w w w .j a v a 2 s.c o m*/ declareRegisterButton(); enableDisableButton(); enableDisableCheckBoxes(); return rootView; }
From source file:co.touchlab.thumbcache.ui.ImageDetailActivity.java
@SuppressLint("NewApi") @Override/* w w w.j a v a 2 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(Images.imageWorkerUrlsAdapter); mImageWorker.setImageCache(ImageCache.findOrCreateCache(this, IMAGE_CACHE_DIR)); mImageWorker.setImageFadeIn(false); // 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); } }
From source file:com.battlelancer.seriesguide.ui.FullscreenImageActivity.java
private void setupActionBar() { final ActionBar actionBar = getActionBar(); actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.background_actionbar_gradient)); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setIcon(R.drawable.ic_actionbar); actionBar.setDisplayShowTitleEnabled(false); }
From source file:com.mbpro.tweebook.facebook.images.FacebookImageDetailActivity.java
@SuppressLint("NewApi") @Override/* w w w . j a va 2s. co m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.facebook_album_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(FaceBookAlbumImages.imageWorkerUrlsAdapter); mImageWorker.setImageCache(ImageCache.findOrCreateCache(this, IMAGE_CACHE_DIR)); mImageWorker.setImageFadeIn(false); // 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); } }
From source file:com.tweetlanes.android.view.TweetSpotlightActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String statusIdAsString = getIntent().getStringExtra(STATUS_ID_KEY); if (statusIdAsString != null) { long statusId = Long.parseLong(statusIdAsString); mGetStatusCallback = TwitterManager.get().getFetchStatusInstance().new FinishedCallback() { @Override//from ww w. j ava 2 s. co m public void finished(TwitterFetchResult result, TwitterStatus status) { // TODO: handle error properly if (result.isSuccessful() && status != null) { if (mTweetSpotlightAdapter != null) { onGetStatus(status); } } else { finish(); } mGetStatusCallback = null; } }; // TODO: Look at using a cached value TwitterManager.get().getStatus(statusId, mGetStatusCallback); } else { finish(); return; } ActionBar actionBar = getActionBar(); actionBar.setDisplayUseLogoEnabled(true); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); mViewSwitcher = (ViewSwitcher) findViewById(R.id.rootViewSwitcher); updateViewVisibility(); }
From source file:com.shafiq.mytwittle.view.TweetSpotlightActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String statusIdAsString = getIntent().getStringExtra(STATUS_ID_KEY); if (statusIdAsString != null) { long statusId = Long.parseLong(statusIdAsString); mGetStatusCallback = TwitterManager.get().getFetchStatusInstance().new FinishedCallback() { @Override//from w ww . j av a2 s. c o m public void finished(TwitterFetchResult result, TwitterStatus status) { // TODO: handle error properly if (result.isSuccessful() && status != null) { if (mTweetSpotlightAdapter != null) { onGetStatus(status); } } else { finish(); } mGetStatusCallback = null; } }; // TODO: Look at using a cached value TwitterManager.get().getStatus(statusId, mGetStatusCallback); } else { finish(); return; } ActionBar actionBar = getActionBar(); actionBar.setDisplayUseLogoEnabled(true); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); mViewSwitcher = (ViewSwitcher) findViewById(R.id.rootViewSwitcher); updateViewVisibility(); }
From source file:com.manning.androidhacks.hack040.ImageDetailActivity.java
@SuppressLint("NewApi") @Override/*from ww w. ja v a 2 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(Images.imageWorkerUrlsAdapter); mImageWorker.setImageCache(ImageCache.findOrCreateCache(this, IMAGE_CACHE_DIR)); mImageWorker.setImageFadeIn(false); // 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); } }
From source file:com.opensource.bitmapfun.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 mImageWorker = new ImageFetcher(this, displaymetrics.widthPixels, displaymetrics.heightPixels); File cachePath = null;/*from www . j a v a 2 s . co m*/ if (Utils.hasExternalStorage()) { File appRoot = new File(Environment.getExternalStorageDirectory(), "BitmapFun"); cachePath = new File(appRoot, ".cache"); } // mImageWorker = new ImageResizer(this, displaymetrics.widthPixels, displaymetrics.heightPixels); mImageWorker.setAdapter(Images.imageWorkerUrlsAdapter); mImageWorker.setImageCache(ImageCache.findOrCreateCache(this, cachePath, IMAGE_CACHE_DIR)); mImageWorker.setImageFadeIn(false); // 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); } }
From source file:am.util.mvp.AMActivity.java
/** * Toolbar//from w w w.j a v a 2s .c o m * * @param toolbarId Toolbar?ID */ @RequiresApi(21) public final void setActionBar(@IdRes int toolbarId, boolean showTitle) { setActionBar(toolbarId); final ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(showTitle); } }
From source file:com.amagi82.kerbalspaceapp.Settings.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(true); getActionBar().setTitle(R.string.title_activity_settings); SeekBar clearance = (SeekBar) findViewById(R.id.seekBarClearance); SeekBar margins = (SeekBar) findViewById(R.id.seekBarMargins); SeekBar inclination = (SeekBar) findViewById(R.id.seekBarInclination); mClearance = (TextView) findViewById(R.id.tvClearance); mMargins = (TextView) findViewById(R.id.tvMargins); mInclination = (TextView) findViewById(R.id.tvInclination); chooseLanguage = (Spinner) findViewById(R.id.spinnerLanguages); SharedPreferences prefs = getSharedPreferences("settings", MODE_PRIVATE); mClearanceValue = prefs.getInt("mClearanceValue", 1000); mMarginsValue = prefs.getInt("mMarginsValue", 10); mInclinationValue = prefs.getInt("mInclinationValue", 30); chooseLanguage.setSelection(prefs.getInt("language", 0)); // Set up spinner ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActionBar().getThemedContext(), R.array.languages, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); chooseLanguage.setAdapter(adapter);//from www. j a v a 2s. c om // @formatter:off if (Locale.getDefault().getLanguage().equals("en")) chooseLanguage.setSelection(0); if (Locale.getDefault().getLanguage().equals("fr")) chooseLanguage.setSelection(1); if (Locale.getDefault().getLanguage().equals("de")) chooseLanguage.setSelection(2); if (Locale.getDefault().getLanguage().equals("es")) chooseLanguage.setSelection(3); if (Locale.getDefault().getLanguage().equals("ru")) chooseLanguage.setSelection(4); // Set seekbar progress clearance.setProgress(mClearanceValue); margins.setProgress(mMarginsValue); inclination.setProgress(mInclinationValue); // Display values mClearance.setText(mClearanceValue + "m"); mMargins.setText(mMarginsValue + "%"); setInclinationText(); clearance.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { String value = NumberFormat.getNumberInstance(Locale.getDefault()).format(progress); mClearance.setText(value + "m"); mClearanceValue = progress; } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); margins.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { mMargins.setText(progress + "%"); mMarginsValue = progress; } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); inclination.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { mInclinationValue = progress; setInclinationText(); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); chooseLanguage.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { language = langCode[chooseLanguage.getSelectedItemPosition()]; onConfigurationChanged(getResources().getConfiguration()); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); }