1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-11-29 13:30:36 +01: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
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
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();
}

View File

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

View File

@ -462,6 +462,7 @@
<string name="show_comments_summary">Ausschalten, um Kommentare auszublenden</string>
<string name="autoplay_title">Automatische Wiedergabe</string>
<string name="no_comments">Keine Kommentare</string>
<string name="comments_are_disabled">Kommentare sind deaktiviert</string>
<string name="error_unable_to_load_comments">Kommentare konnten nicht geladen werden</string>
<string name="close">Schließen</string>
<string name="enable_playback_resume_title">Wiedergabe fortsetzen</string>

View File

@ -336,6 +336,7 @@
<item quantity="other">%s videos</item>
</plurals>
<string name="no_comments">No comments</string>
<string name="comments_are_disabled">Comments are disabled</string>
<!-- Missions -->
<string name="start">Start</string>
<string name="pause">Pause</string>