Move into setContent function
This commit is contained in:
parent
aeaa8ed168
commit
6d45cde9f7
|
@ -8,6 +8,7 @@ import android.widget.ImageView
|
|||
import android.widget.TextView
|
||||
import com.bumptech.glide.Glide
|
||||
import com.h.pixeldroid.api.PixelfedAPI
|
||||
import com.h.pixeldroid.objects.Account
|
||||
import com.h.pixeldroid.objects.Status
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
|
@ -35,17 +36,31 @@ class ProfileActivity : AppCompatActivity() {
|
|||
|
||||
val account = statuses!![0].account
|
||||
|
||||
setContent(account)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<List<Status>>, t: Throwable) {
|
||||
Log.e("Ouch, not OK", t.toString())
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
private fun setContent(account: Account) {
|
||||
// ImageView : profile picture
|
||||
val profilePicture = findViewById<ImageView>(R.id.profilePicture)
|
||||
Glide.with(applicationContext).load(account.avatar).into(profilePicture)
|
||||
|
||||
// TextView : description / bio
|
||||
val description = findViewById<TextView>(R.id.description)
|
||||
description.setText(account.note)
|
||||
description.text = account.note
|
||||
|
||||
// TextView : account name
|
||||
val accountName = findViewById<TextView>(R.id.accountName)
|
||||
accountName.setText(account.username)
|
||||
accountName.text = account.username
|
||||
|
||||
// TextView : number of posts
|
||||
val nbPosts = findViewById<TextView>(R.id.nbPosts)
|
||||
|
@ -63,12 +78,3 @@ class ProfileActivity : AppCompatActivity() {
|
|||
nbFollowing.setTypeface(null, Typeface.BOLD)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<List<Status>>, t: Throwable) {
|
||||
Log.e("Ouch, not OK", t.toString())
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue