From 562f7e7e414ad5164df738eea6043cb8f37fad4d Mon Sep 17 00:00:00 2001 From: Mauricio Colli Date: Sat, 10 Mar 2018 13:16:51 -0300 Subject: [PATCH] Add duration view to video detail fragment - Add "textAllCaps" to the mini stream layout - Closes #609 --- .../fragments/detail/VideoDetailFragment.java | 25 +++++++++++++------ .../main/res/layout/fragment_video_detail.xml | 25 +++++++++++++++++++ .../main/res/layout/list_stream_mini_item.xml | 1 + app/src/main/res/values-es/strings.xml | 1 - app/src/main/res/values-he/strings.xml | 1 - app/src/main/res/values-it/strings.xml | 1 - app/src/main/res/values-nl/strings.xml | 1 - app/src/main/res/values-pt-rBR/strings.xml | 1 - app/src/main/res/values-tr/strings.xml | 1 - app/src/main/res/values-uk/strings.xml | 1 - app/src/main/res/values-zh-rTW/strings.xml | 1 - app/src/main/res/values/strings.xml | 1 - 12 files changed, 43 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 8e8179b9a..fc9a427eb 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -16,7 +16,6 @@ import android.support.v4.content.ContextCompat; import android.support.v4.view.animation.FastOutSlowInInterpolator; import android.support.v7.app.ActionBar; import android.support.v7.app.AlertDialog; -import android.support.v7.widget.Toolbar; import android.text.Html; import android.text.Spanned; import android.text.TextUtils; @@ -92,8 +91,6 @@ import io.reactivex.Single; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.disposables.Disposable; -import io.reactivex.functions.Consumer; -import io.reactivex.functions.Function; import io.reactivex.schedulers.Schedulers; import static org.schabi.newpipe.util.AnimationUtils.animateView; @@ -138,9 +135,9 @@ public class VideoDetailFragment /*////////////////////////////////////////////////////////////////////////// // Views //////////////////////////////////////////////////////////////////////////*/ + private Menu menu; - private Toolbar toolbar; private Spinner spinnerToolbar; private ParallaxScrollView parallaxScrollRootView; @@ -160,6 +157,7 @@ public class VideoDetailFragment private TextView detailControlsAddToPlaylist; private TextView detailControlsDownload; private TextView appendControlsDetail; + private TextView detailDurationView; private LinearLayout videoDescriptionRootLayout; private TextView videoUploadDateView; @@ -461,9 +459,7 @@ public class VideoDetailFragment @Override protected void initViews(View rootView, Bundle savedInstanceState) { super.initViews(rootView, savedInstanceState); - - toolbar = activity.findViewById(R.id.toolbar); - spinnerToolbar = toolbar.findViewById(R.id.toolbar_spinner); + spinnerToolbar = activity.findViewById(R.id.toolbar).findViewById(R.id.toolbar_spinner); parallaxScrollRootView = rootView.findViewById(R.id.detail_main_content); @@ -483,6 +479,7 @@ public class VideoDetailFragment detailControlsAddToPlaylist = rootView.findViewById(R.id.detail_controls_playlist_append); detailControlsDownload = rootView.findViewById(R.id.detail_controls_download); appendControlsDetail = rootView.findViewById(R.id.touch_append_detail); + detailDurationView = rootView.findViewById(R.id.detail_duration_view); videoDescriptionRootLayout = rootView.findViewById(R.id.detail_description_root_layout); videoUploadDateView = rootView.findViewById(R.id.detail_upload_date_view); @@ -1098,6 +1095,7 @@ public class VideoDetailFragment animateView(contentRootLayoutHiding, false, 200); animateView(spinnerToolbar, false, 200); animateView(thumbnailPlayButton, false, 50); + animateView(detailDurationView, false, 100); videoTitleTextView.setText(name != null ? name : ""); videoTitleTextView.setMaxLines(1); @@ -1168,6 +1166,18 @@ public class VideoDetailFragment thumbsDisabledTextView.setVisibility(View.GONE); } + if (info.getDuration() > 0) { + detailDurationView.setText(Localization.getDurationString(info.getDuration())); + detailDurationView.setBackgroundColor(ContextCompat.getColor(activity, R.color.duration_background_color)); + animateView(detailDurationView, true, 100); + } else if (info.getStreamType() == StreamType.LIVE_STREAM) { + detailDurationView.setText(R.string.duration_live); + detailDurationView.setBackgroundColor(ContextCompat.getColor(activity, R.color.live_duration_background_color)); + animateView(detailDurationView, true, 100); + } else { + detailDurationView.setVisibility(View.GONE); + } + videoTitleRoot.setClickable(true); videoTitleToggleArrow.setVisibility(View.VISIBLE); videoTitleToggleArrow.setImageResource(R.drawable.arrow_down); @@ -1201,7 +1211,6 @@ public class VideoDetailFragment case AUDIO_LIVE_STREAM: detailControlsDownload.setVisibility(View.GONE); spinnerToolbar.setVisibility(View.GONE); - toolbar.setTitle(R.string.live); break; default: if (!info.video_streams.isEmpty() || !info.video_only_streams.isEmpty()) break; diff --git a/app/src/main/res/layout/fragment_video_detail.xml b/app/src/main/res/layout/fragment_video_detail.xml index fb9ee2890..cc14e1322 100644 --- a/app/src/main/res/layout/fragment_video_detail.xml +++ b/app/src/main/res/layout/fragment_video_detail.xml @@ -70,6 +70,31 @@ android:visibility="gone" tools:ignore="RtlHardcoded" tools:visibility="visible"/> + + diff --git a/app/src/main/res/layout/list_stream_mini_item.xml b/app/src/main/res/layout/list_stream_mini_item.xml index 22cd3887e..bffd13a6f 100644 --- a/app/src/main/res/layout/list_stream_mini_item.xml +++ b/app/src/main/res/layout/list_stream_mini_item.xml @@ -36,6 +36,7 @@ android:paddingLeft="@dimen/video_item_search_duration_horizontal_padding" android:paddingRight="@dimen/video_item_search_duration_horizontal_padding" android:paddingTop="@dimen/video_item_search_duration_vertical_padding" + android:textAllCaps="true" android:textAppearance="?android:attr/textAppearanceSmall" android:textColor="@color/duration_text_color" android:textSize="@dimen/video_item_search_duration_text_size" diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index d381c30fc..e9d686d10 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -408,7 +408,6 @@ abrir en modo popup La búsqueda inexacta permite al reproductor buscar posiciones más rápido con menor precisión Auto-encolar la siguiente transmisión "Automáticamente añadir un vídeo relacionado cuando el reproductor llegue al último vídeo en una lista de reproducción no repetible. " - DIRECTO SINCRONIZAR diff --git a/app/src/main/res/values-he/strings.xml b/app/src/main/res/values-he/strings.xml index a2b1c6abc..cb69d6639 100644 --- a/app/src/main/res/values-he/strings.xml +++ b/app/src/main/res/values-he/strings.xml @@ -308,5 +308,4 @@ יצוא מסד נתונים נגנים חיצוניים לא תומכים בסוגי קישורים אלה כתובת שגויה - חי diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 5436b9883..f7206893d 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -409,7 +409,6 @@ La ricerca imprecisa permette al riproduttore di spostarti nelle posizioni più velocemente con una precisione ridotta Metti in coda automaticamente il prossimo flusso Aggiungi automaticamente un flusso correlato mentre il playback parte dall\'ultimo flusso in una cosa non ripetitiva. - IN DIRETTA SINCRONIZZAZIONE diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index f09914384..4f8e5b0e5 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -404,7 +404,6 @@ te openen in pop-upmodus Minder exact spoelen laat de speler sneller posities zoeken met verminderde precisie Volgende stream automatisch in wachtrij plaatsen Automatisch een gerealteerde stream toekennen als het afspelen van de laatste stream strat in een niet-herhalende afspeelwachtlijst. - LIVE SYNCHRONISEREN diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 909df3080..96e6ccb70 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -383,7 +383,6 @@ abrir em modo popup Usar índice de indexação inexato Adicionar a próxima stream à fila automaticamente Anexar automaticamente uma stream relacionada quando a reprodução iniciar na última stream em uma fila não repetitiva - Ao Vivo Sincronizar diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 9cecac692..9fbb42e0b 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -399,7 +399,6 @@ İsabetsiz konumlama, oynatıcının konumları düşürülmüş duyarlıkla saptamasını sağlar Sonraki akışı kendiliğinden kuyrukla Yinelemeyen oynatma kuyruğundaki son akış başladığında ilişkili akışı kuyruğun sonuna kendiliğinden ekle. - CANLI EŞZAMANLA diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 7399bad2b..0608d8150 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -390,7 +390,6 @@ Неточне шукання дозволяє програвачеві рухатися позиціями швидше, проте з меншою точністю Автоматично додати до черги наступний стрим Автоматично додавати пов\'язаний стрим, під час початку програвання останнього стриму. - НАЖИВО СИНХРОНІЗАЦІЯ diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index f9f8eaf1f..a112b4830 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -385,7 +385,6 @@ 不精確的尋找,允許玩家以更低的精確更快找到位置 自動佇列下一個串流 在非重複播放佇列中的最後一個串流上開始播放時,自動附上相關串流。 - 直播 同步 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e168165e6..c97f12809 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -113,7 +113,6 @@ Show age restricted content Age Restricted Video. Allowing such material is possible from Settings. live - LIVE Downloads Downloads Error report