public class Place
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Place.AppState
States enum.
|
private static class |
Place.AppTrigger
Trigger enum.
|
private class |
Place.EnterEntry
Action taken when the state machine enters
Place.AppState.INSIDE -> calls Overlay.in()
for every SoundEntity being SoundEntity.Where.INSIDE
TODO: we may prefer using a running guard for this... |
private class |
Place.ExitEntry
Action taken when the state machine exits
Place.AppState.INSIDE -> computes the opacity
given the actual distance_from_user_ , calls Overlay.out(float) for every
SoundEntity being SoundEntity.Where.INSIDE
and dispatches a new PlaceEvent.EXIT if the user isn't already outside () and there is
no reading still being played. |
private class |
Place.StopEntry
Action taken when the state machine enters
Place.AppState.STOPPED -> calls Overlay.off()
for every SoundEntity being SoundEntity.Where.INSIDE . |
Modifier and Type | Field and Description |
---|---|
private android.content.Context |
context_
MainActivity 's Context backref. |
private short |
distance_from_center_
The minimum distance between this place centroid and its outer polygon.
|
private short |
distance_from_user_
The distance between the user
SharedBuffer.location() and the centroid of this place. |
private com.github.oxo42.stateless4j.StateMachine<Place.AppState,Place.AppTrigger> |
fsm_
The state machine.
|
private com.mapbox.mapboxsdk.annotations.Marker |
marker_
A marker that could be displayed in any state but
Place.AppState.STOPPED . |
private int |
MARKER_NORMAL |
private int |
marker_res_
The marker
DrawableRes which is used to guess a selected state boolean. |
private int |
MARKER_SELECT |
private java.util.HashMap<SoundEntity.Where,Overlay> |
overlays_
A list of
Overlay indexed by SoundEntity.Where . |
private PlaceEntity |
place_entity_
The
PlaceEntity handled by this state machine. |
Constructor and Description |
---|
Place(android.content.Context context,
PlaceEntity place_entity) |
Modifier and Type | Method and Description |
---|---|
PlaceEntity |
entity() |
void |
mark(boolean value)
Shows / hides the marker.
|
void |
marker_select(boolean select) |
com.mapbox.mapboxsdk.annotations.Marker |
marker() |
Place.AppState |
state()
Returns the current state of the
fsm_ . |
void |
stop()
stop() trigger. |
void |
update()
Conditional trigger that will set the machine's state to:
Place.AppTrigger.enter if the user is within;
Place.AppTrigger.exit if the user is at least Constants.DISTANCE_PLACE_VISIBILITY meters away;
stop() otherwise.
|
@DrawableRes private final int MARKER_NORMAL
@DrawableRes private final int MARKER_SELECT
private final android.content.Context context_
MainActivity
's Context
backref.private final PlaceEntity place_entity_
PlaceEntity
handled by this state machine.private final java.util.HashMap<SoundEntity.Where,Overlay> overlays_
Overlay
indexed by SoundEntity.Where
.private final short distance_from_center_
private final com.github.oxo42.stateless4j.StateMachine<Place.AppState,Place.AppTrigger> fsm_
@Nullable private com.mapbox.mapboxsdk.annotations.Marker marker_
Place.AppState.STOPPED
.@DrawableRes private int marker_res_
DrawableRes
which is used to guess a selected
state boolean.private short distance_from_user_
SharedBuffer.location()
and the centroid of this place.public Place(@NonNull android.content.Context context, @NonNull PlaceEntity place_entity)
public void stop()
stop()
trigger.public void update()
Place.AppTrigger.enter
if the user is within;Place.AppTrigger.exit
if the user is at least Constants.DISTANCE_PLACE_VISIBILITY
meters away;stop()
otherwise.public void mark(boolean value)
value
- Whether to show the marker or not@NonNull public final PlaceEntity entity()
@Nullable public final com.mapbox.mapboxsdk.annotations.Marker marker()
public void marker_select(boolean select)
public Place.AppState state()
fsm_
.Place.AppState
variable.