// Path: zen-android/src/main/java/zenproject/meditation/android/preferences/BrushOptionsPreferences.java
// public class BrushOptionsPreferences {
//     private static final float DARKENING_FACTOR = 1.4f;
//     private static final String PREF_NAME = "BrushPreferences";
//     private static final String PREF_BRUSH_COLOR = PREF_NAME + "Color";
//     private static final String PREF_BRUSH_SIZE = PREF_NAME + "Size";
//     private static final int DEFAULT_PERCENTAGE = 20;
//     private static final int LEAF_COLOR = Color.rgb(59, 158, 58);
//     private final SharedPreferences sharedPreferences;
// 
//     public static BrushOptionsPreferences newInstance() {
//         return new BrushOptionsPreferences(ContextRetriever.INSTANCE.getApplicationContext().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE));
//     }
// 
//     protected BrushOptionsPreferences(SharedPreferences sharedPreferences) {
//         this.sharedPreferences = sharedPreferences;
//     }
// 
//     public void applyBrushSizePercentage(int percentage) {
//         sharedPreferences.edit().putInt(PREF_BRUSH_SIZE, percentage).apply();
//     }
// 
//     public int getBrushSizePercentage() {
//         return sharedPreferences.getInt(PREF_BRUSH_SIZE, DEFAULT_PERCENTAGE);
//     }
// 
//     public void applyBrushColor(BrushColor color) {
//         sharedPreferences.edit().putInt(PREF_BRUSH_COLOR, color.color()).apply();
//     }
// 
//     public BrushColor getBrushColor() {
//         int defaultColor = BrushColor.DARK.color();
//         int color = sharedPreferences.getInt(PREF_BRUSH_COLOR, defaultColor);
//         return BrushColor.from(color);
//     }
// 
//     public int getBranchColor() {
//         int color = getBrushColor().color();
//         return Color.rgb((int) (Color.red(color) / DARKENING_FACTOR),
//                 (int) (Color.green(color) / DARKENING_FACTOR),
//                 (int) (Color.blue(color) / DARKENING_FACTOR));
//     }
// 
//     public int getLeafColor() {
//         return LEAF_COLOR;
//     }
// }
// 
// Path: zen-android/src/main/java/zenproject/meditation/android/sketch/painting/ink/BrushColor.java
// public enum BrushColor {
//     DARK(ContextRetriever.INSTANCE.getResources().getColor(R.color.dark_brush)),
//     AMBER(ContextRetriever.INSTANCE.getResources().getColor(R.color.amber_brush)),
//     PRIMARY(ContextRetriever.INSTANCE.getResources().getColor(R.color.colorPrimary)),
//     ACCENT(ContextRetriever.INSTANCE.getResources().getColor(R.color.colorAccent)),
//     ERASE(ContextRetriever.INSTANCE.getResources().getColor(R.color.colorSketch));
// 
//     private final int color;
// 
//     BrushColor(int color) {
//         this.color = color;
//     }
// 
//     public static BrushColor from(int color) {
//         for (BrushColor brushColor : values()) {
//             if (brushColor.color == color) {
//                 return brushColor;
//             }
//         }
//         return DARK;
//     }
// 
//     public int color() {
//         return color;
//     }
// 
//     @Override
//     public String toString() {
//         return super.toString();
//     }
// }
// 
// Path: zen-android/src/main/java/zenproject/meditation/android/ui/menu/dialogs/brush/ColorSelectedListener.java
// public interface ColorSelectedListener {
//     void onColorSelected(BrushColor color);
// }


import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import com.novoda.notils.caster.Views;
import de.hdodenhof.circleimageview.CircleImageView;
import zenproject.meditation.android.ContextRetriever;
import zenproject.meditation.android.R;
import zenproject.meditation.android.preferences.BrushOptionsPreferences;
import zenproject.meditation.android.sketch.painting.ink.BrushColor;
import zenproject.meditation.android.ui.menu.dialogs.brush.ColorSelectedListener;
package zenproject.meditation.android.ui.menu.dialogs.brush.color;





@SuppressWarnings("PMD.TooManyMethods")
public class ColorListView extends LinearLayout {
    private static final int UNSELECTED_BORDER_SIZE = ContextRetriever.INSTANCE.getResources().getDimensionPixelSize(R.dimen.divider_weight);
    private static final int SELECTED_BORDER_SIZE = ContextRetriever.INSTANCE.getResources().getDimensionPixelSize(R.dimen.color_selected_weight);
    private static final int DIVIDER = ContextRetriever.INSTANCE.getResources().getColor(R.color.divider);

    private CircleImageView darkColor;
    private CircleImageView amberColor;
    private CircleImageView eraseColor;
    private CircleImageView primaryColor;
    private CircleImageView accentColor;

    private ColorSelectedListener colorSelectedListener;

    public ColorListView(Context context) {
        super(context);
    }

