One textview is enough for disabled comments
Ref: https://github.com/TeamNewPipe/NewPipe/pull/6483#discussion_r654793920
This commit is contained in:
parent
75a8edf20f
commit
36c198fc33
|
@ -25,7 +25,7 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
||||||
public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
|
public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
|
||||||
private final CompositeDisposable disposables = new CompositeDisposable();
|
private final CompositeDisposable disposables = new CompositeDisposable();
|
||||||
|
|
||||||
private TextView commentsDisabledView;
|
private TextView emptyStateDesc;
|
||||||
|
|
||||||
public static CommentsFragment getInstance(final int serviceId, final String url,
|
public static CommentsFragment getInstance(final int serviceId, final String url,
|
||||||
final String name) {
|
final String name) {
|
||||||
|
@ -42,7 +42,7 @@ public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
|
||||||
protected void initViews(final View rootView, final Bundle savedInstanceState) {
|
protected void initViews(final View rootView, final Bundle savedInstanceState) {
|
||||||
super.initViews(rootView, 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) {
|
public void handleResult(@NonNull final CommentsInfo result) {
|
||||||
super.handleResult(result);
|
super.handleResult(result);
|
||||||
|
|
||||||
commentsDisabledView.setVisibility(
|
emptyStateDesc.setText(
|
||||||
result.isCommentsDisabled() ? View.VISIBLE : View.GONE);
|
result.isCommentsDisabled()
|
||||||
|
? R.string.comments_are_disabled
|
||||||
|
: R.string.no_comments);
|
||||||
|
|
||||||
ViewUtils.slideUp(requireView(), 120, 150, 0.06f);
|
ViewUtils.slideUp(requireView(), 120, 150, 0.06f);
|
||||||
disposables.clear();
|
disposables.clear();
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
tools:ignore="HardcodedText,UnusedAttribute" />
|
tools:ignore="HardcodedText,UnusedAttribute" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/empty_state_desc"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
@ -49,17 +50,6 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</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-->
|
<!--ERROR PANEL-->
|
||||||
<include
|
<include
|
||||||
android:id="@+id/error_panel"
|
android:id="@+id/error_panel"
|
||||||
|
|
Loading…
Reference in New Issue