This commit is contained in:
Bnyro 2022-06-26 12:20:56 +02:00
parent 6f1734c57e
commit ecacd13ceb
16 changed files with 24 additions and 24 deletions

View File

@ -1,7 +1,6 @@
package com.github.libretube.dialogs
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.util.Log
import android.util.TypedValue

View File

@ -4,7 +4,6 @@ import android.app.Dialog
import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.DialogFragment
import androidx.preference.PreferenceManager
import com.github.libretube.R
import com.github.libretube.util.PreferenceHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder

View File

@ -1,7 +1,6 @@
package com.github.libretube.fragments
import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater

View File

@ -426,7 +426,8 @@ class PlayerFragment : Fragment() {
// check whether related streams and autoplay are enabled
autoplay = PreferenceHelper.getBoolean(requireContext(), "autoplay", false)
relatedStreamsEnabled = PreferenceHelper.getBoolean(requireContext(), "related_streams_toggle", true)
relatedStreamsEnabled =
PreferenceHelper.getBoolean(requireContext(), "related_streams_toggle", true)
// save related streams for autoplay
relatedStreams = response.relatedStreams
runOnUiThread {
@ -742,7 +743,8 @@ class PlayerFragment : Fragment() {
}
private fun setResolutionAndSubtitles(view: View, response: Streams) {
val videoFormatPreference = PreferenceHelper.getString(requireContext(), "player_video_format", "WEBM")
val videoFormatPreference =
PreferenceHelper.getString(requireContext(), "player_video_format", "WEBM")
val defres = PreferenceHelper.getString(requireContext(), "default_res", "")!!
val qualityText = view.findViewById<TextView>(R.id.quality_text)
@ -857,10 +859,13 @@ class PlayerFragment : Fragment() {
}
private fun createExoPlayer(view: View) {
val playbackSpeed = PreferenceHelper.getString(requireContext(), "playback_speed", "1F")?.toFloat()
val playbackSpeed =
PreferenceHelper.getString(requireContext(), "playback_speed", "1F")?.toFloat()
// multiply by thousand: s -> ms
val bufferingGoal = PreferenceHelper.getString(requireContext(), "buffering_goal", "50")?.toInt()!! * 1000
val seekIncrement = PreferenceHelper.getString(requireContext(), "seek_increment", "5")?.toLong()!! * 1000
val bufferingGoal =
PreferenceHelper.getString(requireContext(), "buffering_goal", "50")?.toInt()!! * 1000
val seekIncrement =
PreferenceHelper.getString(requireContext(), "seek_increment", "5")?.toLong()!! * 1000
val cronetEngine: CronetEngine = CronetHelper.getCronetEngine()
val cronetDataSourceFactory: CronetDataSource.Factory =

View File

@ -275,7 +275,8 @@ class SearchFragment : Fragment() {
}
private fun addToHistory(query: String) {
val searchHistoryEnabled = PreferenceHelper.getBoolean(requireContext(), "search_history_toggle", true)
val searchHistoryEnabled =
PreferenceHelper.getBoolean(requireContext(), "search_history_toggle", true)
if (searchHistoryEnabled) {
var historyList = PreferenceHelper.getHistory(requireContext())

View File

@ -1,6 +1,5 @@
package com.github.libretube.preferences
import android.content.Context
import android.os.Bundle
import android.widget.TextView
import androidx.preference.Preference

View File

@ -2,7 +2,6 @@ package com.github.libretube.preferences
import android.Manifest
import android.content.ContentResolver
import android.content.Context
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
@ -19,7 +18,6 @@ import androidx.lifecycle.lifecycleScope
import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.PreferenceManager
import com.github.libretube.R
import com.github.libretube.dialogs.CustomInstanceDialog
import com.github.libretube.dialogs.DeleteAccountDialog
@ -214,11 +212,11 @@ class InstanceSettings : PreferenceFragmentCompat() {
}
private fun initCustomInstances() {
val customInstances = PreferenceHelper.getCustomInstances(requireContext())
val customInstances = PreferenceHelper.getCustomInstances(requireContext())
var instanceNames = resources.getStringArray(R.array.instances)
var instanceValues = resources.getStringArray(R.array.instancesValue)
customInstances.forEach{instance ->
customInstances.forEach { instance ->
instanceNames += instance.name
instanceValues += instance.apiUrl
}

View File

@ -2,7 +2,6 @@ package com.github.libretube.util
import android.content.Context
import android.content.SharedPreferences
import androidx.core.content.ContentProviderCompat.requireContext
import androidx.preference.PreferenceManager
import com.github.libretube.obj.CustomInstance
import com.google.common.reflect.TypeToken
@ -128,6 +127,7 @@ object PreferenceHelper {
private fun getDefaultSharedPreferences(context: Context): SharedPreferences {
return PreferenceManager.getDefaultSharedPreferences(context)
}
private fun getDefaultSharedPreferencesEditor(context: Context): SharedPreferences.Editor {
return getDefaultSharedPreferences(context).edit()
}

View File

@ -6,7 +6,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="5dp" >
android:paddingVertical="5dp">
<ImageButton
android:id="@+id/back_imageButton"

View File

@ -24,6 +24,6 @@
android:id="@+id/addToPlaylist"
android:text="@string/addToPlaylist"
style="@style/CustomDialogButton"
android:layout_marginRight="16dp"/>
android:layout_marginRight="16dp" />
</LinearLayout>

View File

@ -41,7 +41,7 @@
android:id="@+id/create_new_playlist"
android:text="@string/createPlaylist"
style="@style/CustomDialogButton"
android:layout_marginRight="16dp"/>
android:layout_marginRight="16dp" />
</LinearLayout>

View File

@ -62,7 +62,7 @@
android:id="@+id/addInstance"
android:text="@string/addInstance"
style="@style/CustomDialogButton"
android:layout_marginRight="16dp"/>
android:layout_marginRight="16dp" />
</LinearLayout>

View File

@ -40,7 +40,7 @@
android:id="@+id/delete_account_confirm"
android:text="@string/deleteAccount"
style="@style/CustomDialogButton"
android:layout_marginRight="16dp"/>
android:layout_marginRight="16dp" />
</LinearLayout>

View File

@ -30,6 +30,6 @@
android:id="@+id/download"
android:text="@string/download"
style="@style/CustomDialogButton"
android:layout_marginRight="16dp"/>
android:layout_marginRight="16dp" />
</LinearLayout>

View File

@ -52,7 +52,7 @@
android:id="@+id/login"
android:text="@string/login"
style="@style/CustomDialogButton"
android:layout_marginRight="16dp"/>
android:layout_marginRight="16dp" />
</LinearLayout>

View File

@ -54,7 +54,7 @@
android:padding="@dimen/exo_icon_padding"
android:background="#00FFFFFF"
app:tint="@android:color/white"
android:layout_marginRight="10dp"/>
android:layout_marginRight="10dp" />
<ImageButton
android:id="@+id/lock_player"
@ -162,7 +162,7 @@
<ImageButton
android:id="@+id/fullscreen"
style="@style/ExoStyledControls.Button.Bottom.FullScreen"
android:src="@drawable/ic_fullscreen"/>
android:src="@drawable/ic_fullscreen" />
</LinearLayout>