// Path: app/src/main/java/org/xdty/gallery/model/Config.java
// public class Config {
// 
//     public final static String SAMBA_SERVER = "samba_server";
//     public final static String SAMBA_FOLDER = "samba_folder";
//     public final static String SAMBA_USERNAME = "samba_username";
//     public final static String SAMBA_PASSWORD = "samba_password";
//     public final static String ROTATE_TYPE = "rotate_type";
//     public final static String VIEWPAGER_EFFECT = "viewpager_effect";
//     public final static String GRID_EFFECT = "grid_effect";
//     public final static String GRID_EFFECT_DURATION = "grid_effect_duration";
//     public final static String LOCAL_SORT_TYPE = "local_sort_type";
//     public final static String NETWORK_SORT_TYPE = "network_sort_type";
//     public final static String FILE_EXPLORER_MODE = "file_explorer_mode";
//     public final static String SHOW_HIDING_FILES = "show_hiding_files";
//     public final static String REVERSE_LOCAL_SORT = "reverse_local_sort";
//     public final static String REVERSE_NETWORK_SORT = "reverse_network_sort";
// 
//     public final static String thumbnailDir = "thumbnails";
//     public final static String ROOT_PATH = "root://";
// 
//     public final static String SERVERS = "servers";
// 
//     public final static int MAX_IMAGE_SIZE = 2048;
//     public final static int IMAGE_SIMPLE_SIZE = 2;
//     public final static int IMAGE_THUMBNAIL_SIMPLE_SIZE = 2;
// }


import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.preference.PreferenceManager;
import android.util.TypedValue;
import android.webkit.MimeTypeMap;
import org.xdty.gallery.R;
import org.xdty.gallery.model.Config;
import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
    }

    public static Bitmap getResizedBitmap(Bitmap bm, int newWidth, int newHeight) {
        int width = bm.getWidth();
        int height = bm.getHeight();
        float scaleWidth = ((float) newWidth) / width;
        float scaleHeight = ((float) newHeight) / height;
        Matrix matrix = new Matrix();
        matrix.postScale(scaleWidth, scaleHeight);
        Bitmap resizedBitmap = Bitmap.createBitmap(
                bm, 0, 0, width, height, matrix, false);
        bm.recycle();
        return resizedBitmap;
    }

    public static Bitmap decodeSampledBitmapFromStream(InputStream inputStream,
            int reqWidth, int reqHeight) throws IOException {

        // First decode with inJustDecodeBounds=true to check dimensions
        final BitmapFactory.Options options = new BitmapFactory.Options();
        options.inJustDecodeBounds = true;
        BitmapFactory.decodeStream(inputStream, null, options);

        // Calculate inSampleSize
        //options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
        options.inSampleSize = calculateLessInSampleSize(options, reqWidth, reqHeight);
        //options.inSampleSize = Config.IMAGE_THUMBNAIL_SIMPLE_SIZE;

        // Decode bitmap with inSampleSize set
        options.inJustDecodeBounds = false;
// Path: app/src/main/java/org/xdty/gallery/model/Config.java
// public class Config {
// 
//     public final static String SAMBA_SERVER = "samba_server";
//     public final static String SAMBA_FOLDER = "samba_folder";
//     public final static String SAMBA_USERNAME = "samba_username";
//     public final static String SAMBA_PASSWORD = "samba_password";
//     public final static String ROTATE_TYPE = "rotate_type";
//     public final static String VIEWPAGER_EFFECT = "viewpager_effect";
//     public final static String GRID_EFFECT = "grid_effect";
//     public final static String GRID_EFFECT_DURATION = "grid_effect_duration";
//     public final static String LOCAL_SORT_TYPE = "local_sort_type";
//     public final static String NETWORK_SORT_TYPE = "network_sort_type";
//     public final static String FILE_EXPLORER_MODE = "file_explorer_mode";
//     public final static String SHOW_HIDING_FILES = "show_hiding_files";
//     public final static String REVERSE_LOCAL_SORT = "reverse_local_sort";
//     public final static String REVERSE_NETWORK_SORT = "reverse_network_sort";
// 
//     public final static String thumbnailDir = "thumbnails";
//     public final static String ROOT_PATH = "root://";
// 
//     public final static String SERVERS = "servers";
// 
//     public final static int MAX_IMAGE_SIZE = 2048;
//     public final static int IMAGE_SIMPLE_SIZE = 2;
//     public final static int IMAGE_THUMBNAIL_SIMPLE_SIZE = 2;
// }


// Path: app/src/main/java/org/xdty/gallery/utils/Utils.java
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.preference.PreferenceManager;
import android.util.TypedValue;
import android.webkit.MimeTypeMap;
import org.xdty.gallery.R;
import org.xdty.gallery.model.Config;
import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

    }

    public static Bitmap getResizedBitmap(Bitmap bm, int newWidth, int newHeight) {
        int width = bm.getWidth();
        int height = bm.getHeight();
        float scaleWidth = ((float) newWidth) / width;
        float scaleHeight = ((float) newHeight) / height;
        Matrix matrix = new Matrix();
        matrix.postScale(scaleWidth, scaleHeight);
        Bitmap resizedBitmap = Bitmap.createBitmap(
                bm, 0, 0, width, height, matrix, false);
        bm.recycle();
        return resizedBitmap;
    }

    public static Bitmap decodeSampledBitmapFromStream(InputStream inputStream,
            int reqWidth, int reqHeight) throws IOException {

        // First decode with inJustDecodeBounds=true to check dimensions
        final BitmapFactory.Options options = new BitmapFactory.Options();
        options.inJustDecodeBounds = true;
        BitmapFactory.decodeStream(inputStream, null, options);

        // Calculate inSampleSize
        //options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
        options.inSampleSize = calculateLessInSampleSize(options, reqWidth, reqHeight);
        //options.inSampleSize = Config.IMAGE_THUMBNAIL_SIMPLE_SIZE;

        // Decode bitmap with inSampleSize set
        options.inJustDecodeBounds = false;
        options.inPreferredConfig = Bitmap.Config.RGB_565;