Merge pull request #1826 from Bnyro/master

[Option] New Player UI
This commit is contained in:
Bnyro 2022-11-12 19:05:30 +01:00 committed by GitHub
commit ca84eadc18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 173 additions and 120 deletions

View File

@ -80,6 +80,7 @@ object PreferenceKeys {
const val SB_SHOW_MARKERS = "sb_show_markers" const val SB_SHOW_MARKERS = "sb_show_markers"
const val LIMIT_HLS = "limit_hls" const val LIMIT_HLS = "limit_hls"
const val PROGRESSIVE_LOADING_INTERVAL_SIZE = "progressive_loading_interval" const val PROGRESSIVE_LOADING_INTERVAL_SIZE = "progressive_loading_interval"
const val ALTERNATIVE_PLAYER_LAYOUT = "alternative_player_layout"
/** /**
* Background mode * Background mode

View File

@ -307,9 +307,9 @@ class BackgroundMode : Service() {
*/ */
private fun fetchSponsorBlockSegments() { private fun fetchSponsorBlockSegments() {
CoroutineScope(Dispatchers.IO).launch { CoroutineScope(Dispatchers.IO).launch {
kotlin.runCatching { runCatching {
val categories = PlayerHelper.getSponsorBlockCategories() val categories = PlayerHelper.getSponsorBlockCategories()
if (categories.size > 0) { if (categories.isEmpty()) return@runCatching
segmentData = segmentData =
RetrofitInstance.api.getSegments( RetrofitInstance.api.getSegments(
videoId, videoId,
@ -319,7 +319,6 @@ class BackgroundMode : Service() {
} }
} }
} }
}
/** /**
* check for SponsorBlock segments * check for SponsorBlock segments

View File

@ -17,6 +17,7 @@ import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.databinding.TrendingRowBinding import com.github.libretube.databinding.TrendingRowBinding
import com.github.libretube.databinding.VideoRowBinding import com.github.libretube.databinding.VideoRowBinding
import com.github.libretube.extensions.formatShort import com.github.libretube.extensions.formatShort
import com.github.libretube.extensions.toDp
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.ui.extensions.setFormattedDuration import com.github.libretube.ui.extensions.setFormattedDuration
import com.github.libretube.ui.extensions.setWatchProgressLength import com.github.libretube.ui.extensions.setWatchProgressLength
@ -59,7 +60,7 @@ class VideosAdapter(
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VideosViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VideosViewHolder {
val layoutInflater = LayoutInflater.from(parent.context) val layoutInflater = LayoutInflater.from(parent.context)
return when { return when {
forceMode == ForceMode.TRENDING -> VideosViewHolder(TrendingRowBinding.inflate(layoutInflater, parent, false)) forceMode in listOf(ForceMode.TRENDING, ForceMode.RELATED) -> VideosViewHolder(TrendingRowBinding.inflate(layoutInflater, parent, false))
forceMode == ForceMode.CHANNEL -> VideosViewHolder(VideoRowBinding.inflate(layoutInflater, parent, false)) forceMode == ForceMode.CHANNEL -> VideosViewHolder(VideoRowBinding.inflate(layoutInflater, parent, false))
PreferenceHelper.getBoolean( PreferenceHelper.getBoolean(
PreferenceKeys.ALTERNATIVE_VIDEOS_LAYOUT, PreferenceKeys.ALTERNATIVE_VIDEOS_LAYOUT,
@ -82,6 +83,12 @@ class VideosAdapter(
// Trending layout // Trending layout
holder.trendingRowBinding?.apply { holder.trendingRowBinding?.apply {
if (forceMode == ForceMode.RELATED) {
val params = root.layoutParams
params.width = (180).toDp(root.context.resources).toInt()
root.layoutParams = params
}
textViewTitle.text = video.title textViewTitle.text = video.title
textViewChannel.text = textViewChannel.text =
video.uploaderName + TextUtils.SEPARATOR + video.uploaderName + TextUtils.SEPARATOR +
@ -160,7 +167,8 @@ class VideosAdapter(
NONE, NONE,
TRENDING, TRENDING,
ROW, ROW,
CHANNEL CHANNEL,
RELATED
} }
fun getLayout(context: Context): LayoutManager { fun getLayout(context: Context): LayoutManager {

View File

@ -27,6 +27,7 @@ import android.widget.Toast
import androidx.constraintlayout.motion.widget.MotionLayout import androidx.constraintlayout.motion.widget.MotionLayout
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.core.view.isEmpty
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Lifecycle import androidx.lifecycle.Lifecycle
@ -38,6 +39,8 @@ import com.github.libretube.api.CronetHelper
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.obj.ChapterSegment import com.github.libretube.api.obj.ChapterSegment
import com.github.libretube.api.obj.SegmentData import com.github.libretube.api.obj.SegmentData
import com.github.libretube.api.obj.StreamItem
import com.github.libretube.api.obj.Streams
import com.github.libretube.constants.IntentData import com.github.libretube.constants.IntentData
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.databinding.DoubleTapOverlayBinding import com.github.libretube.databinding.DoubleTapOverlayBinding
@ -120,7 +123,7 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
private var videoId: String? = null private var videoId: String? = null
private var playlistId: String? = null private var playlistId: String? = null
private var isLive = false private var isLive = false
private lateinit var streams: com.github.libretube.api.obj.Streams private lateinit var streams: Streams
/** /**
* for the transition * for the transition
@ -133,7 +136,6 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
* for the comments * for the comments
*/ */
private var commentsAdapter: CommentsAdapter? = null private var commentsAdapter: CommentsAdapter? = null
private var commentsLoaded: Boolean? = false
private var nextPage: String? = null private var nextPage: String? = null
private var isLoading = true private var isLoading = true
@ -383,6 +385,12 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
binding.commentsRecView.setItemViewCacheSize(20) binding.commentsRecView.setItemViewCacheSize(20)
binding.relatedRecView.layoutManager = VideosAdapter.getLayout(requireContext()) binding.relatedRecView.layoutManager = VideosAdapter.getLayout(requireContext())
binding.alternativeTrendingRec.layoutManager = LinearLayoutManager(
context,
LinearLayoutManager.HORIZONTAL,
false
)
} }
private fun setFullscreen() { private fun setFullscreen() {
@ -450,11 +458,14 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
} }
private fun toggleComments() { private fun toggleComments() {
binding.commentsRecView.visibility = if (binding.commentsRecView.isVisible) {
if (binding.commentsRecView.isVisible) View.GONE else View.VISIBLE binding.commentsRecView.visibility = View.GONE
binding.relatedRecView.visibility = binding.relatedRecView.visibility = View.VISIBLE
if (binding.relatedRecView.isVisible) View.GONE else View.VISIBLE } else {
if (!commentsLoaded!!) fetchComments() binding.commentsRecView.visibility = View.VISIBLE
binding.relatedRecView.visibility = View.GONE
if (binding.commentsRecView.isEmpty()) fetchComments()
}
} }
override fun onStart() { override fun onStart() {
@ -610,15 +621,13 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
// show the player notification // show the player notification
initializePlayerNotification() initializePlayerNotification()
if (PlayerHelper.sponsorBlockEnabled) fetchSponsorBlockSegments() if (PlayerHelper.sponsorBlockEnabled) fetchSponsorBlockSegments()
// show comments if related streams disabled
if (!PlayerHelper.relatedStreamsEnabled) toggleComments() // show comments if related streams are disabled or the alternative related streams layout is chosen
if (!PlayerHelper.relatedStreamsEnabled || PlayerHelper.alternativeVideoLayout) toggleComments()
// add the video to the watch history // add the video to the watch history
if (PlayerHelper.watchHistoryEnabled) { if (PlayerHelper.watchHistoryEnabled) {
DatabaseHelper.addToWatchHistory( DatabaseHelper.addToWatchHistory(videoId!!, streams)
videoId!!,
streams
)
} }
} }
} }
@ -629,9 +638,9 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
*/ */
private fun fetchSponsorBlockSegments() { private fun fetchSponsorBlockSegments() {
CoroutineScope(Dispatchers.IO).launch { CoroutineScope(Dispatchers.IO).launch {
kotlin.runCatching { runCatching {
val categories = PlayerHelper.getSponsorBlockCategories() val categories = PlayerHelper.getSponsorBlockCategories()
if (categories.size > 0) { if (categories.isEmpty()) return@runCatching
segmentData = segmentData =
RetrofitInstance.api.getSegments( RetrofitInstance.api.getSegments(
videoId!!, videoId!!,
@ -641,7 +650,6 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
} }
} }
} }
}
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
private fun refreshLiveStatus() { private fun refreshLiveStatus() {
@ -699,7 +707,6 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
videoId = nextVideoId videoId = nextVideoId
// forces the comments to reload for the new video // forces the comments to reload for the new video
commentsLoaded = false
binding.commentsRecView.adapter = null binding.commentsRecView.adapter = null
playVideo() playVideo()
} }
@ -742,7 +749,7 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
private fun initializePlayerView(response: com.github.libretube.api.obj.Streams) { private fun initializePlayerView(response: Streams) {
// initialize the player view actions // initialize the player view actions
binding.player.initialize( binding.player.initialize(
childFragmentManager, childFragmentManager,
@ -891,13 +898,7 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
} }
} }
} }
if (PlayerHelper.relatedStreamsEnabled) { initializeRelatedVideos(response.relatedStreams)
// only show related streams if enabled
binding.relatedRecView.adapter = VideosAdapter(
response.relatedStreams.orEmpty().toMutableList(),
childFragmentManager
)
}
// set video description // set video description
val description = response.description!! val description = response.description!!
binding.playerDescription.text = binding.playerDescription.text =
@ -960,6 +961,23 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
} }
} }
private fun initializeRelatedVideos(relatedStreams: List<StreamItem>?) {
if (!PlayerHelper.relatedStreamsEnabled) return
if (PlayerHelper.alternativeVideoLayout) {
binding.alternativeTrendingRec.adapter = VideosAdapter(
relatedStreams.orEmpty().toMutableList(),
childFragmentManager,
forceMode = VideosAdapter.Companion.ForceMode.RELATED
)
} else {
binding.relatedRecView.adapter = VideosAdapter(
relatedStreams.orEmpty().toMutableList(),
childFragmentManager
)
}
}
private fun initializeChapters() { private fun initializeChapters() {
if (chapters.isEmpty()) { if (chapters.isEmpty()) {
binding.chaptersRecView.visibility = View.GONE binding.chaptersRecView.visibility = View.GONE
@ -1158,7 +1176,7 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
} }
private fun setStreamSource( private fun setStreamSource(
streams: com.github.libretube.api.obj.Streams, streams: Streams,
videosNameArray: Array<String>, videosNameArray: Array<String>,
videosUrlArray: Array<Uri> videosUrlArray: Array<Uri>
) { ) {
@ -1269,7 +1287,6 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
commentsAdapter = CommentsAdapter(videoId!!, commentsResponse.comments) commentsAdapter = CommentsAdapter(videoId!!, commentsResponse.comments)
binding.commentsRecView.adapter = commentsAdapter binding.commentsRecView.adapter = commentsAdapter
nextPage = commentsResponse.nextpage nextPage = commentsResponse.nextpage
commentsLoaded = true
isLoading = false isLoading = false
} }
} }

