Class HomeCard

Direct Known Subclasses:
HomeCardAgenda, HomeCardMail

public class HomeCard extends AppWidgetProvider
Sioul's cards on the home screen (docs/android.md, "The card on the home screen"). The full card (HomeCardToday): today first, the date and the weather; then what the Porch has for you, a dose due, a code you asked for, reminders, the calls declined, two events at once; then Now, what now is for and the next step. The mail card (HomeCardMail) and the agenda card (HomeCardAgenda): a list that scrolls (HomeCardRows, through HomeCardService), the Porch's latest messages, or the coming events, day by day. Rust writes what they say (crates/sioul-app/src/homecard.rs) in Sioul's state folder, ahead, in frames: one per change of time until the end of tomorrow, since Android freezes Sioul in the background; the weather hour by hour. Here: the frame and the hour for now, drawn again at the next change (a frame's end, an hour, a code expiring, a dose, a reminder, an event over, midnight) by an alarm that wakes nothing, and whenever Rust says so (HOME_CARD, sent through android/main.cpp's sioul_android_broadcast). No Rust, no network: cards drawn from a file. A tap opens Sioul: as by its icon on the card itself and on the weather; on a code, a dose, a call, the Porch; on a reminder, what it is about; on the step, Now; in a list, the Porch, a message on it, the Agenda or an event in it (HomeCardOpener). No button does anything else. This class draws all three.
  • Field Details

  • Constructor Details

  • Method Details

    • kind

      What this card shows; the mail and agenda cards say theirs.
    • onReceive

      public void onReceive(Context context, Intent intent)
      Overrides:
      onReceive in class AppWidgetProvider
    • onUpdate

      public void onUpdate(Context context, AppWidgetManager manager, int[] ids)
      Overrides:
      onUpdate in class AppWidgetProvider
    • onAppWidgetOptionsChanged

      public void onAppWidgetOptionsChanged(Context context, AppWidgetManager manager, int id, Bundle options)
      Overrides:
      onAppWidgetOptionsChanged in class AppWidgetProvider
    • onDisabled

      public void onDisabled(Context context)
      Overrides:
      onDisabled in class AppWidgetProvider
    • empty

      static String empty()
      The card before Sioul wrote one, in Sioul's two languages by the phone's (as DoseAlarms.words(int)); every other word is Rust's.
    • drawAll

      static void drawAll(Context context)
      Every card on the home screens drawn again, of every kind; none, the next drawing let go.
    • draw

      private static void draw(Context context, AppWidgetManager manager, int[] ids, String kind)
      Cards of one kind drawn, the lists read again (HomeCardRows), and the next drawing set: the same for every kind, made from the same file.
    • read

      static JSONObject read(Context context)
      The card Rust wrote last; none before Sioul's first start, or one that does not read.
    • frames

      static JSONArray frames(JSONObject card)
      A card's frames: "times" from version 3, "frames" before (an older Sioul's Java reads "frames" alone, finds none in a card of version 3, and says its "beyond": "Open Sioul to bring this card up to date.").
    • frame

      static JSONObject frame(JSONArray frames, long now)
      The frame for now; before the first (the clock set back), the first; past the last, none.
    • views

      private static RemoteViews views(Context context, String kind, int id)
      A mail card or an agenda card: its list (HomeCardRows, one factory per card, its address naming the card and its kind).
    • launch

      static PendingIntent launch(Context context)
      Sioul, as by its icon.
    • opener

      static PendingIntent opener(Context context, String where)
      Sioul on the Porch, on Now, on what a reminder is about: through HomeCardOpener, which keeps the tap for Rust. Each address its own pending intent (Android tells them apart by their data).
    • template

      private static PendingIntent template(Context context)
      The list's taps: HomeCardOpener, each row's address filled in (HomeCardRows). Mutable for that alone, from Android 12 where it must be said; its class is fixed, so a row can only say where Sioul opens.
    • opened

      static void opened(Context context, Intent intent)
      A tap kept for Rust (homecard.rs, `opened`), which takes it when the window comes up: {"open": "porch" | "now" | "mail" | "agenda" | "event" | "reminder", "uid" (a step's), "key" (a message's or an event's file, a reminder's address: "sioul:task/…"), "at"}.
    • schedule

      private static void schedule(Context context, long at)
      The cards drawn again at `at`, when a frame ends, a code expires, a dose comes or goes, the age is to be said, an event is over, or a day's or a message's name changes at midnight: one alarm for every card, that wakes nothing (the cards are drawn when the phone is next awake), on time when Android allows Sioul exact alarms (the doses' "Alarms & reminders"), else within a few minutes. Long.MAX_VALUE: none.