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.MenuInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -24,6 +25,8 @@ 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;
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) {
final CommentsFragment instance = new CommentsFragment(); final CommentsFragment instance = new CommentsFragment();
@ -35,6 +38,13 @@ public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
super(UserAction.REQUESTED_COMMENTS); 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 // LifeCycle
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
@ -73,6 +83,10 @@ public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
@Override @Override
public void handleResult(@NonNull final CommentsInfo result) { public void handleResult(@NonNull final CommentsInfo result) {
super.handleResult(result); super.handleResult(result);
commentsDisabledView.setVisibility(
result.isCommentsDisabled() ? View.VISIBLE : View.GONE);
ViewUtils.slideUp(requireView(), 120, 150, 0.06f); ViewUtils.slideUp(requireView(), 120, 150, 0.06f);
disposables.clear(); disposables.clear();
} }

View File

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

View File

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

View File

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