ims.map
Class MySensorEventListener
java.lang.Object
ims.map.MySensorEventListener
- All Implemented Interfaces:
- android.hardware.SensorEventListener
public class MySensorEventListener
- extends java.lang.Object
- implements android.hardware.SensorEventListener
Handles the rotation in direction of the view (phone's orientation) referring
to the compass mode after the specified amount of time elapses.
Copyright © 2014 by Daniela Blum
This file is part of GPSChildFinder.
GPSChildFinder is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any
later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
this program. If not, see http://www.gnu.org/licenses.
- Author:
- Daniela Blum
Method Summary |
void |
onAccuracyChanged(android.hardware.Sensor sensor,
int accuracy)
|
void |
onSensorChanged(android.hardware.SensorEvent event)
Handles sensor events when the sensor changed. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MySensorEventListener
public MySensorEventListener(Map map)
- Constructor.
- Parameters:
map
- Map class in which the main components of the map.
onSensorChanged
public void onSensorChanged(android.hardware.SensorEvent event)
- Handles sensor events when the sensor changed.
It that case only the Sensor.TYPE_ROTATION_VECTOR
type is
interesting and gets handled and only when the
Map.myLocationButton
is selected and the compass mode
should be shown on the map.
The bearing (direction of the compass) is calculated with help of the
orientation and the declination so that the map's camera can be updated (
updateCamera(float)
).
- Specified by:
onSensorChanged
in interface android.hardware.SensorEventListener
onAccuracyChanged
public void onAccuracyChanged(android.hardware.Sensor sensor,
int accuracy)
- Specified by:
onAccuracyChanged
in interface android.hardware.SensorEventListener