diff --git a/app/build.gradle b/app/build.gradle index 721810e..847cee2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -23,7 +23,7 @@ apply plugin: 'io.fabric' def versionMajor = 0 def versionMinor = 1 def versionPatch = 0 -def versionBuild = 0 // bump for dog food builds, public betas, etc. +def versionBuild = 1 // bump for dog food builds, public betas, etc. android { kapt { diff --git a/app/src/main/java/com/thanksmister/iot/esp8266/api/Status.java b/app/src/main/java/com/thanksmister/iot/esp8266/api/Status.java index 8196186..66cd207 100644 --- a/app/src/main/java/com/thanksmister/iot/esp8266/api/Status.java +++ b/app/src/main/java/com/thanksmister/iot/esp8266/api/Status.java @@ -17,6 +17,7 @@ package com.thanksmister.iot.esp8266.api; public enum Status { + START, LOADING, SUCCESS, ERROR diff --git a/app/src/main/java/com/thanksmister/iot/esp8266/ui/TransmitFragment.kt b/app/src/main/java/com/thanksmister/iot/esp8266/ui/TransmitFragment.kt index 89cf127..c0c1dff 100644 --- a/app/src/main/java/com/thanksmister/iot/esp8266/ui/TransmitFragment.kt +++ b/app/src/main/java/com/thanksmister/iot/esp8266/ui/TransmitFragment.kt @@ -42,7 +42,7 @@ class TransmitFragment : BaseFragment() { @Inject lateinit var viewModelFactory: ViewModelProvider.Factory @Inject lateinit var viewModel: TransmitViewModel private var listener: OnFragmentInteractionListener? = null - private var networkStatus: Status? = null + private var networkStatus: Status = Status.START override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -113,17 +113,21 @@ class TransmitFragment : BaseFragment() { } private fun processNetworkResponse(response: NetworkResponse?) { - networkStatus = response?.status - when (networkStatus) { - Status.LOADING -> { - // - } - Status.SUCCESS -> { - // - } - Status.ERROR -> { - val message = response?.error?.message.toString() - Snackbar.make(activity!!.findViewById(android.R.id.content), message, Snackbar.LENGTH_LONG).show() + if(response?.status != null) { + networkStatus = response.status + when (networkStatus) { + Status.LOADING -> { + // + } + Status.SUCCESS -> { + // + } + Status.ERROR -> { + val message = response.error?.message.toString() + Snackbar.make(activity!!.findViewById(android.R.id.content), message, Snackbar.LENGTH_LONG).show() + } + else -> { + } } } } diff --git a/build.gradle b/build.gradle index 6ef55a5..12cb4dd 100644 --- a/build.gradle +++ b/build.gradle @@ -23,8 +23,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.1' - //classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4' + classpath 'com.android.tools.build:gradle:3.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'io.fabric.tools:gradle:1.+' // NOTE: Do not place your application dependencies here; they belong