// 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.graphics.Bitmap;
import android.os.Handler;
import android.os.Message;
import androidx.palette.graphics.Palette;
import proj.me.bitframe.exceptions.FrameException;
package proj.me.bitframe;



class FrameHandler extends Handler {
    ImageResult imageResult;

    FrameHandler(ImageResult imageResult) {
        this.imageResult = imageResult;
    }

    @Override
    public void handleMessage(Message msg) {

        switch (msg.what) {
            case 1:
                final BeanHandler beanHandler = (BeanHandler) msg.obj;
                final Bitmap bitmap = beanHandler.getBitmap();
                if (imageResult.getCounter() >= imageResult.getFrameModel().getMaxFrameCount()) {
                    imageResult.updateCounter();
                    final BeanBitFrame beanBitFrame = new BeanBitFrame();
                    beanBitFrame.setWidth(bitmap.getWidth());
                    beanBitFrame.setHeight(bitmap.getHeight());
                    beanBitFrame.setLoaded(true);

                    Palette.from(bitmap).generate(new PaletteListener(imageResult, beanBitFrame, beanHandler.getBeanImage(), false));
                } else {
                    boolean doneLoading = imageResult.getCounter() == (imageResult.getFrameModel().getMaxFrameCount()
                            >= imageResult.getTotalImages() ? imageResult.getTotalImages()
                            : imageResult.getFrameModel().getMaxFrameCount()) - 1;
                    imageResult.setDoneLoading(doneLoading);
                    try {
                        imageResult.onImageLoaded(true, bitmap, beanHandler.getBeanImage());
// 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/FrameHandler.java
import android.graphics.Bitmap;
import android.os.Handler;
import android.os.Message;
import androidx.palette.graphics.Palette;
import proj.me.bitframe.exceptions.FrameException;

package proj.me.bitframe;



class FrameHandler extends Handler {
    ImageResult imageResult;

    FrameHandler(ImageResult imageResult) {
        this.imageResult = imageResult;
    }

    @Override
    public void handleMessage(Message msg) {

        switch (msg.what) {
            case 1:
                final BeanHandler beanHandler = (BeanHandler) msg.obj;
                final Bitmap bitmap = beanHandler.getBitmap();
                if (imageResult.getCounter() >= imageResult.getFrameModel().getMaxFrameCount()) {
                    imageResult.updateCounter();
                    final BeanBitFrame beanBitFrame = new BeanBitFrame();
                    beanBitFrame.setWidth(bitmap.getWidth());
                    beanBitFrame.setHeight(bitmap.getHeight());
                    beanBitFrame.setLoaded(true);

                    Palette.from(bitmap).generate(new PaletteListener(imageResult, beanBitFrame, beanHandler.getBeanImage(), false));
                } else {
                    boolean doneLoading = imageResult.getCounter() == (imageResult.getFrameModel().getMaxFrameCount()
                            >= imageResult.getTotalImages() ? imageResult.getTotalImages()
                            : imageResult.getFrameModel().getMaxFrameCount()) - 1;
                    imageResult.setDoneLoading(doneLoading);
                    try {
                        imageResult.onImageLoaded(true, bitmap, beanHandler.getBeanImage());
                    } catch (FrameException e) {