@@ -0,0 +1,2237 @@
+/*%0A   Copyright 2015 Jianan - qinxiandiqi@foxmail.com%0A%0A   Licensed under the Apache License, Version 2.0 (the %22License%22);%0A   you may not use this file except in compliance with the License.%0A   You may obtain a copy of the License at%0A%0A     http://www.apache.org/licenses/LICENSE-2.0%0A%0A   Unless required by applicable law or agreed to in writing, software%0A   distributed under the License is distributed on an %22AS IS%22 BASIS,%0A   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A   See the License for the specific language governing permissions and%0A   limitations under the License.%0A */%0Apackage com.qinxiandiqi.easyandroid.base.util;%0A%0Aimport android.content.res.Resources;%0Aimport android.graphics.BitmapFactory;%0A%0Aimport java.io.File;%0A%0A/**%0A * Created by Jianan on 3/5/15.%0A */%0Apublic class ImageUtil %7B%0A%0A%0A    public static BitmapFactory.Options getBitmapOption(File bitmapFile)%7B%0A        return ImageUtil.getBitmapOption(bitmapFile.getAbsoluteFile());%0A    %7D%0A%0A    public static BitmapFactory.Options getBitmapOption(String bitmapPath)%7B%0A        BitmapFactory.Options options = new BitmapFactory.Options();%0A        options.inJustDecodeBounds = true;%0A        BitmapFactory.decodeFile(bitmapPath, options);%0A        return options;%0A    %7D%0A%0A    public static BitmapFactory.Options getBitmapOption(Resources resources, int resourceId)%7B%0A        BitmapFactory.Options options = new BitmapFactory.Options();%0A        options.inJustDecodeBounds = true;%0A        BitmapFactory.decodeResource(resources, resourceId, options);%0A        return options;%0A    %7D%0A%0A    public static int calculateInSampleSize(int srcWidth, int srcHeight, int reqWidth, int reqHeight)%7B%0A        int inSampleSize = 1;%0A        if (srcHeight %3E reqHeight %7C%7C srcWidth %3E reqWidth) %7B%0A%0A            final int halfHeight = srcHeight / 2;%0A            final int halfWidth = srcWidth / 2;%0A%0A            // Calculate the largest inSampleSize value that is a power of 2 and keeps both%0A            // height and width larger than the requested height and width.%0A            while ((halfHeight / inSampleSize) %3E reqHeight%0A                    && (halfWidth / inSampleSize) %3E reqWidth) %7B%0A                inSampleSize *= 2;%0A            %7D%0A        %7D%0A        return inSampleSize;%0A    %7D%0A%7D%0A

add image util.