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
9e2af6b9
authored
Jun 01, 2020
by
pye52
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop'
parents
e79b5e85
6b3ab98a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
6 deletions
+5
-6
app/src/main/java/com/bgycc/smartcanteen/RootApp.java
+2
-0
app/src/main/java/com/bgycc/smartcanteen/activity/MainActivity.java
+0
-1
app/src/main/java/com/bgycc/smartcanteen/utils/TTSHelper.java
+3
-5
No files found.
app/src/main/java/com/bgycc/smartcanteen/RootApp.java
View file @
9e2af6b9
...
@@ -6,6 +6,7 @@ import androidx.annotation.NonNull;
...
@@ -6,6 +6,7 @@ import androidx.annotation.NonNull;
import
androidx.work.Configuration
;
import
androidx.work.Configuration
;
import
com.bgycc.smartcanteen.executor.SCTaskExecutor
;
import
com.bgycc.smartcanteen.executor.SCTaskExecutor
;
import
com.bgycc.smartcanteen.utils.NetworkUtils
;
import
com.blankj.utilcode.util.CrashUtils
;
import
com.blankj.utilcode.util.CrashUtils
;
import
com.blankj.utilcode.util.LogUtils
;
import
com.blankj.utilcode.util.LogUtils
;
import
com.blankj.utilcode.util.PathUtils
;
import
com.blankj.utilcode.util.PathUtils
;
...
@@ -31,6 +32,7 @@ public class RootApp extends Application implements Configuration.Provider {
...
@@ -31,6 +32,7 @@ public class RootApp extends Application implements Configuration.Provider {
.
setBorderSwitch
(
false
)
.
setBorderSwitch
(
false
)
.
setFilePrefix
(
LOG_PREFIX
)
.
setFilePrefix
(
LOG_PREFIX
)
.
setSaveDays
(
LOG_SAVE_DAYS
);
.
setSaveDays
(
LOG_SAVE_DAYS
);
NetworkUtils
.
initialize
(
this
);
}
}
@NonNull
@NonNull
...
...
app/src/main/java/com/bgycc/smartcanteen/activity/MainActivity.java
View file @
9e2af6b9
...
@@ -97,7 +97,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
...
@@ -97,7 +97,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
deviceSN
=
SmartCanteenUtils
.
getDeviceSN
(
newBase
.
getApplicationContext
());
deviceSN
=
SmartCanteenUtils
.
getDeviceSN
(
newBase
.
getApplicationContext
());
audioManager
=
(
AudioManager
)
getSystemService
(
Context
.
AUDIO_SERVICE
);
audioManager
=
(
AudioManager
)
getSystemService
(
Context
.
AUDIO_SERVICE
);
TTSHelper
.
initialize
(
newBase
.
getApplicationContext
());
TTSHelper
.
initialize
(
newBase
.
getApplicationContext
());
NetworkUtils
.
initialize
(
newBase
.
getApplicationContext
());
if
(
deviceSN
.
isEmpty
())
{
if
(
deviceSN
.
isEmpty
())
{
LogUtils
.
file
(
TAG
,
"设备SN号为空"
);
LogUtils
.
file
(
TAG
,
"设备SN号为空"
);
...
...
app/src/main/java/com/bgycc/smartcanteen/utils/TTSHelper.java
View file @
9e2af6b9
...
@@ -19,10 +19,10 @@ import static com.bgycc.smartcanteen.utils.SmartCanteenUtils.TAG;
...
@@ -19,10 +19,10 @@ import static com.bgycc.smartcanteen.utils.SmartCanteenUtils.TAG;
public
class
TTSHelper
{
public
class
TTSHelper
{
private
static
boolean
mSupportTTS
=
false
;
private
static
boolean
mSupportTTS
=
false
;
private
static
TextToSpeech
mTTS
=
null
;
private
static
TextToSpeech
mTTS
=
null
;
private
static
final
SoundPool
mSoundPool
;
private
static
SoundPool
mSoundPool
;
private
static
final
HashMap
<
String
,
Integer
>
mSoundIdMap
=
new
HashMap
<>();
private
static
final
HashMap
<
String
,
Integer
>
mSoundIdMap
=
new
HashMap
<>();
static
{
public
static
void
initialize
(
Context
context
)
{
AudioAttributes
audioAttributes
=
new
AudioAttributes
.
Builder
()
AudioAttributes
audioAttributes
=
new
AudioAttributes
.
Builder
()
.
setUsage
(
AudioAttributes
.
USAGE_NOTIFICATION
)
.
setUsage
(
AudioAttributes
.
USAGE_NOTIFICATION
)
.
setContentType
(
AudioAttributes
.
CONTENT_TYPE_SPEECH
)
.
setContentType
(
AudioAttributes
.
CONTENT_TYPE_SPEECH
)
...
@@ -31,9 +31,6 @@ public class TTSHelper {
...
@@ -31,9 +31,6 @@ public class TTSHelper {
mSoundPool
=
new
SoundPool
.
Builder
()
mSoundPool
=
new
SoundPool
.
Builder
()
.
setAudioAttributes
(
audioAttributes
)
.
setAudioAttributes
(
audioAttributes
)
.
build
();
.
build
();
}
public
static
void
initialize
(
Context
context
)
{
mSoundPool
.
setOnLoadCompleteListener
((
soundPool
,
sampleId
,
status
)
->
{
mSoundPool
.
setOnLoadCompleteListener
((
soundPool
,
sampleId
,
status
)
->
{
if
(
status
==
0
)
{
if
(
status
==
0
)
{
soundPool
.
play
(
sampleId
,
1
f
,
1
f
,
100
,
0
,
1
f
);
soundPool
.
play
(
sampleId
,
1
f
,
1
f
,
100
,
0
,
1
f
);
...
@@ -45,6 +42,7 @@ public class TTSHelper {
...
@@ -45,6 +42,7 @@ public class TTSHelper {
mSupportTTS
=
result
>=
TextToSpeech
.
LANG_AVAILABLE
;
mSupportTTS
=
result
>=
TextToSpeech
.
LANG_AVAILABLE
;
}
}
});
});
mSoundIdMap
.
clear
();
}
}
public
static
void
speak
(
String
msg
)
{
public
static
void
speak
(
String
msg
)
{
...
...
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