fix wildcards

This commit is contained in:
Bnyro 2022-09-22 18:01:03 +02:00
parent 228ec7860a
commit 1d3df8aeb1
29 changed files with 121 additions and 39 deletions

View File

@ -1,6 +1,11 @@
package com.github.libretube.api
import retrofit2.http.*
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query
interface PipedApi {
@GET("trending")

View File

@ -2,8 +2,16 @@ package com.github.libretube.db
import androidx.room.Database
import androidx.room.RoomDatabase
import com.github.libretube.db.dao.*
import com.github.libretube.db.obj.*
import com.github.libretube.db.dao.CustomInstanceDao
import com.github.libretube.db.dao.LocalSubscriptionDao
import com.github.libretube.db.dao.SearchHistoryDao
import com.github.libretube.db.dao.WatchHistoryDao
import com.github.libretube.db.dao.WatchPositionDao
import com.github.libretube.db.obj.CustomInstance
import com.github.libretube.db.obj.LocalSubscription
import com.github.libretube.db.obj.SearchHistoryItem
import com.github.libretube.db.obj.WatchHistoryItem
import com.github.libretube.db.obj.WatchPosition
@Database(
entities = [

View File

@ -1,6 +1,10 @@
package com.github.libretube.db.dao
import androidx.room.*
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.github.libretube.db.obj.CustomInstance
@Dao

View File

@ -1,6 +1,10 @@
package com.github.libretube.db.dao
import androidx.room.*
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.github.libretube.db.obj.LocalSubscription
@Dao

View File

@ -1,6 +1,10 @@
package com.github.libretube.db.dao
import androidx.room.*
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.github.libretube.db.obj.SearchHistoryItem
@Dao

View File

@ -1,6 +1,10 @@
package com.github.libretube.db.dao
import androidx.room.*
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.github.libretube.db.obj.WatchHistoryItem
@Dao

View File

@ -1,6 +1,10 @@
package com.github.libretube.db.dao
import androidx.room.*
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.github.libretube.db.obj.WatchPosition
@Dao

View File

@ -1,6 +1,10 @@
package com.github.libretube.obj
import com.github.libretube.db.obj.*
import com.github.libretube.db.obj.CustomInstance
import com.github.libretube.db.obj.LocalSubscription
import com.github.libretube.db.obj.SearchHistoryItem
import com.github.libretube.db.obj.WatchHistoryItem
import com.github.libretube.db.obj.WatchPosition
data class BackupFile(
var watchHistory: List<WatchHistoryItem>? = null,

View File

@ -21,7 +21,11 @@ import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.db.DatabaseHelper
import com.github.libretube.extensions.query
import com.github.libretube.extensions.toID
import com.github.libretube.util.*
import com.github.libretube.util.AutoPlayHelper
import com.github.libretube.util.NowPlayingNotification
import com.github.libretube.util.PlayerHelper
import com.github.libretube.util.PlayingQueue
import com.github.libretube.util.PreferenceHelper
import com.google.android.exoplayer2.C
import com.google.android.exoplayer2.ExoPlayer
import com.google.android.exoplayer2.MediaItem

View File

@ -14,12 +14,12 @@ import com.github.libretube.ui.views.BottomSheet
import com.github.libretube.util.BackgroundHelper
import com.github.libretube.util.PreferenceHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.IOException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import retrofit2.HttpException
import java.io.IOException
class PlaylistOptionsBottomSheet(
private val playlistId: String,

View File

@ -10,7 +10,12 @@ import android.os.Bundle
import androidx.core.text.HtmlCompat
import androidx.core.text.parseAsHtml
import com.github.libretube.R
import com.github.libretube.constants.*
import com.github.libretube.constants.DONATE_URL
import com.github.libretube.constants.GITHUB_URL
import com.github.libretube.constants.LICENSE_URL
import com.github.libretube.constants.PIPED_GITHUB_URL
import com.github.libretube.constants.WEBLATE_URL
import com.github.libretube.constants.WEBSITE_URL
import com.github.libretube.databinding.ActivityAboutBinding
import com.github.libretube.extensions.BaseActivity
import com.github.libretube.extensions.getStyledSnackBar

View File

@ -3,7 +3,11 @@ package com.github.libretube.ui.activities
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import com.github.libretube.constants.*
import com.github.libretube.constants.DISCORD_URL
import com.github.libretube.constants.MATRIX_URL
import com.github.libretube.constants.REDDIT_URL
import com.github.libretube.constants.TELEGRAM_URL
import com.github.libretube.constants.TWITTER_URL
import com.github.libretube.databinding.ActivityCommunityBinding
import com.github.libretube.extensions.BaseActivity

View File

@ -7,7 +7,12 @@ import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.*
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.view.WindowInsets
import android.view.WindowInsetsController
import android.view.WindowManager
import android.widget.Toast
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.widget.SearchView

View File

@ -15,11 +15,11 @@ import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.formatShort
import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper
import java.io.IOException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import retrofit2.HttpException
import java.io.IOException
class CommentsAdapter(
private val videoId: String,

View File

@ -17,11 +17,11 @@ import com.github.libretube.sheets.VideoOptionsBottomSheet
import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper
import com.github.libretube.util.PreferenceHelper
import java.io.IOException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import retrofit2.HttpException
import java.io.IOException
class PlaylistAdapter(
private val videoFeed: MutableList<com.github.libretube.api.obj.StreamItem>,

View File

@ -15,11 +15,11 @@ import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NavigationHelper
import com.github.libretube.util.PreferenceHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.IOException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import retrofit2.HttpException
import java.io.IOException
class PlaylistsAdapter(
private val playlists: MutableList<com.github.libretube.api.obj.Playlists>,

View File

@ -18,8 +18,8 @@ import com.github.libretube.models.PlaylistViewModel
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.IOException
import retrofit2.HttpException
import java.io.IOException
class AddToPlaylistDialog : DialogFragment() {
private lateinit var binding: DialogAddtoplaylistBinding

View File

@ -14,8 +14,8 @@ import com.github.libretube.ui.fragments.LibraryFragment
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.IOException
import retrofit2.HttpException
import java.io.IOException
class CreatePlaylistDialog : DialogFragment() {
private var token: String = ""

View File

@ -17,8 +17,8 @@ import com.github.libretube.extensions.TAG
import com.github.libretube.services.DownloadService
import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.IOException
import retrofit2.HttpException
import java.io.IOException
class DownloadDialog(
private val videoId: String

View File

@ -13,8 +13,8 @@ import com.github.libretube.extensions.TAG
import com.github.libretube.util.PreferenceHelper
import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.IOException
import retrofit2.HttpException
import java.io.IOException
class LoginDialog : DialogFragment() {
private lateinit var binding: DialogLoginBinding

View File

@ -18,8 +18,8 @@ import com.github.libretube.extensions.formatShort
import com.github.libretube.extensions.toID
import com.github.libretube.ui.adapters.ChannelAdapter
import com.github.libretube.util.ImageHelper
import java.io.IOException
import retrofit2.HttpException
import java.io.IOException
class ChannelFragment : BaseFragment() {
private lateinit var binding: FragmentChannelBinding

View File

@ -19,8 +19,8 @@ import com.github.libretube.ui.adapters.ChannelAdapter
import com.github.libretube.ui.adapters.TrendingAdapter
import com.github.libretube.util.LocaleHelper
import com.github.libretube.util.PreferenceHelper
import java.io.IOException
import retrofit2.HttpException
import java.io.IOException
class HomeFragment : BaseFragment() {
private lateinit var binding: FragmentHomeBinding

View File

@ -21,8 +21,8 @@ import com.github.libretube.models.PlayerViewModel
import com.github.libretube.ui.adapters.PlaylistsAdapter
import com.github.libretube.ui.dialogs.CreatePlaylistDialog
import com.github.libretube.util.PreferenceHelper
import java.io.IOException
import retrofit2.HttpException
import java.io.IOException
class LibraryFragment : BaseFragment() {

View File

@ -10,8 +10,12 @@ import android.content.res.Configuration
import android.graphics.Rect
import android.media.session.PlaybackState
import android.net.Uri
import android.os.*
import android.os.Build
import android.os.Build.VERSION.SDK_INT
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.os.PowerManager
import android.text.Html
import android.text.format.DateUtils
import android.util.Log
@ -42,7 +46,13 @@ import com.github.libretube.databinding.ExoStyledPlayerControlViewBinding
import com.github.libretube.databinding.FragmentPlayerBinding
import com.github.libretube.db.DatabaseHelper
import com.github.libretube.db.DatabaseHolder.Companion.Database
import com.github.libretube.extensions.*
import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.awaitQuery
import com.github.libretube.extensions.formatShort
import com.github.libretube.extensions.hideKeyboard
import com.github.libretube.extensions.query
import com.github.libretube.extensions.toID
import com.github.libretube.interfaces.PlayerOptionsInterface
import com.github.libretube.models.PlayerViewModel
import com.github.libretube.services.BackgroundMode
@ -54,10 +64,21 @@ import com.github.libretube.ui.adapters.TrendingAdapter
import com.github.libretube.ui.dialogs.AddToPlaylistDialog
import com.github.libretube.ui.dialogs.DownloadDialog
import com.github.libretube.ui.dialogs.ShareDialog
import com.github.libretube.util.*
import com.google.android.exoplayer2.*
import com.github.libretube.util.AutoPlayHelper
import com.github.libretube.util.BackgroundHelper
import com.github.libretube.util.ImageHelper
import com.github.libretube.util.NetworkHelper
import com.github.libretube.util.NowPlayingNotification
import com.github.libretube.util.PlayerHelper
import com.github.libretube.util.PlayingQueue
import com.github.libretube.util.PreferenceHelper
import com.google.android.exoplayer2.C
import com.google.android.exoplayer2.DefaultLoadControl
import com.google.android.exoplayer2.ExoPlayer
import com.google.android.exoplayer2.MediaItem
import com.google.android.exoplayer2.MediaItem.SubtitleConfiguration
import com.google.android.exoplayer2.MediaItem.fromUri
import com.google.android.exoplayer2.Player
import com.google.android.exoplayer2.audio.AudioAttributes
import com.google.android.exoplayer2.ext.cronet.CronetDataSource
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory
@ -72,13 +93,13 @@ import com.google.android.exoplayer2.upstream.DefaultDataSource
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource
import com.google.android.exoplayer2.video.VideoSize
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.IOException
import java.util.concurrent.Executors
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import org.chromium.net.CronetEngine
import retrofit2.HttpException
import java.io.IOException
import java.util.concurrent.Executors
import kotlin.math.abs
class PlayerFragment : BaseFragment() {
@ -848,9 +869,11 @@ class PlayerFragment : BaseFragment() {
return
}
// position is almost the end of the video => don't seek, start from beginning
if (position != null && position < streams.duration!! * 1000 * 0.9) exoPlayer.seekTo(
position
)
if (position != null && position < streams.duration!! * 1000 * 0.9) {
exoPlayer.seekTo(
position
)
}
}
// used for autoplay and skipping to next video

View File

@ -18,8 +18,8 @@ import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.toID
import com.github.libretube.sheets.PlaylistOptionsBottomSheet
import com.github.libretube.ui.adapters.PlaylistAdapter
import java.io.IOException
import retrofit2.HttpException
import java.io.IOException
class PlaylistFragment : BaseFragment() {
private lateinit var binding: FragmentPlaylistBinding

View File

@ -20,8 +20,8 @@ import com.github.libretube.models.SearchViewModel
import com.github.libretube.ui.activities.MainActivity
import com.github.libretube.ui.adapters.SearchHistoryAdapter
import com.github.libretube.ui.adapters.SearchSuggestionsAdapter
import java.io.IOException
import retrofit2.HttpException
import java.io.IOException
class SearchFragment : BaseFragment() {
private lateinit var binding: FragmentSearchBinding

View File

@ -20,8 +20,8 @@ import com.github.libretube.extensions.hideKeyboard
import com.github.libretube.ui.activities.MainActivity
import com.github.libretube.ui.adapters.SearchAdapter
import com.github.libretube.util.PreferenceHelper
import java.io.IOException
import retrofit2.HttpException
import java.io.IOException
class SearchResultFragment : BaseFragment() {
private lateinit var binding: FragmentSearchResultBinding

View File

@ -11,11 +11,11 @@ import com.github.libretube.api.SubscriptionHelper
import com.github.libretube.extensions.TAG
import com.github.libretube.obj.NewPipeSubscription
import com.github.libretube.obj.NewPipeSubscriptions
import java.io.FileOutputStream
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import java.io.FileOutputStream
class ImportHelper(private val activity: Activity) {
/**

View File

@ -7,7 +7,11 @@ import android.content.Intent
import android.os.Build
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.work.*
import androidx.work.Constraints
import androidx.work.ExistingPeriodicWorkPolicy
import androidx.work.NetworkType
import androidx.work.PeriodicWorkRequest
import androidx.work.WorkManager
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.SubscriptionHelper
@ -16,9 +20,9 @@ import com.github.libretube.constants.PUSH_CHANNEL_ID
import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.extensions.toID
import com.github.libretube.ui.activities.MainActivity
import java.util.concurrent.TimeUnit
import kotlinx.coroutines.async
import kotlinx.coroutines.runBlocking
import java.util.concurrent.TimeUnit
class NotificationHelper(
private val context: Context