Remote fetch of thumbnail
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / adapter / Utils.java
1 package com.owncloud.android.ui.adapter;
2
3 import java.io.File;
4
5 import android.content.Context;
6 import android.os.Build;
7 import android.os.Environment;
8
9 public class Utils {
10 public static final int IO_BUFFER_SIZE = 8 * 1024;
11
12 private Utils() {};
13
14 public static boolean isExternalStorageRemovable() {
15 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
16 return Environment.isExternalStorageRemovable();
17 }
18 return true;
19 }
20
21 public static File getExternalCacheDir(Context context) {
22 if (hasExternalCacheDir()) {
23 return context.getExternalCacheDir();
24 }
25
26 // Before Froyo we need to construct the external cache dir ourselves
27 final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/";
28 return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir);
29 }
30
31 public static boolean hasExternalCacheDir() {
32 return Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO;
33 }
34
35 }