diff --git a/app/build.gradle b/app/build.gradle
index e3b1124..9425dac 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -8,7 +8,7 @@ apply plugin: 'com.google.firebase.crashlytics'
def versionMajor = 1
def versionMinor = 1
def versionPatch = 1
-def versionBuild = 5 // bump for dog food builds, public betas, etc.
+def versionBuild = 6 // bump for dog food builds, public betas, etc.
def ALARM_CODE() {
Properties properties = new Properties()
diff --git a/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/network/AlarmPanelService.kt b/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/network/AlarmPanelService.kt
index 11776ea..c21323a 100644
--- a/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/network/AlarmPanelService.kt
+++ b/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/network/AlarmPanelService.kt
@@ -428,12 +428,7 @@ class AlarmPanelService : LifecycleService(), MQTTModule.MQTTListener {
STATE_ARM_NIGHT,
STATE_ARM_AWAY,
STATE_ARM_HOME,
- STATE_DISARM,
- COMMAND_ARM_CUSTOM_BYPASS,
- COMMAND_ARM_NIGHT,
- COMMAND_ARM_AWAY,
- COMMAND_DISARM,
- COMMAND_ARM_HOME -> {
+ STATE_DISARM -> {
insertMessage(id, topic, payload, TYPE_ALARM, delay)
}
STATE_TRIGGERED -> {
@@ -479,9 +474,7 @@ class AlarmPanelService : LifecycleService(), MQTTModule.MQTTListener {
* Publish command with default payload.
*/
private fun publishCommand(command: String, message: String) {
- mqttModule?.let {
- it.publishCommand(command, message)
- }
+ mqttModule?.publishCommand(command, message)
}
/**
@@ -701,16 +694,15 @@ class AlarmPanelService : LifecycleService(), MQTTModule.MQTTListener {
sendAlertMessage(getString(R.string.error_arm_failed))
insertMessage(id, topic, event, TYPE_EVENT)
}
+ // TODO hack for events from alarmo with no delay values, they should be ignored and only use alarm state
STATE_ARM_HOME,
STATE_ARM_AWAY,
STATE_ARM_NIGHT,
- STATE_ARM_CUSTOM_BYPASS,
- COMMAND_ARM_HOME,
- COMMAND_ARM_AWAY,
- COMMAND_ARM_NIGHT,
- COMMAND_ARM_CUSTOM_BYPASS -> {
+ STATE_ARM_CUSTOM_BYPASS -> {
val delay = MqttUtils.parseDelayFromJson(payload)
- insertMessage(id, topic, event, TYPE_ALARM, delay)
+ if(delay > 0) {
+ insertMessage(id, topic, event, TYPE_ALARM, delay)
+ }
}
// TODO this is a hack for alarmo because does not append delay time to pending
EVENT_TRIGGER -> {
diff --git a/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/persistence/Configuration.kt b/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/persistence/Configuration.kt
index 5597385..61a2133 100644
--- a/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/persistence/Configuration.kt
+++ b/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/persistence/Configuration.kt
@@ -89,11 +89,7 @@ constructor(private val context: Context, private val sharedPreferences: SharedP
return (alarmMode == MqttUtils.STATE_ARM_HOME
|| alarmMode == MqttUtils.STATE_ARM_CUSTOM_BYPASS
|| alarmMode == MqttUtils.STATE_ARM_NIGHT
- || alarmMode == MqttUtils.STATE_ARM_AWAY
- || alarmMode == MqttUtils.COMMAND_ARM_HOME
- || alarmMode == MqttUtils.COMMAND_ARM_CUSTOM_BYPASS
- || alarmMode == MqttUtils.COMMAND_ARM_NIGHT
- || alarmMode == MqttUtils.COMMAND_ARM_AWAY)
+ || alarmMode == MqttUtils.STATE_ARM_AWAY)
}
fun isAlarmDisarmedMode(): Boolean {
@@ -160,7 +156,7 @@ constructor(private val context: Context, private val sharedPreferences: SharedP
get() = sharedPreferences.getBoolean(PREF_HARDWARE_ACCELERATION, false)
set(value) = sharedPreferences.edit().putBoolean(PREF_HARDWARE_ACCELERATION, value).apply()
- var platformBar: Boolean
+ var dashboardBar: Boolean
get() = this.sharedPreferences.getBoolean(PREF_PLATFORM_BAR, true)
set(value) = this.sharedPreferences.edit().putBoolean(PREF_PLATFORM_BAR, value).apply()
diff --git a/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/activities/MainActivity.kt b/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/activities/MainActivity.kt
index 76743ee..d013bdd 100644
--- a/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/activities/MainActivity.kt
+++ b/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/activities/MainActivity.kt
@@ -42,7 +42,6 @@ import com.thanksmister.iot.mqtt.alarmpanel.constants.CodeTypes
import com.thanksmister.iot.mqtt.alarmpanel.network.AlarmPanelService
import com.thanksmister.iot.mqtt.alarmpanel.network.AlarmPanelService.Companion.BROADCAST_EVENT_PUBLISH_PANIC
import com.thanksmister.iot.mqtt.alarmpanel.network.AlarmPanelService.Companion.BROADCAST_SNACK_MESSAGE
-import com.thanksmister.iot.mqtt.alarmpanel.network.MQTTOptions
import com.thanksmister.iot.mqtt.alarmpanel.persistence.Weather
import com.thanksmister.iot.mqtt.alarmpanel.ui.adapters.MainSlidePagerAdapter
import com.thanksmister.iot.mqtt.alarmpanel.ui.fragments.*
@@ -764,7 +763,7 @@ class MainActivity : BaseActivity(),
dots[i].setImageDrawable(drawable)
}
if(idx == 0) {
- //settingsContainer.visibility = View.VISIBLE
+ settingsContainer.visibility = View.VISIBLE
buttonSettings.visibility = View.VISIBLE
if (configuration.hasScreenSaver()) {
buttonSleep.visibility = View.VISIBLE
@@ -779,10 +778,10 @@ class MainActivity : BaseActivity(),
buttonRefresh.visibility = View.GONE
platformButton.visibility = View.GONE
} else {
- if(configuration.platformBar.not()) {
- // settingsContainer.visibility = View.GONE
+ if(configuration.dashboardBar.not()) {
+ settingsContainer.visibility = View.GONE
} else {
- //settingsContainer.visibility = View.VISIBLE
+ settingsContainer.visibility = View.VISIBLE
buttonSleep.visibility = View.GONE
alertButton.visibility = View.GONE
buttonRefresh.visibility = View.VISIBLE
diff --git a/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/activities/SettingsActivity.kt b/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/activities/SettingsActivity.kt
index 936c391..d9b6dc7 100644
--- a/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/activities/SettingsActivity.kt
+++ b/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/activities/SettingsActivity.kt
@@ -120,7 +120,7 @@ class SettingsActivity : DaggerAppCompatActivity(){
override fun onResume() {
super.onResume()
- inactivityHandler.postDelayed(inactivityCallback, 60000)
+ inactivityHandler.postDelayed(inactivityCallback, 180000)
}
override fun onDestroy() {
@@ -131,7 +131,7 @@ class SettingsActivity : DaggerAppCompatActivity(){
override fun onUserInteraction() {
inactivityHandler.removeCallbacks(inactivityCallback)
- inactivityHandler.postDelayed(inactivityCallback, 60000)
+ inactivityHandler.postDelayed(inactivityCallback, 180000)
}
private fun logs() {
diff --git a/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/fragments/ControlsFragment.kt b/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/fragments/ControlsFragment.kt
index dd26134..736d928 100644
--- a/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/fragments/ControlsFragment.kt
+++ b/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/fragments/ControlsFragment.kt
@@ -232,7 +232,7 @@ class ControlsFragment : BaseFragment() {
setArmedMode(payload, delay)
}
STATE_ARMING -> {
- if (configuration.isAlarmArming().not()) {
+ if (configuration.isAlarmArming().not() && configuration.isAlarmArmedMode().not()) {
setArmingMode(payload, delay)
}
}
@@ -240,13 +240,8 @@ class ControlsFragment : BaseFragment() {
STATE_ARM_NIGHT,
STATE_ARM_HOME,
STATE_DISARM,
- STATE_ARM_AWAY,
- COMMAND_ARM_CUSTOM_BYPASS,
- COMMAND_ARM_HOME,
- COMMAND_ARM_NIGHT,
- COMMAND_ARM_AWAY,
- COMMAND_DISARM -> {
- if (configuration.isAlarmArmedMode().not()) {
+ STATE_ARM_AWAY -> {
+ if (configuration.isAlarmArmedMode().not() && configuration.isAlarmArming().not()) {
setArmingMode(payload, delay)
}
}
diff --git a/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/fragments/PlatformSettingsFragment.kt b/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/fragments/PlatformSettingsFragment.kt
index e701cad..f88dc02 100644
--- a/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/fragments/PlatformSettingsFragment.kt
+++ b/app/src/main/java/com/thanksmister/iot/mqtt/alarmpanel/ui/fragments/PlatformSettingsFragment.kt
@@ -20,14 +20,11 @@ import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.os.Bundle
-import android.text.TextUtils
import android.view.View
import androidx.preference.*
import com.thanksmister.iot.mqtt.alarmpanel.R
import com.thanksmister.iot.mqtt.alarmpanel.persistence.Configuration
import com.thanksmister.iot.mqtt.alarmpanel.ui.activities.DashboardsActivity
-import com.thanksmister.iot.mqtt.alarmpanel.ui.activities.LiveCameraActivity
-import com.thanksmister.iot.mqtt.alarmpanel.ui.activities.SensorsActivity
import com.thanksmister.iot.mqtt.alarmpanel.ui.activities.SettingsActivity
import dagger.android.support.AndroidSupportInjection
import javax.inject.Inject
@@ -37,12 +34,14 @@ class PlatformSettingsFragment : PreferenceFragmentCompat(), SharedPreferences.O
@Inject lateinit var configuration: Configuration
private var browserHeaderPreference: EditTextPreference? = null
- private var platformBarPreference: CheckBoxPreference? = null
-
private val manageDashboardsPreference: Preference by lazy {
findPreference("button_dashboards") as Preference
}
+ private val platformBarPreference: SwitchPreference by lazy {
+ findPreference("pref_platform_bar") as SwitchPreference
+ }
+
override fun onAttach(context: Context) {
AndroidSupportInjection.inject(this)
super.onAttach(context)
@@ -78,9 +77,9 @@ class PlatformSettingsFragment : PreferenceFragmentCompat(), SharedPreferences.O
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- platformBarPreference = findPreference("pref_platform_bar") as CheckBoxPreference
+
browserHeaderPreference = findPreference(getString(R.string.key_setting_browser_user_agent)) as EditTextPreference
- platformBarPreference?.isChecked = configuration.platformBar
+ platformBarPreference.isChecked = configuration.dashboardBar
manageDashboardsPreference.onPreferenceClickListener = Preference.OnPreferenceClickListener {
startDashboardsActivity(it.context)
@@ -95,8 +94,7 @@ class PlatformSettingsFragment : PreferenceFragmentCompat(), SharedPreferences.O
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
when (key) {
"pref_platform_bar" -> {
- val checked = platformBarPreference!!.isChecked
- configuration.platformBar = checked
+ configuration.dashboardBar = platformBarPreference.isChecked
}
getString(R.string.key_setting_browser_user_agent) -> {
val value = browserHeaderPreference!!.text
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 2d3daee..8affc8d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -267,7 +267,7 @@
Screen timed out…
Hide
Show Bottom Bar
- When checked, displays a bottom navigation buttons on the platform screen.
+ When checked, displays a bottom navigation buttons on the dashboard screen.
Telegram
Enter your Telegram bot chat id.
Enter your Telegram bot API token.
diff --git a/app/src/main/res/xml/preferences_platform.xml b/app/src/main/res/xml/preferences_platform.xml
index 8cb9400..47cf6f2 100644
--- a/app/src/main/res/xml/preferences_platform.xml
+++ b/app/src/main/res/xml/preferences_platform.xml
@@ -33,7 +33,7 @@
android:summary="Add, edit, and remove dashboards."
android:title="Manage Dashboards" />
-
+
+
@@ -104,11 +110,6 @@
android:summary="When active, uses unsplash.it to get random wallpapers"
android:key="pref_screensaver_wallpaper" />
-