Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
huangzhicong
/
SmartCanteen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f8a85f81
authored
Jul 15, 2019
by
patpat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加扫码声效
parent
99960d48
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
+7
-0
app/src/main/assets/beep.mp3
+0
-0
app/src/main/java/com/bgycc/smartcanteen/activity/MainActivity.kt
+7
-0
No files found.
app/src/main/assets/beep.mp3
0 → 100644
View file @
f8a85f81
File added
app/src/main/java/com/bgycc/smartcanteen/activity/MainActivity.kt
View file @
f8a85f81
package
com.bgycc.smartcanteen.activity
import
android.media.AudioManager
import
android.media.SoundPool
import
android.os.Bundle
import
android.widget.TextView
import
com.bgycc.smartcanteen.QRCodeEvent
...
...
@@ -29,6 +31,9 @@ class MainActivity : BaseActivity() {
lateinit
var
mSendTextView
:
TextView
lateinit
var
mRecvTextView
:
TextView
val
mSoundPool
:
SoundPool
=
SoundPool
(
1
,
AudioManager
.
STREAM_SYSTEM
,
0
)
var
mBeepSoundId
=
0
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
fullscreen
()
...
...
@@ -44,6 +49,7 @@ class MainActivity : BaseActivity() {
}
fun
init
()
{
mBeepSoundId
=
mSoundPool
.
load
(
getAssets
().
openFd
(
"beep.mp3"
),
1
)
// WifiHelpler.connect("BGY-802.1X", "dengquanye", "pat2019@", "wpa_eap")
MainWebSocket
.
initialize
()
QRCodeTask
.
getInstance
().
start
()
...
...
@@ -72,6 +78,7 @@ class MainActivity : BaseActivity() {
@Subscribe
(
threadMode
=
ThreadMode
.
MAIN
)
fun
onMessageEvent
(
event
:
QRCodeEvent
)
{
printQRCode
(
event
)
mSoundPool
.
play
(
mBeepSoundId
,
1f
,
1f
,
0
,
0
,
1f
)
}
@Subscribe
(
threadMode
=
ThreadMode
.
MAIN
)
...
...
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