Fix notification crash while navigating
This commit is contained in:
parent
61e2307b07
commit
48f615846c
1 changed files with 11 additions and 11 deletions
|
@ -8,9 +8,7 @@ import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.PorterDuffColorFilter;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.support.v4.app.NotificationCompat;
|
import android.support.v4.app.NotificationCompat;
|
||||||
|
@ -18,7 +16,6 @@ import android.support.v4.app.NotificationCompat.BigTextStyle;
|
||||||
import android.support.v4.app.NotificationCompat.Builder;
|
import android.support.v4.app.NotificationCompat.Builder;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
|
||||||
import net.osmand.plus.NavigationService;
|
import net.osmand.plus.NavigationService;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -147,15 +144,18 @@ public class NavigationNotification extends OsmandNotification {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TurnDrawable drawable = new TurnDrawable(app, false);
|
if (turnType != null) {
|
||||||
int height = (int) app.getResources().getDimension(android.R.dimen.notification_large_icon_height);
|
TurnDrawable drawable = new TurnDrawable(app, false);
|
||||||
int width = (int) app.getResources().getDimension(android.R.dimen.notification_large_icon_width);
|
int height = (int) app.getResources().getDimension(android.R.dimen.notification_large_icon_height);
|
||||||
drawable.setBounds(0, 0, width, height);
|
int width = (int) app.getResources().getDimension(android.R.dimen.notification_large_icon_width);
|
||||||
drawable.setTurnType(turnType);
|
drawable.setBounds(0, 0, width, height);
|
||||||
drawable.setTurnImminent(turnImminent, deviatedFromRoute);
|
drawable.setTurnType(turnType);
|
||||||
turnBitmap = drawableToBitmap(drawable);
|
drawable.setTurnImminent(turnImminent, deviatedFromRoute);
|
||||||
|
turnBitmap = drawableToBitmap(drawable);
|
||||||
|
}
|
||||||
|
|
||||||
notificationTitle = OsmAndFormatter.getFormattedDistance(nextTurnDistance, app) + " • " + RouteCalculationResult.toString(turnType, app);
|
notificationTitle = OsmAndFormatter.getFormattedDistance(nextTurnDistance, app)
|
||||||
|
+ (turnType != null ? " • " + RouteCalculationResult.toString(turnType, app) : "");
|
||||||
if (ri != null && !Algorithms.isEmpty(ri.getDescriptionRoutePart())) {
|
if (ri != null && !Algorithms.isEmpty(ri.getDescriptionRoutePart())) {
|
||||||
notificationText.append(ri.getDescriptionRoutePart());
|
notificationText.append(ri.getDescriptionRoutePart());
|
||||||
notificationText.append("\n");
|
notificationText.append("\n");
|
||||||
|
|
Loading…
Reference in a new issue