PlayQueue: Mark SponsorBlock segments in seekbar

Fixes https://github.com/polymorphicshade/NewPipe/issues/89
This commit is contained in:
Atemu 2021-08-13 15:01:01 +02:00
parent ad9fbf4699
commit a252a5bc76
3 changed files with 11 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.IBinder;
import android.provider.Settings;
@ -17,6 +18,7 @@ import android.widget.SeekBar;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -47,6 +49,7 @@ import java.util.List;
import static org.schabi.newpipe.player.helper.PlayerHelper.formatSpeed;
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
import static org.schabi.newpipe.util.SponsorBlockUtils.markSegments;
import static org.schabi.newpipe.util.external_communication.ShareUtils.shareText;
public final class PlayQueueActivity extends AppCompatActivity
@ -225,6 +228,12 @@ public final class PlayQueueActivity extends AppCompatActivity
} else {
buildComponents();
if (player != null) {
final PlayQueueItem item = player.getPlayQueue().getItem();
final Context context = getApplicationContext();
final SharedPreferences prefs =
PreferenceManager.getDefaultSharedPreferences(context);
markSegments(item, queueControlBinding.seekBar, context, prefs);
player.setActivityListener(PlayQueueActivity.this);
}
}

View file

@ -280,7 +280,7 @@
tools:ignore="HardcodedText"
tools:text="1:06:29" />
<androidx.appcompat.widget.AppCompatSeekBar
<org.schabi.newpipe.views.FocusAwareSeekBar
android:id="@+id/seek_bar"
style="@style/Widget.AppCompat.SeekBar"
android:layout_width="0dp"

View file

@ -122,7 +122,7 @@
tools:text="1:06:29" />
<androidx.appcompat.widget.AppCompatSeekBar
<org.schabi.newpipe.views.FocusAwareSeekBar
android:id="@+id/seek_bar"
style="@style/Widget.AppCompat.SeekBar"
android:layout_width="0dp"