Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
openhab-android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenLicht
openhab-android
Commits
0cd8cb17
Unverified
Commit
0cd8cb17
authored
6 years ago
by
mueller-ma
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use Util.convertDpToPixel() in OsmViewHolder (#1364)
Signed-off-by:
mueller-ma
<
mueller-ma@users.noreply.github.com
>
parent
9e335e0d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mobile/src/foss/java/org/openhab/habdroid/ui/MapViewHelper.java
+1
-13
1 addition, 13 deletions
.../src/foss/java/org/openhab/habdroid/ui/MapViewHelper.java
with
1 addition
and
13 deletions
mobile/src/foss/java/org/openhab/habdroid/ui/MapViewHelper.java
+
1
−
13
View file @
0cd8cb17
...
...
@@ -6,7 +6,6 @@ import android.content.res.Resources;
import
android.location.Location
;
import
android.os.Handler
;
import
android.preference.PreferenceManager
;
import
android.util.DisplayMetrics
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.ViewGroup
;
...
...
@@ -192,7 +191,7 @@ public class MapViewHelper {
Log
.
d
(
TAG
,
String
.
format
(
"North %f, south %f, west %f, east %f"
,
north
,
south
,
west
,
east
));
BoundingBox
boundingBox
=
new
BoundingBox
(
north
,
east
,
south
,
west
);
int
extraPixel
=
(
int
)
convertDpToPixel
(
24
f
,
mapView
.
getContext
());
int
extraPixel
=
(
int
)
Util
.
convertDpToPixel
(
24
f
,
mapView
.
getContext
());
try
{
mapView
.
zoomToBoundingBox
(
boundingBox
,
false
,
extraPixel
);
}
catch
(
Exception
e
)
{
...
...
@@ -219,17 +218,6 @@ public class MapViewHelper {
}
}
/**
* This method converts dp unit to equivalent pixels, depending on device density.
*
* @param dp A value in dp (density independent pixels) unit. Which we need to convert into pixels
* @param context Context to get resources and device specific display metrics
* @return A float value to represent px equivalent to dp depending on device density
*/
private
static
float
convertDpToPixel
(
float
dp
,
Context
context
){
return
dp
*
((
float
)
context
.
getResources
().
getDisplayMetrics
().
densityDpi
/
DisplayMetrics
.
DENSITY_DEFAULT
);
}
private
static
void
moveCamera
(
MapView
mapView
,
float
zoom
,
GeoPoint
geoPoint
)
{
IMapController
mapController
=
mapView
.
getController
();
mapController
.
setZoom
(
zoom
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment