Skip to content

Commit

Permalink
* Initial Status value should not be null
Browse files Browse the repository at this point in the history
thanksmister committed Aug 13, 2018
1 parent ea68314 commit f48fc6d
Showing 4 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
package com.thanksmister.iot.esp8266.api;

public enum Status {
START,
LOADING,
SUCCESS,
ERROR
Original file line number Diff line number Diff line change
@@ -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 -> {
}
}
}
}
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f48fc6d

Please sign in to comment.