Move default case to layout xml

This commit is contained in:
Matthieu 2020-03-06 00:28:54 +01:00
parent 463e3fce32
commit 033c4843a2
2 changed files with 5 additions and 31 deletions

View File

@ -31,32 +31,7 @@ class ProfileActivity : AppCompatActivity() {
if (response.code() == 200) {
statuses = response.body() as ArrayList<Status>?
if(statuses.isNullOrEmpty()) {
// TextView : description / bio
val description = findViewById<TextView>(R.id.description)
description.setText("")
// TextView : account name
val accountName = findViewById<TextView>(R.id.accountName)
accountName.setText("No Name")
// TextView : number of posts
val nbPosts = findViewById<TextView>(R.id.nbPosts)
nbPosts.setText(0)
nbPosts.setTypeface(null, Typeface.BOLD)
// TextView : number of followers
val nbFollowers = findViewById<TextView>(R.id.nbFollowers)
nbFollowers.setText(0)
nbFollowers.setTypeface(null, Typeface.BOLD)
// TextView : number of following
val nbFollowing = findViewById<TextView>(R.id.nbFollowing)
nbFollowing.setText(0)
nbFollowing.setTypeface(null, Typeface.BOLD)
} else {
if(!statuses.isNullOrEmpty()) {
val account = statuses!![0].account

View File

@ -23,7 +23,7 @@
android:layout_height="26dp"
android:layout_marginTop="52dp"
android:layout_marginEnd="36dp"
android:text="TextView"
android:text="N/A"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -43,7 +43,7 @@
android:layout_height="27dp"
android:layout_marginStart="152dp"
android:layout_marginTop="52dp"
android:text="TextView"
android:text="N/A"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -72,7 +72,7 @@
android:layout_width="39dp"
android:layout_height="27dp"
android:layout_marginTop="52dp"
android:text="TextView"
android:text="N/A"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.669"
app:layout_constraintStart_toStartOf="parent"
@ -83,7 +83,7 @@
android:layout_width="156dp"
android:layout_height="22dp"
android:layout_marginTop="15dp"
android:text="Name"
android:text="No Username"
app:layout_constraintStart_toStartOf="@+id/profilePicture"
app:layout_constraintTop_toBottomOf="@+id/profilePicture" />
@ -92,7 +92,6 @@
android:layout_width="348dp"
android:layout_height="85dp"
android:layout_marginTop="14dp"
android:text="Description"
app:layout_constraintStart_toStartOf="@+id/accountName"
app:layout_constraintTop_toBottomOf="@+id/accountName" />