WIP
This commit is contained in:
parent
ca17fe1e22
commit
bde81ee4e7
@ -12,6 +12,6 @@ data class UserProfileDto(
|
||||
val followingThisUser: Boolean,
|
||||
val thisUserIsFollowingMe: Boolean,
|
||||
val profileImageId: String?,
|
||||
val descriptionText: String,
|
||||
val descriptionText: String?,
|
||||
val descriptionAudioId: String?
|
||||
)
|
||||
|
||||
@ -78,12 +78,18 @@ class ProfileMainFragment : Fragment() {
|
||||
title = profile.name
|
||||
viewBinding.textViewUsername.text = profile.name
|
||||
viewBinding.textViewDescription.text = profile.descriptionText
|
||||
if(profile.descriptionText.isNullOrBlank()) {
|
||||
viewBinding.descriptionCard.visibility = View.GONE
|
||||
}
|
||||
|
||||
viewBinding.goToFollowersBtn.text = getString(
|
||||
R.string.go_to_followers_btn_text,
|
||||
profile.numberOfFollowers.toString(),
|
||||
profile.numberOfFollowing.toString()
|
||||
)
|
||||
|
||||
|
||||
setupUiForUserType(profile.isUserItself)
|
||||
}
|
||||
|
||||
private val postsObserver: Observer<Pair<List<Post>?, UpdateEvent>?> = Observer {
|
||||
@ -237,6 +243,14 @@ class ProfileMainFragment : Fragment() {
|
||||
|
||||
}
|
||||
|
||||
private fun setupUiForUserType(isOwnProfile: Boolean) {
|
||||
if(isOwnProfile) {
|
||||
viewBinding.followButton.visibility = View.GONE
|
||||
} else {
|
||||
viewBinding.newPost.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
|
||||
@ -57,17 +57,27 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/text_view_following_state"
|
||||
tools:text="Erik Cavazos" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_view_description"
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/description_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:maxLines="4"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
style="?attr/materialCardViewFilledStyle"
|
||||
app:layout_constraintTop_toBottomOf="@id/text_view_username"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:text="Hi there, I am software developer!" />
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
<TextView
|
||||
android:id="@+id/text_view_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:maxLines="4"
|
||||
android:textAlignment="center"
|
||||
|
||||
tools:text="Hi there, I am software developer!" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/go_to_followers_btn"
|
||||
@ -76,7 +86,7 @@
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
app:layout_constraintTop_toBottomOf="@id/text_view_description"/>
|
||||
app:layout_constraintTop_toBottomOf="@id/description_card"/>
|
||||
|
||||
|
||||
|
||||
@ -136,8 +146,9 @@
|
||||
style="@style/Widget.Material3.BottomAppBar" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/new_post"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_anchor="@id/bottomAppBar"
|
||||
app:icon="@drawable/baseline_add_24" />
|
||||
app:icon="@drawable/baseline_add_24"
|
||||
app:layout_anchor="@id/bottomAppBar" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
Loading…
x
Reference in New Issue
Block a user