public voidupdateNotification() {boolean isShow=false;if (SettingInfo.shareInstance().isNotifyPlugin()||MyTrackInfo.getInstance().isStart()){
isShow=true;
}if (!isShow){
((NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE)).cancel(notify_info);
((NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE)).cancel(notify_control);return;
}if (mNotificationControl == null) {
mNotificationControl= new Notification(R.drawable.ic_launcher, "NotificationName", System.currentTimeMillis());
mNotificationControl.flags= Notification.FLAG_ONGOING_EVENT |Notification.FLAG_NO_CLEAR;
RemoteViews contentView= newRemoteViews(mContext.getPackageName(), R.layout.layout_notify_control);
mNotificationControl.contentView=contentView;
PendingIntent pendingIntent1= PendingIntent.getBroadcast(mContext, 0, new Intent(NotificationBroadcastReceiver.CLICK_ACTION_BUTTON_1), 0);
contentView.setOnClickPendingIntent(R.id.button1, pendingIntent1);
PendingIntent pendingIntent2= PendingIntent.getBroadcast(mContext, 0, new Intent(NotificationBroadcastReceiver.CLICK_ACTION_BUTTON_2), 0);
contentView.setOnClickPendingIntent(R.id.button2, pendingIntent2);
}if (MyTrackInfo.getInstance().getStatus() ==MyTrackInfo.status_create) {
mNotificationControl.contentView.setTextViewText(R.id.button1,"开始室内");
mNotificationControl.contentView.setTextViewText(R.id.button2,"开启户外");
}else if (MyTrackInfo.getInstance().getStatus() ==MyTrackInfo.status_resume) {
mNotificationControl.contentView.setTextViewText(R.id.button1,"暂停");
mNotificationControl.contentView.setTextViewText(R.id.button2,"结束");
}else if (MyTrackInfo.getInstance().getStatus() ==MyTrackInfo.status_pause) {
mNotificationControl.contentView.setTextViewText(R.id.button1,"继续");
mNotificationControl.contentView.setTextViewText(R.id.button2,"结束");
}if (mNotificationInfo == null) {
mNotificationInfo= new Notification(R.drawable.ic_launcher, "notificationName", System.currentTimeMillis());
mNotificationInfo.flags= Notification.FLAG_ONGOING_EVENT |Notification.FLAG_NO_CLEAR;
RemoteViews contentView= newRemoteViews(mContext.getPackageName(), R.layout.layout_notify_info);
PendingIntent contentIntent= PendingIntent.getBroadcast(mContext, 0, new Intent(NotificationBroadcastReceiver.CLICK_ACTION_BUTTON_OPEN), 0);
mNotificationInfo.contentIntent=contentIntent;
mNotificationInfo.contentView=contentView;
}mNotificationInfo.contentView.setTextViewText(R.id.textView1, TimeUtils.second2Time(13:12:31 00:00:00));mNotificationInfo.contentView.setTextViewText(R.id.textView2, RunningUtils.getMeterStr(31));mNotificationInfo.contentView.setTextViewText(R.id.textView3, TimeUtils.second2Pace(3));if (mNotificationManager == null) {
mNotificationManager=(NotificationManager) mContext.getSystemService(mContext.NOTIFICATION_SERVICE);
}
mNotificationManager.notify(notify_info, mNotificationInfo);
mNotificationManager.notify(notify_control, mNotificationControl);//if (totalSec%5==0) {
mContext.sendBroadcast(newIntent(ControlAllWidgetProvider.ACTION_CONTROL_UPDATE));//}
}