Skip to content

Commit

Permalink
Add the option to hide video controls (#1210)
Browse files Browse the repository at this point in the history
  • Loading branch information
epireyn authored Jul 25, 2024
1 parent e3ff1cf commit 15d2d21
Show file tree
Hide file tree
Showing 60 changed files with 93 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@ import android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHO
import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import android.view.animation.AnimationUtils
import android.widget.LinearLayout
import androidx.appcompat.app.AlertDialog
import androidx.core.graphics.blue
import androidx.core.graphics.green
import androidx.core.graphics.red
import androidx.core.view.children
import androidx.core.view.isGone
import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import androidx.core.widget.doOnTextChanged
import androidx.preference.PreferenceManager
import com.google.android.material.button.MaterialButton
import com.lagradost.cloudstream3.CommonActivity.keyEventListener
import com.lagradost.cloudstream3.CommonActivity.playerEventListener
import com.lagradost.cloudstream3.CommonActivity.screenHeight
Expand Down Expand Up @@ -120,6 +123,7 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
protected var doubleTapPauseEnabled = true
protected var playerRotateEnabled = false
protected var autoPlayerRotateEnabled = false
private var hideControlsNames = false

protected var subtitleDelay
set(value) = try {
Expand Down Expand Up @@ -1419,6 +1423,8 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
false
)

hideControlsNames = settingsManager.getBoolean(ctx.getString(R.string.hide_player_control_names_key), false)

val profiles = QualityDataHelper.getProfiles()
val type = if (ctx.isUsingMobileData())
QualityDataHelper.QualityProfileType.Data
Expand All @@ -1439,6 +1445,9 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
playerSpeedBtt.isVisible = playBackSpeedEnabled
playerResizeBtt.isVisible = playerResizeEnabled
playerRotateBtt.isVisible = playerRotateEnabled
if (hideControlsNames) {
hideControlsNames()
}
}
} catch (e: Exception) {
logError(e)
Expand Down Expand Up @@ -1591,6 +1600,22 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
}
}

private fun PlayerCustomLayoutBinding.hideControlsNames() {
fun iterate(layout: LinearLayout) {
layout.children.forEach {
if (it is MaterialButton) {
it.textSize = 0f
it.iconPadding = 0
it.iconGravity = MaterialButton.ICON_GRAVITY_TEXT_START
it.setPadding(0,0,0,0)
} else if (it is LinearLayout) {
iterate(it)
}
}
}
iterate(playerLockHolder.parent as LinearLayout)
}

