Package com.gluonhq.attach.orientation
Interface OrientationService
-
- All Known Implementing Classes:
AndroidOrientationService
,DummyOrientationService
,IOSOrientationService
public interface OrientationService
With the orientation service you can detect whether the device is currently oriented horizontally or vertically.The OrientationService provides a read-only
orientation property
that will be updated when the orientation of the device changes. A user of the OrientationService can listen to changes of the orientation by registering aChangeListener
to theorientation property
.Example
OrientationService.create().ifPresent(service -> { Orientation orientation = service.getOrientation(); System.out.println("Current orientation: " + orientation.name()); });
Android Configuration: none
iOS Configuration: none
- Since:
- 3.0.0
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static java.util.Optional<OrientationService>
create()
Returns an instance ofOrientationService
.java.util.Optional<javafx.geometry.Orientation>
getOrientation()
Returns the current orientation of the device.javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Orientation>
orientationProperty()
A read-only property containing the current orientation of the device, which will be updated automatically whenever the device orientation changes.
-
-
-
Method Detail
-
create
static java.util.Optional<OrientationService> create()
Returns an instance ofOrientationService
.- Returns:
- An instance of
OrientationService
.
-
orientationProperty
javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Orientation> orientationProperty()
A read-only property containing the current orientation of the device, which will be updated automatically whenever the device orientation changes.- Returns:
- A read-only property containing the current orientation of the device
-
getOrientation
java.util.Optional<javafx.geometry.Orientation> getOrientation()
Returns the current orientation of the device.- Returns:
- An optional containing the orientation of the device, or empty if unknown
-
-