1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-25 12:32:31 +01:00

One textview is enough for disabled comments

Ref: https://github.com/TeamNewPipe/NewPipe/pull/6483#discussion_r654793920
This commit is contained in:
litetex 2021-06-19 15:03:20 +02:00 committed by Stypox
parent 75a8edf20f
commit 36c198fc33
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
2 changed files with 7 additions and 15 deletions

View File

@ -25,7 +25,7 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable;
public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
private final CompositeDisposable disposables = new CompositeDisposable();
private TextView commentsDisabledView;
private TextView emptyStateDesc;
public static CommentsFragment getInstance(final int serviceId, final String url,
final String name) {
@ -42,7 +42,7 @@ public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
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);
}
/*//////////////////////////////////////////////////////////////////////////
@ -84,8 +84,10 @@ public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
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);
ViewUtils.slideUp(requireView(), 120, 150, 0.06f);
disposables.clear();

View File

@ -41,6 +41,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"
@ -49,17 +50,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"