mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	Merge pull request #6483 from litetex/addDisabledComments
Added comments disabled functionallity
This commit is contained in:
		| @@ -186,7 +186,7 @@ dependencies { | |||||||
|     // name and the commit hash with the commit hash of the (pushed) commit you want to test |     // name and the commit hash with the commit hash of the (pushed) commit you want to test | ||||||
|     // This works thanks to JitPack: https://jitpack.io/ |     // This works thanks to JitPack: https://jitpack.io/ | ||||||
|     implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751' |     implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751' | ||||||
|     implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.21.6' |     implementation 'com.github.TeamNewPipe:NewPipeExtractor:c38a06e8dcd9c206a52b622704b138b78d633274' | ||||||
|  |  | ||||||
| /** Checkstyle **/ | /** Checkstyle **/ | ||||||
|     checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}" |     checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}" | ||||||
|   | |||||||
| @@ -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 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) { | ||||||
|         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); | ||||||
|  |  | ||||||
|  |         emptyStateDesc = rootView.findViewById(R.id.empty_state_desc); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /*////////////////////////////////////////////////////////////////////////// |     /*////////////////////////////////////////////////////////////////////////// | ||||||
|     // LifeCycle |     // LifeCycle | ||||||
|     //////////////////////////////////////////////////////////////////////////*/ |     //////////////////////////////////////////////////////////////////////////*/ | ||||||
| @@ -73,6 +83,12 @@ 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); | ||||||
|  |  | ||||||
|  |         emptyStateDesc.setText( | ||||||
|  |                 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" | ||||||
|   | |||||||
| @@ -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> | ||||||
|   | |||||||
| @@ -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> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stypox
					Stypox