1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-11-26 03:54:50 +00:00

Added comments disabled functionallity

This commit is contained in:
litetex
2021-06-13 21:35:34 +02:00
committed by Stypox
parent a932bc2503
commit 81107df53f
4 changed files with 27 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -24,6 +25,8 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable;
public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
private final CompositeDisposable disposables = new CompositeDisposable();
private TextView commentsDisabledView;
public static CommentsFragment getInstance(final int serviceId, final String url,
final String name) {
final CommentsFragment instance = new CommentsFragment();
@@ -35,6 +38,13 @@ public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
super(UserAction.REQUESTED_COMMENTS);
}
@Override
protected void initViews(final View rootView, final Bundle savedInstanceState) {
super.initViews(rootView, savedInstanceState);
commentsDisabledView = rootView.findViewById(R.id.comments_disabled);
}
/*//////////////////////////////////////////////////////////////////////////
// LifeCycle
//////////////////////////////////////////////////////////////////////////*/
@@ -73,6 +83,10 @@ public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
@Override
public void handleResult(@NonNull final CommentsInfo result) {
super.handleResult(result);
commentsDisabledView.setVisibility(
result.isCommentsDisabled() ? View.VISIBLE : View.GONE);
ViewUtils.slideUp(requireView(), 120, 150, 0.06f);
disposables.clear();
}