Class DoseAlarms

java.lang.Object
com.aurelienpierre.sioul.DoseAlarms

final class DoseAlarms extends Object
Doses reminded while Sioul is not on the screen (docs/android.md, "Doses while Sioul is away"). Android freezes an app it does not show: each coming dose is given to Android's alarm clock ahead, and at its time DoseReceiver asks Rust's side what to say (crates/sioul-app/src/alarms.rs), which reads first what your other devices marked. Here: the alarms, their list kept for Android's restarts, the reminders, the dose of a tapped one, and Sioul's library, loaded without its window when Android starts Sioul for an alarm alone (android/main.cpp).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final String
     
    (package private) static final String
     
    private static final String
     
    private static final long
    "Taken at 08:03" stays half a day in the shade.
    private static final int
     
    private static final String
     
    private static final int
     
    private static final String
     
    private static boolean
     
    (package private) static final String
    The dose as the list names it: "Levothyroxine · 75 µg".
    private static final String
     
    private static final int
    A reminder is known by its dose's key (its tag) and this number.
    private static final String
     
    (package private) static final String
     
    (package private) static final String
     
    private static final int
     
    (package private) static final String
    The reminder's title and text, as Rust said them.
    private static final String[][]
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static Uri
    A dose's intents differ by their address, its key: one alarm per dose, whatever the keys' hashes.
    (package private) static void
    again(Context context, String key, long at, String name)
    A dose asked about again at `at`, Rust waiting for news from your other devices.
    private static void
    alarm(Context context, String key, long at, String name)
    A dose's alarm, at its time even while the phone sleeps (Doze).
    private static Intent
    alarmIntent(Context context, String key)
     
    (package private) static void
    askWhen(Context context, String key, String title, String line)
    "Taken" more than half an hour late: when, asked in Sioul, which a tap opens.
    private static void
    cancel(Context context, String key)
     
    (package private) static void
    channel(Context context)
    The "Doses" channel: Android's default importance (its sound, no banner over what you do), yours to change in Android's settings.
    (package private) static void
    confirm(Context context, String key, String title, String line)
    "Taken" recorded: the reminder becomes a quiet line, "Taken at 08:03", for half a day.
    (package private) static void
    dismiss(Context context, String key)
    A dose's reminder taken away: marked meanwhile, or said for nothing.
    (package private) static boolean
    exact(Context context)
    Whether the alarms ring on time: "Alarms & reminders" allowed, which Android 12 lets you take back and gives from Android 13 (USE_EXACT_ALARM).
    (package private) static void
    fallback(Context context, String key)
    No answer from Rust, or none in time: never silence, never a claim.
    private static void
    keep(Context context, JSONArray doses)
     
    private static SharedPreferences
    kept(Context context)
     
    (package private) static String
    key(Intent intent)
    The dose an intent is about; "" when none.
    private static String
     
    private static JSONArray
    list(Context context)
     
    (package private) static void
    load(Context context)
    Sioul's library, loaded and started once per process.
    (package private) static String
     
    (package private) static void
     
    (package private) static String
     
    (package private) static boolean
    Whether reminders can show: Sioul's notifications on (from Android 13, your yes), the "Doses" channel too.
    (package private) static void
    opened(Context context, String key)
    A tapped reminder's dose, kept until Sioul takes it (DoseOpener).
    private static void
    put(JSONObject dose, String name, Object value)
     
    (package private) static void
    remind(Context context, String key, String title, String body, String name, String taken)
    Rust's reminder, as Rust said it, with "Taken"; a tap opens Sioul on the dose's question.
    (package private) static void
    reminded(Context context, String key)
    A dose reminded: out of the list, not to ring again after a restart.
    private static Notification.Builder
    reminder(Context context, String key, String title, String text)
     
    (package private) static void
    restore(Context context, String why)
    The alarms given again from the list kept: Android forgets them when it restarts (DoseBootReceiver).
    private static void
    schedule(Context context, JSONArray doses)
     
    (package private) static void
    set(Context context, String json)
    Rust's coming doses (android/main.cpp): JSON [{key, at (Unix milliseconds), title}].
    private static void
    show(Context context, String key, Notification.Builder reminder)
     
    (package private) static String
    The dose of a tapped reminder, once; null when there is none (android/main.cpp, for Rust).
    private static String
    words(int which)
    The few words said here, in Sioul's two languages (crates/sioul-core/ locales), by the phone's language as Sioul takes it (android/main.cpp); all the others are Rust's.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait