Skip to content

Commit

Permalink
Bugfix k3b#81: GeoMap did not show photo locations anymore. Crash whe…
Browse files Browse the repository at this point in the history
…n clicking into the map
  • Loading branch information
k3b committed Apr 19, 2017
1 parent 1312915 commit 8db9a2d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ android {
// 0.6.0.170315 (26) Bugfix for new Tag support (fdroid build failed)
// 0.6.0.170402 (27) language updates. (fdroid build failed)
// 0.6.0.170404 (28) same as 0.6.0.170402. try to fix fdroid build
// 0.6.0.170420 (29) bugfix Map

versionCode = 28
versionName = '0.6.0.170404'
versionCode = 29
versionName = '0.6.0.170420'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected OverlayManager doInBackground(QueryParameter... queryParameter) {
"," + FotoSql.SQL_COL_LAT +
" or " + FotoSql.SQL_COL_PK);
}
String markerItemCount = "1";
String markerItemCount = null;
int increment = PROGRESS_INCREMENT;
while (cursor.moveToNext()) {
int id = cursor.getInt(colIconID);
Expand All @@ -131,8 +131,9 @@ protected OverlayManager doInBackground(QueryParameter... queryParameter) {
} else {
marker = createMarker();
GeoPoint point = new GeoPoint(cursor.getDouble(colLat),cursor.getDouble(colLon));

if (colCount != -1) markerItemCount = cursor.getString(colCount);
BitmapDrawable icon = (colCount != -1) ? null : createIcon(markerItemCount);
BitmapDrawable icon = createIcon(markerItemCount);
marker.set(id, point, icon,null );
}

Expand Down
12 changes: 7 additions & 5 deletions app/src/main/java/de/k3b/android/osmdroid/IconFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ public BitmapDrawable createIcon(String text) {
Bitmap finalIcon = Bitmap.createBitmap(mBackground.getWidth(), mBackground.getHeight(), mBackground.getConfig());
Canvas iconCanvas = new Canvas(finalIcon);
iconCanvas.drawBitmap(mBackground, 0, 0, null);
int textHeight = (int) (mTextPaint.descent() + mTextPaint.ascent());
iconCanvas.drawText(text,
mTextAnchorU * finalIcon.getWidth(),
mTextAnchorV * finalIcon.getHeight() - textHeight / 2,
mTextPaint);
if ((text != null) && (text.length() > 0)) {
int textHeight = (int) (mTextPaint.descent() + mTextPaint.ascent());
iconCanvas.drawText(text,
mTextAnchorU * finalIcon.getWidth(),
mTextAnchorV * finalIcon.getHeight() - textHeight / 2,
mTextPaint);
}
return new BitmapDrawable(resources, finalIcon);
}
}

0 comments on commit 8db9a2d

Please sign in to comment.