List of usage examples for android.app ActionBar hide
public abstract void hide();
From source file:com.mbpro.tweebook.facebook.images.FacebookImageDetailActivity.java
@SuppressLint("NewApi") @Override//from w w w . j av a 2s . c o 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.manning.androidhacks.hack040.ImageDetailActivity.java
@SuppressLint("NewApi") @Override/*w w w .j a v a 2s . 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;/* w w w . jav a2 s .com*/ 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:run.ace.NativeHost.java
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); _activity = (CordovaActivity) cordova.getActivity(); _application = _activity.getApplication(); _webView = webView;//from w ww. j a v a 2 s . c o m _mainFrame = new Frame(_activity); this.intent = _activity.getIntent(); /* TODO: No point unless XBF parsing is also done in native host and instances can be retrieved on managed side without caching of property values try { _startupMarkup = readXbf("www/xbf/startup.xbf"); // Since a startup markup file exists, detach the WebView ((android.view.ViewGroup)_webView.getView().getParent()).removeView(_webView.getView()); } catch (IOException ex) { // A startup markup file doesn't exist } */ // TODO: Remove the hiding here, or do it off of some setting final android.app.ActionBar actionBar = _activity.getActionBar(); if (actionBar != null) { Runnable runnable = new Runnable() { public void run() { actionBar.hide(); }; }; _activity.runOnUiThread(runnable); } }
From source file:org.orange.querysystem.ScoresActivity.java
@TargetApi(11) @Override// www . j a v a 2s . c o m protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_tabs_pager); mTabHost = (TabHost) findViewById(android.R.id.tabhost); mTabHost.setup(); mViewPager = (ViewPager) findViewById(R.id.pager); mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager); //3.0ActionBar if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { //Title findViewById(R.id.currentTime).setLayoutParams(new LinearLayout.LayoutParams(0, 0)); ActionBar mActionBar = getActionBar(); mActionBar.setTitle(R.string.transcripts); //????ActionBar if (getResources() .getConfiguration().orientation == android.content.res.Configuration.ORIENTATION_LANDSCAPE) { mActionBar.hide(); } } else { //Title ((TextView) findViewById(R.id.currentTime)).setText(R.string.transcripts); } if (savedInstanceState == null) { authenticated = !SettingsActivity.requestPasswordForPrivateInformation(this); if (authenticated) { enterActivity(); } else { showDialog(PASSWORD_PROMPT); } } else { authenticated = savedInstanceState.getBoolean(KEY_AUTHENTICATED, false); if (authenticated) { currentTab = savedInstanceState.getString(KEY_CURRENT_TAB); enterActivity(); } } }
From source file:org.orange.querysystem.PostsActivity.java
@TargetApi(11) @Override//w w w . java2 s. c om protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_tabs_pager); currentTime = (TextView) findViewById(R.id.currentTime); currentTime.setText(R.string.post); mWebUpdaterToDB = Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB ? new PostUpdater(this) : new PostUpdater(this) { @Override public boolean updatePosts(boolean mandatorily) { boolean isUpdating = super.updatePosts(mandatorily); if (isUpdating) { startRefreshAnimation(); } return isUpdating; } }; mWebUpdaterToDB.setOnPostExecuteListener(new OnPostUpdateListener() { @Override public void onPostUpdate(long numberOfInsertedPosts, boolean mandatorily) { if (mandatorily || numberOfInsertedPosts > 0) { if (numberOfInsertedPosts > 0) { reloadPosts(); String message = PostsActivity.this.getResources().getString(R.string.has_updated_posts, numberOfInsertedPosts); Toast.makeText(PostsActivity.this, message, Toast.LENGTH_SHORT).show(); } else if (numberOfInsertedPosts == 0) { Toast.makeText(PostsActivity.this, R.string.no_new_post, Toast.LENGTH_SHORT).show(); } else //numberOfInsertedPosts < 0 { Toast.makeText(PostsActivity.this, R.string.fail_to_update_post, Toast.LENGTH_SHORT).show(); } } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { stopRefreshAnimation(); } } }); if (mWebUpdaterToDB.updatePostsAutomatically()) { Toast.makeText(this, R.string.start_to_update_post_automatically, Toast.LENGTH_SHORT).show(); } mTabHost = (TabHost) findViewById(android.R.id.tabhost); mTabHost.setup(); mViewPager = (ViewPager) findViewById(R.id.pager); mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager); //3.0ActionBar if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { ActionBar mActionBar = getActionBar(); mActionBar.setTitle(R.string.post); currentTime.setLayoutParams(new LinearLayout.LayoutParams(0, 0)); //????ActionBar if (getResources() .getConfiguration().orientation == android.content.res.Configuration.ORIENTATION_LANDSCAPE) { mActionBar.hide(); } } loadPosts(); }
From source file:com.leo.runningman.ui.ImageDetailActivity.java
@SuppressLint("NewApi") @Override//from w w w . jav a2 s . com 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.actionbarsherlock.sample.hcgallery.ContentFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mContentView = inflater.inflate(R.layout.content_welcome, null); final ImageView imageView = (ImageView) mContentView.findViewById(R.id.image); mContentView.setDrawingCacheEnabled(false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mContentView.setOnDragListener(new View.OnDragListener() { public boolean onDrag(View v, DragEvent event) { switch (event.getAction()) { case DragEvent.ACTION_DRAG_ENTERED: mContentView.setBackgroundColor(getResources().getColor(R.color.drag_active_color)); break; case DragEvent.ACTION_DRAG_EXITED: mContentView.setBackgroundColor(Color.TRANSPARENT); break; case DragEvent.ACTION_DRAG_STARTED: return processDragStarted(event); case DragEvent.ACTION_DROP: mContentView.setBackgroundColor(Color.TRANSPARENT); return processDrop(event, imageView); }/*from ww w . ja v a2 s . c om*/ return false; } }); // Keep the action bar visibility in sync with the system status bar. That is, when entering // 'lights out mode,' hide the action bar, and when exiting this mode, show the action bar. final Activity activity = getActivity(); mContentView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() { public void onSystemUiVisibilityChange(int visibility) { ActionBar actionBar = activity.getActionBar(); if (actionBar != null) { mContentView.setSystemUiVisibility(visibility); if (visibility == View.STATUS_BAR_VISIBLE) { actionBar.show(); } else { actionBar.hide(); } } } }); // Show/hide the system status bar when single-clicking a photo. This is also called // 'lights out mode.' Activating and deactivating this mode also invokes the listener // defined above, which will show or hide the action bar accordingly. mContentView.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (mContentView.getSystemUiVisibility() == View.STATUS_BAR_VISIBLE) { mContentView.setSystemUiVisibility(View.STATUS_BAR_HIDDEN); } else { mContentView.setSystemUiVisibility(View.STATUS_BAR_VISIBLE); } } }); } // When long-pressing a photo, activate the action mode for selection, showing the // contextual action bar (CAB). mContentView.setOnLongClickListener(new View.OnLongClickListener() { public boolean onLongClick(View view) { if (mCurrentActionMode != null) { return false; } mCurrentActionMode = getActivity().startActionMode(mContentSelectionActionModeCallback); mContentView.setSelected(true); return true; } }); return mContentView; }
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 ww w . ja v a 2s.c o m 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.hellosky.recyclingimageloader.ImageDetailActivity.java
@TargetApi(11) @Override/*ww w. jav a2s.co 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; // For this sample we'll use half of the longest width to resize our images. As the // image scaling ensures the image is larger than this, we should be left with a // resolution that is appropriate for both portrait and landscape. For best image quality // we shouldn't divide by 2, but this will use more memory and require a larger memory // cache. final int longest = (height > width ? height : width) / 2; mImageLoader = new ImageLoader(this); mImageLoader.setImageSize(longest); // Set up ViewPager and backing adapter mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), Images.imageUrls.length); mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mAdapter); mPager.setPageMargin((int) getResources().getDimension(R.dimen.image_detail_pager_margin)); mPager.setOffscreenPageLimit(2); // 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.hasHoneycomb()) { final ActionBar actionBar = getActionBar(); // Hide title text and set home as up actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); // 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(); } } }); // Start low profile mode and hide ActionBar mPager.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); actionBar.hide(); } // 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); } }