29 lines
1.2 KiB
Kotlin
29 lines
1.2 KiB
Kotlin
package io.simplydvb.tv
|
|
|
|
import android.content.Context
|
|
|
|
/** Player and app settings (shared preferences "live", as before). */
|
|
object Prefs {
|
|
private fun p(ctx: Context) = ctx.getSharedPreferences("live", Context.MODE_PRIVATE)
|
|
|
|
/** OSD with the programme info on every channel change. */
|
|
fun osdOnZap(ctx: Context) = p(ctx).getBoolean("osd_on_zap", true)
|
|
|
|
/** How long the OSD stays (seconds). */
|
|
fun osdSeconds(ctx: Context) = p(ctx).getInt("osd_seconds", 6)
|
|
val OSD_SECONDS = intArrayOf(3, 6, 10, 15)
|
|
|
|
/** Resolution, signal and stream bitrate in the OSD. */
|
|
fun osdTech(ctx: Context) = p(ctx).getBoolean("osd_tech", true)
|
|
|
|
/** Programme description in the OSD. */
|
|
fun osdDescription(ctx: Context) = p(ctx).getBoolean("osd_desc", true)
|
|
|
|
/** Detailed tuner card (top right) on every channel change. */
|
|
fun tunerCard(ctx: Context) = p(ctx).getBoolean("tuner_info", false)
|
|
|
|
fun set(ctx: Context, key: String, value: Boolean) = p(ctx).edit().putBoolean(key, value).apply()
|
|
fun set(ctx: Context, key: String, value: Int) = p(ctx).edit().putInt(key, value).apply()
|
|
fun bool(ctx: Context, key: String, def: Boolean) = p(ctx).getBoolean(key, def)
|
|
}
|