Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
Scan QR Code Barcode Reader
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
Scan QR Code Barcode Reader
Commits
40c3bd0e
Commit
40c3bd0e
authored
Dec 30, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
11e5ed70
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
6 deletions
+69
-6
NotificationManager.kt
...a/com/base/scanqr/fcm/notification/NotificationManager.kt
+8
-0
NotificationUiUtil.kt
...va/com/base/scanqr/fcm/notification/NotificationUiUtil.kt
+58
-3
stay_notification_big_function.xml
app/src/main/res/layout/stay_notification_big_function.xml
+3
-3
No files found.
app/src/main/java/com/base/scanqr/fcm/notification/NotificationManager.kt
View file @
40c3bd0e
...
@@ -3,7 +3,11 @@ package com.base.scanqr.fcm.notification
...
@@ -3,7 +3,11 @@ package com.base.scanqr.fcm.notification
import
android.content.Context
import
android.content.Context
import
com.base.scanqr.BuildConfig
import
com.base.scanqr.BuildConfig
import
com.base.scanqr.bean.NotificationSendBean
import
com.base.scanqr.bean.NotificationSendBean
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_EMAIL
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_SCAN
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_SCAN
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_TEXT
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_WEBSITE
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_WIFI
import
com.base.scanqr.bean.NotificationSendBean.Companion.POPUP_WHERE_LOCK
import
com.base.scanqr.bean.NotificationSendBean.Companion.POPUP_WHERE_LOCK
import
com.base.scanqr.bean.config.PopupConfigBean.Companion.popupConfigBean
import
com.base.scanqr.bean.config.PopupConfigBean.Companion.popupConfigBean
import
com.base.scanqr.helper.EventUtils
import
com.base.scanqr.helper.EventUtils
...
@@ -31,6 +35,10 @@ object NotificationManager {
...
@@ -31,6 +35,10 @@ object NotificationManager {
private
val
looper_actionId
=
listOf
(
private
val
looper_actionId
=
listOf
(
ACTION_ID_SCAN
,
ACTION_ID_SCAN
,
ACTION_ID_WIFI
,
ACTION_ID_TEXT
,
ACTION_ID_EMAIL
,
ACTION_ID_WEBSITE
,
)
)
private
var
actionIdList
=
arrayListOf
<
String
>()
private
var
actionIdList
=
arrayListOf
<
String
>()
...
...
app/src/main/java/com/base/scanqr/fcm/notification/NotificationUiUtil.kt
View file @
40c3bd0e
...
@@ -13,7 +13,11 @@ import androidx.core.graphics.drawable.IconCompat
...
@@ -13,7 +13,11 @@ import androidx.core.graphics.drawable.IconCompat
import
com.base.scanqr.MyApplication
import
com.base.scanqr.MyApplication
import
com.base.scanqr.R
import
com.base.scanqr.R
import
com.base.scanqr.bean.NotificationSendBean
import
com.base.scanqr.bean.NotificationSendBean
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_EMAIL
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_SCAN
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_SCAN
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_TEXT
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_WEBSITE
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_WIFI
import
com.base.scanqr.ui.start.StartActivity
import
com.base.scanqr.ui.start.StartActivity
import
kotlin.random.Random
import
kotlin.random.Random
...
@@ -31,12 +35,63 @@ object NotificationUiUtil {
...
@@ -31,12 +35,63 @@ object NotificationUiUtil {
sendBean
.
bigRemoteViews
=
RemoteViews
(
MyApplication
.
appContext
.
packageName
,
R
.
layout
.
stay_notification_big_scan
)
sendBean
.
bigRemoteViews
=
RemoteViews
(
MyApplication
.
appContext
.
packageName
,
R
.
layout
.
stay_notification_big_scan
)
sendBean
.
smallRemoteViews
=
RemoteViews
(
MyApplication
.
appContext
.
packageName
,
R
.
layout
.
stay_notification_small_scan
)
sendBean
.
smallRemoteViews
=
RemoteViews
(
MyApplication
.
appContext
.
packageName
,
R
.
layout
.
stay_notification_small_scan
)
val
intent
=
Intent
(
sendBean
.
context
,
StartActivity
::
class
.
java
)
intent
.
putExtra
(
"actionId"
,
sendBean
.
actionId
)
}
sendBean
.
intent
=
intent
ACTION_ID_WIFI
->
{
val
bigRemoteViews
=
RemoteViews
(
MyApplication
.
appContext
.
packageName
,
R
.
layout
.
stay_notification_big_function
)
val
smallRemoteViews
=
RemoteViews
(
MyApplication
.
appContext
.
packageName
,
R
.
layout
.
stay_notification_small_function
)
bigRemoteViews
.
setImageViewResource
(
R
.
id
.
ivIcon
,
R
.
mipmap
.
h_wifi
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tvDesc
,
"Try to create your own wifi QR cord and share it!"
)
smallRemoteViews
.
setImageViewResource
(
R
.
id
.
ivIcon
,
R
.
mipmap
.
h_wifi
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tvTitle
,
"Create wifi QR"
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tvDesc
,
"Try to create your own wifi QR cord and share it!"
)
}
}
ACTION_ID_TEXT
->
{
val
bigRemoteViews
=
RemoteViews
(
MyApplication
.
appContext
.
packageName
,
R
.
layout
.
stay_notification_big_function
)
val
smallRemoteViews
=
RemoteViews
(
MyApplication
.
appContext
.
packageName
,
R
.
layout
.
stay_notification_small_function
)
bigRemoteViews
.
setImageViewResource
(
R
.
id
.
ivIcon
,
R
.
mipmap
.
h_text
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tvDesc
,
"Try to create your own text QR cord and share it!"
)
smallRemoteViews
.
setImageViewResource
(
R
.
id
.
ivIcon
,
R
.
mipmap
.
h_text
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tvTitle
,
"Create text QR"
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tvDesc
,
"Try to create your own text QR cord and share it!"
)
}
ACTION_ID_EMAIL
->
{
val
bigRemoteViews
=
RemoteViews
(
MyApplication
.
appContext
.
packageName
,
R
.
layout
.
stay_notification_big_function
)
val
smallRemoteViews
=
RemoteViews
(
MyApplication
.
appContext
.
packageName
,
R
.
layout
.
stay_notification_small_function
)
bigRemoteViews
.
setImageViewResource
(
R
.
id
.
ivIcon
,
R
.
mipmap
.
h_email
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tvDesc
,
"Try to create your own email QR cord and share it!"
)
smallRemoteViews
.
setImageViewResource
(
R
.
id
.
ivIcon
,
R
.
mipmap
.
h_email
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tvTitle
,
"Create email QR"
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tvDesc
,
"Try to create your own email QR cord and share it!"
)
}
ACTION_ID_WEBSITE
->
{
val
bigRemoteViews
=
RemoteViews
(
MyApplication
.
appContext
.
packageName
,
R
.
layout
.
stay_notification_big_function
)
val
smallRemoteViews
=
RemoteViews
(
MyApplication
.
appContext
.
packageName
,
R
.
layout
.
stay_notification_small_function
)
bigRemoteViews
.
setImageViewResource
(
R
.
id
.
ivIcon
,
R
.
mipmap
.
h_website
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tvDesc
,
"Try to create your own website QR cord and share it!"
)
smallRemoteViews
.
setImageViewResource
(
R
.
id
.
ivIcon
,
R
.
mipmap
.
h_email
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tvTitle
,
"Create website QR"
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tvDesc
,
"Try to create your own website QR cord and share it!"
)
}
}
}
val
intent
=
Intent
(
sendBean
.
context
,
StartActivity
::
class
.
java
)
intent
.
putExtra
(
"actionId"
,
sendBean
.
actionId
)
sendBean
.
intent
=
intent
sendCustomNotification
(
sendBean
)
sendCustomNotification
(
sendBean
)
}
}
...
...
app/src/main/res/layout/stay_notification_big_function.xml
View file @
40c3bd0e
...
@@ -12,11 +12,11 @@
...
@@ -12,11 +12,11 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:layout_marginTop=
"8dp"
android:src=
"@mipmap/h_wifi
"
tools:ignore=
"ContentDescription
"
tools:
ignore=
"ContentDescription
"
/>
tools:
src=
"@mipmap/h_wifi
"
/>
<TextView
<TextView
android:id=
"@+id/tv
_d
esc"
android:id=
"@+id/tv
D
esc"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:layout_marginTop=
"10dp"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment