package com.cygnusa.hyperm.calendarView.utils;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.LayerDrawable;

import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;

import com.cygnusa.hyperm.R;
import com.cygnusa.hyperm.calendarView.CalendarUtils;


/**
 * Created by Mateusz Kornakiewicz on 02.08.2018.
 */

public final class DrawableUtils {

    public static Drawable getCircleDrawableWithText(Context context, String string) {
        Drawable background = ContextCompat.getDrawable(context, R.drawable.sample_circle);
        Drawable text = CalendarUtils.getDrawableText(context, string, null, android.R.color.white, 12);

        Drawable[] layers = {background, text};
        return new LayerDrawable(layers);
    }

    @SuppressLint("ResourceType")
    public static Drawable getPeachDots(Context context, String trainingStatus) {
        Drawable unwrappedDrawable = AppCompatResources.getDrawable(context, R.drawable.cal_peach_indicator);
        Drawable wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
        DrawableCompat.setTint(wrappedDrawable, Color.parseColor(trainingStatus));
        //Add padding to too large icon
        return new InsetDrawable(unwrappedDrawable, 50, 0, 50, 0);
    }


    private DrawableUtils() {
    }
}
