public class AutoNightDelegate
A androidx.lifecycle.FullLifecycleObserver that updates the AppCompatDelegate's default night mode. The night is updated when the given LifecycleOwner is started, and again at the next dawn/dusk event if the LifecycleOwner has not stopped.
| Modifier and Type | Class and Description |
|---|---|
static class |
AutoNightDelegate.Companion |
| Modifier and Type | Field and Description |
|---|---|
static AutoNightDelegate.Companion |
Companion |
| Constructor and Description |
|---|
AutoNightDelegate(androidx.appcompat.app.AppCompatDelegate appCompatDelegate,
drewhamilton.skylight.backport.SkylightForCoordinates skylight)
A androidx.lifecycle.FullLifecycleObserver that updates the AppCompatDelegate's default night mode. The night
is updated when the given LifecycleOwner is started, and again at the next dawn/dusk event if the LifecycleOwner
has not stopped.
|
| Modifier and Type | Method and Description |
|---|---|
static AutoNightDelegate |
fallback(androidx.appcompat.app.AppCompatDelegate appCompatDelegate)
Construct an
class AutoNightDelegate that updates the night mode at the default times of 7am and 10pm. |
static AutoNightDelegate |
ofCoordinates(androidx.appcompat.app.AppCompatDelegate appCompatDelegate,
double latitude,
double longitude)
Construct an
class AutoNightDelegate that updates the night mode at dawn and dusk at the given latitude
and longitude. |
static AutoNightDelegate |
ofTimes(androidx.appcompat.app.AppCompatDelegate appCompatDelegate,
org.threeten.bp.OffsetTime dawn,
org.threeten.bp.OffsetTime dusk)
|
void |
onStart(androidx.lifecycle.LifecycleOwner owner)
Update the current night mode setting and watch for the next dawn/dusk event when the given
owner starts. |
void |
onStop(androidx.lifecycle.LifecycleOwner owner)
Stop watching for the next dawn/dusk event when the given
owner stops. |
public static AutoNightDelegate.Companion Companion
public AutoNightDelegate(@NotNull
androidx.appcompat.app.AppCompatDelegate appCompatDelegate,
@NotNull
drewhamilton.skylight.backport.SkylightForCoordinates skylight)
A androidx.lifecycle.FullLifecycleObserver that updates the AppCompatDelegate's default night mode. The night is updated when the given LifecycleOwner is started, and again at the next dawn/dusk event if the LifecycleOwner has not stopped.
public void onStart(@NotNull
androidx.lifecycle.LifecycleOwner owner)
Update the current night mode setting and watch for the next dawn/dusk event when the given owner starts.
ownerpublic void onStop(@NotNull
androidx.lifecycle.LifecycleOwner owner)
Stop watching for the next dawn/dusk event when the given owner stops.
owner@JvmStatic @NotNull public static AutoNightDelegate fallback(@NotNull androidx.appcompat.app.AppCompatDelegate appCompatDelegate)
Construct an class AutoNightDelegate that updates the night mode at the default times of 7am and 10pm.
class AutoNightDelegate@JvmStatic @NotNull public static AutoNightDelegate ofTimes(@NotNull androidx.appcompat.app.AppCompatDelegate appCompatDelegate, @NotNull org.threeten.bp.OffsetTime dawn, @NotNull org.threeten.bp.OffsetTime dusk)
Construct an class AutoNightDelegate that updates the night mode at the given dawn and dusk times.
class AutoNightDelegate,
dawn,
dusk@JvmStatic @NotNull public static AutoNightDelegate ofCoordinates(@NotNull androidx.appcompat.app.AppCompatDelegate appCompatDelegate, double latitude, double longitude)
Construct an class AutoNightDelegate that updates the night mode at dawn and dusk at the given latitude
and longitude.
class AutoNightDelegate,
latitude,
longitude