/* * mygram-droid: Android TV client for Foldergram. * Copyright (C) 2026 Danilo M. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ package mygram.droid; import android.content.Context; import android.content.SharedPreferences; /** Settings stored on the device. */ final class Prefs { private static SharedPreferences prefs; private Prefs() { } static void init(Context c) { prefs = c.getSharedPreferences("mygram", Context.MODE_PRIVATE); } /** Base URL like "http://192.0.2.10:4141", or null before setup. */ static String server() { return prefs.getString("server", null); } /** Viewer password; empty for a public instance. */ static String password() { return prefs.getString("password", ""); } static int photoSeconds() { return prefs.getInt("photo", 8); } static int backgroundSeconds() { return prefs.getInt("background", 15); } static void setServer(String base, String password) { prefs.edit().putString("server", base).putString("password", password).apply(); } static void setPassword(String password) { prefs.edit().putString("password", password).apply(); } static void setTimes(int photo, int background) { prefs.edit().putInt("photo", photo).putInt("background", background).apply(); } }