Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sparky3387 committed Jul 27, 2022
1 parent b6f2ad2 commit 13699f6
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ class UserPreferences(context: Context) : SharedPreferenceStore(
*/
var resumeSubtractDuration = stringPreference("pref_resume_preroll", "0")

/**
* Duration in seconds to subtract from resume time
*/
var subtitleFGColor = stringPreference("subtitleFGColor", "#ffffffff")

/**
* Enable cinema mode
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package org.jellyfin.androidtv.ui.preference.custom

import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Checkable
import android.widget.RadioButton
import android.widget.TextView
import androidx.appcompat.view.ContextThemeWrapper
import androidx.core.view.isVisible
Expand All @@ -15,6 +17,8 @@ import androidx.recyclerview.widget.RecyclerView
import org.jellyfin.androidtv.R
import org.jellyfin.androidtv.databinding.PreferenceRichListBinding



class RichListDialogFragment : LeanbackPreferenceDialogFragmentCompat() {
companion object {
fun newInstance(key: String) = RichListDialogFragment().apply {
Expand Down Expand Up @@ -53,6 +57,8 @@ class RichListDialogFragment : LeanbackPreferenceDialogFragmentCompat() {
val styledInflater = inflater.cloneInContext(styledContext)
binding = PreferenceRichListBinding.inflate(styledInflater, container, false)


//Log.d("CUSTOMRYAN",button?.)
// Dialog
binding.decorTitle.text = preference.dialogTitle

Expand Down Expand Up @@ -112,6 +118,7 @@ class RichListDialogFragment : LeanbackPreferenceDialogFragmentCompat() {
holder as OptionViewHolder

holder.button.isChecked = item.key == selectedValue
holder.button_fg.background=resources.getColor(R.color.subtitles_white)
holder.title.text = item.title
holder.summary.text = item.summary
holder.summary.isVisible = item.summary?.isNotBlank() == true
Expand Down Expand Up @@ -146,6 +153,7 @@ class RichListDialogFragment : LeanbackPreferenceDialogFragmentCompat() {
private val clickListener: (viewHolder: OptionViewHolder) -> Unit
) : RecyclerView.ViewHolder(view), View.OnClickListener {
val button = view.findViewById<View>(R.id.button) as Checkable
val button_fg = view.findViewById<View>(R.id.button)
val title = view.findViewById<TextView>(R.id.title)
val summary = view.findViewById<TextView>(R.id.summary)
val container = view.findViewById<ViewGroup>(R.id.container).also {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.jellyfin.androidtv.ui.preference.screen

import android.app.AlertDialog
import org.jellyfin.androidtv.R
import org.jellyfin.androidtv.auth.store.AuthenticationPreferences
import org.jellyfin.androidtv.preference.UserPreferences
import org.jellyfin.androidtv.preference.constant.AudioBehavior
import org.jellyfin.androidtv.preference.constant.NEXTUP_TIMER_DISABLED
Expand Down Expand Up @@ -70,6 +71,15 @@ class PlaybackPreferencesScreen : OptionsFragment() {
}
bind(userPreferences, UserPreferences.resumeSubtractDuration)
}
@Suppress("MagicNumber")
list {
setTitle(R.string.lbl_subtitle_fg)
val subtitlecolorskeys = context.resources.getStringArray(R.array.pref_subtitle_color_keys)
val subtitlecolorsvalues = context.resources.getIntArray(R.array.pref_subtitle_color_values).map{ "#"+Integer.toHexString(it)}.toTypedArray()
entries = subtitlecolorsvalues.zip(subtitlecolorskeys).toMap()
bind(userPreferences, UserPreferences.subtitleFGColor)

}

checkbox {
setTitle(R.string.lbl_tv_queuing)
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@
<string name="lbl_guide_option_played">Last Played</string>
<string name="lbl_guide_option_number">Channel Number</string>
<string name="lbl_resume_preroll">Resume pre-roll</string>
<string name="lbl_subtitle_fg">Subtitle Foreground Color</string>
<string name="lbl_resume_from">Resume from %1$s</string>
<string name="lbl_more_like_this">More Like This</string>
<string name="lbl_previous_episode">Previous Episode</string>
Expand Down Expand Up @@ -444,6 +445,14 @@
<string name="searchable_settings_description">Media</string>
<string name="pref_subtitles_background_title">Enable background</string>
<string name="pref_subtitles_background_summary">Show a black background behind the subtitles</string>
<string name="pref_subtitles_color_white">White</string>
<string name="pref_subtitles_color_black">Black</string>
<string name="pref_subtitles_color_red">Red</string>
<string name="pref_subtitles_color_green">Green</string>
<string name="pref_subtitles_color_blue">Blue</string>
<string name="pref_subtitles_color_yellow">Yellow</string>
<string name="pref_subtitles_color_pink">Pink</string>
<string name="pref_subtitles_color_cyan">Cyan</string>
<string name="pref_subtitles_size">Text size</string>
<string name="server_issue_unable_to_connect">Unable to connect</string>
<string name="server_issue_invalid_product">Server software is incompatible</string>
Expand Down
33 changes: 33 additions & 0 deletions app/src/main/res/values/subtitle_colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Subtitle Color -->
<color name="subtitles_white">#FFFFFF</color>
<color name="subtitles_black">#000000</color>
<color name="subtitles_red">#C80000</color>
<color name="subtitles_green">#00C800</color>
<color name="subtitles_blue">#0000C8</color>
<color name="subtitles_yellow">#EEDC00</color>
<color name="subtitles_pink">#D60080</color>
<color name="subtitles_cyan">#009FDA</color>
<string-array name="pref_subtitle_color_keys">
<item>@string/pref_subtitles_color_white</item>
<item>@string/pref_subtitles_color_black</item>
<item>@string/pref_subtitles_color_red</item>
<item>@string/pref_subtitles_color_green</item>
<item>@string/pref_subtitles_color_blue</item>
<item>@string/pref_subtitles_color_yellow</item>
<item>@string/pref_subtitles_color_pink</item>
<item>@string/pref_subtitles_color_cyan</item>
</string-array>
<integer-array name="pref_subtitle_color_values">
<item>@color/subtitles_white</item>
<item>@color/subtitles_black</item>
<item>@color/subtitles_red</item>
<item>@color/subtitles_green</item>
<item>@color/subtitles_blue</item>
<item>@color/subtitles_yellow</item>
<item>@color/subtitles_pink</item>
<item>@color/subtitles_cyan</item>
</integer-array>

</resources>
1 change: 0 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=cb87f222c5585bd46838ad4db78463a5c5f3d336e5e2b98dc7c0c586527351c2
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 13699f6

Please sign in to comment.