This commit is contained in:
LagradOst 2021-08-04 16:28:36 +02:00
parent 0f6dbb160f
commit e59b26cb0e
4 changed files with 75 additions and 7 deletions

View file

@ -13,8 +13,8 @@ android {
applicationId "com.lagradost.cloudstream3"
minSdkVersion 21
targetSdkVersion 30
versionCode 9
versionName "1.1.7"
versionCode 10
versionName "1.1.8"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -50,7 +50,7 @@ repositories {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'

View file

@ -799,6 +799,7 @@ class PlayerFragment : Fragment() {
Typeface.SANS_SERIF
)
)
subs.translationY = -10.toPx.toFloat()
settingsManager = PreferenceManager.getDefaultSharedPreferences(activity)
swipeEnabled = settingsManager.getBoolean("swipe_enabled", true)
@ -1116,9 +1117,41 @@ class PlayerFragment : Fragment() {
playback_speed_btt.setOnClickListener {
lateinit var dialog: AlertDialog
// Lmao kind bad
val speedsText = arrayOf("0.5x", "0.75x", "1x", "1.25x", "1.5x", "1.75x", "2x")
val speedsNumbers = arrayOf(0.5f, 0.75f, 1f, 1.25f, 1.5f, 1.75f, 2f)
val builder = AlertDialog.Builder(requireContext(), R.style.AlertDialogCustom)
val speedsText = listOf("0.5x", "0.75x", "1x", "1.25x", "1.5x", "1.75x", "2x")
val speedsNumbers = listOf(0.5f, 0.75f, 1f, 1.25f, 1.5f, 1.75f, 2f)
val builder =
AlertDialog.Builder(requireContext(), R.style.AlertDialogCustom).setView(R.layout.player_select_speed)
val speedDialog = builder.create()
speedDialog.show()
val speedList = speedDialog.findViewById<ListView>(R.id.sort_speed)!!
// val applyButton = speedDialog.findViewById<MaterialButton>(R.id.pick_source_apply)!!
// val cancelButton = speedDialog.findViewById<MaterialButton>(R.id.pick_source_cancel)!!
val arrayAdapter = ArrayAdapter<String>(view.context, R.layout.sort_bottom_single_choice)
arrayAdapter.addAll(speedsText)
speedList.adapter = arrayAdapter
speedList.choiceMode = AbsListView.CHOICE_MODE_SINGLE
val speedIndex = speedsNumbers.indexOf(playbackSpeed)
speedList.setSelection(speedIndex)
speedList.setItemChecked(speedIndex, true)
speedList.setOnItemClickListener { _, _, which, _ ->
playbackSpeed = speedsNumbers[which]
requireContext().setKey(PLAYBACK_SPEED_KEY, playbackSpeed)
val param = PlaybackParameters(playbackSpeed)
exoPlayer.playbackParameters = param
player_speed_text.text = "Speed (${playbackSpeed}x)".replace(".0x", "x")
speedDialog.dismiss()
activity?.hideSystemUI()
}
/*
builder.setTitle("Pick playback speed")
builder.setOnDismissListener {
activity?.hideSystemUI()
@ -1137,8 +1170,9 @@ class PlayerFragment : Fragment() {
dialog.dismiss()
activity?.hideSystemUI()
}
dialog = builder.create()
dialog.show()
dialog.show()*/
}
sources_btt.setOnClickListener {

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:background="@null"
android:layout_height="match_parent">
<TextView
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:layout_marginTop="20dp"
android:layout_marginBottom="10dp"
android:textStyle="bold"
android:text="@string/player_speed"
android:textSize="20sp"
android:textColor="?attr/textColor"
android:layout_width="match_parent"
android:layout_rowWeight="1"
android:layout_height="wrap_content">
</TextView>
<ListView
android:layout_marginTop="-10dp"
android:paddingTop="10dp"
android:id="@+id/sort_speed"
android:background="?attr/bitDarkerGrayBackground"
tools:listitem="@layout/sort_bottom_single_choice"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_rowWeight="1"
/>
</LinearLayout>

View file

@ -69,4 +69,5 @@
<string name="play_episode_toast">Play Episode</string>
<string name="sort_apply">Apply</string>
<string name="sort_cancel">Cancel</string>
<string name="player_speed">Player Speed</string>
</resources>