    public ColorListView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

// Path: zen-android/src/main/java/zenproject/meditation/android/preferences/BrushOptionsPreferences.java
// public class BrushOptionsPreferences {
//     private static final float DARKENING_FACTOR = 1.4f;
//     private static final String PREF_NAME = "BrushPreferences";
//     private static final String PREF_BRUSH_COLOR = PREF_NAME + "Color";
//     private static final String PREF_BRUSH_SIZE = PREF_NAME + "Size";
//     private static final int DEFAULT_PERCENTAGE = 20;
//     private static final int LEAF_COLOR = Color.rgb(59, 158, 58);
//     private final SharedPreferences sharedPreferences;
// 
//     public static BrushOptionsPreferences newInstance() {
//         return new BrushOptionsPreferences(ContextRetriever.INSTANCE.getApplicationContext().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE));
//     }
// 
//     protected BrushOptionsPreferences(SharedPreferences sharedPreferences) {
//         this.sharedPreferences = sharedPreferences;
//     }
// 
//     public void applyBrushSizePercentage(int percentage) {
//         sharedPreferences.edit().putInt(PREF_BRUSH_SIZE, percentage).apply();
//     }
// 
//     public int getBrushSizePercentage() {
//         return sharedPreferences.getInt(PREF_BRUSH_SIZE, DEFAULT_PERCENTAGE);
//     }
// 
//     public void applyBrushColor(BrushColor color) {
//         sharedPreferences.edit().putInt(PREF_BRUSH_COLOR, color.color()).apply();
//     }
// 
//     public BrushColor getBrushColor() {
//         int defaultColor = BrushColor.DARK.color();
//         int color = sharedPreferences.getInt(PREF_BRUSH_COLOR, defaultColor);
//         return BrushColor.from(color);
//     }
// 
//     public int getBranchColor() {
//         int color = getBrushColor().color();
//         return Color.rgb((int) (Color.red(color) / DARKENING_FACTOR),
//                 (int) (Color.green(color) / DARKENING_FACTOR),
//                 (int) (Color.blue(color) / DARKENING_FACTOR));
//     }
// 
//     public int getLeafColor() {
//         return LEAF_COLOR;
//     }
// }
// 
// Path: zen-android/src/main/java/zenproject/meditation/android/sketch/painting/ink/BrushColor.java
// public enum BrushColor {
//     DARK(ContextRetriever.INSTANCE.getResources().getColor(R.color.dark_brush)),
//     AMBER(ContextRetriever.INSTANCE.getResources().getColor(R.color.amber_brush)),
//     PRIMARY(ContextRetriever.INSTANCE.getResources().getColor(R.color.colorPrimary)),
//     ACCENT(ContextRetriever.INSTANCE.getResources().getColor(R.color.colorAccent)),
//     ERASE(ContextRetriever.INSTANCE.getResources().getColor(R.color.colorSketch));
// 
//     private final int color;
// 
//     BrushColor(int color) {
//         this.color = color;
//     }
// 
//     public static BrushColor from(int color) {
//         for (BrushColor brushColor : values()) {
//             if (brushColor.color == color) {
//                 return brushColor;
//             }
//         }
//         return DARK;
//     }
// 
//     public int color() {
//         return color;
//     }
// 
//     @Override
//     public String toString() {
//         return super.toString();
//     }
// }
// 
// Path: zen-android/src/main/java/zenproject/meditation/android/ui/menu/dialogs/brush/ColorSelectedListener.java
// public interface ColorSelectedListener {
//     void onColorSelected(BrushColor color);
// }


// Path: zen-android/src/main/java/zenproject/meditation/android/ui/menu/dialogs/brush/color/ColorListView.java
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import com.novoda.notils.caster.Views;
import de.hdodenhof.circleimageview.CircleImageView;
import zenproject.meditation.android.ContextRetriever;
import zenproject.meditation.android.R;
import zenproject.meditation.android.preferences.BrushOptionsPreferences;
import zenproject.meditation.android.sketch.painting.ink.BrushColor;
import zenproject.meditation.android.ui.menu.dialogs.brush.ColorSelectedListener;

package zenproject.meditation.android.ui.menu.dialogs.brush.color;





@SuppressWarnings("PMD.TooManyMethods")
public class ColorListView extends LinearLayout {
    private static final int UNSELECTED_BORDER_SIZE = ContextRetriever.INSTANCE.getResources().getDimensionPixelSize(R.dimen.divider_weight);
    private static final int SELECTED_BORDER_SIZE = ContextRetriever.INSTANCE.getResources().getDimensionPixelSize(R.dimen.color_selected_weight);
    private static final int DIVIDER = ContextRetriever.INSTANCE.getResources().getColor(R.color.divider);

    private CircleImageView darkColor;
    private CircleImageView amberColor;
    private CircleImageView eraseColor;
    private CircleImageView primaryColor;
    private CircleImageView accentColor;

    private ColorSelectedListener colorSelectedListener;

    public ColorListView(Context context) {
        super(context);
    }

    public ColorListView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ColorListView(Context context, AttributeSet attrs, int defStyleAttr) {