Remove unused bullet comments code

This commit is contained in:
h authored and Tobi committed 2026-11-03 23:04:48 +01:00
1 parent 8f9b687210
commit f8a3142835
11 files changed
+1 -807

No files matched your search

@@ -1,194 +0,0 @@
package org.schabi.newpipe.player.bulletComments;
import android.annotation.SuppressLint;
import android.util.Log;
import org.schabi.newpipe.extractor.bulletComments.BulletCommentsExtractor;
import org.schabi.newpipe.extractor.bulletComments.BulletCommentsInfo;
import org.schabi.newpipe.extractor.bulletComments.BulletCommentsInfoItem;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.util.ExtractorHelper;
import org.schabi.newpipe.views.BulletCommentsView;
import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.schedulers.Schedulers;
public class MovieBulletCommentsPlayer {
public MovieBulletCommentsPlayer(final BulletCommentsView bulletCommentsView) {
super();
this.bulletCommentsView = bulletCommentsView;
}
private final String TAG = "MovieBCPlayer";
protected int serviceId;
protected String url;
protected final BulletCommentsView bulletCommentsView;
protected List<BulletCommentsInfoItem> commentsInfoItems;
private BulletCommentsExtractor extractor;
public boolean isRoundPlayStream = false;
/**
* Set data. Call before init().
*
* @param newServiceId Service id.
* @param newUrl Url.
*/
public void setInitialData(final int newServiceId, final String newUrl) {
Log.d(TAG, "setInitialData() serviceId=" + newServiceId + " url=" + newUrl);
this.serviceId = newServiceId;
this.url = newUrl;
}
public final Duration interval = Duration.ofMillis(50);
protected boolean isLoading = false;
/**
* Fetch comments and init. Call after setInitialData().
*/
@SuppressLint("CheckResult")
public void init() {
Log.d(TAG, "init() called for url=" + this.url);
this.bulletCommentsView.clearComments();
isLoading = true;
try {
ExtractorHelper.getBulletCommentsInfo(this.serviceId, this.url, false)
.filter(Objects::nonNull)
.map((BulletCommentsInfo commentsInfo) -> {
extractor = commentsInfo.getBulletCommentsExtractor();
extractor.reconnect();
return commentsInfo.getRelatedItems();
}
)
.filter(Objects::nonNull)
.map(s -> s.stream().toArray(BulletCommentsInfoItem[]::new))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe((BulletCommentsInfoItem[] newCommentsInfoItems) -> {
this.commentsInfoItems = Arrays.asList(newCommentsInfoItems);
Log.d(TAG, "init() success: got "
+ newCommentsInfoItems.length
+ " initial comments for " + this.url);
if (extractor != null) {
Log.d(TAG, "init() extractor isLive=" + extractor.isLive()
+ " isDisabled=" + extractor.isDisabled());
}
isLoading = false;
},
throwable -> Log.e(TAG, Log.getStackTraceString(throwable))
);
} catch (final Exception e) {
Log.e(TAG, Log.getStackTraceString(e));
}
}
protected Duration lastPosition = Duration.ZERO;
/**
* Draw all comments which duration is between last
* drawUntilPosition and current drawUntilPosition.
*
* @param drawUntilPosition Duration to draw comments until.
*/
public void drawComments(final Duration drawUntilPosition) {
if (isLoading) {
return;
}
Log.v(TAG, "drawComments() position=" + drawUntilPosition.toMillis()
+ "ms extractor=" + (extractor != null ? "yes" : "null"));
final BulletCommentsInfoItem[] nextCommentsInfoItems;
if (extractor.isDisabled()) {
return;
}
if (extractor != null && extractor.isLive()) {
// have to put all messages we get to the pool as they only appear once
try {
nextCommentsInfoItems = extractor.getLiveMessages()
.stream().toArray(BulletCommentsInfoItem[]::new);
if (drawUntilPosition.compareTo(Duration.ofSeconds(Long.MAX_VALUE)) != 0) {
extractor.setCurrentPlayPosition(drawUntilPosition.toMillis());
}
} catch (final ParsingException e) {
Log.e(TAG, "drawComments() getLiveMessages failed", e);
throw new RuntimeException(e);
}
} else { // we can filter the messages because we have the full list
if (drawUntilPosition.toString().equals("PT0.049S")) {
return;
}
nextCommentsInfoItems = commentsInfoItems
.stream()
.filter(item -> {
final Duration d = item.getDuration();
return d.compareTo(lastPosition) >= 0
&& d.compareTo(drawUntilPosition) < 0;
}
)
.toArray(BulletCommentsInfoItem[]::new);
}
Log.v(TAG, "drawComments() drawing " + nextCommentsInfoItems.length + " comments");
bulletCommentsView.drawComments(nextCommentsInfoItems, drawUntilPosition);
this.lastPosition = drawUntilPosition;
}
/**
* Resume comments. (Avoids drawing massive comments after skipping.)
*
* @param currentPosition Current position.
*/
public void start(final Duration currentPosition) {
Log.d(TAG, "start() position=" + currentPosition.toMillis() + "ms");
this.lastPosition = currentPosition;
bulletCommentsView.resumeComments();
}
/**
* Pause comments.
*/
public void pause() {
Log.d(TAG, "pause() called");
bulletCommentsView.pauseComments();
}
/**
* Clear comments.
*/
public void clear() {
Log.d(TAG, "clear() called");
bulletCommentsView.clearComments();
}
public void disconnect() {
Log.d(TAG, "disconnect() called");
if (extractor != null && extractor.isLive()) {
extractor.disconnect();
}
}
/**
* Draw all comments after max(movieDuration - interval, lastPosition).
*
* @param movieDuration The duration of the movie, used to avoid drawing too many comments.
*/
public void complete(final Duration movieDuration) {
Log.d(TAG, "complete() called");
if (lastPosition == null) {
return; //is actually finished
}
final Duration minimumLastPosition = movieDuration.minus(interval);
if (minimumLastPosition.compareTo(lastPosition) >= 0) {
lastPosition = minimumLastPosition;
}
//Show all comments.
drawComments(Duration.ofSeconds(Long.MAX_VALUE));
}
public String getUrl() {
return url;
}
}
@@ -1,87 +0,0 @@
package org.schabi.newpipe.settings;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.preference.SeekBarPreference;
import org.schabi.newpipe.R;
public class BulletCommentsSettingsFragment extends BasePreferenceFragment {
private SharedPreferences.OnSharedPreferenceChangeListener listener;
@Override
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
addPreferencesFromResourceRegistry();
listener = (sharedPreferences, s) -> {
if (s.equals(getString(R.string.top_bottom_bullet_comments_duration_key))) {
final int newSetting = sharedPreferences.getInt(s, 8);
final SeekBarPreference topBottomBulletCommentsDuration = findPreference(s);
if (topBottomBulletCommentsDuration != null) {
topBottomBulletCommentsDuration.setSummary(newSetting + " seconds");
}
} else if (s.equals(getString(R.string.regular_bullet_comments_duration_key))) {
final int newSetting = sharedPreferences.getInt(s, 8);
final SeekBarPreference regularBulletCommentsDuration = findPreference(s);
if (regularBulletCommentsDuration != null) {
regularBulletCommentsDuration.setSummary(newSetting + " seconds");
}
} else if (s.equals(getString(R.string.max_bullet_comments_rows_top_key))
|| s.equals(getString(R.string.max_bullet_comments_rows_bottom_key))
|| s.equals(getString(R.string.max_bullet_comments_rows_regular_key))) {
final int newSetting = sharedPreferences.getInt(s, 15);
final SeekBarPreference rowsPref = findPreference(s);
if (rowsPref != null) {
rowsPref.setSummary(String.valueOf(newSetting));
}
}
};
final SeekBarPreference regularBulletCommentsDuration =
findPreference(getString(R.string.regular_bullet_comments_duration_key));
if (regularBulletCommentsDuration != null) {
regularBulletCommentsDuration.setMin(5);
}
final SeekBarPreference topBottomBulletCommentsDuration =
findPreference(getString(R.string.top_bottom_bullet_comments_duration_key));
if (topBottomBulletCommentsDuration != null) {
topBottomBulletCommentsDuration.setMin(5);
}
final SeekBarPreference topRowsPref =
findPreference(getString(R.string.max_bullet_comments_rows_top_key));
final SeekBarPreference bottomRowsPref =
findPreference(getString(R.string.max_bullet_comments_rows_bottom_key));
final SeekBarPreference regularRowsPref =
findPreference(getString(R.string.max_bullet_comments_rows_regular_key));
final SharedPreferences sharedPreferences =
getPreferenceManager().getSharedPreferences();
if (topRowsPref != null) {
topRowsPref.setSummary(String.valueOf(sharedPreferences.getInt(
getString(R.string.max_bullet_comments_rows_top_key), 15)));
}
if (bottomRowsPref != null) {
bottomRowsPref.setSummary(String.valueOf(sharedPreferences.getInt(
getString(R.string.max_bullet_comments_rows_bottom_key), 15)));
}
if (regularRowsPref != null) {
regularRowsPref.setSummary(String.valueOf(sharedPreferences.getInt(
getString(R.string.max_bullet_comments_rows_regular_key), 15)));
}
}
@Override
public void onResume() {
super.onResume();
getPreferenceManager().getSharedPreferences()
.registerOnSharedPreferenceChangeListener(listener);
}
@Override
public void onPause() {
super.onPause();
getPreferenceManager().getSharedPreferences()
.unregisterOnSharedPreferenceChangeListener(listener);
}
}
@@ -41,7 +41,6 @@ public final class SettingsResourceRegistry {
add(UpdateSettingsFragment.class, R.xml.update_settings);
add(VideoAudioSettingsFragment.class, R.xml.video_audio_settings);
add(ExoPlayerSettingsFragment.class, R.xml.exoplayer_settings);
add(BulletCommentsSettingsFragment.class, R.xml.bullet_comments_settings);
add(BackupRestoreSettingsFragment.class, R.xml.backup_restore_settings);
}
@@ -40,7 +40,6 @@ import org.schabi.newpipe.extractor.ListExtractor.InfoItemsPage;
import org.schabi.newpipe.extractor.MetaInfo;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.Page;
import org.schabi.newpipe.extractor.bulletComments.BulletCommentsInfo;
import org.schabi.newpipe.extractor.channel.ChannelInfo;
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabInfo;
import org.schabi.newpipe.extractor.kiosk.KioskInfo;
@@ -169,15 +168,6 @@ public final class ExtractorHelper {
Single.fromCallable(() -> KioskInfo.getInfo(NewPipe.getService(serviceId), url)));
}
public static Single<BulletCommentsInfo> getBulletCommentsInfo(final int serviceId,
final String url,
final boolean forceLoad) {
checkServiceId(serviceId);
return checkCache(forceLoad, serviceId, url, InfoCache.Type.BULLET_COMMENTS,
Single.fromCallable(() ->
BulletCommentsInfo.getInfo(NewPipe.getService(serviceId), url)));
}
public static Single<InfoItemsPage<StreamInfoItem>> getMoreKioskItems(final int serviceId,
final String url,
final Page nextPage) {
@@ -55,9 +55,8 @@ public final class InfoCache {
CHANNEL,
CHANNEL_TAB,
COMMENTS,
BULLET_COMMENTS,
PLAYLIST,
KIOSK,
KIOSK
}
public static InfoCache getInstance() {
@@ -1,384 +0,0 @@
package org.schabi.newpipe.views;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.os.Build;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Gravity;
import android.view.animation.LinearInterpolator;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.preference.PreferenceManager;
import org.schabi.newpipe.R;
import org.schabi.newpipe.databinding.BulletCommentsPlayerBinding;
import org.schabi.newpipe.extractor.bulletComments.BulletCommentsInfoItem;
import java.time.Duration;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.stream.Collectors;
public final class BulletCommentsView extends ConstraintLayout {
private final String TAG = "BulletCommentsView";
private SharedPreferences prefs;
/**
* Tuple of TextView and ObjectAnimator.
*/
private static class AnimatedTextView {
AnimatedTextView(final TextView textView, final ObjectAnimator animator) {
this.textView = textView;
this.animator = animator;
}
public final TextView textView;
public final ObjectAnimator animator;
}
public BulletCommentsView(final Context context) {
super(context);
setClipChildren(false);
init(context);
}
public BulletCommentsView(final Context context,
final AttributeSet attrs) {
super(context, attrs);
setClipChildren(false);
init(context);
}
public BulletCommentsView(final Context context,
final AttributeSet attrs,
final int defStyleAttr) {
super(context, attrs, defStyleAttr);
setClipChildren(false);
init(context);
}
private void init(final Context context) {
final View layout = LayoutInflater.from(context)
.inflate(R.layout.bullet_comments_player, this);
prefs = PreferenceManager.getDefaultSharedPreferences(context);
commentsDuration = prefs.getInt(
context.getString(R.string.top_bottom_bullet_comments_duration_key), 8);
durationFactor = (float) prefs.getInt(
context.getString(R.string.regular_bullet_comments_duration_key), 8)
/ (float) commentsDuration;
outlineRadius = prefs.getInt(
context.getString(R.string.bullet_comments_outline_radius_key), 2);
final boolean limitMaxRows = prefs.getBoolean(
context.getString(R.string.enable_max_rows_customization_key), false);
if (limitMaxRows) {
maxRowsTop = prefs.getInt(
context.getString(R.string.max_bullet_comments_rows_top_key), 15);
maxRowsBottom = prefs.getInt(
context.getString(R.string.max_bullet_comments_rows_bottom_key), 15);
maxRowsRegular = prefs.getInt(
context.getString(R.string.max_bullet_comments_rows_regular_key), 15);
}
font = prefs.getString(context.getString(R.string.bullet_comments_font_key), "default");
opacity = prefs.getInt(context.getString(R.string.bullet_comments_opacity_key), 0xFF);
binding = BulletCommentsPlayerBinding.bind(this);
}
private boolean layoutSet = false;
private void setLayout() {
final int additionalWidth = additionalSpaceRelative * getWidth();
binding.bottomRight.getLayoutParams().width = additionalWidth;
requestLayout();
Log.i(TAG, "Additional width: " + additionalWidth
+ ", container width: " + binding.bulletCommentsContainer.getWidth());
}
private BulletCommentsPlayerBinding binding;
private final int additionalSpaceRelative = 4;
private final int commentsRowsCount = 11;
private int lastCalculatedCommentsRowsCount = 11;
private List<Long> rows = Collections.synchronizedList(new ArrayList<Long>());
private List<Map.Entry<Long, Integer>> rowsRegular =
Collections.synchronizedList(new ArrayList<>());
private final double commentRelativeTextSize = 1 / 13.5;
private PriorityQueue<BulletCommentsInfoItem> bulletCommentsInfoItemRegularPool =
new PriorityQueue<>();
private PriorityQueue<BulletCommentsInfoItem> bulletCommentsInfoItemFixedPool =
new PriorityQueue<>();
private int commentsDuration;
private float durationFactor;
private int outlineRadius;
private String font;
private int opacity; // 0~255, 0: hide
private final List<AnimatedTextView> animatedTextViews = new ArrayList<>();
private int maxRowsTop = 1000000;
private int maxRowsBottom = 1000000;
private int maxRowsRegular = 1000000;
public void clearComments() {
Log.d(TAG, "clearComments() called, animatedViews=" + animatedTextViews.size());
animatedTextViews.clear();
if (binding != null) {
binding.bulletCommentsContainer.removeAllViews();
}
}
public void setPauseComments(final boolean pause) {
if (pause) {
pauseComments();
} else {
resumeComments();
}
}
public void pauseComments() {
animatedTextViews.stream().forEach(s -> s.animator.pause());
}
public void resumeComments() {
animatedTextViews.stream().forEach(s -> s.animator.resume());
}
public void drawComments(@NonNull final BulletCommentsInfoItem[] items,
final Duration drawUntilPosition) {
Log.v(TAG, "drawComments() items=" + items.length
+ " position=" + drawUntilPosition.toMillis() + "ms");
if (binding == null || getWidth() == 0 || getHeight() == 0) {
Log.w(TAG, "drawComments() skipped: view not ready");
return;
}
if (!layoutSet) {
setLayout();
layoutSet = true;
}
bulletCommentsInfoItemRegularPool.addAll(
Arrays.asList(items).stream()
.filter(x -> x.getPosition() == BulletCommentsInfoItem.Position.REGULAR)
.collect(Collectors.toList()));
bulletCommentsInfoItemFixedPool.addAll(
Arrays.asList(items).stream()
.filter(x -> x.getPosition() != BulletCommentsInfoItem.Position.REGULAR)
.collect(Collectors.toList()));
final int height = getHeight();
final int width = getWidth();
final int calculatedCommentRowsCount =
height / Math.min(height, width) * commentsRowsCount;
if (calculatedCommentRowsCount != lastCalculatedCommentsRowsCount) {
lastCalculatedCommentsRowsCount = calculatedCommentRowsCount;
rows.clear();
rowsRegular.clear();
}
while (rowsRegular.size() < calculatedCommentRowsCount) {
rowsRegular.add(new AbstractMap.SimpleEntry<>(0L, 0));
}
while (rows.size() < calculatedCommentRowsCount) {
rows.add(0L);
}
drawCommentsByPool(bulletCommentsInfoItemRegularPool, drawUntilPosition,
height, width, calculatedCommentRowsCount);
drawCommentsByPool(bulletCommentsInfoItemFixedPool, drawUntilPosition,
height, width, calculatedCommentRowsCount);
Log.v(TAG, "drawComments() done, containerChildCount="
+ binding.bulletCommentsContainer.getChildCount());
}
public int tryToDrawComment(final BulletCommentsInfoItem item,
final int calculatedCommentRowsCount,
final int width,
final boolean reallyDo) {
final long current = new Date().getTime();
int row = -1;
final int comparedDuration = (int) (commentsDuration * 1000);
if (item.getPosition().equals(BulletCommentsInfoItem.Position.TOP)
|| item.getPosition().equals(BulletCommentsInfoItem.Position.SUPERCHAT)) {
for (int i = 0; i < Math.min(maxRowsTop, calculatedCommentRowsCount); i++) {
final long last = rows.get(i);
if (current - last >= comparedDuration) {
if (reallyDo) {
rows.set(i, current);
}
row = i;
break;
}
}
} else if (item.getPosition().equals(BulletCommentsInfoItem.Position.REGULAR)) {
for (int i = 0; i < Math.min(maxRowsRegular, calculatedCommentRowsCount); i++) {
final long lastTime = rowsRegular.get(i).getKey();
final long lastLength = rowsRegular.get(i).getValue();
final long t = current - lastTime;
final double tAll = comparedDuration * durationFactor;
final double lx = (lastLength / 25.0 + 1) * width;
final double ly = (item.getCommentText().length() / 25.0 + 1) * width;
final double vx = lx / tAll;
final double vy = ly / tAll;
if ((vy - vx) * (tAll - t) < t * vx - (lastLength / 25.0) * width
&& t * vx - (lastLength / 25.0) * width > 0) {
if (reallyDo) {
rowsRegular.set(i,
new AbstractMap.SimpleEntry<>(current,
item.getCommentText().length()));
}
row = i;
break;
}
}
} else {
for (int i = calculatedCommentRowsCount - 1;
i >= Math.max(0, calculatedCommentRowsCount - maxRowsBottom); i--) {
final long last = rows.get(i);
if (current - last >= comparedDuration) {
if (reallyDo) {
rows.set(i, current);
}
row = i;
break;
}
}
}
return row;
}
private void drawCommentsByPool(final PriorityQueue<BulletCommentsInfoItem> pool,
final Duration drawUntilPosition,
final int height,
final int width,
final int calculatedCommentRowsCount) {
if (binding == null) {
return;
}
final Context context = binding.bulletCommentsContainer.getContext();
int drawn = 0;
while (!pool.isEmpty()
&& (drawUntilPosition.compareTo(Duration.ofSeconds(Long.MAX_VALUE)) == 0
|| pool.peek().getDuration().toMillis() < drawUntilPosition.toMillis())) {
final BulletCommentsInfoItem item = pool.peek();
if (item.isLive()
&& tryToDrawComment(item, calculatedCommentRowsCount, width, false) == -1) {
Log.v(TAG, "drawCommentsByPool() row collision, skipping item");
pool.poll(); // skip this item instead of aborting all
continue;
}
pool.poll();
final TextView textView = new TextView(context);
final Typeface fontToBeUsed;
switch (font) {
case "serif":
fontToBeUsed = Typeface.SERIF;
break;
case "monospace":
fontToBeUsed = Typeface.MONOSPACE;
break;
case "sans-serif":
fontToBeUsed = Typeface.SANS_SERIF;
break;
default:
fontToBeUsed = Typeface.DEFAULT;
break;
}
textView.setGravity(Gravity.CENTER);
int color = item.getArgbColor();
if (opacity != 0xFF) {
color &= 0x00FFFFFF;
color |= ((opacity & 0xFF) << 24);
}
textView.setTextColor(color);
final String commentText = item.getCommentText();
Log.v(TAG, "drawCommentsByPool() text=[" + commentText + "] color="
+ String.format("0x%08X", color) + " pos=" + item.getPosition());
if (commentText.length() == 0) {
Log.v(TAG, "drawCommentsByPool() skipping empty text");
continue;
}
textView.setText(commentText);
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
(float) (Math.min(height, width) * commentRelativeTextSize
* item.getRelativeFontSize()));
textView.setMaxLines(1);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
textView.setTypeface(Typeface.create(fontToBeUsed, Typeface.BOLD,
item.getPosition().equals(BulletCommentsInfoItem.Position.SUPERCHAT)));
} else {
textView.setTypeface(Typeface.create(fontToBeUsed, Typeface.BOLD));
}
final Paint paint = textView.getPaint();
int shadowColor = Color.BLACK & 0x00FFFFFF;
shadowColor |= ((opacity & 0xFF) << 24);
paint.setShadowLayer(outlineRadius, 0, 0, shadowColor);
textView.setLayerType(View.LAYER_TYPE_SOFTWARE, paint);
final int row = tryToDrawComment(item, calculatedCommentRowsCount, width, true);
if (row == -1) {
continue;
}
textView.setX(width);
textView.post(() -> {
final int textWidth = textView.getWidth();
final int textHeight = textView.getHeight();
final ObjectAnimator animator;
if (!item.getPosition().equals(BulletCommentsInfoItem.Position.REGULAR)) {
animator = ObjectAnimator.ofFloat(
textView,
View.TRANSLATION_X,
(float) ((width - textWidth) / 2.0),
(float) ((width - textWidth) / 2.0)
);
} else {
animator = ObjectAnimator.ofFloat(
textView,
View.TRANSLATION_X,
width,
-textWidth
);
}
textView.setY((float) (height * (0.5 + row) / calculatedCommentRowsCount
- textHeight / 2));
final AnimatedTextView animatedTextView = new AnimatedTextView(
textView, animator);
animatedTextViews.add(animatedTextView);
animator.setFrameDelay(1);
animator.setInterpolator(new LinearInterpolator());
animator.setDuration(item.getLastingTime() != -1
? item.getLastingTime()
: (long) (commentsDuration * 1000
* (item.getPosition().equals(BulletCommentsInfoItem.Position.REGULAR)
? durationFactor : 1)));
animator.addListener(new AnimatorListenerAdapter() {
public void onAnimationEnd(final Animator animation) {
binding.bulletCommentsContainer.removeView(textView);
animatedTextViews.remove(animatedTextView);
}
});
animator.start();
});
binding.bulletCommentsContainer.addView(textView);
drawn++;
}
if (drawn > 0) {
Log.v(TAG, "drawCommentsByPool() drawn=" + drawn);
}
}
}
@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<Space
android:id="@+id/topLeft"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintEnd_toStartOf="parent"
android:layout_width="0dp"
android:layout_height="0dp" />
<Space
android:id="@+id/bottomRight"
app:layout_constraintStart_toEndOf="parent"
app:layout_constraintTop_toBottomOf="parent"
android:layout_width="0dp"
android:layout_height="0dp" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bulletCommentsContainer"
app:layout_constraintBottom_toBottomOf="@id/bottomRight"
app:layout_constraintEnd_toEndOf="@id/bottomRight"
app:layout_constraintStart_toStartOf="@id/topLeft"
app:layout_constraintTop_toTopOf="@id/topLeft"
android:layout_width="0dp"
android:layout_height="0dp"
android:clipChildren="false"
android:clipToPadding="false"
android:foregroundGravity="center_horizontal" />
</androidx.constraintlayout.widget.ConstraintLayout>
-10
View File
@@ -1515,14 +1515,4 @@
<item>@string/image_quality_high_key</item>
</string-array>
<!-- Bullet comments -->
<string name="top_bottom_bullet_comments_duration_key">top_bottom_bullet_comments_duration_key</string>
<string name="regular_bullet_comments_duration_key">regular_bullet_comments_duration_key</string>
<string name="bullet_comments_outline_radius_key">bullet_comments_outline_radius_key</string>
<string name="bullet_comments_font_key">bullet_comments_font_key</string>
<string name="bullet_comments_opacity_key">bullet_comments_opacity_key</string>
<string name="enable_max_rows_customization_key">enable_max_rows_customization_key</string>
<string name="max_bullet_comments_rows_top_key">max_bullet_comments_rows_top_key</string>
<string name="max_bullet_comments_rows_bottom_key">max_bullet_comments_rows_bottom_key</string>
<string name="max_bullet_comments_rows_regular_key">max_bullet_comments_rows_regular_key</string>
</resources>
-14
View File
@@ -924,18 +924,4 @@
<string name="api23_requirement_dialog_message">Unfortunately NewPipe depends on a few libraries that dropped support for Android 5.0 and 5.1. The next NewPipe release will therefore only work on devices with Android 6 or higher, sadly. Read more in the blogpost.</string>
<string name="api23_requirement_dialog_blogpost">Blogpost</string>
<!-- Bullet comments -->
<string name="settings_category_bullet_comments_title">Bullet comments</string>
<string name="settings_category_bullet_comments_summary">Configure live chat overlay</string>
<string name="regular_bullet_comments_duration_title">Regular comments duration</string>
<string name="regular_bullet_comments_duration_summary">Duration of scrolling comments in seconds</string>
<string name="top_bottom_bullet_comments_duration_title">Top/bottom comments duration</string>
<string name="top_bottom_bullet_comments_duration_summary">Duration of fixed comments in seconds</string>
<string name="bullet_comments_outline_radius_title">Outline radius</string>
<string name="bullet_comments_font_title">Font</string>
<string name="bullet_comments_opacity_title">Opacity</string>
<string name="enable_max_rows_customization_title">Limit max rows</string>
<string name="max_bullet_comments_rows_top_title">Max top rows</string>
<string name="max_bullet_comments_rows_bottom_title">Max bottom rows</string>
<string name="max_bullet_comments_rows_regular_title">Max regular rows</string>
</resources>
@@ -1,65 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/settings_category_bullet_comments_title">
<SeekBarPreference
android:defaultValue="8"
android:key="@string/regular_bullet_comments_duration_key"
android:max="20"
android:summary="@string/regular_bullet_comments_duration_summary"
android:title="@string/regular_bullet_comments_duration_title"
app:showSeekBarValue="true" />
<SeekBarPreference
android:defaultValue="8"
android:key="@string/top_bottom_bullet_comments_duration_key"
android:max="20"
android:summary="@string/top_bottom_bullet_comments_duration_summary"
android:title="@string/top_bottom_bullet_comments_duration_title"
app:showSeekBarValue="true" />
<SeekBarPreference
android:defaultValue="2"
android:key="@string/bullet_comments_outline_radius_key"
android:max="10"
android:title="@string/bullet_comments_outline_radius_title"
app:showSeekBarValue="true" />
<SeekBarPreference
android:defaultValue="255"
android:key="@string/bullet_comments_opacity_key"
android:max="255"
android:title="@string/bullet_comments_opacity_title"
app:showSeekBarValue="true" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:key="@string/enable_max_rows_customization_key"
android:title="@string/enable_max_rows_customization_title" />
<SeekBarPreference
android:defaultValue="15"
android:dependency="@string/enable_max_rows_customization_key"
android:key="@string/max_bullet_comments_rows_top_key"
android:max="50"
android:title="@string/max_bullet_comments_rows_top_title"
app:showSeekBarValue="true" />
<SeekBarPreference
android:defaultValue="15"
android:dependency="@string/enable_max_rows_customization_key"
android:key="@string/max_bullet_comments_rows_bottom_key"
android:max="50"
android:title="@string/max_bullet_comments_rows_bottom_title"
app:showSeekBarValue="true" />
<SeekBarPreference
android:defaultValue="15"
android:dependency="@string/enable_max_rows_customization_key"
android:key="@string/max_bullet_comments_rows_regular_key"
android:max="50"
android:title="@string/max_bullet_comments_rows_regular_title"
app:showSeekBarValue="true" />
</PreferenceScreen>
-7
View File
@@ -10,13 +10,6 @@
android:title="@string/settings_category_video_audio_title"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.schabi.newpipe.settings.BulletCommentsSettingsFragment"
android:icon="@drawable/ic_comment"
android:title="@string/settings_category_bullet_comments_title"
android:summary="@string/settings_category_bullet_comments_summary"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.schabi.newpipe.settings.DownloadSettingsFragment"
android:icon="@drawable/ic_file_download"