Skip to content

Commit

Permalink
One textview is enough for disabled comments
Browse files Browse the repository at this point in the history
  • Loading branch information
litetex authored and spvkgn committed Aug 4, 2021
1 parent eef8568 commit a1e0527
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {

private boolean mIsVisibleToUser = false;

private TextView commentsDisabledView;
private TextView emptyStateDesc;

public static CommentsFragment getInstance(final int serviceId, final String url,
final String name) {
Expand All @@ -42,7 +42,7 @@ public static CommentsFragment getInstance(final int serviceId, final String ur
protected void initViews(final View rootView, final Bundle savedInstanceState) {
super.initViews(rootView, savedInstanceState);

commentsDisabledView = rootView.findViewById(R.id.comments_disabled);
emptyStateDesc = rootView.findViewById(R.id.empty_state_desc);
}

/*//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -102,8 +102,10 @@ public void showLoading() {
public void handleResult(@NonNull final CommentsInfo result) {
super.handleResult(result);

commentsDisabledView.setVisibility(
result.isCommentsDisabled() ? View.VISIBLE : View.GONE);
emptyStateDesc.setText(
result.isCommentsDisabled()
? R.string.comments_are_disabled
: R.string.no_comments);

AnimationUtils.slideUp(getView(), 120, 150, 0.06f);

Expand Down
12 changes: 1 addition & 11 deletions app/src/main/res/layout/fragment_comments.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
tools:ignore="HardcodedText,UnusedAttribute"/>

<TextView
android:id="@+id/empty_state_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
Expand All @@ -50,17 +51,6 @@

</LinearLayout>

<TextView
android:id="@+id/comments_disabled"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/empty_state_view"
android:layout_centerHorizontal="true"
android:text="@string/comments_are_disabled"
android:textSize="20sp"
android:visibility="gone"
tools:visibility="visible" />

<!--ERROR PANEL-->
<include
android:id="@+id/error_panel"
Expand Down

0 comments on commit a1e0527

Please sign in to comment.