View File

@ -1,10 +1,6 @@
package com.github.libretube.ui.preferences package com.github.libretube.ui.preferences
import android.content.ActivityNotFoundException
import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.provider.Settings
import android.widget.Toast
import androidx.preference.ListPreference import androidx.preference.ListPreference
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.SwitchPreferenceCompat import androidx.preference.SwitchPreferenceCompat
@ -14,7 +10,6 @@ import com.github.libretube.ui.activities.SettingsActivity
import com.github.libretube.ui.base.BasePreferenceFragment import com.github.libretube.ui.base.BasePreferenceFragment
import com.github.libretube.ui.dialogs.NavBarOptionsDialog import com.github.libretube.ui.dialogs.NavBarOptionsDialog
import com.github.libretube.ui.dialogs.RequireRestartDialog import com.github.libretube.ui.dialogs.RequireRestartDialog
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.util.ThemeHelper import com.github.libretube.util.ThemeHelper
import com.google.android.material.color.DynamicColors import com.google.android.material.color.DynamicColors
@ -69,27 +64,6 @@ class AppearanceSettings : BasePreferenceFragment() {
true true
} }
val systemCaptionStyle =
findPreference<SwitchPreferenceCompat>(PreferenceKeys.SYSTEM_CAPTION_STYLE)
val captionSettings = findPreference<Preference>(PreferenceKeys.CAPTION_SETTINGS)
captionSettings?.isVisible =
PreferenceHelper.getBoolean(PreferenceKeys.SYSTEM_CAPTION_STYLE, true)
systemCaptionStyle?.setOnPreferenceChangeListener { _, newValue ->
captionSettings?.isVisible = newValue as Boolean
true
}
captionSettings?.setOnPreferenceClickListener {
try {
val captionSettingsIntent = Intent(Settings.ACTION_CAPTIONING_SETTINGS)
startActivity(captionSettingsIntent)
} catch (e: ActivityNotFoundException) {
Toast.makeText(activity, R.string.error, Toast.LENGTH_SHORT).show()
}
true
}
val legacySubscriptionView = val legacySubscriptionView =
findPreference<SwitchPreferenceCompat>(PreferenceKeys.LEGACY_SUBSCRIPTIONS) findPreference<SwitchPreferenceCompat>(PreferenceKeys.LEGACY_SUBSCRIPTIONS)
val legacySubscriptionColumns = val legacySubscriptionColumns =

