TilesTimelineManagerInternal

public class TilesTimelineManagerInternal


Manager for a single Tiles timeline.

This handles the dispatching of single Tiles layouts from a full timeline. It will set the correct alarms to detect when a layout should be updated, and dispatch it to its listener.

Summary

Nested types

TilesTimelineManagerInternal.Clock

Interface so this manager can retrieve the current time.

TilesTimelineManagerInternal.Listener

Type to listen for layout updates from a given timeline.

Constants

static final @NonNull long

Public constructors

TilesTimelineManagerInternal(
    @NonNull AlarmManager alarmManager,
    @NonNull TilesTimelineManagerInternal.Clock clock,
    @NonNull TimelineProto.Timeline timeline,
    @NonNull int token,
    @NonNull Executor listenerExecutor,
    @NonNull TilesTimelineManagerInternal.Listener listener
)

Default constructor.

Public methods

@Override @NonNull void

Tears down this Timeline Manager.

@NonNull void

Sets up this Timeline Manager.

Constants

MIN_TILE_UPDATE_DELAY_MILLIS

@NonNull
public static final @NonNull long MIN_TILE_UPDATE_DELAY_MILLIS

Public constructors

TilesTimelineManagerInternal

public TilesTimelineManagerInternal(
    @NonNull AlarmManager alarmManager,
    @NonNull TilesTimelineManagerInternal.Clock clock,
    @NonNull TimelineProto.Timeline timeline,
    @NonNull int token,
    @NonNull Executor listenerExecutor,
    @NonNull TilesTimelineManagerInternal.Listener listener
)

Default constructor.

Parameters
@NonNull AlarmManager alarmManager

An AlarmManager instance suitable for setting RTC alarms on.

@NonNull TilesTimelineManagerInternal.Clock clock

A Clock to use to ascertain the current time (and hence which tile to show). This should be synchronized to the same clock as used by {@code alarmManager}

@NonNull TimelineProto.Timeline timeline

The Tiles timeline to use.

@NonNull int token

A token, which will be passed to {@code listener}'s callback.

@NonNull Executor listenerExecutor

The Executor to dispatch listener's calls on.

@NonNull TilesTimelineManagerInternal.Listener listener

A listener instance, called when a new timeline entry is available.

Public methods

close

@Override
@NonNull
public @Override void close()

Tears down this Timeline Manager. This will ensure any set alarms are cleared up.

init

@NonNull
public void init()

Sets up this Timeline Manager. This will cause the timeline manager to dispatch the first layout, and set its first alarm.