Skip to content

Commit bf8cac6

Browse files
committed
* Fix for crash when switching views while TTS is initializing (some devices)
* Fix for crash when switching views while MQTT is initializing (some devices) * Updated Kotlin version
1 parent f5d1b0f commit bf8cac6

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ repositories {
4040
def versionMajor = 0
4141
def versionMinor = 6
4242
def versionPatch = 8
43-
def versionBuild = 1 // bump for dog food builds, public betas, etc.
43+
def versionBuild = 2 // bump for dog food builds, public betas, etc.
4444

4545
def ALARM_CODE() {
4646
Properties properties = new Properties()
@@ -279,5 +279,5 @@ dependencies {
279279
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
280280
transitive = true;
281281
}
282-
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
282+
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
283283
}

app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/network/MQTTService.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ class MQTTService(private var context: Context, options: MQTTOptions,
159159
}
160160

161161
mqttClient = MqttUtils.getMqttAndroidClient(context, mqttOptions?.brokerUrl!!, mqttOptions?.getClientId()!!, object : MqttCallbackExtended {
162+
@Throws(NullPointerException::class)
162163
override fun connectComplete(reconnect: Boolean, serverURI: String) {
163164
if (reconnect) {
164165
Timber.d("Reconnected to : " + serverURI)
@@ -218,7 +219,8 @@ class MQTTService(private var context: Context, options: MQTTOptions,
218219
mReady.set(true)
219220
} catch (e: IllegalArgumentException) {
220221
e.printStackTrace()
221-
Timber.e(e, "Error disconnecting MQTT service")
222+
} catch (e: NullPointerException) {
223+
e.printStackTrace()
222224
} catch (e: Exception) {
223225
e.printStackTrace()
224226
if (listener != null) {

app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/modules/TextToSpeechModule.kt

+4-5
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ class TextToSpeechModule( base: Context?, private val configuration: Configurati
6161
}
6262
}
6363

64+
// FIXME null pointer line 67 for textToSpeech
6465
override fun onInit(status: Int) {
65-
if (status == TextToSpeech.SUCCESS) {
66-
val sdkVersion = Build.VERSION.SDK_INT
67-
textToSpeech!!.language = Locale.getDefault()
68-
textToSpeech!!.setOnUtteranceProgressListener(object : UtteranceProgressListener() {
66+
if (status == TextToSpeech.SUCCESS && textToSpeech != null) {
67+
textToSpeech?.language = Locale.getDefault()
68+
textToSpeech?.setOnUtteranceProgressListener(object : UtteranceProgressListener() {
6969
override fun onError(p0: String?) {
7070
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
7171
}
@@ -103,7 +103,6 @@ class TextToSpeechModule( base: Context?, private val configuration: Configurati
103103
if(textToSpeech != null) {
104104
textToSpeech?.stop()
105105
textToSpeech?.shutdown()
106-
textToSpeech = null
107106
}
108107
}
109108
}

app/src/main/res/values-es/strings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110

111111
<string name="preference_tts_topic">TTS Topic</string>
112112
<string name="preference_tts_topic_title">Esteblece el "Topic Value"</string>
113-
<string name="preference_tts_topic_summary">Formato de ejemplo para el "message topic" y "alarmState" que será reproducido (ten en cuenta que para reproducir locuciones TTS, se necesitan unos altavoces externos): \n\n"{'topic':'home/notification', 'alarmState':'Hello!'}"</string>
113+
<string name="preference_tts_topic_summary">Formato de ejemplo para el "message topic" y "alarmState" que será reproducido (ten en cuenta que para reproducir locuciones TTS, se necesitan unos altavoces externos): \n\n"{\"topic\":\"home/notification\", \"payload\":\"Hello!\"}"</string>
114114

115115

116116
<string name="preference_camera">Capturas con la cámara</string>

app/src/main/res/values/strings.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<string name="preference_title_web">Home Automation Page</string>
8686
<string name="preference_summary_web">Displays your home automation web page by swiping main screen.</string>
8787
<string name="preference_title_web_url">Platform Address</string>
88-
<string name="preference_summary_web_url">Enter the IP address of your home automation web page with prefix and port if needed (example: http://ipaddress:8123).</string>
88+
<string name="preference_summary_web_url">Enter the IP address of your home automation web page with prefix and port if needed (example: http://ipaddress:port).</string>
8989
<string name="preference_web_description">This is an experimental feature. The web page is rendered with Android\'s version of the Chrome Browser and may render differently depending on your Android SDK and WebView versions.</string>
9090

9191
<string name="preference_title_notification">Notifications</string>
@@ -110,7 +110,7 @@
110110

111111
<string name="preference_tts_topic">TTS Topic</string>
112112
<string name="preference_tts_topic_title">Set Topic Value</string>
113-
<string name="preference_tts_topic_summary">Example format for the message topic and alarmState to be spoken (note that externally powered speakers are required for TTS): \n\n"{'topic':'home/notification', 'alarmState':'Hello!'}"</string>
113+
<string name="preference_tts_topic_summary">Example format for the message topic and alarmState to be spoken (note that externally powered speakers are required for TTS): \n\n"{\"topic\":\"home/notification\", \"payload\":\"Hello!\"}"</string>
114114

115115

116116
<string name="preference_camera">Camera Capture</string>

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.2.0'
4+
ext.kotlin_version = '1.2.20'
55
repositories {
66
jcenter()
77
maven {

0 commit comments

Comments
 (0)