Hide comments by default. Fixes #141

This commit is contained in:
Matthieu 2020-11-03 10:13:43 +01:00
parent ee06e0229c
commit 245c9c2e64
3 changed files with 18 additions and 10 deletions

View File

@ -259,11 +259,16 @@ data class Status(
//Setup post pic only if there are media attachments
if(!media_attachments.isNullOrEmpty()) {
setupPostPics(rootView, request, homeFragment)
} else {
rootView.postPicture.visibility = GONE
rootView.postPager.visibility = GONE
rootView.postTabs.visibility = GONE
}
//Set comment initial visibility
rootView.findViewById<LinearLayout>(R.id.commentIn).visibility = GONE
rootView.findViewById<LinearLayout>(R.id.commentContainer).visibility = GONE
}
fun setDescription(rootView: View, api: PixelfedAPI, credential: String) {

View File

@ -220,12 +220,15 @@ abstract class PostUtils {
if(response.code() == 200) {
val statuses = response.body()!!.descendants
holder.commentCont.removeAllViews()
//Create the new views for each comment
for (status in statuses) {
addComment(holder.context, holder.commentCont, status.account!!.username!!,
status.content!!
)
}
holder.commentCont.visibility = View.VISIBLE
} else {
Log.e("COMMENT ERROR", "${response.code()} with body ${response.errorBody()}")
}

View File

@ -221,6 +221,15 @@
app:layout_constraintTop_toBottomOf="@+id/description"
tools:text="Yesterday" />
<TextView
android:id="@+id/ViewComments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/commentIn"
tools:text="3 comments" />
<LinearLayout
android:id="@+id/commentIn"
android:layout_width="match_parent"
@ -257,16 +266,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:layout_editor_absoluteY="315dp"
app:layout_constraintTop_toBottomOf="@+id/commentIn">
<TextView
android:id="@+id/ViewComments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginBottom="10dp"
tools:text="3 comments"/>
app:layout_constraintTop_toBottomOf="@+id/ViewComments">
</LinearLayout>