Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
SystemAlertWindow
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
SystemAlertWindow
Commits
3dc45b7d
提交
3dc45b7d
authored
4月 01, 2024
作者:
shixiaochen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:调试自定义通知样式、展示;
上级
c1c22ea2
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
100 行增加
和
44 行删除
+100
-44
WindowServiceNew.java
...jvapps/system_alert_window/services/WindowServiceNew.java
+2
-3
notification_configuration_layout.xml
...src/main/res/layout/notification_configuration_layout.xml
+8
-41
home_transport_waybill_bean.dart
example/lib/home_transport_waybill_bean.dart
+50
-0
main.dart
example/lib/main.dart
+40
-0
没有找到文件。
android/src/main/java/in/jvapps/system_alert_window/services/WindowServiceNew.java
浏览文件 @
3dc45b7d
...
...
@@ -269,10 +269,9 @@ public class WindowServiceNew extends Service implements View.OnTouchListener {
if
(
lastLoadTime
!=
null
)
{
remoteViews
.
setTextViewText
(
R
.
id
.
tv_last_load_time
,
"最晚装货:"
+
lastLoadTime
);
}
notification
=
new
NotificationCompat
.
Builder
(
this
,
CHANNEL_ID
)
.
setContentTitle
(
"任务进行中"
)
.
setContentText
(
"当前有任务正在进行中"
)
notification
=
new
NotificationCompat
.
Builder
(
this
,
CHANNEL_ID
)
.
setSmallIcon
(
R
.
drawable
.
ic_notification_logo
)
.
setStyle
(
new
NotificationCompat
.
DecoratedCustomViewStyle
())
.
setCustomBigContentView
(
remoteViews
)
.
setContentIntent
(
pendingIntent
)
.
build
();
...
...
android/src/main/res/layout/notification_configuration_layout.xml
浏览文件 @
3dc45b7d
...
...
@@ -4,46 +4,13 @@
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<ImageView
android:layout_marginTop=
"8dp"
android:layout_width=
"28dp"
android:layout_height=
"28dp"
android:src=
"@drawable/ic_notification_logo"
/>
<LinearLayout
android:layout_marginTop=
"5dp"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"任务进行中"
android:textColor=
"#333C4C"
android:textFontWeight=
"500"
android:textSize=
"16sp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"4dp"
android:text=
""
android:textColor=
"#333C4C"
android:textSize=
"13sp"
/>
</LinearLayout>
</LinearLayout>
android:text=
"任务进行中"
android:textColor=
"#333C4C"
android:textFontWeight=
"500"
android:textSize=
"16sp"
/>
<LinearLayout
android:layout_width=
"match_parent"
...
...
@@ -147,9 +114,9 @@
<TextView
android:id=
"@+id/tv_last_load_time"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:layout_width=
"175dp"
android:layout_height=
"18dp"
android:text=
""
android:textColor=
"#ff344254"
android:textSize=
"13sp"
/>
...
...
example/lib/home_transport_waybill_bean.dart
0 → 100644
浏览文件 @
3dc45b7d
/// childNo : 100000000
/// receiveAddress : "西城"
/// sendAddress : "朝阳"
/// truckNo : "京A12345"
class
HomeTransportWaybillBean
{
HomeTransportWaybillBean
({
this
.
childNo
,
this
.
receiveAddress
,
this
.
sendAddress
,
this
.
truckNo
,
this
.
status
,
this
.
lastArriveSendTime
,
this
.
lastArriveReceiveTime
,
this
.
lastLoadTime
,
});
HomeTransportWaybillBean
.
fromJson
(
dynamic
json
)
{
childNo
=
json
?[
'childNo'
];
receiveAddress
=
json
?[
'receiveAddress'
];
sendAddress
=
json
?[
'sendAddress'
];
truckNo
=
json
?[
'truckNo'
];
status
=
json
?[
'status'
];
lastArriveSendTime
=
json
?[
'lastArriveSendTime'
];
lastArriveReceiveTime
=
json
?[
'lastArriveReceiveTime'
];
lastLoadTime
=
json
?[
'lastLoadTime'
];
}
String
?
childNo
;
String
?
receiveAddress
;
String
?
sendAddress
;
String
?
truckNo
;
int
?
status
;
String
?
lastArriveSendTime
;
String
?
lastArriveReceiveTime
;
String
?
lastLoadTime
;
Map
<
String
,
dynamic
>
toJson
()
{
final
map
=
<
String
,
dynamic
>{};
map
[
'childNo'
]
=
childNo
;
map
[
'receiveAddress'
]
=
receiveAddress
;
map
[
'sendAddress'
]
=
sendAddress
;
map
[
'truckNo'
]
=
truckNo
;
map
[
'status'
]
=
status
;
map
[
'lastArriveSendTime'
]
=
lastArriveSendTime
;
map
[
'lastArriveReceiveTime'
]
=
lastArriveReceiveTime
;
map
[
'lastLoadTime'
]
=
lastLoadTime
;
return
map
;
}
}
example/lib/main.dart
浏览文件 @
3dc45b7d
import
'dart:async'
;
import
'dart:convert'
;
import
'dart:developer'
;
import
'dart:isolate'
;
import
'dart:ui'
;
...
...
@@ -7,7 +8,9 @@ import 'package:flutter/material.dart';
import
'package:flutter/services.dart'
;
import
'package:share_plus/share_plus.dart'
;
import
'package:system_alert_window/system_alert_window.dart'
;
import
'custom_overlay.dart'
;
import
'home_transport_waybill_bean.dart'
;
void
main
(
)
{
WidgetsFlutterBinding
.
ensureInitialized
();
...
...
@@ -121,6 +124,33 @@ class _MyAppState extends State<MyApp> {
}
}
void
_showCustomOverlayWindow
()
{
if
(
_isShowingWindow
)
{
var
bean
=
HomeTransportWaybillBean
(
childNo:
"CYD2024040161416603"
,
sendAddress:
"韩集镇"
,
receiveAddress:
"天坛公园"
,
lastArriveSendTime:
"2024-04-06 01:01:11"
,
lastArriveReceiveTime:
"2024-04-06 02:02:22"
,
lastLoadTime:
"2024-04-06 03:03:33"
,
);
// 更新通知中进行中运单状态数据
String
?
jsonStr
=
json
.
encode
(
bean
);
print
(
'=====
$jsonStr
'
);
SystemAlertWindow
.
updateSystemWindow
(
height:
200
,
width:
MediaQuery
.
of
(
context
).
size
.
width
.
floor
(),
gravity:
SystemWindowGravity
.
CENTER
,
prefMode:
prefMode
,
notificationUpdateData:
jsonStr
,
isDisableClicks:
true
);
setState
(()
{
_isUpdatedWindow
=
true
;
SystemAlertWindow
.
sendMessageToOverlay
(
_isUpdatedWindow
);
});
}
}
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
...
...
@@ -146,6 +176,16 @@ class _MyAppState extends State<MyApp> {
padding:
const
EdgeInsets
.
symmetric
(
vertical:
8.0
),
),
),
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
8.0
),
child:
MaterialButton
(
onPressed:
_showCustomOverlayWindow
,
textColor:
Colors
.
white
,
child:
Text
(
"update Custom notification"
),
color:
Colors
.
deepOrange
,
padding:
const
EdgeInsets
.
symmetric
(
vertical:
8.0
),
),
),
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
8.0
),
child:
MaterialButton
(
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论