package com.zxhyis.toolss.notification.provider

import android.content.ContentValues
import android.content.Context
import android.net.Uri

object MyContentProviderUtils {

    private val CONTENT_URI = Uri.parse("content://com.zxhyis.toolss/myIntValue")
    const val RESUMED_VALUE = 1
    const val PAUSED_VALUE = 2

    fun getMyIntValue(context: Context): Int {
        var myIntValue = 0
        val contentResolver = context.contentResolver
        val cursor = contentResolver.query(CONTENT_URI, null, null, null, null)
        if (cursor != null && cursor.moveToFirst()) {
            myIntValue = cursor.getInt(0)
            cursor.close()
        }
        return myIntValue
    }

    fun setMyIntValue(context: Context, myIntValue: Int) {
        val contentResolver = context.contentResolver
        val values = ContentValues()
        values.put("myIntValue", myIntValue)
        contentResolver.update(CONTENT_URI, values, null, null)
    }

}
