From 8d639d4b637946b5b67f864edca21e6875b190a4 Mon Sep 17 00:00:00 2001 From: sonora Date: Tue, 6 Jan 2015 11:32:10 +0100 Subject: [PATCH] import Sensor --- .../osmand/plus/activities/search/SearchPOIActivity.java | 9 +++++---- .../net/osmand/plus/dashboard/DashFavoritesFragment.java | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java index ff61980ea2..8253693fb6 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java @@ -51,6 +51,7 @@ import android.app.AlertDialog.Builder; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.hardware.Sensor; import android.hardware.SensorManager; import android.graphics.Canvas; import android.graphics.ColorFilter; @@ -807,10 +808,10 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa } //Looks like screenOrientation correction must not be applied for devices without compass? - // Sensor s = ((SensorManager) getSystemService(Context.SENSOR_SERVICE)).getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); - // if (s == null) { - // screenOrientation = 0; - // } + Sensor s = ((SensorManager) getSystemService(Context.SENSOR_SERVICE)).getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); + if (s == null) { + screenOrientation = 0; + } draw.setAngle(mes[1] - a + 180 + screenOrientation); diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java index 8e333cbd22..1b3aa6ea1c 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java @@ -3,6 +3,7 @@ package net.osmand.plus.dashboard; import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.hardware.Sensor; import android.hardware.SensorManager; import android.graphics.Typeface; import android.graphics.drawable.Drawable; @@ -206,10 +207,10 @@ public class DashFavoritesFragment extends DashBaseFragment { } //Looks like screenOrientation correction must not be applied for devices without compass? - // Sensor s = ((SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE)).getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); - // if (s == null) { - // screenOrientation = 0; - // } + Sensor s = ((SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE)).getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); + if (s == null) { + screenOrientation = 0; + } draw.setAngle(mes[1] - a + 180 + screenOrientation);