List of usage examples for android.os StatFs StatFs
public StatFs(String path)
From source file:com.android.fragmentbase.cache.ImageCache.java
/** * Check how much usable space is available at a given path. * * @param path The path to check/* w w w . j a va 2s. c o m*/ * @return The space available in bytes */ @TargetApi(VERSION_CODES.GINGERBREAD) public static long getUsableSpace(File path) { if (ImageUtils.hasGingerbread()) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }
From source file:android.bitmap.util.ImageCache.java
/** * Check how much usable space is available at a given path. * * @param path The path to check// w w w . j av a 2 s. c o m * @return The space available in bytes */ @TargetApi(VERSION_CODES.GINGERBREAD) public static long getUsableSpace(File path) { if (Utils.hasGingerbread()) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }
From source file:github.daneren2005.dsub.fragments.SubsonicFragment.java
protected void warnIfStorageUnavailable() { if (!Util.isExternalStoragePresent()) { Util.toast(context, R.string.select_album_no_sdcard); }//from w w w .j a va 2s . com try { StatFs stat = new StatFs(FileUtil.getMusicDirectory(context).getPath()); long bytesAvailableFs = (long) stat.getAvailableBlocks() * (long) stat.getBlockSize(); if (bytesAvailableFs < 50000000L) { Util.toast(context, context.getResources().getString(R.string.select_album_no_room, Util.formatBytes(bytesAvailableFs))); } } catch (Exception e) { Log.w(TAG, "Error while checking storage space for music directory", e); } }
From source file:com.chatitzemoumin.londoncoffeeapp.util.ImageCache.java
/** * Check how much usable space is available at a given path. * * @param path The path to check// w w w. j a va2 s .co m * @return The space available in bytes */ @TargetApi(VERSION_CODES.GINGERBREAD) public static long getUsableSpace(File path) { if (PlatformUtils.hasGingerbread()) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }
From source file:com.slack.slackteam.cache.ImageCache.java
/** * Check how much usable space is available at a given path. * * @param path The path to check//from w w w . j a v a 2 s. co m * @return The space available in bytes */ @TargetApi(VERSION_CODES.GINGERBREAD) public static long getUsableSpace(File path) { if (SLUtils.hasGingerbread()) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }
From source file:com.common.library.bitmap.ImageCache.java
/** * Check how much usable space is available at a given path. * * @param path The path to check/*w w w . j a v a 2 s .c o m*/ * @return The space available in bytes */ @TargetApi(VERSION_CODES.GINGERBREAD) public static long getUsableSpace(File path) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }
From source file:com.ccz.viewimages.displayingbitmaps.util.ImageCache.java
/** * Check how much usable space is available at a given path. * * @param path The path to check/* w w w. j ava2 s . co m*/ * @return The space available in bytes */ @TargetApi(VERSION_CODES.GINGERBREAD) public static long getUsableSpace(File path) { if (FlavorUtils.hasGingerbread()) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }
From source file:air.com.snagfilms.utils.ImageCache.java
/** * Check how much usable space is available at a given path. * /* w w w.j a v a2 s .com*/ * @param path * The path to check * @return The space available in bytes */ @SuppressWarnings("deprecation") @TargetApi(VERSION_CODES.GINGERBREAD) public static long getUsableSpace(File path) { if (Utils.hasGingerbread()) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }
From source file:com.sughimura.samplebitmaps.util.ImageCache.java
/** * Check how much usable space is available at a given path. * * @param path The path to check/*from w ww . j a v a2s . c om*/ * @return The space available in bytes */ @TargetApi(VERSION_CODES.GINGERBREAD) public static long getUsableSpace(File path) { if (com.sughimura.samplebitmaps.util.Utils.hasGingerbread()) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }
From source file:com.yooiistudios.newskit.core.cache.volley.ImageCache.java
/** * Check how much usable space is available at a given path. * * @param path The path to check//from w w w . j a v a2 s . c o m * @return The space available in bytes */ @TargetApi(VERSION_CODES.GINGERBREAD) public static long getUsableSpace(File path) { if (Device.hasGingerbread()) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); }