improve lifecycle
This commit is contained in:
parent
0dcef96194
commit
c1193f2166
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -29,7 +29,7 @@
|
|||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
@ -10,8 +10,8 @@ android {
|
|||||||
applicationId "adrienmalin.pingpoints"
|
applicationId "adrienmalin.pingpoints"
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 8
|
versionCode 9
|
||||||
versionName "2.1"
|
versionName "2.3"
|
||||||
vectorDrawables.useSupportLibrary true
|
vectorDrawables.useSupportLibrary true
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
@ -104,6 +104,17 @@ class SttDialog : DialogFragment() {
|
|||||||
putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true)
|
putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true)
|
||||||
putExtra(RecognizerIntent.EXTRA_PREFER_OFFLINE, true)
|
putExtra(RecognizerIntent.EXTRA_PREFER_OFFLINE, true)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.create()!!
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
|
||||||
|
matchActivity?.apply {
|
||||||
|
matchModel?.apply {
|
||||||
|
stt?.destroy()
|
||||||
stt = SpeechRecognizer.createSpeechRecognizer(activity).apply {
|
stt = SpeechRecognizer.createSpeechRecognizer(activity).apply {
|
||||||
setRecognitionListener(SttListener())
|
setRecognitionListener(SttListener())
|
||||||
try {
|
try {
|
||||||
@ -118,13 +129,12 @@ class SttDialog : DialogFragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.create()!!
|
|
||||||
|
|
||||||
override fun onStop() {
|
override fun onPause() {
|
||||||
unMuteAudio()
|
unMuteAudio()
|
||||||
stt?.stopListening()
|
stt?.stopListening()
|
||||||
stt?.destroy()
|
stt?.destroy()
|
||||||
super.onStop()
|
super.onPause()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
|
@ -28,7 +28,6 @@ class VictoryActivity : AppCompatActivity() {
|
|||||||
previousMatch = getPreferences(Context.MODE_PRIVATE)
|
previousMatch = getPreferences(Context.MODE_PRIVATE)
|
||||||
initVictoryModel()
|
initVictoryModel()
|
||||||
updateUI()
|
updateUI()
|
||||||
saveScore()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun initVictoryModel() {
|
fun initVictoryModel() {
|
||||||
@ -76,7 +75,7 @@ class VictoryActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun saveScore() {
|
override fun onStop() {
|
||||||
victoryModel?.apply {
|
victoryModel?.apply {
|
||||||
previousMatch?.edit()?.apply {
|
previousMatch?.edit()?.apply {
|
||||||
putString(
|
putString(
|
||||||
@ -92,6 +91,7 @@ class VictoryActivity : AppCompatActivity() {
|
|||||||
commit()
|
commit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
super.onStop()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun newMatch(view: View) {
|
fun newMatch(view: View) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user