Solved bug when the account dont have avatar

This commit is contained in:
ivan agosto 2018-10-10 10:13:35 -05:00
parent 72d1922d97
commit cd21704a49
3 changed files with 17 additions and 11 deletions

View File

@ -1,7 +1,8 @@
package org.libre.agosto.p2play.ajax
import android.support.design.widget.Snackbar
// import android.support.design.widget.Snackbar
import android.util.JsonReader
import android.util.JsonToken
import android.util.Log
import org.libre.agosto.p2play.ManagerSingleton
import org.libre.agosto.p2play.models.TokenModel
@ -133,16 +134,21 @@ class Auth: Client() {
when(l.toString()){
"followersCount" -> user.followers = data.nextInt()
"avatar" -> {
if(data.peek() == JsonToken.BEGIN_OBJECT) {
data.beginObject()
while (data.hasNext()){
while (data.hasNext()) {
val m = data.nextName()
when (m.toString()){
when (m.toString()) {
"path" -> user.avatar = data.nextString()
else -> data.skipValue()
}
}
data.endObject()
}
else{
data.skipValue()
}
}
else -> data.skipValue()
}
}

View File

@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.android.tools.build:gradle:3.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong

View File

@ -1,6 +1,6 @@
#Wed Jul 11 18:31:20 CDT 2018
#Sun Sep 30 14:50:40 CDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip