public class ProximitySensor extends AndroidNonvisibleComponent implements OnStopListener, OnResumeListener, SensorComponent, OnPauseListener, android.hardware.SensorEventListener, Deleteable
form
ACCELEROMETER_SENSITIVITY_MODERATE, ACCELEROMETER_SENSITIVITY_STRONG, ACCELEROMETER_SENSITIVITY_WEAK, ALIGNMENT_CENTER, ALIGNMENT_NORMAL, ALIGNMENT_OPPOSITE, ASSET_DIRECTORY, BUTTON_SHAPE_DEFAULT, BUTTON_SHAPE_OVAL, BUTTON_SHAPE_RECT, BUTTON_SHAPE_ROUNDED, COLOR_BLACK, COLOR_BLUE, COLOR_CYAN, COLOR_DEFAULT, COLOR_DKGRAY, COLOR_GRAY, COLOR_GREEN, COLOR_LTGRAY, COLOR_MAGENTA, COLOR_NONE, COLOR_ORANGE, COLOR_PINK, COLOR_RED, COLOR_WHITE, COLOR_YELLOW, DEFAULT_VALUE_COLOR_BLACK, DEFAULT_VALUE_COLOR_BLUE, DEFAULT_VALUE_COLOR_CYAN, DEFAULT_VALUE_COLOR_DEFAULT, DEFAULT_VALUE_COLOR_DKGRAY, DEFAULT_VALUE_COLOR_GRAY, DEFAULT_VALUE_COLOR_GREEN, DEFAULT_VALUE_COLOR_LTGRAY, DEFAULT_VALUE_COLOR_MAGENTA, DEFAULT_VALUE_COLOR_NONE, DEFAULT_VALUE_COLOR_ORANGE, DEFAULT_VALUE_COLOR_PINK, DEFAULT_VALUE_COLOR_RED, DEFAULT_VALUE_COLOR_WHITE, DEFAULT_VALUE_COLOR_YELLOW, DIRECTION_EAST, DIRECTION_MAX, DIRECTION_MIN, DIRECTION_NONE, DIRECTION_NORTH, DIRECTION_NORTHEAST, DIRECTION_NORTHWEST, DIRECTION_SOUTH, DIRECTION_SOUTHEAST, DIRECTION_SOUTHWEST, DIRECTION_WEST, FONT_DEFAULT_SIZE, LAYOUT_ORIENTATION_HORIZONTAL, LAYOUT_ORIENTATION_VERTICAL, LENGTH_FILL_PARENT, LENGTH_PREFERRED, LENGTH_UNKNOWN, SLIDER_MAX_VALUE, SLIDER_MIN_VALUE, SLIDER_THUMB_VALUE, TOAST_LENGTH_LONG, TOAST_LENGTH_SHORT, TYPEFACE_DEFAULT, TYPEFACE_MONOSPACE, TYPEFACE_SANSSERIF, TYPEFACE_SERIF
Constructor and Description |
---|
ProximitySensor(ComponentContainer container)
Creates a new ProximitySensor component.
|
Modifier and Type | Method and Description |
---|---|
boolean |
Available()
Used to determine if the device has ProximitySensor
|
float |
Distance()
Returns the distance.
|
boolean |
Enabled()
If true, the sensor will generate events.
|
void |
Enabled(boolean enabled)
Specifies whether the sensor should generate events.
|
boolean |
KeepRunningWhenOnPause()
Returns value of keepRunningWhenOnPause
|
void |
KeepRunningWhenOnPause(boolean enabled)
Specifies if sensor should still be listening when activity is not active
|
float |
MaximumRange()
Determines a sensor's maximum range.
|
void |
onAccuracyChanged(android.hardware.Sensor sensor,
int accuracy)
Called when the accuracy of the registered sensor has changed
|
void |
onDelete() |
void |
onPause() |
void |
onResume() |
void |
onSensorChanged(android.hardware.SensorEvent sensorEvent)
Called when sensor values have changed
|
void |
onStop() |
void |
ProximityChanged(float distance) |
getDispatchDelegate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDispatchDelegate
public ProximitySensor(ComponentContainer container)
container
- ignored (because this is a non-visible component)public boolean Available()
true
indicates that an proximity sensor is available,
false
that it isn'tpublic void onResume()
onResume
in interface OnResumeListener
public void onStop()
onStop
in interface OnStopListener
public void onDelete()
onDelete
in interface Deleteable
public void onPause()
onPause
in interface OnPauseListener
public void onSensorChanged(android.hardware.SensorEvent sensorEvent)
onSensorChanged
in interface android.hardware.SensorEventListener
sensorEvent
- holds information such as the sensor's type,
the time-stamp, accuracy and sensor's datapublic float MaximumRange()
public boolean Enabled()
true
indicates that the sensor generates events,
false
that it doesn'tpublic void Enabled(boolean enabled)
enabled
- true
enables sensor event generation,
false
disables itpublic boolean KeepRunningWhenOnPause()
public void KeepRunningWhenOnPause(boolean enabled)
enabled
- public void ProximityChanged(float distance)
public float Distance()
public void onAccuracyChanged(android.hardware.Sensor sensor, int accuracy)
onAccuracyChanged
in interface android.hardware.SensorEventListener
sensor
- Sensoraccuracy
- the new accuracy of this sensor