Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3293760d7e
2 changed files with 35 additions and 15 deletions
|
@ -22,6 +22,8 @@ import android.os.IBinder;
|
|||
import android.os.PowerManager;
|
||||
import android.os.PowerManager.WakeLock;
|
||||
import android.os.SystemClock;
|
||||
import android.support.v4.app.NotificationCompat.Builder;
|
||||
import android.support.v7.app.NotificationCompat;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -181,10 +183,9 @@ public class NavigationService extends Service implements LocationListener {
|
|||
|
||||
};
|
||||
registerReceiver(broadcastReceiver, new IntentFilter(OSMAND_STOP_SERVICE_ACTION));
|
||||
|
||||
|
||||
Intent notificationIntent = new Intent(OSMAND_STOP_SERVICE_ACTION);
|
||||
Notification notification = new Notification(R.drawable.bgs_icon, "", //$NON-NLS-1$
|
||||
System.currentTimeMillis());
|
||||
notification.flags = Notification.FLAG_NO_CLEAR;
|
||||
|
||||
//Show currently active wake-up interval
|
||||
int soi = settings.SERVICE_OFF_INTERVAL.get();
|
||||
|
@ -196,11 +197,21 @@ public class NavigationService extends Service implements LocationListener {
|
|||
} else {
|
||||
nt = nt + Integer.toString(soi/1000/60) + " " + getString(R.string.int_min);
|
||||
}
|
||||
PendingIntent broadcast = PendingIntent.getBroadcast(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
// Notification notification = new Notification(R.drawable.bgs_icon, "", //$NON-NLS-1$
|
||||
// System.currentTimeMillis());
|
||||
//
|
||||
// notification.setLatestEventInfo(this, Version.getAppName(cl) + " " + getString(R.string.osmand_service), nt,
|
||||
// broadcast);
|
||||
// notification.flags = Notification.FLAG_NO_CLEAR;
|
||||
// startForeground(NOTIFICATION_SERVICE_ID, notification);
|
||||
|
||||
notification.setLatestEventInfo(this, Version.getAppName(cl) + " " + getString(R.string.osmand_service), nt,
|
||||
PendingIntent.getBroadcast(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT));
|
||||
|
||||
startForeground(NOTIFICATION_SERVICE_ID, notification);
|
||||
final Builder noti = new NotificationCompat.Builder(
|
||||
this).setContentTitle(Version.getAppName(cl))
|
||||
.setContentText(getString(R.string.osmand_service)).setSmallIcon(R.drawable.bgs_icon)
|
||||
// .setLargeIcon(Helpers.getBitmap(R.drawable.mirakel, getBaseContext()))
|
||||
.setContentIntent(broadcast).setOngoing(true);
|
||||
startForeground(NOTIFICATION_SERVICE_ID, noti.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -40,7 +40,6 @@ import net.osmand.plus.base.MapViewTrackingUtilities;
|
|||
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||
import net.osmand.plus.helpers.GpxImportHelper;
|
||||
import net.osmand.plus.helpers.WakeLockHelper;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
import net.osmand.plus.render.RendererRegistry;
|
||||
import net.osmand.plus.resources.ResourceManager;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
|
@ -68,6 +67,8 @@ import android.os.Bundle;
|
|||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.v4.app.NotificationCompat.Builder;
|
||||
import android.support.v7.app.NotificationCompat;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
@ -119,12 +120,20 @@ public class MapActivity extends AccessibleActivity {
|
|||
private Notification getNotification() {
|
||||
Intent notificationIndent = new Intent(this, getMyApplication().getAppCustomization().getMapActivity());
|
||||
notificationIndent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
Notification notification = new Notification(R.drawable.bgs_icon_drive, "", //$NON-NLS-1$
|
||||
System.currentTimeMillis());
|
||||
notification.flags |= Notification.FLAG_AUTO_CANCEL;
|
||||
notification.setLatestEventInfo(this, Version.getAppName(app), getString(R.string.go_back_to_osmand),
|
||||
PendingIntent.getActivity(this, 0, notificationIndent, PendingIntent.FLAG_UPDATE_CURRENT));
|
||||
return notification;
|
||||
PendingIntent pi = PendingIntent.getActivity(this, 0, notificationIndent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
// Notification notification = new Notification(R.drawable.bgs_icon_drive, "", //$NON-NLS-1$
|
||||
// System.currentTimeMillis());
|
||||
// notification.flags |= Notification.FLAG_AUTO_CANCEL;
|
||||
// notification.setLatestEventInfo(this, Version.getAppName(app), getString(R.string.go_back_to_osmand),
|
||||
// pi);
|
||||
int smallIcon = app.getSettings().getApplicationMode().getSmallIconDark();
|
||||
final Builder noti = new NotificationCompat.Builder(
|
||||
this).setContentTitle(Version.getAppName(app))
|
||||
.setContentText(getString(R.string.go_back_to_osmand))
|
||||
.setSmallIcon(smallIcon )
|
||||
// .setLargeIcon(Helpers.getBitmap(R.drawable.mirakel, getBaseContext()))
|
||||
.setContentIntent(pi).setOngoing(true);
|
||||
return noti.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue