mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 07:50:31 +05:30
ktlint
This commit is contained in:
parent
6f1734c57e
commit
ecacd13ceb
@ -1,7 +1,6 @@
|
|||||||
package com.github.libretube.dialogs
|
package com.github.libretube.dialogs
|
||||||
|
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.content.Context
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
|
@ -4,7 +4,6 @@ import android.app.Dialog
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
import androidx.preference.PreferenceManager
|
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
import com.github.libretube.util.PreferenceHelper
|
import com.github.libretube.util.PreferenceHelper
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.github.libretube.fragments
|
package com.github.libretube.fragments
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
@ -426,7 +426,8 @@ class PlayerFragment : Fragment() {
|
|||||||
|
|
||||||
// check whether related streams and autoplay are enabled
|
// check whether related streams and autoplay are enabled
|
||||||
autoplay = PreferenceHelper.getBoolean(requireContext(), "autoplay", false)
|
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
|
// save related streams for autoplay
|
||||||
relatedStreams = response.relatedStreams
|
relatedStreams = response.relatedStreams
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
@ -742,7 +743,8 @@ class PlayerFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setResolutionAndSubtitles(view: View, response: Streams) {
|
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 defres = PreferenceHelper.getString(requireContext(), "default_res", "")!!
|
||||||
|
|
||||||
val qualityText = view.findViewById<TextView>(R.id.quality_text)
|
val qualityText = view.findViewById<TextView>(R.id.quality_text)
|
||||||
@ -857,10 +859,13 @@ class PlayerFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createExoPlayer(view: View) {
|
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
|
// multiply by thousand: s -> ms
|
||||||
val bufferingGoal = PreferenceHelper.getString(requireContext(), "buffering_goal", "50")?.toInt()!! * 1000
|
val bufferingGoal =
|
||||||
val seekIncrement = PreferenceHelper.getString(requireContext(), "seek_increment", "5")?.toLong()!! * 1000
|
PreferenceHelper.getString(requireContext(), "buffering_goal", "50")?.toInt()!! * 1000
|
||||||
|
val seekIncrement =
|
||||||
|
PreferenceHelper.getString(requireContext(), "seek_increment", "5")?.toLong()!! * 1000
|
||||||
|
|
||||||
val cronetEngine: CronetEngine = CronetHelper.getCronetEngine()
|
val cronetEngine: CronetEngine = CronetHelper.getCronetEngine()
|
||||||
val cronetDataSourceFactory: CronetDataSource.Factory =
|
val cronetDataSourceFactory: CronetDataSource.Factory =
|
||||||
|
@ -275,7 +275,8 @@ class SearchFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun addToHistory(query: String) {
|
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) {
|
if (searchHistoryEnabled) {
|
||||||
var historyList = PreferenceHelper.getHistory(requireContext())
|
var historyList = PreferenceHelper.getHistory(requireContext())
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.github.libretube.preferences
|
package com.github.libretube.preferences
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
|
@ -2,7 +2,6 @@ package com.github.libretube.preferences
|
|||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.content.ContentResolver
|
import android.content.ContentResolver
|
||||||
import android.content.Context
|
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
@ -19,7 +18,6 @@ import androidx.lifecycle.lifecycleScope
|
|||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import androidx.preference.PreferenceManager
|
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
import com.github.libretube.dialogs.CustomInstanceDialog
|
import com.github.libretube.dialogs.CustomInstanceDialog
|
||||||
import com.github.libretube.dialogs.DeleteAccountDialog
|
import com.github.libretube.dialogs.DeleteAccountDialog
|
||||||
@ -214,11 +212,11 @@ class InstanceSettings : PreferenceFragmentCompat() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun initCustomInstances() {
|
private fun initCustomInstances() {
|
||||||
val customInstances = PreferenceHelper.getCustomInstances(requireContext())
|
val customInstances = PreferenceHelper.getCustomInstances(requireContext())
|
||||||
|
|
||||||
var instanceNames = resources.getStringArray(R.array.instances)
|
var instanceNames = resources.getStringArray(R.array.instances)
|
||||||
var instanceValues = resources.getStringArray(R.array.instancesValue)
|
var instanceValues = resources.getStringArray(R.array.instancesValue)
|
||||||
customInstances.forEach{instance ->
|
customInstances.forEach { instance ->
|
||||||
instanceNames += instance.name
|
instanceNames += instance.name
|
||||||
instanceValues += instance.apiUrl
|
instanceValues += instance.apiUrl
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package com.github.libretube.util
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import androidx.core.content.ContentProviderCompat.requireContext
|
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import com.github.libretube.obj.CustomInstance
|
import com.github.libretube.obj.CustomInstance
|
||||||
import com.google.common.reflect.TypeToken
|
import com.google.common.reflect.TypeToken
|
||||||
@ -128,6 +127,7 @@ object PreferenceHelper {
|
|||||||
private fun getDefaultSharedPreferences(context: Context): SharedPreferences {
|
private fun getDefaultSharedPreferences(context: Context): SharedPreferences {
|
||||||
return PreferenceManager.getDefaultSharedPreferences(context)
|
return PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getDefaultSharedPreferencesEditor(context: Context): SharedPreferences.Editor {
|
private fun getDefaultSharedPreferencesEditor(context: Context): SharedPreferences.Editor {
|
||||||
return getDefaultSharedPreferences(context).edit()
|
return getDefaultSharedPreferences(context).edit()
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingVertical="5dp" >
|
android:paddingVertical="5dp">
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/back_imageButton"
|
android:id="@+id/back_imageButton"
|
||||||
|
@ -24,6 +24,6 @@
|
|||||||
android:id="@+id/addToPlaylist"
|
android:id="@+id/addToPlaylist"
|
||||||
android:text="@string/addToPlaylist"
|
android:text="@string/addToPlaylist"
|
||||||
style="@style/CustomDialogButton"
|
style="@style/CustomDialogButton"
|
||||||
android:layout_marginRight="16dp"/>
|
android:layout_marginRight="16dp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
android:id="@+id/create_new_playlist"
|
android:id="@+id/create_new_playlist"
|
||||||
android:text="@string/createPlaylist"
|
android:text="@string/createPlaylist"
|
||||||
style="@style/CustomDialogButton"
|
style="@style/CustomDialogButton"
|
||||||
android:layout_marginRight="16dp"/>
|
android:layout_marginRight="16dp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
android:id="@+id/addInstance"
|
android:id="@+id/addInstance"
|
||||||
android:text="@string/addInstance"
|
android:text="@string/addInstance"
|
||||||
style="@style/CustomDialogButton"
|
style="@style/CustomDialogButton"
|
||||||
android:layout_marginRight="16dp"/>
|
android:layout_marginRight="16dp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
android:id="@+id/delete_account_confirm"
|
android:id="@+id/delete_account_confirm"
|
||||||
android:text="@string/deleteAccount"
|
android:text="@string/deleteAccount"
|
||||||
style="@style/CustomDialogButton"
|
style="@style/CustomDialogButton"
|
||||||
android:layout_marginRight="16dp"/>
|
android:layout_marginRight="16dp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -30,6 +30,6 @@
|
|||||||
android:id="@+id/download"
|
android:id="@+id/download"
|
||||||
android:text="@string/download"
|
android:text="@string/download"
|
||||||
style="@style/CustomDialogButton"
|
style="@style/CustomDialogButton"
|
||||||
android:layout_marginRight="16dp"/>
|
android:layout_marginRight="16dp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
android:id="@+id/login"
|
android:id="@+id/login"
|
||||||
android:text="@string/login"
|
android:text="@string/login"
|
||||||
style="@style/CustomDialogButton"
|
style="@style/CustomDialogButton"
|
||||||
android:layout_marginRight="16dp"/>
|
android:layout_marginRight="16dp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
android:padding="@dimen/exo_icon_padding"
|
android:padding="@dimen/exo_icon_padding"
|
||||||
android:background="#00FFFFFF"
|
android:background="#00FFFFFF"
|
||||||
app:tint="@android:color/white"
|
app:tint="@android:color/white"
|
||||||
android:layout_marginRight="10dp"/>
|
android:layout_marginRight="10dp" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/lock_player"
|
android:id="@+id/lock_player"
|
||||||
@ -162,7 +162,7 @@
|
|||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/fullscreen"
|
android:id="@+id/fullscreen"
|
||||||
style="@style/ExoStyledControls.Button.Bottom.FullScreen"
|
style="@style/ExoStyledControls.Button.Bottom.FullScreen"
|
||||||
android:src="@drawable/ic_fullscreen"/>
|
android:src="@drawable/ic_fullscreen" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user