Commit 84c1ced5 authored by wanglei's avatar wanglei

...

parent 44b02ca7
...@@ -57,9 +57,7 @@ import kotlin.random.Random ...@@ -57,9 +57,7 @@ import kotlin.random.Random
object NotificationUiUtil { object NotificationUiUtil {
private val TAG = "NotificationUiUtil" private val TAG = "NotificationUiUtil"
private const val CHANNEL_ID = "browser_notification_id" // 通知渠道ID var NOTIFICATION_ID = Random.nextInt(1000, 1800)
private const val CHANNEL_NAME = "browser_fcm_channel" // 通知渠道名称
var NOTIFICATION_ID = 8999
private fun currentDate(): String { private fun currentDate(): String {
val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()) val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
...@@ -304,12 +302,13 @@ object NotificationUiUtil { ...@@ -304,12 +302,13 @@ object NotificationUiUtil {
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val channelId = context.resources.getString(R.string.app_name).replace(" ", "_") + "_channel_id"
val channelName = context.resources.getString(R.string.app_name).replace(" ", "_") + "_channel"
//创建channel //创建channel
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel( val channel = NotificationChannel(
CHANNEL_ID, channelId, channelName, NotificationManager.IMPORTANCE_HIGH
CHANNEL_NAME,
NotificationManager.IMPORTANCE_HIGH
) )
channel.lockscreenVisibility = NotificationCompat.VISIBILITY_PUBLIC channel.lockscreenVisibility = NotificationCompat.VISIBILITY_PUBLIC
notificationManager.createNotificationChannel(channel) notificationManager.createNotificationChannel(channel)
...@@ -317,7 +316,7 @@ object NotificationUiUtil { ...@@ -317,7 +316,7 @@ object NotificationUiUtil {
// Create the notification // Create the notification
val builder: NotificationCompat.Builder = NotificationCompat.Builder(context, CHANNEL_ID) val builder: NotificationCompat.Builder = NotificationCompat.Builder(context, channelId)
//设置状态栏内的小图标 //设置状态栏内的小图标
val smallIcon = IconCompat.createFromIcon( val smallIcon = IconCompat.createFromIcon(
......
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
android:src="@mipmap/wancheng" android:src="@mipmap/wancheng"
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@id/iv_more" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
...@@ -421,8 +421,8 @@ ...@@ -421,8 +421,8 @@
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:max="100" android:max="100"
tools:progress="50" android:progressDrawable="@drawable/progress_bar_pdf"
android:progressDrawable="@drawable/progress_bar_pdf" /> tools:progress="50" />
</LinearLayout> </LinearLayout>
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
tools:ignore="UseCompoundDrawables"> tools:ignore="UseCompoundDrawables">
<ImageView <ImageView
android:layout_width="23dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:src="@mipmap/doc_notification" android:src="@mipmap/doc_notification"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment