From d12a8894ae6630e10c894abbd04887d8daba1499 Mon Sep 17 00:00:00 2001 From: LagradOst Date: Sat, 14 Aug 2021 22:28:04 +0200 Subject: [PATCH] fixed subs --- app/build.gradle | 4 ++-- .../cloudstream3/ui/player/PlayerFragment.kt | 19 +++++++++++++++---- .../cloudstream3/ui/search/SearchFragment.kt | 5 +++-- app/src/main/res/layout/fragment_player.xml | 1 - .../main/res/layout/player_custom_layout.xml | 16 +++++++++++----- app/src/main/res/values/strings.xml | 3 ++- 6 files changed, 33 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6a90f835..2478c82c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,8 +13,8 @@ android { applicationId "com.lagradost.cloudstream3" minSdkVersion 21 targetSdkVersion 30 - versionCode 13 - versionName "1.2.2" + versionCode 14 + versionName "1.2.3" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt index 3d281a5d..a975703b 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt @@ -12,7 +12,6 @@ import android.content.pm.ActivityInfo import android.content.res.Resources import android.database.ContentObserver import android.graphics.Color -import android.graphics.Typeface import android.graphics.drawable.Icon import android.media.AudioManager import android.net.Uri @@ -45,7 +44,6 @@ import com.google.android.exoplayer2.C.TIME_UNSET import com.google.android.exoplayer2.source.DefaultMediaSourceFactory import com.google.android.exoplayer2.trackselection.DefaultTrackSelector import com.google.android.exoplayer2.ui.AspectRatioFrameLayout -import com.google.android.exoplayer2.ui.CaptionStyleCompat import com.google.android.exoplayer2.ui.SubtitleView import com.google.android.exoplayer2.upstream.DataSource import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory @@ -57,8 +55,8 @@ import com.google.android.gms.cast.framework.CastContext import com.google.android.gms.cast.framework.CastState import com.google.android.material.button.MaterialButton import com.lagradost.cloudstream3.* -import com.lagradost.cloudstream3.MainActivity.Companion.isInPIPMode import com.lagradost.cloudstream3.MainActivity.Companion.canEnterPipMode +import com.lagradost.cloudstream3.MainActivity.Companion.isInPIPMode import com.lagradost.cloudstream3.R import com.lagradost.cloudstream3.mvvm.Resource import com.lagradost.cloudstream3.mvvm.observe @@ -281,6 +279,14 @@ class PlayerFragment : Fragment() { fadeAnimation.duration = 100 fadeAnimation.fillAfter = true + subView?.let { sView -> + val move = if (isShowing) -((bottom_player_bar?.height?.toFloat() ?: 0f) + 10.toPx) else -subStyle.elevation.toPx.toFloat() + ObjectAnimator.ofFloat(sView, "translationY", move).apply { + duration = 200 + start() + } + } + if (!isLocked) { shadow_overlay?.startAnimation(fadeAnimation) } @@ -809,6 +815,11 @@ class PlayerFragment : Fragment() { super.onViewCreated(view, savedInstanceState) subView = player_view.findViewById(R.id.exo_subtitles) + subView?.let { sView -> + (sView.parent as ViewGroup?) ?.removeView(sView) + subtitle_holder.addView(sView) + } + subStyle = context?.getCurrentSavedStyle()!! onSubStyleChanged(subStyle) SubtitlesFragment.applyStyleEvent += ::onSubStyleChanged @@ -1549,7 +1560,7 @@ class PlayerFragment : Fragment() { "\"Chromium\";v=\"91\", \" Not;A Brand\";v=\"99\"" ) dataSource.setRequestProperty("sec-ch-ua-mobile", "?0") - // dataSource.setRequestProperty("Sec-Fetch-Site", "none") //same-site + // dataSource.setRequestProperty("Sec-Fetch-Site", "none") //same-site dataSource.setRequestProperty("Sec-Fetch-User", "?1") dataSource.setRequestProperty("Sec-Fetch-Mode", "navigate") dataSource.setRequestProperty("Sec-Fetch-Dest", "document") diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt index 9611ac48..cb71dc3b 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt @@ -120,8 +120,6 @@ class SearchFragment : Fragment() { val cancelButton = dialog.findViewById(R.id.cancel_btt)!! // val applyHolder = dialog.findViewById(R.id.apply_btt_holder)!! - toggle.text = getString(R.string.search_provider_text) - val arrayAdapter = ArrayAdapter(view.context, R.layout.sort_bottom_single_choice) arrayAdapter.addAll(apiNames) @@ -169,6 +167,9 @@ class SearchFragment : Fragment() { } fun toggleSearch(isOn: Boolean) { + toggle.text = + getString(if (isOn) R.string.search_provider_text_types else R.string.search_provider_text_providers) + if (isOn) { listView2?.visibility = View.VISIBLE listView?.visibility = View.GONE diff --git a/app/src/main/res/layout/fragment_player.xml b/app/src/main/res/layout/fragment_player.xml index 8667305c..7bb3ff76 100644 --- a/app/src/main/res/layout/fragment_player.xml +++ b/app/src/main/res/layout/fragment_player.xml @@ -29,7 +29,6 @@ app:controller_layout_id="@layout/player_custom_layout" /> - - + android:layout_height="match_parent"> + + +