|
YAACC - UPNP Client and Server
|
The one receiver pick that can be open at a time in a browser activity (the "Play on..." sheet), and what the sheet's answer does with it. More...

Classes | |
| interface | Callbacks |
| What the owner of the pick wants done with the answer. More... | |
| enum | Outcome |
What resolve / abandon did. More... | |
Public Member Functions | |
| PendingPick (Supplier< String > idSupplier) | |
| synchronized String | open (Callbacks newCallbacks) |
| Opens a pick. | |
| synchronized boolean | isOpen (String pickId) |
| Outcome | resolve (String pickId, boolean confirmed, Set< String > chosenIds) |
| The sheet's answer. | |
| Outcome | abandon () |
| Cancels the open pick, if any (the activity is going away, the share timed out). | |
Static Public Member Functions | |
| static PendingPick | createDefault () |
| A holder whose ids are random UUIDs (a restored sheet of an earlier process cannot match). | |
The one receiver pick that can be open at a time in a browser activity (the "Play on..." sheet), and what the sheet's answer does with it.
Plain Java, no android.*, so the rules are unit tested on the JVM; the activity keeps one instance in a field (the pending action is lost with the activity, accepted).
open stores the callbacks of the action and returns an id the sheet reports back. While a pick is open, another open is dropped (returns null) and never replaces it, so an answer can only ever start the action the user saw. resolve with a confirm and at least one receiver closes the pick and runs Callbacks#onConfirmed once; a confirm without a receiver keeps the pick open and runs nothing; a cancel closes the pick and runs Callbacks#onCancelled once and never hands out the ticked ids. An id that is not the open pick's (stale, forged, repeated, after an abandon) changes nothing, so nothing is delivered twice. The decision itself is ReceiverPickResult#decide. abandon (the activity goes away, the share timed out) cancels an open pick. The state is cleared before a callback runs and callbacks run outside the lock, so an action may open the next pick and a throwing action cannot leave a pick open. Thread-safe.
| de.yaacc.share.PendingPick.PendingPick | ( | Supplier< String > | idSupplier | ) |
| idSupplier | makes the ids of picks; a null or empty id refuses the pick |
Referenced by de.yaacc.share.PendingPick.createDefault().

| synchronized boolean de.yaacc.share.PendingPick.isOpen | ( | String | pickId | ) |
pickId is the id of the open pick Referenced by de.yaacc.share.PendingPick.resolve().

| synchronized String de.yaacc.share.PendingPick.open | ( | Callbacks | newCallbacks | ) |
Opens a pick.
| Outcome de.yaacc.share.PendingPick.resolve | ( | String | pickId, |
| boolean | confirmed, | ||
| Set< String > | chosenIds ) |
The sheet's answer.
| pickId | the id open returned |
| confirmed | true for the confirm button, false for a dismissal |
| chosenIds | the receivers ticked, may be null |