override fun playerDimensionsLoaded(width: Int, height: Int) {
isVerticalOrientation = height > width
updateOrientation()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ class SettingsPlayer : PreferenceFragmentCompat() {
return@setOnPreferenceClickListener true
}

/*(getPref(R.string.double_tap_seek_time_key) as? SeekBarPreference?)?.let {
}*/

getPref(R.string.prefer_limit_title_rez_key)?.setOnPreferenceClickListener {
val prefNames = resources.getStringArray(R.array.limit_title_rez_pref_names)
val prefValues = resources.getIntArray(R.array.limit_title_rez_pref_values)
Expand All @@ -109,6 +105,8 @@ class SettingsPlayer : PreferenceFragmentCompat() {
return@setOnPreferenceClickListener true
}

getPref(R.string.hide_player_control_names_key)?.hideOn(TV)

getPref(R.string.quality_pref_key)?.setOnPreferenceClickListener {
val prefValues = Qualities.values().map { it.value }.reversed().toMutableList()
prefValues.remove(Qualities.Unknown.value)
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-af/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,5 @@
<string name="subs_import_text" formatted="true">Voer lettertipes in deur dit in %s te plaas</string>
<string name="cast_format" formatted="true">Rolverdeling: %s</string>
<string name="subscribe_tooltip">Nuwe episode notifikasie</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ajp/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -640,4 +640,5 @@
<string name="dismiss">تجاهل</string>
<string name="open_downloaded_repo">متاح الريپوزيتوري</string>
<string name="device_pin_url_message">فتاح <b>%s</b> ع تلفونك أو كمپيوترك، وحط الكود اللي فوق</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-am/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,5 @@
<string name="action_open_watching">ተጨማሪ መረጃ</string>
<string name="search_provider_text_types">ዓይነቶችን በመጠቀም ይፈልጉ</string>
<string name="subs_import_text" formatted="true">ቅርጸ-ቁምፊዎችን በ%s ውስጥ በማስቀመጥ ያጫኑ</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -666,4 +666,5 @@
<string name="device_pin_url_message">قم بزيارة <b>%s</b> على هاتفك الذكي أو جهاز الكمبيوتر وأدخل الرمز أعلاه</string>
<string name="device_pin_error_message">لا يمكن الحصول على رمز PIN للجهاز، حاول المصادقة المحلية</string>
<string name="device_pin_counter_text">تنتهي صلاحية الرمز خلال %1$dm %2$ds</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ars/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -352,4 +352,5 @@
<string name="documentaries_singular">وثائقي</string>
<string name="site">موقع</string>
<string name="limit_title">عنوان مشغل الفيديو بحد أقصى لعدد الأحرف</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-as/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -621,4 +621,5 @@
<string name="pick_subtitle">ছাবটাইটেল বাছনি কৰক</string>
<string name="play_episode">পৰ্ব খেলাওক</string>
<string name="sort_apply">প্ৰয়োগ কৰক</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -601,4 +601,5 @@
<string name="recommendations_tooltip">Покажи предложения</string>
<string name="speed_setting_summary">Добавя опция за промяна на скоростта в плеъра</string>
<string name="test_extensions_summary">Този тест е направен за програмисти и не проверява работата на никакви добавки.</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-bn/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -359,4 +359,5 @@
<string name="account">অ্যাকাউন্ট</string>
<string name="logout">প্রস্থান</string>
<string name="episode_format" formatted="true">%1$d%2$s</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-bp/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -656,4 +656,5 @@
<string name="device_pin_error_message">Não é possível obter o código PIN do dispositivo, tente a autenticação local</string>
<string name="device_pin_expired_message">O código PIN expirou!</string>
<string name="device_pin_counter_text">O código expira em %1$dm %2$ds</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -658,4 +658,5 @@
<string name="pref_category_accounts">Účty</string>
<string name="auth_locally">Lokální ověření</string>
<string name="device_pin_expired_message">PIN kód vypršel!</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -615,4 +615,5 @@
<string name="reset_btn">Zurücksetzen</string>
<string name="app_unrestricted_toast">Akkuverbrauch der App ist bereits auf unbeschränkt eingestellt</string>
<string name="app_info_intent_error">CloudStreams App-Info kann nicht geöffnet werden.</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -625,4 +625,5 @@
<string name="biometric_warning">Τα δεδομένα σας στο CloudStream έχουν κάνει back up. Αν και η πιθανότητα είναι πολύ χαμηλή, όλες οι συσκευές συμπεριφέρονται διαφορετικά. Στη σπάνια περίπτωση, που απαγορευτεί η πρόσβασή σας από την εφαρμογή, διαγράψτε τα δεδομένα εφαρμογής και επαναφέρετέ τα από ένα ήδη υπάρχον backup. Συγνώμη για οποιαδήποτε ταλαιπωρία.</string>
<string name="pref_category_accounts">Λογαριασμοί</string>
<string name="pref_category_security">Ασφάλεια</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-eo/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,5 @@
<string name="downloaded">Elŝutite</string>
<string name="downloading">Elŝutante</string>
<string name="download_failed">Elŝuto Malsukcesite</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -634,4 +634,5 @@
<string name="device_pin_expired_message">¡El código PIN ya ha caducado!</string>
<string name="device_pin_counter_text">El código caduca en %1$d mín y %2$d s</string>
<string name="device_pin_error_message">No puedo obtener el código PIN del dispositivo; intente con la autenticación local</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,5 @@
<string name="action_default">پیش‌فرض</string>
<string name="cartoons_singular">کارتون</string>
<string name="torrent_singular">تورنت</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
4 changes: 3 additions & 1 deletion app/src/main/res/values-fil/strings.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources/>
<resources>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -620,4 +620,5 @@
<string name="biometric_setting">Verrouillage biométrique</string>
<string name="player_settings_select_cast_device">Sélectionnez un appareil de diffusion</string>
<string name="next_season_episode_format" formatted="true">Saison %1$d Episode %2$d sera publié dans</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-gl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,5 @@
<string name="automatic_plugin_download_mode_title">Selecciona o modo para filtrar a descarga dos complementos</string>
<string name="automatic_plugin_download_summary">Instala automáticamente todos os complementos aínda non instalados dos repositorios engadidos.</string>
<string name="updates_settings">Mostrar actualizacións da aplicación</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-hi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,5 @@
<string name="subs_outline_color">रूपरेखा रंग</string>
<string name="subs_subtitle_elevation">उपशीर्षक ऊंचाई</string>
<string name="subs_font">अक्षर शैली</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-hr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -651,4 +651,5 @@
<string name="cs3wiki">CloudStream Wiki</string>
<string name="pref_category_accounts">Računi</string>
<string name="pref_category_security">Sigurnost</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-hu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -592,4 +592,5 @@
<string name="pin_error_length">A PIN 4 karakter hosszú kell legyen</string>
<string name="auto_rotate_video">Auto elforgatás</string>
<string name="auto_rotate_video_desc">Az automatikus videó orientáció alapján való képernyő elforgatás bekapcsolása</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-in/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -647,4 +647,5 @@
<string name="cs3wiki">CloudStream Wiki</string>
<string name="pref_category_security">Keamanan</string>
<string name="pref_category_accounts">Akun</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -654,4 +654,5 @@
<string name="device_pin_error_message">Impossibile ottenere il codice PIN del dispositivo, prova l\'autenticazione locale</string>
<string name="device_pin_expired_message">Il codice PIN è scaduto!</string>
<string name="device_pin_counter_text">Il codice scadrà tra %1$dm %2$ds</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-iw/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -550,4 +550,5 @@
\nיגרמו לעדיפות הסרטון להיות 10.
\n
\nשימו לב: אם הסכום הוא 10 או יותר, הנגן ידלג על טעינת הסרטון כאשר הלינק נטען!</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,5 @@
<string name="autoplay_next_settings_des">現在のエピソードが終了したら次のエピソードを開始する</string>
<string name="subs_hold_to_reset_to_default">長押しするとデフォルトにリセットされます</string>
<string name="popup_resume_download">ダウンロードを再開</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-kn/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,5 @@
<string name="swipe_to_change_settings_des">Brightness ಅಥವಾ volume ಬದಲಾಯಿಸಲು ಎಡ ಅಥವಾ ಬಲಭಾಗದಲ್ಲಿ ಮೇಲಕ್ಕೆ ಅಥವಾ ಕೆಳಕ್ಕೆ ಸ್ಲೈಡ್ ಮಾಡಿ</string>
<string name="autoplay_next_settings_des">ಈಗಿನ ಎಪಿಸೋಡ್ ಮುಗಿದಾಗ ಮುಂದಿನ ಎಪಿಸೋಡ್ ಅನ್ನು ಪ್ರಾರಂಭಿಸಿ</string>
<string name="swipe_to_change_settings">ಸೆಟ್ಟಿಂಗ್‌ಗಳನ್ನು ಬದಲಾಯಿಸಲು ಸ್ವೈಪ್ ಮಾಡಿ</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -634,4 +634,5 @@
<string name="enter_pin_with_name" formatted="true">%s의 PIN 입력</string>
<string name="action_remove_from_favorites">즐겨찾기에서 제거</string>
<string name="episode_action_cast_mirror">캐스트미러</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-lt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,5 @@
<string name="confirm_exit_dialog">Ar tikrai norite išeiti\?</string>
<string name="action_remove_from_watched">Pašalinti iš žiūrimų</string>
<string name="audio_tracks">Garso takelis</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-lv/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -527,4 +527,5 @@
<string name="subscription_in_progress_notification">Abonēto šovu atjaunināšana</string>
<string name="subscription_list_name">Abonēts</string>
<string name="subscription_new">Abonēts %s</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-mk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -624,4 +624,5 @@
<string name="clipboard_permission_error">Грешка при пристапот до таблата со исечоци, обидете се повторно.</string>
<string name="clipboard_unknown_error">Грешка при копирање, копирајте го logcat и контактирајте со поддршката за апликацијата.</string>
<string name="audio_book_singular">Аудио книга</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ml/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,5 @@
<string name="subs_edge_type">എഡ്ജ് തരം</string>
<string name="subs_outline_color">ഔട്ട്ലൈൻ നിറം</string>
<string name="subs_background_color">പശ്ചാത്തല നിറം</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ms/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@
<string name="sort_close">Tutup</string>
<string name="app_dub_sub_episode_text_format" formatted="true">Ep</string>
<string name="next_season_episode_format" formatted="true">cuba</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-mt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,5 @@
<string name="error_bookmarks_text">Bookmarks</string>
<string name="action_remove_from_bookmarks">Neħħi</string>
<string name="download_failed">Falla t-tniżżil</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-my/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -550,4 +550,5 @@
<string name="already_voted">သင်နဂိုတည်းကသတ်မှတ်ပြီး</string>
<string name="select_library">လိုက်ဘရီရွေးချယ်ရန်</string>
<string name="open_with">ဖြင့်ဖွင့်မည်</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ne/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,5 @@
<string name="player_subtitles_settings_des">प्लेयरको उपशीर्षकको सेटिङ</string>
<string name="repo_copy_label">रिपोजिटरी को नाम र यूआरएल</string>
<string name="toast_copied">कपी गरियो!</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -608,4 +608,5 @@
<string name="links_reloaded_toast">Link opnieuw geladen</string>
<string name="auto_rotate_video">Autoroteer</string>
<string name="rotate_video">Roteer</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-nn/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,5 @@
<string name="picture_in_picture">Bilde i bilde</string>
<string name="continue_watching">Fortsett å sjå</string>
<string name="reload_error">Prøv tilkopling på nytt…</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-no/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -538,4 +538,5 @@
<string name="use">Bruk</string>
<string name="help">Hjelp</string>
<string name="profile_background_des">Profilbakgrunn</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-or/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,5 @@
<string name="no_data">କୌଣସି ତଥ୍ୟ ନାହିଁ</string>
<string name="app_dub_sub_episode_text_format" formatted="true">%1$s ଅ %2$d</string>
<string name="video_skip_op">ଆଦ୍ୟ ବାଦ୍ ଦିଅ</string>
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
</resources>
Loading

0 comments on commit 15d2d21

Please sign in to comment.