This commit is contained in:
Bnyro 2022-07-02 18:23:24 +02:00
parent 46238c718e
commit 94c5abecc3
45 changed files with 82 additions and 78 deletions

View File

@ -22,7 +22,7 @@
android:supportsRtl="true"
android:theme="@style/Theme.Purple">
<activity
android:name=".util.Player"
android:name=".activities.Player"
android:configChanges="orientation|screenSize"
android:exported="false" />
<activity

View File

@ -33,10 +33,10 @@ import com.github.libretube.R
import com.github.libretube.databinding.ActivityMainBinding
import com.github.libretube.fragments.PlayerFragment
import com.github.libretube.fragments.isFullScreen
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.services.ClosingService
import com.github.libretube.util.CronetHelper
import com.github.libretube.util.LocaleHelper
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.ThemeHelper
import com.google.android.material.bottomnavigation.BottomNavigationView

View File

@ -1,4 +1,4 @@
package com.github.libretube.util
package com.github.libretube.activities
import android.app.Activity
import android.os.Bundle

View File

@ -16,7 +16,7 @@ import com.github.libretube.dialogs.VideoOptionsDialog
import com.github.libretube.fragments.PlayerFragment
import com.github.libretube.obj.PlaylistId
import com.github.libretube.obj.StreamItem
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import com.squareup.picasso.Picasso
import kotlinx.coroutines.CoroutineScope

View File

@ -11,7 +11,7 @@ import com.github.libretube.activities.MainActivity
import com.github.libretube.databinding.PlaylistsRowBinding
import com.github.libretube.obj.PlaylistId
import com.github.libretube.obj.Playlists
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.squareup.picasso.Picasso

View File

@ -7,7 +7,7 @@ import android.widget.EditText
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.databinding.SearchhistoryRowBinding
import com.github.libretube.fragments.SearchFragment
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
class SearchHistoryAdapter(
private val context: Context,
@ -46,4 +46,5 @@ class SearchHistoryAdapter(
}
}
class SearchHistoryViewHolder(val binding: SearchhistoryRowBinding) : RecyclerView.ViewHolder(binding.root)
class SearchHistoryViewHolder(val binding: SearchhistoryRowBinding) :
RecyclerView.ViewHolder(binding.root)

View File

@ -38,4 +38,5 @@ class SearchSuggestionsAdapter(
}
}
class SearchSuggestionsViewHolder(val binding: SearchsuggestionRowBinding) : RecyclerView.ViewHolder(binding.root)
class SearchSuggestionsViewHolder(val binding: SearchsuggestionRowBinding) :
RecyclerView.ViewHolder(binding.root)

View File

@ -97,4 +97,5 @@ class SubscriptionAdapter(
}
}
class SubscriptionViewHolder(val binding: TrendingRowBinding) : RecyclerView.ViewHolder(binding.root)
class SubscriptionViewHolder(val binding: TrendingRowBinding) :
RecyclerView.ViewHolder(binding.root)

View File

@ -11,7 +11,7 @@ import com.github.libretube.activities.MainActivity
import com.github.libretube.databinding.ChannelSubscriptionRowBinding
import com.github.libretube.obj.Subscribe
import com.github.libretube.obj.Subscription
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import com.squareup.picasso.Picasso
import kotlinx.coroutines.CoroutineScope
@ -110,4 +110,5 @@ class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscrip
}
}
class SubscriptionChannelViewHolder(val binding: ChannelSubscriptionRowBinding) : RecyclerView.ViewHolder(binding.root)
class SubscriptionChannelViewHolder(val binding: ChannelSubscriptionRowBinding) :
RecyclerView.ViewHolder(binding.root)

View File

@ -88,4 +88,5 @@ class WatchHistoryAdapter(
}
}
class WatchHistoryViewHolder(val binding: WatchHistoryRowBinding) : RecyclerView.ViewHolder(binding.root)
class WatchHistoryViewHolder(val binding: WatchHistoryRowBinding) :
RecyclerView.ViewHolder(binding.root)

View File

@ -13,7 +13,7 @@ import androidx.lifecycle.lifecycleScope
import com.github.libretube.R
import com.github.libretube.databinding.DialogAddtoplaylistBinding
import com.github.libretube.obj.PlaylistId
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import retrofit2.HttpException

View File

@ -12,7 +12,7 @@ import com.github.libretube.R
import com.github.libretube.databinding.DialogCreatePlaylistBinding
import com.github.libretube.fragments.LibraryFragment
import com.github.libretube.obj.Playlists
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import retrofit2.HttpException

View File

@ -11,7 +11,7 @@ import com.github.libretube.R
import com.github.libretube.activities.SettingsActivity
import com.github.libretube.databinding.DialogCustomInstanceBinding
import com.github.libretube.obj.CustomInstance
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.net.URL

View File

@ -12,7 +12,7 @@ import com.github.libretube.R
import com.github.libretube.activities.requireMainActivityRestart
import com.github.libretube.databinding.DialogDeleteAccountBinding
import com.github.libretube.obj.DeleteUserRequest
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import com.google.android.material.dialog.MaterialAlertDialogBuilder

View File

@ -12,7 +12,7 @@ import com.github.libretube.R
import com.github.libretube.activities.requireMainActivityRestart
import com.github.libretube.databinding.DialogLoginBinding
import com.github.libretube.obj.Login
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import retrofit2.HttpException

View File

@ -9,7 +9,7 @@ import androidx.fragment.app.DialogFragment
import com.github.libretube.R
import com.github.libretube.activities.requireMainActivityRestart
import com.github.libretube.databinding.DialogLogoutBinding
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
class LogoutDialog : DialogFragment() {

View File

@ -9,7 +9,7 @@ import android.widget.Toast
import androidx.fragment.app.DialogFragment
import com.github.libretube.R
import com.github.libretube.obj.PlaylistId
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.coroutines.CoroutineScope

View File

@ -5,7 +5,7 @@ import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.DialogFragment
import com.github.libretube.R
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
class ShareDialog(

View File

@ -7,8 +7,8 @@ import android.widget.ArrayAdapter
import android.widget.Toast
import androidx.fragment.app.DialogFragment
import com.github.libretube.R
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.BackgroundMode
import com.github.libretube.util.PreferenceHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
/**

View File

@ -13,7 +13,7 @@ import com.github.libretube.R
import com.github.libretube.adapters.ChannelAdapter
import com.github.libretube.databinding.FragmentChannelBinding
import com.github.libretube.obj.Subscribe
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.formatShort
import com.google.android.material.button.MaterialButton

View File

@ -12,7 +12,7 @@ import androidx.recyclerview.widget.GridLayoutManager
import com.github.libretube.R
import com.github.libretube.adapters.TrendingAdapter
import com.github.libretube.databinding.FragmentHomeBinding
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import retrofit2.HttpException
import java.io.IOException

View File

@ -14,7 +14,7 @@ import com.github.libretube.R
import com.github.libretube.adapters.PlaylistsAdapter
import com.github.libretube.databinding.FragmentLibraryBinding
import com.github.libretube.dialogs.CreatePlaylistDialog
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import retrofit2.HttpException
import java.io.IOException

View File

@ -47,10 +47,10 @@ import com.github.libretube.obj.SponsorBlockPrefs
import com.github.libretube.obj.StreamItem
import com.github.libretube.obj.Streams
import com.github.libretube.obj.Subscribe
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.services.IS_DOWNLOAD_RUNNING
import com.github.libretube.util.CronetHelper
import com.github.libretube.util.DescriptionAdapter
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.formatShort
import com.google.android.exoplayer2.C

View File

@ -11,7 +11,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.github.libretube.R
import com.github.libretube.adapters.PlaylistAdapter
import com.github.libretube.databinding.FragmentPlaylistBinding
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import retrofit2.HttpException
import java.io.IOException

View File

@ -25,7 +25,7 @@ import com.github.libretube.adapters.SearchAdapter
import com.github.libretube.adapters.SearchHistoryAdapter
import com.github.libretube.adapters.SearchSuggestionsAdapter
import com.github.libretube.databinding.FragmentSearchBinding
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import retrofit2.HttpException

View File

@ -17,7 +17,7 @@ import com.github.libretube.R
import com.github.libretube.adapters.SubscriptionAdapter
import com.github.libretube.adapters.SubscriptionChannelAdapter
import com.github.libretube.databinding.FragmentSubscriptionsBinding
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import retrofit2.HttpException
import java.io.IOException

View File

@ -8,7 +8,7 @@ import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.github.libretube.adapters.WatchHistoryAdapter
import com.github.libretube.databinding.FragmentWatchHistoryBinding
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
class WatchHistoryFragment : Fragment() {
private val TAG = "WatchHistoryFragment"

View File

@ -7,7 +7,6 @@ import androidx.preference.PreferenceFragmentCompat
import com.github.libretube.R
import com.github.libretube.activities.SettingsActivity
import com.github.libretube.activities.requireMainActivityRestart
import com.github.libretube.util.PreferenceHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
class AdvancedSettings : PreferenceFragmentCompat() {

View File

@ -25,7 +25,6 @@ import com.github.libretube.dialogs.CustomInstanceDialog
import com.github.libretube.dialogs.DeleteAccountDialog
import com.github.libretube.dialogs.LoginDialog
import com.github.libretube.dialogs.LogoutDialog
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import org.json.JSONObject
import org.json.JSONTokener

View File

@ -1,4 +1,4 @@
package com.github.libretube.util
package com.github.libretube.preferences
import android.content.Context
import android.content.SharedPreferences

View File

@ -19,7 +19,7 @@ import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import com.arthenica.ffmpegkit.FFmpegKit
import com.github.libretube.R
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.preferences.PreferenceHelper
import java.io.File
var IS_DOWNLOAD_RUNNING = false

View File

@ -4,6 +4,7 @@ import android.app.NotificationManager
import android.content.Context
import android.support.v4.media.session.MediaSessionCompat
import com.github.libretube.obj.Streams
import com.github.libretube.preferences.PreferenceHelper
import com.google.android.exoplayer2.C
import com.google.android.exoplayer2.ExoPlayer
import com.google.android.exoplayer2.MediaItem

View File

@ -2,6 +2,7 @@ package com.github.libretube.util
import android.content.Context
import android.os.Build
import com.github.libretube.preferences.PreferenceHelper
import java.util.*
object LocaleHelper {

View File

@ -1,11 +1,11 @@
package com.github.libretube
package com.github.libretube.util
import java.util.*
import kotlin.reflect.KProperty
class ResettableLazyManager {
// we synchronize to make sure the timing of a reset() call and new inits do not collide
val managedDelegates = LinkedList<Resettable>()
private val managedDelegates = LinkedList<Resettable>()
fun register(managed: Resettable) {
synchronized(managedDelegates) {
@ -38,7 +38,7 @@ class ResettableLazy<PROPTYPE>(val manager: ResettableLazyManager, val init: ()
lazyHolder = makeInitBlock()
}
fun makeInitBlock(): Lazy<PROPTYPE> {
private fun makeInitBlock(): Lazy<PROPTYPE> {
return lazy {
manager.register(this)
init()

View File

@ -1,7 +1,5 @@
package com.github.libretube.util
import com.github.libretube.resettableLazy
import com.github.libretube.resettableManager
import retrofit2.Retrofit
import retrofit2.converter.jackson.JacksonConverterFactory

View File

@ -8,6 +8,7 @@ import android.content.pm.PackageManager
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import com.github.libretube.R
import com.github.libretube.preferences.PreferenceHelper
object ThemeHelper {

View File

@ -1,4 +1,4 @@
package com.github.libretube.util
package com.github.libretube.views
import android.annotation.SuppressLint
import android.content.Context

View File

@ -1,4 +1,4 @@
package com.github.libretube.util
package com.github.libretube.views
import android.content.Context
import android.util.AttributeSet

View File

@ -1,4 +1,4 @@
package com.github.libretube.util
package com.github.libretube.views
import android.content.Context
import android.graphics.Rect

View File

@ -4,9 +4,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
tools:context=".util.Player">
tools:context=".activities.Player">
<com.github.libretube.util.CustomExoPlayerView
<com.github.libretube.views.CustomExoPlayerView
android:id="@+id/fullscreen_player"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.github.libretube.util.CustomSwipeToRefresh xmlns:android="http://schemas.android.com/apk/res/android"
<com.github.libretube.views.CustomSwipeToRefresh xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/channel_refresh"
android:layout_width="match_parent"
@ -113,4 +113,4 @@
</RelativeLayout>
</LinearLayout>
</ScrollView>
</com.github.libretube.util.CustomSwipeToRefresh>
</com.github.libretube.views.CustomSwipeToRefresh>

View File

@ -33,7 +33,7 @@
android:textStyle="bold" />
</RelativeLayout>
<com.github.libretube.util.CustomSwipeToRefresh
<com.github.libretube.views.CustomSwipeToRefresh
android:id="@+id/playlist_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -88,7 +88,7 @@
</RelativeLayout>
</LinearLayout>
</ScrollView>
</com.github.libretube.util.CustomSwipeToRefresh>
</com.github.libretube.views.CustomSwipeToRefresh>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/create_playlist"

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.github.libretube.util.SingleViewTouchableMotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.github.libretube.views.SingleViewTouchableMotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/playerMotionLayout"
@ -352,7 +352,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.github.libretube.util.CustomExoPlayerView
<com.github.libretube.views.CustomExoPlayerView
android:id="@+id/player"
android:layout_width="match_parent"
android:layout_height="0dp"
@ -402,4 +402,4 @@
app:layout_constraintStart_toEndOf="@+id/player"
app:layout_constraintTop_toTopOf="@+id/play_imageView" />
</com.github.libretube.util.SingleViewTouchableMotionLayout>
</com.github.libretube.views.SingleViewTouchableMotionLayout>

View File

@ -39,7 +39,7 @@
android:textStyle="bold" />
</RelativeLayout>
<com.github.libretube.util.CustomSwipeToRefresh
<com.github.libretube.views.CustomSwipeToRefresh
android:id="@+id/sub_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -101,5 +101,5 @@
</RelativeLayout>
</LinearLayout>
</ScrollView>
</com.github.libretube.util.CustomSwipeToRefresh>
</com.github.libretube.views.CustomSwipeToRefresh>
</RelativeLayout>