// Path: bitframe/src/main/java/proj/me/bitframe/exceptions/FrameException.java
// public class FrameException extends Exception{
//     public FrameException(String message){
//         super(message);
//         Utils.logVerbose(message);
//     }
// 
//     public FrameException(String message, Throwable throwable){
//         super(message, throwable);
//         Utils.logVerbose(message);
//     }
// 
//     public FrameException(Throwable throwable){
//         super(throwable);
//         String message = throwable.getMessage();
//         if(!TextUtils.isEmpty(message)) Utils.logVerbose(message);
//     }
// }


import android.content.Context;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import android.util.Patterns;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.MimeTypeMap;
import android.webkit.URLUtil;
import android.widget.ImageView;
import android.widget.Toast;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import proj.me.bitframe.R;
import proj.me.bitframe.exceptions.FrameException;

                    //shifting to left as 1, 3, 5.....
                    finalColor += resultInt << i;
                    bitLength--;
                    i+=2;
                }

                bitLength = 32 - n;
                int bits = bitLength * 2;
                int val = 1 << (bits - 1);

                if((val & finalColor) != 0){ finalColor = finalColor >> bits;  return finalColor + 1;}
                else return finalColor >> bits;
            case 4:
                return (colors[0] + colors[1] + colors[2] + colors[3]) >> 2;
            case 5:
                finalColor = colors[0] + colors[1] + colors[2] + colors[3] + colors[4];
                int q = (finalColor >> 1) + (finalColor >> 2);
                q = q + (q >> 4);
                q = q + (q >> 8);
                q = q + (q >> 16);
                q = q >> 3;
                int r = finalColor - (((q << 2) + q) << 1);
                return (q + ((r > 9) ? 1 : 0)) << 1;
            case 6:
                finalColor = getMixedColor(colors[0]+colors[1]+colors[2]+colors[3], colors[4], colors[5]);
                return finalColor >> 1;
        }
        return finalColor;
    }


// Path: bitframe/src/main/java/proj/me/bitframe/exceptions/FrameException.java
// public class FrameException extends Exception{
//     public FrameException(String message){
//         super(message);
//         Utils.logVerbose(message);
//     }
// 
//     public FrameException(String message, Throwable throwable){
//         super(message, throwable);
//         Utils.logVerbose(message);
//     }
// 
//     public FrameException(Throwable throwable){
//         super(throwable);
//         String message = throwable.getMessage();
//         if(!TextUtils.isEmpty(message)) Utils.logVerbose(message);
//     }
// }


// Path: bitframe/src/main/java/proj/me/bitframe/helper/Utils.java
import android.content.Context;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import android.util.Patterns;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.MimeTypeMap;
import android.webkit.URLUtil;
import android.widget.ImageView;
import android.widget.Toast;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import proj.me.bitframe.R;
import proj.me.bitframe.exceptions.FrameException;

                    //shifting to left as 1, 3, 5.....
                    finalColor += resultInt << i;
                    bitLength--;
                    i+=2;
                }

                bitLength = 32 - n;
                int bits = bitLength * 2;
                int val = 1 << (bits - 1);

                if((val & finalColor) != 0){ finalColor = finalColor >> bits;  return finalColor + 1;}
                else return finalColor >> bits;
            case 4:
                return (colors[0] + colors[1] + colors[2] + colors[3]) >> 2;
            case 5:
                finalColor = colors[0] + colors[1] + colors[2] + colors[3] + colors[4];
                int q = (finalColor >> 1) + (finalColor >> 2);
                q = q + (q >> 4);
                q = q + (q >> 8);
                q = q + (q >> 16);
                q = q >> 3;
                int r = finalColor - (((q << 2) + q) << 1);
                return (q + ((r > 9) ? 1 : 0)) << 1;
            case 6:
                finalColor = getMixedColor(colors[0]+colors[1]+colors[2]+colors[3], colors[4], colors[5]);
                return finalColor >> 1;
        }
        return finalColor;
    }


    public static int getMixedArgbColor(int ... colors) throws FrameException{