View File

@ -1,6 +1,10 @@
package com.github.libretube.ui.preferences package com.github.libretube.ui.preferences
import android.content.ActivityNotFoundException
import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.provider.Settings
import android.widget.Toast
import androidx.preference.ListPreference import androidx.preference.ListPreference
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.SwitchPreferenceCompat import androidx.preference.SwitchPreferenceCompat
@ -37,6 +41,27 @@ class PlayerSettings : BasePreferenceFragment() {
val defaultSubtitle = findPreference<ListPreference>(PreferenceKeys.DEFAULT_SUBTITLE) val defaultSubtitle = findPreference<ListPreference>(PreferenceKeys.DEFAULT_SUBTITLE)
defaultSubtitle?.let { setupSubtitlePref(it) } defaultSubtitle?.let { setupSubtitlePref(it) }
val systemCaptionStyle =
findPreference<SwitchPreferenceCompat>(PreferenceKeys.SYSTEM_CAPTION_STYLE)
val captionSettings = findPreference<Preference>(PreferenceKeys.CAPTION_SETTINGS)
captionSettings?.isVisible =
PreferenceHelper.getBoolean(PreferenceKeys.SYSTEM_CAPTION_STYLE, true)
systemCaptionStyle?.setOnPreferenceChangeListener { _, newValue ->
captionSettings?.isVisible = newValue as Boolean
true
}
captionSettings?.setOnPreferenceClickListener {
try {
val captionSettingsIntent = Intent(Settings.ACTION_CAPTIONING_SETTINGS)
startActivity(captionSettingsIntent)
} catch (e: ActivityNotFoundException) {
Toast.makeText(activity, R.string.error, Toast.LENGTH_SHORT).show()
}
true
}
} }
private fun setupSubtitlePref(preference: ListPreference) { private fun setupSubtitlePref(preference: ListPreference) {

View File

@ -287,6 +287,12 @@ object PlayerHelper {
"fit" "fit"
) )
val alternativeVideoLayout: Boolean
get() = PreferenceHelper.getBoolean(
PreferenceKeys.ALTERNATIVE_PLAYER_LAYOUT,
false
)
fun getDefaultResolution(context: Context): String { fun getDefaultResolution(context: Context): String {
return if (NetworkHelper.isNetworkMobile(context)) { return if (NetworkHelper.isNetworkMobile(context)) {
PreferenceHelper.getString( PreferenceHelper.getString(

View File

@ -5,8 +5,7 @@
android:id="@+id/playerMotionLayout" android:id="@+id/playerMotionLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layoutDescription="@xml/player_scene" app:layoutDescription="@xml/player_scene">
tools:context=".ui.fragments.PlayerFragment">
<ScrollView <ScrollView
android:id="@+id/player_scrollView" android:id="@+id/player_scrollView"
@ -147,13 +146,13 @@
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:gravity="center" android:gravity="center"
android:weightSum="5" android:orientation="horizontal"
android:orientation="horizontal"> android:weightSum="5">
<LinearLayout <LinearLayout
android:id="@+id/relPlayer_share" android:id="@+id/relPlayer_share"
android:layout_weight="1" style="@style/PlayerActionsLayout"
style="@style/PlayerActionsLayout"> android:layout_weight="1">
<ImageView <ImageView
android:layout_width="24dp" android:layout_width="24dp"
@ -161,16 +160,16 @@
android:src="@drawable/ic_share" /> android:src="@drawable/ic_share" />
<TextView <TextView
style="@style/PlayerActionsText"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/PlayerActionsText"
android:text="@string/share" /> android:text="@string/share" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/relPlayer_download" android:id="@+id/relPlayer_download"
android:layout_weight="1" style="@style/PlayerActionsLayout"
style="@style/PlayerActionsLayout"> android:layout_weight="1">
<ImageView <ImageView
android:layout_width="24dp" android:layout_width="24dp"
@ -178,16 +177,16 @@
android:src="@drawable/ic_download" /> android:src="@drawable/ic_download" />
<TextView <TextView
style="@style/PlayerActionsText"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/PlayerActionsText"
android:text="@string/download" /> android:text="@string/download" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/relPlayer_open" android:id="@+id/relPlayer_open"
android:layout_weight="1" style="@style/PlayerActionsLayout"
style="@style/PlayerActionsLayout"> android:layout_weight="1">
<ImageView <ImageView
android:layout_width="24dp" android:layout_width="24dp"
@ -196,16 +195,16 @@
android:src="@drawable/ic_open" /> android:src="@drawable/ic_open" />
<TextView <TextView
style="@style/PlayerActionsText"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/PlayerActionsText"
android:text="@string/open" /> android:text="@string/open" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/relPlayer_background" android:id="@+id/relPlayer_background"
android:layout_weight="1" style="@style/PlayerActionsLayout"
style="@style/PlayerActionsLayout"> android:layout_weight="1">
<ImageView <ImageView
android:layout_width="24dp" android:layout_width="24dp"
@ -213,16 +212,16 @@
android:src="@drawable/ic_headphones" /> android:src="@drawable/ic_headphones" />
<TextView <TextView
style="@style/PlayerActionsText"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/PlayerActionsText"
android:text="@string/audio" /> android:text="@string/audio" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/relPlayer_save" android:id="@+id/relPlayer_save"
android:layout_weight="1" style="@style/PlayerActionsLayout"
style="@style/PlayerActionsLayout"> android:layout_weight="1">
<ImageView <ImageView
android:layout_width="24dp" android:layout_width="24dp"
@ -230,9 +229,9 @@
android:src="@drawable/ic_save" /> android:src="@drawable/ic_save" />
<TextView <TextView
style="@style/PlayerActionsText"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/PlayerActionsText"
android:text="@string/save" /> android:text="@string/save" />
</LinearLayout> </LinearLayout>
@ -300,6 +299,12 @@
app:cornerRadius="11dp" /> app:cornerRadius="11dp" />
</LinearLayout> </LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/alternativeTrendingRec"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp" />
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/comments_toggle" android:id="@+id/comments_toggle"
style="@style/Widget.Material3.CardView.Elevated" style="@style/Widget.Material3.CardView.Elevated"

View File

@ -82,6 +82,8 @@
android:id="@+id/textView_channel" android:id="@+id/textView_channel"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:paddingBottom="16dp" android:paddingBottom="16dp"
app:layout_constraintEnd_toEndOf="@+id/textView_title" app:layout_constraintEnd_toEndOf="@+id/textView_title"
app:layout_constraintStart_toStartOf="@+id/textView_title" app:layout_constraintStart_toStartOf="@+id/textView_title"

View File

@ -228,7 +228,7 @@
<string name="change_playback_speed">Playback speed</string> <string name="change_playback_speed">Playback speed</string>
<string name="require_restart">App restart required</string> <string name="require_restart">App restart required</string>
<string name="require_restart_message">This change requires the app to be restarted. Press \'Ok\' to restart now.</string> <string name="require_restart_message">This change requires the app to be restarted. Press \'Ok\' to restart now.</string>
<string name="navLabelVisibility">Navbar label visibility</string> <string name="navLabelVisibility">Label visibility</string>
<string name="always">Always</string> <string name="always">Always</string>
<string name="selected">Selected</string> <string name="selected">Selected</string>
<string name="never">Never</string> <string name="never">Never</string>
@ -365,6 +365,11 @@
<string name="end_time">End time</string> <string name="end_time">End time</string>
<string name="notification_time">Notification time</string> <string name="notification_time">Notification time</string>
<string name="notification_time_summary">Time span in which notifications are allowed to show.</string> <string name="notification_time_summary">Time span in which notifications are allowed to show.</string>
<string name="alternative_trending_layout">Alternative trending layout</string>
<string name="navbar_order">Order</string>
<string name="layout">Layout</string>
<string name="alternative_player_layout">Alternative player layout</string>
<string name="alternative_player_layout_summary">Show the related videos as a row above the comments instead of below.</string>
<!-- Notification channel strings --> <!-- Notification channel strings -->
<string name="download_channel_name">Download Service</string> <string name="download_channel_name">Download Service</string>

View File

@ -38,14 +38,14 @@
app:title="@string/app_icon" app:title="@string/app_icon"
app:useSimpleSummaryProvider="true" /> app:useSimpleSummaryProvider="true" />
</PreferenceCategory>
<PreferenceCategory app:title="@string/navigation_bar">
<Preference <Preference
android:icon="@drawable/ic_home" android:icon="@drawable/ic_home"
app:key="navbar_items" app:key="navbar_items"
app:title="@string/navigation_bar" /> app:title="@string/navbar_order" />
</PreferenceCategory>
<PreferenceCategory app:title="@string/app_behavior">
<ListPreference <ListPreference
android:icon="@drawable/ic_label" android:icon="@drawable/ic_label"
@ -56,33 +56,9 @@
app:title="@string/navLabelVisibility" app:title="@string/navLabelVisibility"
app:useSimpleSummaryProvider="true" /> app:useSimpleSummaryProvider="true" />
<ListPreference
android:icon="@drawable/ic_grid"
app:defaultValue="@integer/grid_items"
app:entries="@array/grid"
app:entryValues="@array/grid"
app:key="grid"
app:title="@string/grid"
app:useSimpleSummaryProvider="true" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory app:title="@string/player"> <PreferenceCategory app:title="@string/layout">
<SwitchPreferenceCompat
android:icon="@drawable/ic_caption"
app:defaultValue="true"
app:key="system_caption_style"
app:title="@string/system_caption_style" />
<Preference
android:icon="@drawable/ic_settings"
app:key="caption_settings"
app:title="@string/caption_settings" />
</PreferenceCategory>
<PreferenceCategory app:title="@string/misc">
<SwitchPreferenceCompat <SwitchPreferenceCompat
app:defaultValue="false" app:defaultValue="false"
@ -105,6 +81,26 @@
app:key="alternative_videos_layout" app:key="alternative_videos_layout"
app:title="@string/alternative_videos_layout" /> app:title="@string/alternative_videos_layout" />
<SwitchPreferenceCompat
android:icon="@drawable/ic_list"
app:defaultValue="false"
app:key="alternative_player_layout"
app:summary="@string/alternative_player_layout_summary"
app:title="@string/alternative_player_layout" />
<ListPreference
android:icon="@drawable/ic_grid"
app:defaultValue="@integer/grid_items"
app:entries="@array/grid"
app:entryValues="@array/grid"
app:key="grid"
app:title="@string/grid"
app:useSimpleSummaryProvider="true" />
</PreferenceCategory>
<PreferenceCategory app:title="@string/misc">
<ListPreference <ListPreference
android:defaultValue="recent" android:defaultValue="recent"
android:entries="@array/playlistSortingOptions" android:entries="@array/playlistSortingOptions"

View File

@ -55,6 +55,21 @@
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory app:title="@string/appearance">
<SwitchPreferenceCompat
android:icon="@drawable/ic_caption"
app:defaultValue="true"
app:key="system_caption_style"
app:title="@string/system_caption_style" />
<Preference
android:icon="@drawable/ic_settings"
app:key="caption_settings"
app:title="@string/caption_settings" />
</PreferenceCategory>
<PreferenceCategory app:title="@string/behavior"> <PreferenceCategory app:title="@string/behavior">
<SwitchPreferenceCompat <SwitchPreferenceCompat