Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
TopPay
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qyw
TopPay
Commits
8225a90f
Commit
8225a90f
authored
Dec 21, 2018
by
qyw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 饭堂支付
parent
77725a94
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
3 deletions
+22
-3
SoundPlayUtils.java
TOP_Pay/app/src/main/java/com/ifavine/pay/utils/SoundPlayUtils.java
+22
-3
fail.mp3
TOP_Pay/app/src/main/res/raw/fail.mp3
+0
-0
fail.wav
TOP_Pay/app/src/main/res/raw/fail.wav
+0
-0
s513.mp3
TOP_Pay/app/src/main/res/raw/s513.mp3
+0
-0
No files found.
TOP_Pay/app/src/main/java/com/ifavine/pay/utils/SoundPlayUtils.java
View file @
8225a90f
...
...
@@ -14,11 +14,11 @@ import java.util.HashMap;
public
class
SoundPlayUtils
{
// SoundPool对象
public
static
SoundPool
mSoundPlayer
=
new
SoundPool
(
20
,
AudioManager
.
STREAM_MUSIC
,
5
);
public
static
SoundPool
mSoundPlayer
;
public
static
SoundPlayUtils
soundPlayUtils
;
// 上下文
static
Context
mContext
;
static
boolean
isOnLoadComplete
=
false
;
private
static
HashMap
<
Integer
,
Integer
>
data
=
new
HashMap
<
Integer
,
Integer
>();
/**
...
...
@@ -33,9 +33,12 @@ public class SoundPlayUtils {
}
// 初始化声音
mContext
=
context
;
mSoundPlayer
=
new
SoundPool
(
20
,
AudioManager
.
STREAM_MUSIC
,
5
);
/**
* 参数1:加载音乐流第多少个 (只用了俩个音乐) 2:设置音乐的质量 音乐流 3:资源的质量 0
*/
isOnLoadComplete
=
false
;
data
.
put
(
200
,
mSoundPlayer
.
load
(
mContext
,
R
.
raw
.
success
,
1
));
data
.
put
(
1
,
mSoundPlayer
.
load
(
mContext
,
R
.
raw
.
fail
,
1
));
data
.
put
(
500
,
mSoundPlayer
.
load
(
mContext
,
R
.
raw
.
s500
,
1
));
...
...
@@ -54,6 +57,12 @@ public class SoundPlayUtils {
data
.
put
(
513
,
mSoundPlayer
.
load
(
mContext
,
R
.
raw
.
s513
,
1
));
data
.
put
(
514
,
mSoundPlayer
.
load
(
mContext
,
R
.
raw
.
s514
,
1
));
data
.
put
(
515
,
mSoundPlayer
.
load
(
mContext
,
R
.
raw
.
s515
,
1
));
mSoundPlayer
.
setOnLoadCompleteListener
(
new
SoundPool
.
OnLoadCompleteListener
()
{
@Override
public
void
onLoadComplete
(
SoundPool
soundPool
,
int
i
,
int
i1
)
{
isOnLoadComplete
=
true
;
}
});
return
soundPlayUtils
;
}
...
...
@@ -63,6 +72,12 @@ public class SoundPlayUtils {
* @param soundID 设置声音
*/
public
static
void
play
(
int
soundID
)
{
if
(!
isOnLoadComplete
)
{
return
;
}
if
(
mSoundPlayer
==
null
)
{
return
;
}
if
(
data
.
containsKey
(
soundID
))
{
mSoundPlayer
.
play
(
data
.
get
(
soundID
),
1
,
1
,
0
,
0
,
1
);
}
else
{
...
...
@@ -71,7 +86,11 @@ public class SoundPlayUtils {
}
public
static
void
release
()
{
mSoundPlayer
.
release
();
if
(
mSoundPlayer
!=
null
)
{
mSoundPlayer
.
release
();
}
soundPlayUtils
=
null
;
}
}
TOP_Pay/app/src/main/res/raw/fail.mp3
0 → 100644
View file @
8225a90f
File added
TOP_Pay/app/src/main/res/raw/fail.wav
deleted
100644 → 0
View file @
77725a94
File deleted
TOP_Pay/app/src/main/res/raw/s513.mp3
View file @
8225a90f
No preview for this file type
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