This repository has been archived by the owner on Apr 22, 2022. It is now read-only.
forked from soundcloud/lightcycle
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: When type Parent->Child, enable Dispatcher<Child> to bind LightC…
…ycle<Parent>. The processor internaly lift the LightCycle<Parent> to LightCycle<Child>.
- Loading branch information
Showing
12 changed files
with
491 additions
and
26 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...src/main/java/com/soundcloud/lightcycle/sample/real_world/AppForegroundStateProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.soundcloud.lightcycle.sample.real_world; | ||
|
||
import com.soundcloud.lightcycle.DefaultActivityLightCycle; | ||
|
||
import android.app.Activity; | ||
|
||
import javax.inject.Inject; | ||
import javax.inject.Singleton; | ||
|
||
@Singleton | ||
class AppForegroundStateProvider extends DefaultActivityLightCycle<Activity> { | ||
|
||
private boolean isForeground; | ||
|
||
@Inject | ||
public AppForegroundStateProvider() { | ||
isForeground = false; | ||
} | ||
|
||
@Override | ||
public void onResume(Activity activity) { | ||
isForeground = true; | ||
} | ||
|
||
@Override | ||
public void onPause(Activity activity) { | ||
isForeground = false; | ||
} | ||
|
||
public boolean isForeground() { | ||
return isForeground; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
lightcycle-api/src/main/java/com/soundcloud/lightcycle/LightCycleDispatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.