package com.led.scroller.barrage.banner.sp

import android.content.Context
import com.led.scroller.barrage.banner.R
import com.led.scroller.barrage.banner.app.asStoreProvider

class AppSP(context: Context) {

    private val store = BaseSP(
        context
            .getSharedPreferences(context.packageName, Context.MODE_PRIVATE)
            .asStoreProvider()
    )

    var fontResId: Int by store.int(
        key = FONT_RES_ID,
        defaultValue = R.font.font_medium
    )

    var fontColorResId: Int by store.int(
        key = FONT_COLOR_RES_ID,
        defaultValue = R.color.font_color_1
    )

    var fontSize: Int by store.int(
        key = FONT_Size,
        defaultValue = 80
    )

    var bgColorResId: Int by store.int(
        key = BG_COLOR_RES_ID,
        defaultValue = R.color.default_preview_bg_color
    )

    companion object {
        const val FONT_RES_ID = "font_res_id"
        const val FONT_COLOR_RES_ID = "font_color_res_id"
        const val FONT_Size = "font_size"
        const val BG_COLOR_RES_ID = "bg_color_res_id"
    }
}