|
@@ -11,6 +11,7 @@ import android.graphics.drawable.Drawable;
|
|
|
import android.media.ExifInterface;
|
|
import android.media.ExifInterface;
|
|
|
import android.net.Uri;
|
|
import android.net.Uri;
|
|
|
import android.support.v4.graphics.drawable.DrawableCompat;
|
|
import android.support.v4.graphics.drawable.DrawableCompat;
|
|
|
|
|
+import android.util.Log;
|
|
|
|
|
|
|
|
import java.io.BufferedOutputStream;
|
|
import java.io.BufferedOutputStream;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.ByteArrayOutputStream;
|
|
@@ -473,7 +474,7 @@ public class ImageUtil {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static File compressImageFile(Context context, File imgFile) {
|
|
public static File compressImageFile(Context context, File imgFile) {
|
|
|
-
|
|
|
|
|
|
|
+ long startTime = System.currentTimeMillis(); //起始时间
|
|
|
if (imgFile == null || context == null) {
|
|
if (imgFile == null || context == null) {
|
|
|
return imgFile;
|
|
return imgFile;
|
|
|
}
|
|
}
|
|
@@ -538,10 +539,16 @@ public class ImageUtil {
|
|
|
|
|
|
|
|
ImageUtil.updateGallery(context,rotedpath);
|
|
ImageUtil.updateGallery(context,rotedpath);
|
|
|
|
|
|
|
|
|
|
+ long endTime = System.currentTimeMillis(); //结束时间
|
|
|
|
|
+ long runTime = endTime - startTime;
|
|
|
|
|
+ Log.d("compressImageFile", String.format("成功 耗时 %d ms", runTime));
|
|
|
return scaleFile;
|
|
return scaleFile;
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
|
|
+ long endTime = System.currentTimeMillis(); //结束时间
|
|
|
|
|
+ long runTime = endTime - startTime;
|
|
|
|
|
+ Log.d("compressImageFile", String.format("失败 耗时 %d ms", runTime));
|
|
|
return routedFile;
|
|
return routedFile;
|
|
|
}
|
|
}
|
|
|
|
|
|