Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
SystemAlertWindow
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
SystemAlertWindow
Commits
5a45b7a9
提交
5a45b7a9
authored
4月 02, 2024
作者:
shixiaochen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:修复更新悬浮窗方法崩溃问题;
上级
3dc45b7d
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
32 行增加
和
36 行删除
+32
-36
WindowServiceNew.java
...jvapps/system_alert_window/services/WindowServiceNew.java
+32
-36
没有找到文件。
android/src/main/java/in/jvapps/system_alert_window/services/WindowServiceNew.java
浏览文件 @
5a45b7a9
...
@@ -244,43 +244,39 @@ public class WindowServiceNew extends Service implements View.OnTouchListener {
...
@@ -244,43 +244,39 @@ public class WindowServiceNew extends Service implements View.OnTouchListener {
// update the notification
// update the notification
private
void
updateNotification
(
HashMap
<
String
,
Object
>
paramsMap
)
{
private
void
updateNotification
(
HashMap
<
String
,
Object
>
paramsMap
)
{
String
notificationUpdateData
=
(
String
)
paramsMap
.
get
(
Constants
.
KEY_UPDATE_NOTIFICATION_DATA
);
String
notificationUpdateData
=
(
String
)
paramsMap
.
get
(
Constants
.
KEY_UPDATE_NOTIFICATION_DATA
);
assert
notificationUpdateData
!=
null
;
if
(
notificationUpdateData
!=
null
)
{
HashMap
<
String
,
String
>
notificationData
=
new
Gson
().
fromJson
(
notificationUpdateData
,
HashMap
.
class
);
HashMap
<
String
,
String
>
notificationData
=
new
Gson
().
fromJson
(
notificationUpdateData
,
HashMap
.
class
);
if
(
notificationData
!=
null
)
{
if
(
notificationData
!=
null
)
{
LogUtils
.
getInstance
().
d
(
TAG
,
"Updating the notification"
);
LogUtils
.
getInstance
().
d
(
TAG
,
"Updating the notification"
);
LogUtils
.
getInstance
().
d
(
TAG
,
notificationData
.
toString
());
LogUtils
.
getInstance
().
d
(
TAG
,
notificationData
.
toString
());
String
receiveAddress
=
notificationData
.
get
(
Constants
.
KEY_RECEIVE_ADDRESS
);
String
receiveAddress
=
notificationData
.
get
(
Constants
.
KEY_RECEIVE_ADDRESS
);
String
sendAddress
=
notificationData
.
get
(
Constants
.
KEY_SEND_ADDRESS
);
String
sendAddress
=
notificationData
.
get
(
Constants
.
KEY_SEND_ADDRESS
);
String
lastArriveSendTime
=
notificationData
.
get
(
Constants
.
KEY_LATEST_SEND_ADDRESS
);
String
lastArriveSendTime
=
notificationData
.
get
(
Constants
.
KEY_LATEST_SEND_ADDRESS
);
String
lastArriveReceiveTime
=
notificationData
.
get
(
Constants
.
KEY_LATEST_RECEIVE_ADDRESS
);
String
lastArriveReceiveTime
=
notificationData
.
get
(
Constants
.
KEY_LATEST_RECEIVE_ADDRESS
);
String
lastLoadTime
=
notificationData
.
get
(
Constants
.
KEY_LATEST_LOAD_TIME
);
String
lastLoadTime
=
notificationData
.
get
(
Constants
.
KEY_LATEST_LOAD_TIME
);
if
(
receiveAddress
!=
null
)
{
if
(
receiveAddress
!=
null
)
{
remoteViews
.
setTextViewText
(
R
.
id
.
tv_receive_address
,
receiveAddress
);
remoteViews
.
setTextViewText
(
R
.
id
.
tv_receive_address
,
receiveAddress
);
}
}
if
(
sendAddress
!=
null
)
{
if
(
sendAddress
!=
null
)
{
remoteViews
.
setTextViewText
(
R
.
id
.
tv_send_address
,
sendAddress
);
remoteViews
.
setTextViewText
(
R
.
id
.
tv_send_address
,
sendAddress
);
}
}
if
(
lastArriveSendTime
!=
null
)
{
if
(
lastArriveSendTime
!=
null
)
{
remoteViews
.
setTextViewText
(
R
.
id
.
tv_last_arrive_send_time
,
lastArriveSendTime
);
remoteViews
.
setTextViewText
(
R
.
id
.
tv_last_arrive_send_time
,
lastArriveSendTime
);
}
}
if
(
lastArriveReceiveTime
!=
null
)
{
if
(
lastArriveReceiveTime
!=
null
)
{
remoteViews
.
setTextViewText
(
R
.
id
.
tv_last_arrive_receive_time
,
lastArriveReceiveTime
);
remoteViews
.
setTextViewText
(
R
.
id
.
tv_last_arrive_receive_time
,
lastArriveReceiveTime
);
}
}
if
(
lastLoadTime
!=
null
)
{
if
(
lastLoadTime
!=
null
)
{
remoteViews
.
setTextViewText
(
R
.
id
.
tv_last_load_time
,
"最晚装货:"
+
lastLoadTime
);
remoteViews
.
setTextViewText
(
R
.
id
.
tv_last_load_time
,
"最晚装货:"
+
lastLoadTime
);
}
}
notification
=
new
NotificationCompat
.
Builder
(
this
,
CHANNEL_ID
)
notification
=
new
NotificationCompat
.
Builder
(
this
,
CHANNEL_ID
).
setSmallIcon
(
R
.
drawable
.
ic_notification_logo
).
setStyle
(
new
NotificationCompat
.
DecoratedCustomViewStyle
()).
setCustomBigContentView
(
remoteViews
).
setContentIntent
(
pendingIntent
).
build
();
.
setSmallIcon
(
R
.
drawable
.
ic_notification_logo
)
if
(
Build
.
VERSION
.
SDK_INT
>=
34
)
{
.
setStyle
(
new
NotificationCompat
.
DecoratedCustomViewStyle
())
startForeground
(
NOTIFICATION_ID
,
notification
,
FOREGROUND_SERVICE_TYPE_SPECIAL_USE
);
.
setCustomBigContentView
(
remoteViews
)
}
else
{
.
setContentIntent
(
pendingIntent
)
startForeground
(
NOTIFICATION_ID
,
notification
);
.
build
();
}
if
(
Build
.
VERSION
.
SDK_INT
>=
34
)
{
startForeground
(
NOTIFICATION_ID
,
notification
,
FOREGROUND_SERVICE_TYPE_SPECIAL_USE
);
}
else
{
startForeground
(
NOTIFICATION_ID
,
notification
);
}
}
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论