Commit f8a85f81 by patpat

增加扫码声效

parent 99960d48
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)
......
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 sign in to comment