Added preview of the current playback speed and video quality in the VideoOptionsFragment

This commit is contained in:
Florian CUNY 2020-07-04 22:30:58 +02:00
parent 8d7063ee78
commit 70593c17ee
19 changed files with 52 additions and 39 deletions

View File

@ -18,7 +18,9 @@
package net.schueller.peertube.fragment; package net.schueller.peertube.fragment;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -65,7 +67,7 @@ public class VideoOptionsFragment extends BottomSheetDialogFragment {
LinearLayout menuRow = (LinearLayout) inflater.inflate(R.layout.row_popup_menu, null); LinearLayout menuRow = (LinearLayout) inflater.inflate(R.layout.row_popup_menu, null);
TextView iconView = menuRow.findViewById(R.id.video_quality_icon); TextView iconView = menuRow.findViewById(R.id.video_quality_icon);
TextView textView = menuRow.findViewById(R.id.video_quality_text); TextView textView = menuRow.findViewById(R.id.video_quality_text);
textView.setText(getString(R.string.menu_video_options_playback_speed)); textView.setText(String.format(getString(R.string.menu_video_options_playback_speed), videoPlayerService.getPlayBackSpeed()));
iconView.setText(R.string.video_option_speed_icon); iconView.setText(R.string.video_option_speed_icon);
new Iconics.IconicsBuilder().ctx(getContext()).on(iconView).build(); new Iconics.IconicsBuilder().ctx(getContext()).on(iconView).build();
textView.setOnClickListener(view1 -> { textView.setOnClickListener(view1 -> {
@ -80,7 +82,7 @@ public class VideoOptionsFragment extends BottomSheetDialogFragment {
LinearLayout menuRow2 = (LinearLayout) inflater.inflate(R.layout.row_popup_menu, null); LinearLayout menuRow2 = (LinearLayout) inflater.inflate(R.layout.row_popup_menu, null);
TextView iconView2 = menuRow2.findViewById(R.id.video_quality_icon); TextView iconView2 = menuRow2.findViewById(R.id.video_quality_icon);
TextView textView2 = menuRow2.findViewById(R.id.video_quality_text); TextView textView2 = menuRow2.findViewById(R.id.video_quality_text);
textView2.setText(getString(R.string.menu_video_options_quality)); textView2.setText(String.format(getString(R.string.menu_video_options_quality), getCurrentVideoQuality(files)));
iconView2.setText(R.string.video_option_quality_icon); iconView2.setText(R.string.video_option_quality_icon);
new Iconics.IconicsBuilder().ctx(getContext()).on(iconView2).build(); new Iconics.IconicsBuilder().ctx(getContext()).on(iconView2).build();
textView2.setOnClickListener(view1 -> { textView2.setOnClickListener(view1 -> {
@ -95,4 +97,15 @@ public class VideoOptionsFragment extends BottomSheetDialogFragment {
} }
private String getCurrentVideoQuality(ArrayList<File> files) {
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
Integer videoQuality = sharedPref.getInt("pref_quality", 0);
for (File file : files) {
if (videoQuality.equals(file.getResolution().getId())) {
return file.getResolution().getLabel();
}
}
return "Auto";
}
} }

View File

@ -143,9 +143,9 @@
<string name="video_meta_button_license">الرخصة</string> <string name="video_meta_button_license">الرخصة</string>
<string name="video_meta_button_language">اللغة</string> <string name="video_meta_button_language">اللغة</string>
<string name="video_meta_button_tags">العلامات</string> <string name="video_meta_button_tags">العلامات</string>
<string name="menu_video_options_playback_speed">سرعة التشغيل</string> <string name="menu_video_options_playback_speed" formatted="true">سرعة التشغيل</string>
<string name="menu_video_options_quality">الجودة</string> <string name="menu_video_options_quality" formatted="true">(%s) الجودة</string>
<string name="account_bottom_menu_videos">الفيديو</string> <string name="account_bottom_menu_videos" formatted="true">الفيديو (s%)</string>
<string name="account_bottom_menu_channels">القنوات</string> <string name="account_bottom_menu_channels">القنوات</string>
<string name="account_bottom_menu_about">حول</string> <string name="account_bottom_menu_about">حول</string>
<string name="account_about_account">الحساب:</string> <string name="account_about_account">الحساب:</string>

View File

@ -285,8 +285,8 @@
<string name="deeppurple">গাঢ় বেগুনি</string> <string name="deeppurple">গাঢ় বেগুনি</string>
<string name="action_bar_title_account">অ্যাকাউন্ট</string> <string name="action_bar_title_account">অ্যাকাউন্ট</string>
<string name="bottom_nav_title_recent">সাম্প্রতিক</string> <string name="bottom_nav_title_recent">সাম্প্রতিক</string>
<string name="menu_video_options_playback_speed">প্লেব্যাক এর গতি</string> <string name="menu_video_options_playback_speed" formatted="true">প্লেব্যাক এর গতি (%s)</string>
<string name="menu_video_options_quality">কোয়ালিটি</string> <string name="menu_video_options_quality" formatted="true">কোয়ালিটি (%s)</string>
<string name="account_bottom_menu_videos">ভিডিও</string> <string name="account_bottom_menu_videos">ভিডিও</string>
<string name="account_bottom_menu_channels">চ্যানেলগুলি</string> <string name="account_bottom_menu_channels">চ্যানেলগুলি</string>
<string name="account_bottom_menu_about">সম্পর্কিত</string> <string name="account_bottom_menu_about">সম্পর্কিত</string>

View File

@ -276,8 +276,8 @@
<string name="video_meta_button_license">Lizenz</string> <string name="video_meta_button_license">Lizenz</string>
<string name="video_meta_button_language">Sprache</string> <string name="video_meta_button_language">Sprache</string>
<string name="video_meta_button_tags">Tags</string> <string name="video_meta_button_tags">Tags</string>
<string name="menu_video_options_playback_speed">Wiedergabegeschwindigkeit</string> <string name="menu_video_options_playback_speed" formatted="true">Wiedergabegeschwindigkeit (%s)</string>
<string name="menu_video_options_quality">Qualität</string> <string name="menu_video_options_quality" formatted="true">Qualität (%s)</string>
<string name="account_bottom_menu_videos">Videos</string> <string name="account_bottom_menu_videos">Videos</string>
<string name="account_bottom_menu_channels">Kanäle</string> <string name="account_bottom_menu_channels">Kanäle</string>
<string name="account_bottom_menu_about">Über</string> <string name="account_bottom_menu_about">Über</string>

View File

@ -96,8 +96,8 @@
<string name="video_meta_button_license">Licencia</string> <string name="video_meta_button_license">Licencia</string>
<string name="video_meta_button_language">Idioma</string> <string name="video_meta_button_language">Idioma</string>
<string name="video_meta_button_tags">Etiquetas</string> <string name="video_meta_button_tags">Etiquetas</string>
<string name="menu_video_options_playback_speed">Velocidad de reproducción</string> <string name="menu_video_options_playback_speed" formatted="true">Velocidad de reproducción (%s)</string>
<string name="menu_video_options_quality">Calidad</string> <string name="menu_video_options_quality" formatted="true">Calidad (%s)</string>
<string name="account_bottom_menu_videos">Vídeos</string> <string name="account_bottom_menu_videos">Vídeos</string>
<string name="account_bottom_menu_channels">Canales</string> <string name="account_bottom_menu_channels">Canales</string>
<string name="account_bottom_menu_about">Acerca de</string> <string name="account_bottom_menu_about">Acerca de</string>

View File

@ -103,7 +103,7 @@
<string name="mi">maori</string> <string name="mi">maori</string>
<string name="or">oriya (makrokieli)</string> <string name="or">oriya (makrokieli)</string>
<string name="bi">bislama</string> <string name="bi">bislama</string>
<string name="menu_video_options_quality">Laatu</string> <string name="menu_video_options_quality" formatted="true">Laatu (%s)</string>
<string name="api_error">Jotain meni pieleen, yritä myöhemmin!</string> <string name="api_error">Jotain meni pieleen, yritä myöhemmin!</string>
<string name="bg">bulgaria</string> <string name="bg">bulgaria</string>
<string name="uz">uzbekki</string> <string name="uz">uzbekki</string>
@ -204,7 +204,7 @@
<string name="nv">navajo</string> <string name="nv">navajo</string>
<string name="kr">kanuri</string> <string name="kr">kanuri</string>
<string name="su">sunda</string> <string name="su">sunda</string>
<string name="menu_video_options_playback_speed">Toistonopeus</string> <string name="menu_video_options_playback_speed" formatted="true">Toistonopeus (%s)</string>
<string name="ii">sichuanin-yi</string> <string name="ii">sichuanin-yi</string>
<string name="red">Punainen</string> <string name="red">Punainen</string>
<string name="video_row_video_thumbnail">Videon esikatselukuva</string> <string name="video_row_video_thumbnail">Videon esikatselukuva</string>

View File

@ -99,8 +99,8 @@
<string name="video_meta_button_license">Licence</string> <string name="video_meta_button_license">Licence</string>
<string name="video_meta_button_language">Langue</string> <string name="video_meta_button_language">Langue</string>
<string name="video_meta_button_tags">Étiquettes</string> <string name="video_meta_button_tags">Étiquettes</string>
<string name="menu_video_options_playback_speed">Vitesse de lecture</string> <string name="menu_video_options_playback_speed" formatted="true">Vitesse de lecture (%s)</string>
<string name="menu_video_options_quality">Qualité</string> <string name="menu_video_options_quality" formatted="true">Qualité (%s)</string>
<string name="account_bottom_menu_videos">Vidéos</string> <string name="account_bottom_menu_videos">Vidéos</string>
<string name="account_bottom_menu_channels">Chaînes</string> <string name="account_bottom_menu_channels">Chaînes</string>
<string name="account_bottom_menu_about">À propos</string> <string name="account_bottom_menu_about">À propos</string>

View File

@ -285,8 +285,8 @@
<string name="video_meta_button_license">Ceadachas</string> <string name="video_meta_button_license">Ceadachas</string>
<string name="video_meta_button_language">Cànan</string> <string name="video_meta_button_language">Cànan</string>
<string name="video_meta_button_tags">Tagaichean</string> <string name="video_meta_button_tags">Tagaichean</string>
<string name="menu_video_options_playback_speed">Luaths na cluiche</string> <string name="menu_video_options_playback_speed" formatted="true">Luaths na cluiche (%s)</string>
<string name="menu_video_options_quality">Càileachd</string> <string name="menu_video_options_quality" formatted="true">Càileachd (%s)</string>
<string name="account_bottom_menu_videos">Videothan</string> <string name="account_bottom_menu_videos">Videothan</string>
<string name="account_bottom_menu_channels">Seanailean</string> <string name="account_bottom_menu_channels">Seanailean</string>
<string name="account_bottom_menu_about">Mu dhèidhinn</string> <string name="account_bottom_menu_about">Mu dhèidhinn</string>

View File

@ -286,8 +286,8 @@
<string name="video_meta_button_license">Licenza</string> <string name="video_meta_button_license">Licenza</string>
<string name="video_meta_button_language">Lingua</string> <string name="video_meta_button_language">Lingua</string>
<string name="video_meta_button_tags">Parole chiave</string> <string name="video_meta_button_tags">Parole chiave</string>
<string name="menu_video_options_playback_speed">Velocità di riproduzione</string> <string name="menu_video_options_playback_speed" formatted="true">Velocità di riproduzione (%s)</string>
<string name="menu_video_options_quality">Qualità</string> <string name="menu_video_options_quality" formatted="true">Qualità (%s)</string>
<string name="account_bottom_menu_videos">Video</string> <string name="account_bottom_menu_videos">Video</string>
<string name="account_bottom_menu_channels">Canali</string> <string name="account_bottom_menu_channels">Canali</string>
<string name="account_bottom_menu_about">A proposito</string> <string name="account_bottom_menu_about">A proposito</string>

View File

@ -88,8 +88,8 @@
<string name="video_meta_button_license">ラインセンス</string> <string name="video_meta_button_license">ラインセンス</string>
<string name="video_meta_button_language">言語</string> <string name="video_meta_button_language">言語</string>
<string name="video_meta_button_tags">タグ</string> <string name="video_meta_button_tags">タグ</string>
<string name="menu_video_options_playback_speed">再生速度</string> <string name="menu_video_options_playback_speed" formatted="true">再生速度 (%s)</string>
<string name="menu_video_options_quality">クオリティ</string> <string name="menu_video_options_quality" formatted="true">クオリティ(%s)</string>
<string name="account_bottom_menu_videos">ビデオ</string> <string name="account_bottom_menu_videos">ビデオ</string>
<string name="account_bottom_menu_channels">チャンネル</string> <string name="account_bottom_menu_channels">チャンネル</string>
<string name="account_bottom_menu_about">情報</string> <string name="account_bottom_menu_about">情報</string>

View File

@ -51,8 +51,8 @@
<string name="video_meta_button_license">Lisens</string> <string name="video_meta_button_license">Lisens</string>
<string name="video_meta_button_language">Språk</string> <string name="video_meta_button_language">Språk</string>
<string name="video_meta_button_tags">Etiketter</string> <string name="video_meta_button_tags">Etiketter</string>
<string name="menu_video_options_playback_speed">Avspillingshastighet</string> <string name="menu_video_options_playback_speed" formatted="true">Avspillingshastighet (%s)</string>
<string name="menu_video_options_quality">Kvalitet</string> <string name="menu_video_options_quality" formatted="true">Kvalitet (%s)</string>
<string name="account_bottom_menu_videos">Videoer</string> <string name="account_bottom_menu_videos">Videoer</string>
<string name="account_bottom_menu_channels">Kanaler</string> <string name="account_bottom_menu_channels">Kanaler</string>
<string name="account_bottom_menu_about">Om</string> <string name="account_bottom_menu_about">Om</string>

View File

@ -275,8 +275,8 @@
<string name="video_meta_button_license">Licentie</string> <string name="video_meta_button_license">Licentie</string>
<string name="video_meta_button_language">Taal</string> <string name="video_meta_button_language">Taal</string>
<string name="video_meta_button_tags">Labels</string> <string name="video_meta_button_tags">Labels</string>
<string name="menu_video_options_playback_speed">Afspeelsnelheid</string> <string name="menu_video_options_playback_speed" formatted="true">Afspeelsnelheid (%s)</string>
<string name="menu_video_options_quality">Kwaliteit</string> <string name="menu_video_options_quality" formatted="true">Kwaliteit (%s)</string>
<string name="account_bottom_menu_videos">Video\'s</string> <string name="account_bottom_menu_videos">Video\'s</string>
<string name="account_bottom_menu_channels">Kanalen</string> <string name="account_bottom_menu_channels">Kanalen</string>
<string name="account_bottom_menu_about">Over</string> <string name="account_bottom_menu_about">Over</string>

View File

@ -48,8 +48,8 @@
<string name="account_about_account">Konto:</string> <string name="account_about_account">Konto:</string>
<string name="account_bottom_menu_channels">Kanały</string> <string name="account_bottom_menu_channels">Kanały</string>
<string name="account_bottom_menu_videos">Filmy</string> <string name="account_bottom_menu_videos">Filmy</string>
<string name="menu_video_options_quality">Jakość</string> <string name="menu_video_options_quality" formatted="true">Jakość (%s)</string>
<string name="menu_video_options_playback_speed">Prędkość odtwarzania</string> <string name="menu_video_options_playback_speed" formatted="true">Prędkość odtwarzania (%s)</string>
<string name="video_meta_button_tags">Znaczniki</string> <string name="video_meta_button_tags">Znaczniki</string>
<string name="video_meta_button_language">Język</string> <string name="video_meta_button_language">Język</string>
<string name="video_meta_button_license">Licencja</string> <string name="video_meta_button_license">Licencja</string>

View File

@ -277,8 +277,8 @@
<string name="video_meta_button_license">Лицензия</string> <string name="video_meta_button_license">Лицензия</string>
<string name="video_meta_button_language">Язык</string> <string name="video_meta_button_language">Язык</string>
<string name="video_meta_button_tags">Теги</string> <string name="video_meta_button_tags">Теги</string>
<string name="menu_video_options_playback_speed">Скорость воспроизведения</string> <string name="menu_video_options_playback_speed" formatted="true">Скорость воспроизведения (%s)</string>
<string name="menu_video_options_quality">Качество</string> <string name="menu_video_options_quality" formatted="true">Качество (%s)</string>
<string name="account_about_description">Описание:</string> <string name="account_about_description">Описание:</string>
<string name="api_error">Что-то пошло не так, пожалуйста, попробуйте позже!</string> <string name="api_error">Что-то пошло не так, пожалуйста, попробуйте позже!</string>
<string name="action_set_url">Выберите сервер</string> <string name="action_set_url">Выберите сервер</string>

View File

@ -272,8 +272,8 @@
<string name="video_meta_button_license">Licens</string> <string name="video_meta_button_license">Licens</string>
<string name="video_meta_button_language">Språk</string> <string name="video_meta_button_language">Språk</string>
<string name="video_meta_button_tags">Taggar</string> <string name="video_meta_button_tags">Taggar</string>
<string name="menu_video_options_playback_speed">Uppspelningshastighet</string> <string name="menu_video_options_playback_speed" formatted="true">Uppspelningshastighet (%s)</string>
<string name="menu_video_options_quality">Kvalitet</string> <string name="menu_video_options_quality" formatted="true">Kvalitet (%s)</string>
<string name="account_bottom_menu_videos">Videor</string> <string name="account_bottom_menu_videos">Videor</string>
<string name="account_bottom_menu_channels">Kanaler</string> <string name="account_bottom_menu_channels">Kanaler</string>
<string name="account_bottom_menu_about">Om</string> <string name="account_bottom_menu_about">Om</string>

View File

@ -291,8 +291,8 @@
<string name="video_meta_button_license">Lisans</string> <string name="video_meta_button_license">Lisans</string>
<string name="video_meta_button_language">Dil</string> <string name="video_meta_button_language">Dil</string>
<string name="video_meta_button_tags">Etiketler</string> <string name="video_meta_button_tags">Etiketler</string>
<string name="menu_video_options_playback_speed">Oynatma hızı</string> <string name="menu_video_options_playback_speed" formatted="true">Oynatma hızı (%s)</string>
<string name="menu_video_options_quality">Kalite</string> <string name="menu_video_options_quality" formatted="true">Kalite (%s)</string>
<!-- Constants, Don't translate --> <!-- Constants, Don't translate -->
<string name="action_bar_title_account">Hesap</string> <string name="action_bar_title_account">Hesap</string>
<string name="bottom_nav_title_recent">Yeniler</string> <string name="bottom_nav_title_recent">Yeniler</string>

View File

@ -112,8 +112,8 @@
<string name="video_meta_button_category">类别</string> <string name="video_meta_button_category">类别</string>
<string name="video_meta_button_license">许可</string> <string name="video_meta_button_license">许可</string>
<string name="video_meta_button_tags">标签</string> <string name="video_meta_button_tags">标签</string>
<string name="menu_video_options_playback_speed">播放速度</string> <string name="menu_video_options_playback_speed" formatted="true">播放速度 (%s)</string>
<string name="menu_video_options_quality">画质</string> <string name="menu_video_options_quality" formatted="true">画质 (%s)</string>
<string name="account_bottom_menu_videos">视频</string> <string name="account_bottom_menu_videos">视频</string>
<string name="account_bottom_menu_channels">频道</string> <string name="account_bottom_menu_channels">频道</string>
<string name="account_bottom_menu_about">关于</string> <string name="account_bottom_menu_about">关于</string>

View File

@ -279,8 +279,8 @@
<string name="video_meta_button_license">授權條款</string> <string name="video_meta_button_license">授權條款</string>
<string name="video_meta_button_language">語言</string> <string name="video_meta_button_language">語言</string>
<string name="video_meta_button_tags">標籤</string> <string name="video_meta_button_tags">標籤</string>
<string name="menu_video_options_playback_speed">播放速度</string> <string name="menu_video_options_playback_speed" formatted="true">播放速度 (%s)</string>
<string name="menu_video_options_quality">畫質</string> <string name="menu_video_options_quality" formatted="true">畫質 (%s)</string>
<string name="account_bottom_menu_videos">影片</string> <string name="account_bottom_menu_videos">影片</string>
<string name="account_bottom_menu_channels">頻道</string> <string name="account_bottom_menu_channels">頻道</string>
<string name="account_bottom_menu_about">關於</string> <string name="account_bottom_menu_about">關於</string>

View File

@ -324,8 +324,8 @@
<string name="video_meta_button_license">License</string> <string name="video_meta_button_license">License</string>
<string name="video_meta_button_language">Language</string> <string name="video_meta_button_language">Language</string>
<string name="video_meta_button_tags">Tags</string> <string name="video_meta_button_tags">Tags</string>
<string name="menu_video_options_playback_speed">Playback speed</string> <string name="menu_video_options_playback_speed" formatted="true">Playback speed (%s)</string>
<string name="menu_video_options_quality">Quality</string> <string name="menu_video_options_quality" formatted="true">Quality (%s)</string>
<string name="account_bottom_menu_videos">Videos</string> <string name="account_bottom_menu_videos">Videos</string>
<string name="account_bottom_menu_channels">Channels</string> <string name="account_bottom_menu_channels">Channels</string>
<string name="account_bottom_menu_about">About</string> <string name="account_bottom_menu_about">About</string>