Merge branch 'r3.9'

This commit is contained in:
max-klaus 2021-02-04 16:45:00 +03:00
commit 5eb5d1080b
2 changed files with 12 additions and 16 deletions

View file

@ -4,16 +4,13 @@ import android.app.Notification;
import android.app.Service; import android.app.Service;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.location.LocationManager;
import android.os.Binder; import android.os.Binder;
import android.os.IBinder; import android.os.IBinder;
import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import net.osmand.Location; import net.osmand.Location;
import net.osmand.PlatformUtil;
import net.osmand.plus.helpers.LocationServiceHelper; import net.osmand.plus.helpers.LocationServiceHelper;
import net.osmand.plus.helpers.LocationServiceHelper.LocationCallback; import net.osmand.plus.helpers.LocationServiceHelper.LocationCallback;
import net.osmand.plus.notifications.OsmandNotification; import net.osmand.plus.notifications.OsmandNotification;
@ -95,12 +92,6 @@ public class NavigationService extends Service {
@Override @Override
public void onLocationAvailability(boolean locationAvailable) { public void onLocationAvailability(boolean locationAvailable) {
if (!locationAvailable) {
OsmandApplication app = (OsmandApplication) getApplication();
if (app != null) {
app.showToastMessage(getString(R.string.off_router_service_no_gps_available));
}
}
} }
}); });
} catch (SecurityException e) { } catch (SecurityException e) {
@ -137,11 +128,13 @@ public class NavigationService extends Service {
app.setNavigationService(null); app.setNavigationService(null);
usedBy = 0; usedBy = 0;
// remove updates // remove updates
if (locationServiceHelper != null) {
try { try {
locationServiceHelper.removeLocationUpdates(); locationServiceHelper.removeLocationUpdates();
} catch (SecurityException e) { } catch (SecurityException e) {
// Location service permission not granted // Location service permission not granted
} }
}
// remove notification // remove notification
stopForeground(Boolean.TRUE); stopForeground(Boolean.TRUE);
app.getNotificationHelper().updateTopNotification(); app.getNotificationHelper().updateTopNotification();

View file

@ -90,11 +90,14 @@ public class JSMediaCommandPlayerImpl extends MediaCommandPlayerImpl {
if (voiceDir.getName().contains("tts")) { if (voiceDir.getName().contains("tts")) {
return false; return false;
} }
for (File f : voiceDir.listFiles()) { File[] files = voiceDir.listFiles();
if (files != null) {
for (File f : files) {
if (f.getName().endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS)) { if (f.getName().endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS)) {
return true; return true;
} }
} }
}
return false; return false;
} }