@@ -0,0 +1,2161 @@
+/*%0A * Copyright 2015 Hippo Seven%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 */%0A%0Apackage com.hippo.nimingban.util;%0A%0Aimport android.graphics.Bitmap;%0Aimport android.graphics.BitmapFactory;%0Aimport android.support.annotation.NonNull;%0A%0Aimport com.hippo.yorozuya.MathUtils;%0Aimport com.hippo.yorozuya.io.InputStreamPipe;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0A%0Apublic class BitmapUtils %7B%0A%0A    /**%0A     * @return null or the bitmap%0A     */%0A    public static Bitmap decodeStream(@NonNull InputStreamPipe isp, int maxWidth, int maxHeight) %7B%0A        try %7B%0A            isp.obtain();%0A            InputStream is = isp.open();%0A%0A            BitmapFactory.Options options = new BitmapFactory.Options();%0A            options.inJustDecodeBounds = true;%0A            BitmapFactory.decodeStream(is, null, options);%0A            is.close();%0A%0A            int width = options.outWidth;%0A            int height = options.outHeight;%0A            if (width %3C= 0 %7C%7C height %3C= 0) %7B%0A                return null;%0A            %7D%0A%0A            options.inJustDecodeBounds = false;%0A            if (width %3C= maxWidth && height %3C= maxHeight) %7B%0A                options.inSampleSize = 1;%0A            %7D else %7B%0A                float scaleW = (float) width / (float) maxWidth;%0A                float scaleH = (float) height / (float) maxHeight;%0A                options.inSampleSize = MathUtils.nextPowerOf2((int) Math.max(scaleW, scaleH));%0A            %7D%0A%0A            return BitmapFactory.decodeStream(isp.open(), null, options);%0A        %7D catch (IOException e) %7B%0A            return null;%0A        %7D finally %7B%0A            isp.close();%0A            isp.release();%0A        %7D%0A    %7D%0A%7D%0A

Use image loading strategy for Header