List of usage examples for android.app ActionBar hide
public abstract void hide();
From source file:uz.sag.sagbuyurtmalari.sagbuyurtmalari.ui.ImageDetailActivity.java
@TargetApi(VERSION_CODES.HONEYCOMB) @Override/* w w w. j ava2 s . c o m*/ public void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode(); } 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; ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(this, IMAGE_CACHE_DIR); cacheParams.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of app memory // The ImageFetcher takes care of loading images into our ImageView children asynchronously mImageFetcher = new ImageFetcher(this, longest); mImageFetcher.addImageCache(getSupportFragmentManager(), cacheParams); mImageFetcher.setImageFadeIn(false); // Set up ViewPager and backing adapter mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), Images.imageUrls.length); mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mAdapter); //@TODO mPager.setPageMargin((int) getResources().getDimension(R.dimen.horizontal_page_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); } }
From source file:ginger.connexus.activity.ImageDetailActivity.java
@Override public void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode();/* w ww . j a va2 s. c o m*/ } super.onCreate(savedInstanceState); setContentView(R.layout.pager_image_detail); // 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; ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(this, IMAGE_CACHE_DIR); // Set memory cache to 25% of app memory cacheParams.setMemCacheSizePercent(0.25f); // The ImageFetcher takes care of loading images into our ImageView // children asynchronously mImageFetcher = new ImageFetcher(this, longest); mImageFetcher.addImageCache(getSupportFragmentManager(), cacheParams); mImageFetcher.setImageFadeIn(false); // Set up ViewPager and backing adapter final List<String> imageUrls = Arrays.asList(getIntent().getStringArrayExtra(EXTRA_IMAGE_URLS)); mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), imageUrls); 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); } }
From source file:com.vector.wemarried.android.utils.bitmapfun.ui.ImageDetailActivity.java
@TargetApi(11) @Override/*from ww w. j ava2 s .co m*/ public void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode(); } 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; // Set up ViewPager and backing adapter mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), Images.imageIDs.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(); if (actionBar != null) { // 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); } }
From source file:org.kegbot.app.HomeActivity.java
@Override protected void onStart() { super.onStart(); mCore = KegbotCore.getInstance(this); mConfig = mCore.getConfiguration();/*www . j a v a2 s .co m*/ maybeShowTapWarnings(); //for dummy pour status final Pair<String, String> qty = Units.localizeWithoutScaling(mCore.getConfiguration(), 0.0); mPourVolumeBadge.setBadgeValue(qty.first); mPourVolumeBadge.setBadgeCaption("Current " + Units.capitalizeUnits(qty.second) + " Poured"); mImageView0.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final ActionBar actionBar = getActionBar(); if (actionBar.isShowing()) { actionBar.hide(); mConfig.setShowActionBar(false); } else { actionBar.show(); mConfig.setShowActionBar(true); } } }); //for start button final Context thisContext = this; mStartButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mConfig.useAccounts()) { final Intent intent = KegtabCommon.getAuthDrinkerActivityIntent(thisContext); startActivityForResult(intent, REQUEST_AUTHENTICATE); } else { mCore.getFlowManager().activateUserAmbiguousTap(""); } } }); mNewDrinkerButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Intent intent = KegtabCommon.getCreateDrinkerActivityIntent(thisContext); startActivityForResult(intent, REQUEST_CREATE_DRINKER); } }); mTapStatusPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { //for progress bar if (mTaps.size() > 0) { final KegTap tap = mTaps.get(position); if (tap.hasCurrentKeg()) { final Models.Keg keg = tap.getCurrentKeg(); double remainml = keg.getRemainingVolumeMl(); double totalml = keg.getFullVolumeMl(); double percent = (remainml) / (totalml) * 100; final ProgressBar mTapProgress = (ProgressBar) findViewById(R.id.tapProgress); mTapProgress.setMax((int) totalml); mTapProgress.setProgress((int) remainml); final TextView mTapPercentage = (TextView) findViewById(R.id.tapPercentage); mTapPercentage.setText(String.format("%.2f", percent) + "%"); } } //for backgrounds switch (position) { case 0: mImageView0.setImageResource(R.drawable.e1); mImageView1.setBackgroundResource(R.drawable.e2); break; case 1: mImageView0.setImageResource(R.drawable.a1); mImageView1.setBackgroundResource(R.drawable.a2); break; case 2: mImageView0.setImageResource(R.drawable.b1); mImageView1.setBackgroundResource(R.drawable.b2); break; case 3: mImageView0.setImageResource(R.drawable.c1); mImageView1.setBackgroundResource(R.drawable.c2); break; case 4: mImageView0.setImageResource(R.drawable.d1); mImageView1.setBackgroundResource(R.drawable.d2); break; default: mImageView0.setImageResource(R.drawable.e1); mImageView1.setBackgroundResource(R.drawable.e2); break; } } @Override public void onPageScrollStateChanged(int state) { } }); }
From source file:com.gmail.charleszq.picorner.ui.ImageDetailActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.image_detail_pager); // The ImageFetcher takes care of loading images into our ImageView // children asynchronously mImageFetcher = ImageLoader.getInstance(); // is offline enabled String isOfflineEnabledString = getIntent().getStringExtra(OFFLINE_COMMAND_KEY); if (isOfflineEnabledString != null) { mIsOfflineEnabled = Boolean.parseBoolean(isOfflineEnabledString); }//from ww w . j a va 2 s .c o m // Set up ViewPager and backing adapter mPhotosProvider = (IPhotosProvider) getIntent().getExtras().getSerializable(DP_KEY); mAdapter = new ImagePagerAdapter(mPhotosProvider, getSupportFragmentManager(), mPhotosProvider.getCurrentSize(), mIsOfflineEnabled); 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); final ActionBar actionBar = getActionBar(); // Hide title text and set home as up actionBar.setDisplayHomeAsUpEnabled(true); // actionBar.setDisplayShowTitleEnabled(false); // Hide and show the ActionBar as the visibility changes mPager.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() { @Override public void onSystemUiVisibilityChange(int vis) { boolean shown = true; if ((vis & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0) { actionBar.hide(); shown = false; } else { actionBar.show(); } if (mActionBarListeners != null) { for (IActionBarVisibleListener lis : mActionBarListeners) { lis.onActionBarShown(shown); } } } }); // Start low profile mode and hide ActionBar boolean showActionBar = getIntent().getBooleanExtra(SHOW_ACTION_BAR_KEY, true); if (!showActionBar) { 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(LARGE_IMAGE_POSITION, -1); if (extraCurrentItem != -1) { mPager.setCurrentItem(extraCurrentItem); } boolean startSlide = getIntent().getBooleanExtra(SLIDE_SHOW_KEY, false); if (startSlide) { startSlideShow(1); } }
From source file:com.brkc.traffic.ui.image.ImageDetailActivity.java
@TargetApi(VERSION_CODES.HONEYCOMB) @Override//w w w . ja va 2 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; // 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; ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(this, IMAGE_CACHE_DIR); cacheParams.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of app memory // The ImageFetcher takes care of loading images into our ImageView children asynchronously mImageFetcher = new ImageFetcher(this, longest); mImageFetcher.addImageCache(getSupportFragmentManager(), cacheParams); mImageFetcher.setImageFadeIn(false); // Set up ViewPager and backing adapter mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), ImageListFragment.getImageCount()); mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mAdapter); mPager.setPageMargin((int) getResources().getDimension(R.dimen.horizontal_page_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(); if (actionBar != null) { // 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); } }
From source file:com.ovte.bitmap_load.ui.ImageDetailActivity.java
@TargetApi(11) @Override/*from w w w.j a va 2 s . c o m*/ public void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode(); } 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; ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(this, IMAGE_CACHE_DIR); cacheParams.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of app memory // The ImageFetcher takes care of loading images into our ImageView children asynchronously mImageFetcher = new ImageFetcher(this, longest); mImageFetcher.addImageCache(getSupportFragmentManager(), cacheParams); mImageFetcher.setImageFadeIn(false); // 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(); if (actionBar != null) { // 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); } }
From source file:io.github.sunggu.searchimage.ui.ImageDetailActivity.java
@TargetApi(VERSION_CODES.HONEYCOMB) @Override/* w w w . java 2 s. c o m*/ public void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode(); } 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; ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(this, IMAGE_CACHE_DIR); cacheParams.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of app memory // The ImageFetcher takes care of loading images into our ImageView children asynchronously mImageFetcher = new ImageFetcher(this, longest); mImageFetcher.addImageCache(getSupportFragmentManager(), cacheParams); mImageFetcher.setImageFadeIn(false); // Set up ViewPager and backing adapter mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), Images.getInstance().getCount()); mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mAdapter); mPager.setPageMargin((int) getResources().getDimension(R.dimen.horizontal_page_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(); if (actionBar != null) { // 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); } }
From source file:anastasoft.rallyvision.activity.MenuPrincipal.java
private void hideActionBar() { if (Build.VERSION.SDK_INT < 16) { android.support.v7.app.ActionBar actionBar = getSupportActionBar(); actionBar.hide(); } else {/*from ww w . ja va2 s.c o m*/ // Remember that you should never show the action bar if the // status bar is hidden, so hide that too if necessary. ActionBar actionBar = getActionBar(); actionBar.hide(); } }
From source file:com.simplelife.seeds.android.utils.gridview.gridviewui.ImageDetailActivity.java
@TargetApi(11) @Override/*from www.ja v a 2 s .c o m*/ public void onCreate(Bundle savedInstanceState) { /* if (BuildConfig.DEBUG) { Utils.enableStrictMode(); }*/ super.onCreate(savedInstanceState); setContentView(R.layout.activity_seeds_gridview_detailpager); // 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; ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(this, SeedsDefinitions.SEEDS_IMAGE_CACHE_DIR); cacheParams.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of app memory // The ImageFetcher takes care of loading images into our ImageView children asynchronously mImageFetcher = new ImageFetcher(this, longest); mImageFetcher.addImageCache(getSupportFragmentManager(), cacheParams, "DETAILTAG"); mImageFetcher.setImageFadeIn(false); // Set up ViewPager and backing adapter //mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), Images.imageUrls.length); mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), Images.getSeedsEntity().getPicLinks().size()); 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 if (null != actionBar) { 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); } }