Class LiveActivityDescriptor

java.lang.Object
com.codename1.surfaces.LiveActivityDescriptor

public class LiveActivityDescriptor extends Object

Describes a live activity: an ongoing-state surface (delivery, timer, ride, score) that stays visible outside the app while it is in progress. The layout is built once from surface nodes with ${key} placeholders; each LiveActivity.update(...) then ships only a fresh state map.

Platform lowering:

  • iOS: ActivityKit live activity. setContent(...) is the lock screen / banner presentation; the set...(...) region setters fill the Dynamic Island (ignored on devices without one).
  • Android: an ongoing notification whose collapsed and expanded views render setCompactLeading/setCompactTrailing and setContent respectively.
  • Desktop: a floating always-on-top pill window rendering setContent.
  • Constructor Details

    • LiveActivityDescriptor

      public LiveActivityDescriptor(String activityType)

      Creates a live activity descriptor.

      Parameters
      • activityType: an app-defined type tag (e.g. delivery), delivered back as the source of action events from this activity
  • Method Details

    • setContent

      public LiveActivityDescriptor setContent(SurfaceNode root)

      Sets the primary presentation: the iOS lock screen / banner layout, the Android expanded notification and the desktop pill content.

      Parameters
      • root: the layout root node
      Returns

      this descriptor, for chaining

    • setCompactLeading

      public LiveActivityDescriptor setCompactLeading(SurfaceNode node)

      Sets the Dynamic Island compact leading region (left of the camera cutout).

      Parameters
      • node: the region content
      Returns

      this descriptor, for chaining

    • setCompactTrailing

      public LiveActivityDescriptor setCompactTrailing(SurfaceNode node)

      Sets the Dynamic Island compact trailing region (right of the camera cutout).

      Parameters
      • node: the region content
      Returns

      this descriptor, for chaining

    • setMinimal

      public LiveActivityDescriptor setMinimal(SurfaceNode node)

      Sets the Dynamic Island minimal region, shown when multiple activities compete for the island.

      Parameters
      • node: the region content
      Returns

      this descriptor, for chaining

    • setExpandedLeading

      public LiveActivityDescriptor setExpandedLeading(SurfaceNode node)

      Sets the leading region of the expanded (long-pressed) Dynamic Island.

      Parameters
      • node: the region content
      Returns

      this descriptor, for chaining

    • setExpandedTrailing

      public LiveActivityDescriptor setExpandedTrailing(SurfaceNode node)

      Sets the trailing region of the expanded (long-pressed) Dynamic Island.

      Parameters
      • node: the region content
      Returns

      this descriptor, for chaining

    • setExpandedCenter

      public LiveActivityDescriptor setExpandedCenter(SurfaceNode node)

      Sets the center region of the expanded (long-pressed) Dynamic Island.

      Parameters
      • node: the region content
      Returns

      this descriptor, for chaining

    • setExpandedBottom

      public LiveActivityDescriptor setExpandedBottom(SurfaceNode node)

      Sets the bottom region of the expanded (long-pressed) Dynamic Island.

      Parameters
      • node: the region content
      Returns

      this descriptor, for chaining

    • setTint

      public LiveActivityDescriptor setTint(SurfaceColor tint)

      Sets the accent color of the activity's chrome (island key line, notification accent).

      Parameters
      • tint: the accent color
      Returns

      this descriptor, for chaining

    • setAndroidChannelId

      public LiveActivityDescriptor setAndroidChannelId(String channelId)

      Sets the Android notification channel the activity's ongoing notification posts to. When unset a default cn1_live_activities channel is used.

      Parameters
      • channelId: the channel id
      Returns

      this descriptor, for chaining

    • getActivityType

      public String getActivityType()
      Returns the app-defined activity type tag.
    • getContent

      public SurfaceNode getContent()
      Returns the primary presentation layout, or null.
    • getCompactLeading

      public SurfaceNode getCompactLeading()
      Returns the compact leading island region, or null.
    • getCompactTrailing

      public SurfaceNode getCompactTrailing()
      Returns the compact trailing island region, or null.
    • getMinimal

      public SurfaceNode getMinimal()
      Returns the minimal island region, or null.
    • getExpandedLeading

      public SurfaceNode getExpandedLeading()
      Returns the expanded leading island region, or null.
    • getExpandedTrailing

      public SurfaceNode getExpandedTrailing()
      Returns the expanded trailing island region, or null.
    • getExpandedCenter

      public SurfaceNode getExpandedCenter()
      Returns the expanded center island region, or null.
    • getExpandedBottom

      public SurfaceNode getExpandedBottom()
      Returns the expanded bottom island region, or null.
    • getTint

      public SurfaceColor getTint()
      Returns the accent color, or null.
    • getAndroidChannelId

      public String getAndroidChannelId()
      Returns the Android notification channel id, or null for the default channel.