Merge pull request #1056 from Bnyro/master

cleanup
This commit is contained in:
Bnyro 2022-08-14 10:00:49 +02:00 committed by GitHub
commit d055ca30c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
76 changed files with 246 additions and 256 deletions

View File

@ -8,12 +8,12 @@ import android.os.Build
import android.os.StrictMode
import android.os.StrictMode.VmPolicy
import androidx.work.ExistingPeriodicWorkPolicy
import com.github.libretube.database.DatabaseHolder
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.db.DatabaseHolder
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.preferences.PreferenceKeys
import com.github.libretube.util.ExceptionHandler
import com.github.libretube.util.NotificationHelper
import com.github.libretube.util.RetrofitInstance
class MyApp : Application() {
override fun onCreate() {

View File

@ -28,16 +28,17 @@ import androidx.navigation.ui.setupWithNavController
import coil.ImageLoader
import com.github.libretube.Globals
import com.github.libretube.R
import com.github.libretube.api.CronetHelper
import com.github.libretube.databinding.ActivityMainBinding
import com.github.libretube.dialogs.ErrorDialog
import com.github.libretube.extensions.BaseActivity
import com.github.libretube.extensions.TAG
import com.github.libretube.fragments.PlayerFragment
import com.github.libretube.models.SearchViewModel
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.preferences.PreferenceKeys
import com.github.libretube.services.ClosingService
import com.github.libretube.util.ConnectionHelper
import com.github.libretube.util.CronetHelper
import com.github.libretube.util.LocaleHelper
import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -45,7 +46,6 @@ import com.google.android.material.elevation.SurfaceColors
import com.google.android.material.navigation.NavigationBarView
class MainActivity : BaseActivity() {
val TAG = "MainActivity"
lateinit var binding: ActivityMainBinding
@ -301,7 +301,7 @@ class MainActivity : BaseActivity() {
val intentData: Uri? = intent?.data
// check whether an URI got submitted over the intent data
if (intentData != null && intentData.host != null && intentData.path != null) {
Log.d(TAG, "intentData: ${intentData.host} ${intentData.path} ")
Log.d(TAG(), "intentData: ${intentData.host} ${intentData.path} ")
// load the URI of the submitted link (e.g. video)
loadIntentData(intentData)
}
@ -375,10 +375,10 @@ class MainActivity : BaseActivity() {
}
private fun loadVideo(videoId: String, query: String?) {
Log.i(TAG, "URI type: Video")
Log.i(TAG(), "URI type: Video")
val bundle = Bundle()
Log.e(TAG, videoId)
Log.e(TAG(), videoId)
// for time stamped links
if (query != null && query.contains("t=")) {
@ -407,7 +407,7 @@ class MainActivity : BaseActivity() {
channelId: String? = null,
channelName: String? = null
) {
Log.i(TAG, "Uri Type: Channel")
Log.i(TAG(), "Uri Type: Channel")
val bundle = if (channelId != null) bundleOf("channel_id" to channelId)
else bundleOf("channel_name" to channelName)
@ -415,7 +415,7 @@ class MainActivity : BaseActivity() {
}
private fun loadPlaylist(playlistId: String) {
Log.i(TAG, "Uri Type: Playlist")
Log.i(TAG(), "Uri Type: Playlist")
val bundle = bundleOf("playlist_id" to playlistId)
navController.navigate(R.id.playlistFragment, bundle)
@ -497,7 +497,10 @@ class MainActivity : BaseActivity() {
)
}
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
window.setFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
)
}
private fun unsetFullscreen() {

View File

@ -7,10 +7,10 @@ import android.os.Bundle
import android.util.Log
import com.github.libretube.R
import com.github.libretube.extensions.BaseActivity
import com.github.libretube.extensions.TAG
import com.github.libretube.util.ThemeHelper
class RouterActivity : BaseActivity() {
val TAG = "RouterActivity"
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (intent.getStringExtra(Intent.EXTRA_TEXT) != null && checkHost(intent)) {
@ -31,12 +31,12 @@ class RouterActivity : BaseActivity() {
val hostsList = resources.getStringArray(R.array.shareHostsList)
val intentDataUri: Uri = Uri.parse(intent.getStringExtra(Intent.EXTRA_TEXT))
val intentDataHost = intentDataUri.host
Log.d(TAG, "$intentDataHost")
Log.d(TAG(), "$intentDataHost")
return hostsList.contains(intentDataHost)
}
private fun handleSendText(uri: Uri) {
Log.i(TAG, uri.toString())
Log.i(TAG(), uri.toString())
val pm: PackageManager = this.packageManager
val intent = pm.getLaunchIntentForPackage(this.packageName)
intent?.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK

View File

@ -7,7 +7,6 @@ import com.github.libretube.extensions.BaseActivity
import com.github.libretube.preferences.MainSettings
class SettingsActivity : BaseActivity() {
val TAG = "SettingsActivity"
lateinit var binding: ActivitySettingsBinding
override fun onCreate(savedInstanceState: Bundle?) {

View File

@ -14,7 +14,6 @@ class ChaptersAdapter(
private val chapters: List<ChapterSegment>,
private val exoPlayer: ExoPlayer
) : RecyclerView.Adapter<ChaptersViewHolder>() {
val TAG = "ChaptersAdapter"
private var selectedPosition = 0
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ChaptersViewHolder {

View File

@ -8,12 +8,13 @@ import android.widget.Toast
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.databinding.CommentsRowBinding
import com.github.libretube.extensions.TAG
import com.github.libretube.obj.Comment
import com.github.libretube.obj.CommentsPage
import com.github.libretube.util.ConnectionHelper
import com.github.libretube.util.NavigationHelper
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.formatShort
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@ -25,7 +26,6 @@ class CommentsAdapter(
private val videoId: String,
private val comments: MutableList<Comment>
) : RecyclerView.Adapter<CommentsViewHolder>() {
private val TAG = "CommentsAdapter"
private var isLoading = false
private var nextpage = ""
@ -97,9 +97,9 @@ class CommentsAdapter(
repliesPage = RetrofitInstance.api.getCommentsNextPage(videoId, nextPage)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response," + e.response())
Log.e(TAG(), "HttpException, unexpected response," + e.response())
}
repliesAdapter.updateItems(repliesPage.comments)
isLoading = false

View File

@ -7,15 +7,16 @@ import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.databinding.PlaylistRowBinding
import com.github.libretube.dialogs.VideoOptionsDialog
import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.setFormattedDuration
import com.github.libretube.obj.PlaylistId
import com.github.libretube.obj.StreamItem
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.ConnectionHelper
import com.github.libretube.util.NavigationHelper
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.setWatchProgressLength
import com.github.libretube.util.toID
import kotlinx.coroutines.CoroutineScope
@ -31,7 +32,6 @@ class PlaylistAdapter(
private val activity: Activity,
private val childFragmentManager: FragmentManager
) : RecyclerView.Adapter<PlaylistViewHolder>() {
private val TAG = "PlaylistAdapter"
override fun getItemCount(): Int {
return videoFeed.size
@ -86,10 +86,10 @@ class PlaylistAdapter(
)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
return@launch
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
return@launch
}
}

View File

@ -7,14 +7,15 @@ import android.view.ViewGroup
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.databinding.PlaylistsRowBinding
import com.github.libretube.dialogs.PlaylistOptionsDialog
import com.github.libretube.extensions.TAG
import com.github.libretube.obj.PlaylistId
import com.github.libretube.obj.Playlists
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.ConnectionHelper
import com.github.libretube.util.NavigationHelper
import com.github.libretube.util.RetrofitInstance
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@ -27,7 +28,6 @@ class PlaylistsAdapter(
private val childFragmentManager: FragmentManager,
private val activity: Activity
) : RecyclerView.Adapter<PlaylistsViewHolder>() {
val TAG = "PlaylistsAdapter"
override fun getItemCount(): Int {
return playlists.size
@ -94,10 +94,10 @@ class PlaylistsAdapter(
)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
return@launch
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
return@launch
}
try {
@ -106,7 +106,7 @@ class PlaylistsAdapter(
activity.runOnUiThread { notifyDataSetChanged() }
}
} catch (e: Exception) {
Log.e(TAG, e.toString())
Log.e(TAG(), e.toString())
}
}
}

View File

@ -13,7 +13,6 @@ import com.github.libretube.util.formatShort
class RepliesAdapter(
private val replies: MutableList<Comment>
) : RecyclerView.Adapter<RepliesViewHolder>() {
private val TAG = "RepliesAdapter"
fun clear() {
val size: Int = replies.size

View File

@ -6,6 +6,7 @@ import android.view.ViewGroup
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R
import com.github.libretube.api.SubscriptionHelper
import com.github.libretube.databinding.ChannelRowBinding
import com.github.libretube.databinding.PlaylistSearchRowBinding
import com.github.libretube.databinding.VideoRowBinding
@ -15,7 +16,6 @@ import com.github.libretube.extensions.setFormattedDuration
import com.github.libretube.obj.SearchItem
import com.github.libretube.util.ConnectionHelper
import com.github.libretube.util.NavigationHelper
import com.github.libretube.util.SubscriptionHelper
import com.github.libretube.util.formatShort
import com.github.libretube.util.setWatchProgressLength
import com.github.libretube.util.toID

View File

@ -4,9 +4,9 @@ import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.appcompat.widget.SearchView
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.database.DatabaseHolder
import com.github.libretube.databinding.SearchhistoryRowBinding
import com.github.libretube.obj.SearchHistoryItem
import com.github.libretube.db.DatabaseHolder
import com.github.libretube.db.obj.SearchHistoryItem
class SearchHistoryAdapter(
private var historyList: List<String>,
@ -32,7 +32,7 @@ class SearchHistoryAdapter(
deleteHistory.setOnClickListener {
historyList -= historyQuery
Thread {
DatabaseHolder.database.searchHistoryDao().delete(
DatabaseHolder.db.searchHistoryDao().delete(
SearchHistoryItem(query = historyQuery)
)
}.start()

View File

@ -12,8 +12,6 @@ class SearchSuggestionsAdapter(
) :
RecyclerView.Adapter<SearchSuggestionsViewHolder>() {
private val TAG = "SearchSuggestionsAdapter"
override fun getItemCount(): Int {
return suggestionsList.size
}

View File

@ -4,16 +4,15 @@ import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R
import com.github.libretube.api.SubscriptionHelper
import com.github.libretube.databinding.ChannelSubscriptionRowBinding
import com.github.libretube.obj.Subscription
import com.github.libretube.util.ConnectionHelper
import com.github.libretube.util.NavigationHelper
import com.github.libretube.util.SubscriptionHelper
import com.github.libretube.util.toID
class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscription>) :
RecyclerView.Adapter<SubscriptionChannelViewHolder>() {
val TAG = "SubChannelAdapter"
override fun getItemCount(): Int {
return subscriptions.size

View File

@ -20,7 +20,6 @@ class TrendingAdapter(
private val childFragmentManager: FragmentManager,
private val showAllAtOne: Boolean = true
) : RecyclerView.Adapter<SubscriptionViewHolder>() {
private val TAG = "TrendingAdapter"
var index = 10

View File

@ -4,11 +4,11 @@ import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.database.DatabaseHelper
import com.github.libretube.databinding.WatchHistoryRowBinding
import com.github.libretube.db.DatabaseHelper
import com.github.libretube.db.obj.WatchHistoryItem
import com.github.libretube.dialogs.VideoOptionsDialog
import com.github.libretube.extensions.setFormattedDuration
import com.github.libretube.obj.WatchHistoryItem
import com.github.libretube.util.ConnectionHelper
import com.github.libretube.util.NavigationHelper
import com.github.libretube.util.setWatchProgressLength
@ -18,7 +18,6 @@ class WatchHistoryAdapter(
private val childFragmentManager: FragmentManager
) :
RecyclerView.Adapter<WatchHistoryViewHolder>() {
private val TAG = "WatchHistoryAdapter"
fun removeFromWatchHistory(position: Int) {
DatabaseHelper.removeFromWatchHistory(position)

View File

@ -1,4 +1,4 @@
package com.github.libretube.util
package com.github.libretube.api
import android.content.Context
import com.google.net.cronet.okhttptransport.CronetCallFactory
@ -10,10 +10,10 @@ class CronetHelper {
lateinit var callFactory: CronetCallFactory
fun initCronet(context: Context) {
this.engine = CronetEngine.Builder(context)
engine = CronetEngine.Builder(context)
.enableBrotli(true)
.build()
callFactory = CronetCallFactory.newBuilder(this.engine)
callFactory = CronetCallFactory.newBuilder(engine)
.build()
}

View File

@ -1,4 +1,4 @@
package com.github.libretube.util
package com.github.libretube.api
import com.github.libretube.obj.Channel
import com.github.libretube.obj.CommentsPage

View File

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

View File

@ -1,6 +1,7 @@
package com.github.libretube.util
package com.github.libretube.api
import android.util.Log
import com.github.libretube.extensions.TAG
import com.github.libretube.obj.Subscribe
import com.github.libretube.preferences.PreferenceHelper
import kotlinx.coroutines.CoroutineScope
@ -8,7 +9,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
object SubscriptionHelper {
val TAG = "SubscriptionHelper"
fun subscribe(channelId: String) {
if (PreferenceHelper.getToken() != "") {
@ -19,7 +19,7 @@ object SubscriptionHelper {
Subscribe(channelId)
)
} catch (e: Exception) {
Log.e(TAG, e.toString())
Log.e(TAG(), e.toString())
}
}
} else {
@ -38,7 +38,7 @@ object SubscriptionHelper {
Subscribe(channelId)
)
} catch (e: Exception) {
Log.e(TAG, e.toString())
Log.e(TAG(), e.toString())
}
}
} else {
@ -56,7 +56,7 @@ object SubscriptionHelper {
PreferenceHelper.getToken()
)
} catch (e: Exception) {
Log.e(TAG, e.toString())
Log.e(TAG(), e.toString())
return null
}
return isSubscribed.subscribed

View File

@ -1,11 +1,15 @@
package com.github.libretube.database
package com.github.libretube.db
import androidx.room.Database
import androidx.room.RoomDatabase
import com.github.libretube.obj.CustomInstance
import com.github.libretube.obj.SearchHistoryItem
import com.github.libretube.obj.WatchHistoryItem
import com.github.libretube.obj.WatchPosition
import com.github.libretube.db.dao.CustomInstanceDao
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.SearchHistoryItem
import com.github.libretube.db.obj.WatchHistoryItem
import com.github.libretube.db.obj.WatchPosition
@Database(
entities = [

View File

@ -1,8 +1,8 @@
package com.github.libretube.database
package com.github.libretube.db
import com.github.libretube.db.obj.WatchHistoryItem
import com.github.libretube.db.obj.WatchPosition
import com.github.libretube.obj.Streams
import com.github.libretube.obj.WatchHistoryItem
import com.github.libretube.obj.WatchPosition
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.preferences.PreferenceKeys
import com.github.libretube.util.toID
@ -20,14 +20,15 @@ object DatabaseHelper {
streams.duration
)
Thread {
DatabaseHolder.database.watchHistoryDao().insertAll(watchHistoryItem)
val maxHistorySize = PreferenceHelper.getString(PreferenceKeys.WATCH_HISTORY_SIZE, "unlimited")
DatabaseHolder.db.watchHistoryDao().insertAll(watchHistoryItem)
val maxHistorySize =
PreferenceHelper.getString(PreferenceKeys.WATCH_HISTORY_SIZE, "unlimited")
if (maxHistorySize == "unlimited") return@Thread
// delete the first watch history entry if the limit is reached
val watchHistory = DatabaseHolder.database.watchHistoryDao().getAll()
val watchHistory = DatabaseHolder.db.watchHistoryDao().getAll()
if (watchHistory.size > maxHistorySize.toInt()) {
DatabaseHolder.database.watchHistoryDao()
DatabaseHolder.db.watchHistoryDao()
.delete(watchHistory.first())
}
}.start()
@ -35,8 +36,8 @@ object DatabaseHelper {
fun removeFromWatchHistory(index: Int) {
Thread {
DatabaseHolder.database.watchHistoryDao().delete(
DatabaseHolder.database.watchHistoryDao().getAll()[index]
DatabaseHolder.db.watchHistoryDao().delete(
DatabaseHolder.db.watchHistoryDao().getAll()[index]
)
}.start()
}
@ -47,14 +48,14 @@ object DatabaseHelper {
position
)
Thread {
DatabaseHolder.database.watchPositionDao().insertAll(watchPosition)
DatabaseHolder.db.watchPositionDao().insertAll(watchPosition)
}.start()
}
fun removeWatchPosition(videoId: String) {
Thread {
DatabaseHolder.database.watchPositionDao().delete(
DatabaseHolder.database.watchPositionDao().findById(videoId)
DatabaseHolder.db.watchPositionDao().delete(
DatabaseHolder.db.watchPositionDao().findById(videoId)
)
}.start()
}

View File

@ -1,14 +1,14 @@
package com.github.libretube.database
package com.github.libretube.db
import android.content.Context
import androidx.room.Room
import com.github.libretube.DATABASE_NAME
object DatabaseHolder {
lateinit var database: AppDatabase
lateinit var db: AppDatabase
fun initializeDatabase(context: Context) {
database = Room.databaseBuilder(
db = Room.databaseBuilder(
context,
AppDatabase::class.java,
DATABASE_NAME

View File

@ -1,11 +1,11 @@
package com.github.libretube.database
package com.github.libretube.db.dao
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.github.libretube.obj.CustomInstance
import com.github.libretube.db.obj.CustomInstance
@Dao
interface CustomInstanceDao {

View File

@ -1,11 +1,11 @@
package com.github.libretube.database
package com.github.libretube.db.dao
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.github.libretube.obj.SearchHistoryItem
import com.github.libretube.db.obj.SearchHistoryItem
@Dao
interface SearchHistoryDao {

View File

@ -1,11 +1,11 @@
package com.github.libretube.database
package com.github.libretube.db.dao
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.github.libretube.obj.WatchHistoryItem
import com.github.libretube.db.obj.WatchHistoryItem
@Dao
interface WatchHistoryDao {

View File

@ -1,11 +1,11 @@
package com.github.libretube.database
package com.github.libretube.db.dao
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.github.libretube.obj.WatchPosition
import com.github.libretube.db.obj.WatchPosition
@Dao
interface WatchPositionDao {

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj
package com.github.libretube.db.obj
import androidx.room.ColumnInfo
import androidx.room.Entity

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj
package com.github.libretube.db.obj
import androidx.room.Entity
import androidx.room.PrimaryKey

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj
package com.github.libretube.db.obj
import androidx.room.ColumnInfo
import androidx.room.Entity

View File

@ -1,4 +1,4 @@
package com.github.libretube.obj
package com.github.libretube.db.obj
import androidx.room.ColumnInfo
import androidx.room.Entity

View File

@ -10,17 +10,17 @@ import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import com.github.libretube.Globals
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.databinding.DialogAddtoplaylistBinding
import com.github.libretube.extensions.TAG
import com.github.libretube.obj.PlaylistId
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import retrofit2.HttpException
import java.io.IOException
class AddToPlaylistDialog : DialogFragment() {
private val TAG = "AddToPlaylistDialog"
private lateinit var binding: DialogAddtoplaylistBinding
private lateinit var videoId: String
@ -51,11 +51,11 @@ class AddToPlaylistDialog : DialogFragment() {
RetrofitInstance.authApi.playlists(token)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
}
@ -96,11 +96,11 @@ class AddToPlaylistDialog : DialogFragment() {
RetrofitInstance.authApi.addToPlaylist(token, PlaylistId(playlistId, videoId))
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
}

View File

@ -7,18 +7,18 @@ import android.widget.Toast
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.databinding.DialogCreatePlaylistBinding
import com.github.libretube.extensions.TAG
import com.github.libretube.fragments.LibraryFragment
import com.github.libretube.obj.Playlists
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import retrofit2.HttpException
import java.io.IOException
class CreatePlaylistDialog : DialogFragment() {
val TAG = "CreatePlaylistDialog"
private var token: String = ""
private lateinit var binding: DialogCreatePlaylistBinding
@ -58,15 +58,15 @@ class CreatePlaylistDialog : DialogFragment() {
RetrofitInstance.authApi.createPlaylist(token, Playlists(name = name))
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response $e")
Log.e(TAG(), "HttpException, unexpected response $e")
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
}
if (response != null) {
if (response.playlistId != null) {
Toast.makeText(context, R.string.playlistCreated, Toast.LENGTH_SHORT).show()
} else {
Toast.makeText(context, getString(R.string.unknown_error), Toast.LENGTH_SHORT)
@ -77,7 +77,7 @@ class CreatePlaylistDialog : DialogFragment() {
val parent = parentFragment as LibraryFragment
parent.fetchPlaylists()
} catch (e: Exception) {
Log.e(TAG, e.toString())
Log.e(TAG(), e.toString())
}
dismiss()
}

View File

@ -5,15 +5,14 @@ import android.os.Bundle
import android.widget.Toast
import androidx.fragment.app.DialogFragment
import com.github.libretube.R
import com.github.libretube.database.DatabaseHolder
import com.github.libretube.databinding.DialogCustomInstanceBinding
import com.github.libretube.obj.CustomInstance
import com.github.libretube.db.DatabaseHolder
import com.github.libretube.db.obj.CustomInstance
import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.net.URL
class CustomInstanceDialog : DialogFragment() {
val TAG = "CustomInstanceDialog"
private lateinit var binding: DialogCustomInstanceBinding
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
@ -43,7 +42,7 @@ class CustomInstanceDialog : DialogFragment() {
URL(customInstance.frontendUrl).toURI()
Thread {
DatabaseHolder.database.customInstanceDao().insertAll(customInstance)
DatabaseHolder.db.customInstanceDao().insertAll(customInstance)
}.start()
activity?.recreate()

View File

@ -7,15 +7,15 @@ import android.widget.Toast
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.databinding.DialogDeleteAccountBinding
import com.github.libretube.extensions.TAG
import com.github.libretube.obj.DeleteUserRequest
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
class DeleteAccountDialog : DialogFragment() {
private val TAG = "DeleteAccountDialog"
private lateinit var binding: DialogDeleteAccountBinding
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
@ -50,7 +50,7 @@ class DeleteAccountDialog : DialogFragment() {
try {
RetrofitInstance.authApi.deleteAccount(token, DeleteUserRequest(password))
} catch (e: Exception) {
Log.e(TAG, e.toString())
Log.e(TAG(), e.toString())
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
}

View File

@ -11,18 +11,18 @@ import androidx.core.view.size
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.databinding.DialogDownloadBinding
import com.github.libretube.extensions.TAG
import com.github.libretube.obj.Streams
import com.github.libretube.services.DownloadService
import com.github.libretube.util.PermissionHelper
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import retrofit2.HttpException
import java.io.IOException
class DownloadDialog : DialogFragment() {
private val TAG = "DownloadDialog"
private lateinit var binding: DialogDownloadBinding
private lateinit var videoId: String
@ -62,11 +62,11 @@ class DownloadDialog : DialogFragment() {
RetrofitInstance.api.getStreams(videoId)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
}

View File

@ -7,17 +7,17 @@ import android.widget.Toast
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.databinding.DialogLoginBinding
import com.github.libretube.extensions.TAG
import com.github.libretube.obj.Login
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import retrofit2.HttpException
import java.io.IOException
class LoginDialog : DialogFragment() {
private val TAG = "LoginDialog"
private lateinit var binding: DialogLoginBinding
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
@ -64,15 +64,15 @@ class LoginDialog : DialogFragment() {
RetrofitInstance.authApi.login(login)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: Exception) {
Log.e(TAG, "dafaq?$e")
Log.e(TAG(), "dafaq?$e")
return@launchWhenCreated
}
if (response.error != null) {
@ -96,15 +96,15 @@ class LoginDialog : DialogFragment() {
RetrofitInstance.authApi.register(login)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: Exception) {
Log.e(TAG, "dafaq?$e")
Log.e(TAG(), "dafaq?$e")
return@launchWhenCreated
}
if (response.error != null) {

View File

@ -11,7 +11,6 @@ import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
class LogoutDialog : DialogFragment() {
private val TAG = "LogoutDialog"
private lateinit var binding: DialogLogoutBinding
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {

View File

@ -7,10 +7,11 @@ import android.widget.ArrayAdapter
import android.widget.Toast
import androidx.fragment.app.DialogFragment
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.extensions.TAG
import com.github.libretube.obj.PlaylistId
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.BackgroundHelper
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.toID
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.coroutines.CoroutineScope
@ -24,7 +25,6 @@ class PlaylistOptionsDialog(
private val playlistId: String,
private val isOwner: Boolean
) : DialogFragment() {
val TAG = "PlaylistOptionsDialog"
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
// options for the dialog
@ -104,7 +104,7 @@ class PlaylistOptionsDialog(
} catch (e: HttpException) {
return@launch
}
Log.e(TAG, response.toString())
Log.e(TAG(), response.toString())
}
}
run()
@ -113,14 +113,14 @@ class PlaylistOptionsDialog(
private fun deletePlaylist(id: String, token: String) {
fun run() {
CoroutineScope(Dispatchers.IO).launch {
val response = try {
try {
RetrofitInstance.authApi.deletePlaylist(token, PlaylistId(id))
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
return@launch
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
return@launch
}
}

View File

@ -7,9 +7,9 @@ import androidx.fragment.app.DialogFragment
import com.github.libretube.PIPED_FRONTEND_URL
import com.github.libretube.R
import com.github.libretube.YOUTUBE_FRONTEND_URL
import com.github.libretube.database.DatabaseHolder
import com.github.libretube.db.DatabaseHolder
import com.github.libretube.db.obj.CustomInstance
import com.github.libretube.extensions.await
import com.github.libretube.obj.CustomInstance
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.preferences.PreferenceKeys
import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -76,7 +76,7 @@ class ShareDialog(
// get the api urls of the other custom instances
var customInstances = listOf<CustomInstance>()
Thread {
customInstances = DatabaseHolder.database.customInstanceDao().getAll()
customInstances = DatabaseHolder.db.customInstanceDao().getAll()
}.await()
// return the custom instance frontend url if available

View File

@ -22,7 +22,6 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
class VideoOptionsDialog(
private val videoId: String
) : DialogFragment() {
private val TAG = "VideoOptionsDialog"
/**
* Dialog that returns a [MaterialAlertDialogBuilder] showing a menu of options.
@ -40,7 +39,8 @@ class VideoOptionsDialog(
/**
* Check whether the player is running by observing the notification
*/
val notificationManager = context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val notificationManager =
context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.activeNotifications.forEach {
if (it.id == PLAYER_NOTIFICATION_ID) {
optionsList += context?.getString(R.string.add_to_queue)

View File

@ -3,7 +3,7 @@ package com.github.libretube.util
import android.view.View
import android.view.ViewTreeObserver
import android.widget.LinearLayout
import com.github.libretube.database.DatabaseHolder
import com.github.libretube.db.DatabaseHolder
import com.github.libretube.extensions.await
/**
@ -15,7 +15,7 @@ fun View?.setWatchProgressLength(videoId: String, duration: Long) {
Thread {
try {
progress = DatabaseHolder.database.watchPositionDao().findById(videoId).position
progress = DatabaseHolder.db.watchPositionDao().findById(videoId).position
} catch (e: Exception) {
progress = null
}

View File

@ -0,0 +1,3 @@
package com.github.libretube.extensions
fun Any.TAG(): String = this::class.java.name

View File

@ -9,18 +9,18 @@ import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.github.libretube.R
import com.github.libretube.adapters.ChannelAdapter
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.SubscriptionHelper
import com.github.libretube.databinding.FragmentChannelBinding
import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.TAG
import com.github.libretube.util.ConnectionHelper
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.SubscriptionHelper
import com.github.libretube.util.formatShort
import com.github.libretube.util.toID
import retrofit2.HttpException
import java.io.IOException
class ChannelFragment : BaseFragment() {
private val TAG = "ChannelFragment"
private lateinit var binding: FragmentChannelBinding
private var channelId: String? = null
@ -115,11 +115,11 @@ class ChannelFragment : BaseFragment() {
} catch (e: IOException) {
binding.channelRefresh.isRefreshing = false
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
binding.channelRefresh.isRefreshing = false
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
return@launchWhenCreated
}
nextPage = response.nextpage
@ -169,11 +169,11 @@ class ChannelFragment : BaseFragment() {
} catch (e: IOException) {
binding.channelRefresh.isRefreshing = false
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
binding.channelRefresh.isRefreshing = false
Log.e(TAG, "HttpException, unexpected response," + e.response())
Log.e(TAG(), "HttpException, unexpected response," + e.response())
return@launchWhenCreated
}
nextPage = response.nextpage

View File

@ -10,17 +10,17 @@ import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager
import com.github.libretube.R
import com.github.libretube.adapters.TrendingAdapter
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.databinding.FragmentHomeBinding
import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.TAG
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.preferences.PreferenceKeys
import com.github.libretube.util.LocaleHelper
import com.github.libretube.util.RetrofitInstance
import retrofit2.HttpException
import java.io.IOException
class HomeFragment : BaseFragment() {
private val TAG = "HomeFragment"
private lateinit var binding: FragmentHomeBinding
private lateinit var region: String
@ -44,7 +44,7 @@ class HomeFragment : BaseFragment() {
val grid = PreferenceHelper.getString(
PreferenceKeys.GRID_COLUMNS,
resources.getInteger(R.integer.grid_items).toString()
)!!
)
val regionPref = PreferenceHelper.getString(PreferenceKeys.REGION, "sys")!!
@ -70,11 +70,11 @@ class HomeFragment : BaseFragment() {
RetrofitInstance.api.getTrending(region)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} finally {

View File

@ -13,18 +13,18 @@ import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.Globals
import com.github.libretube.R
import com.github.libretube.adapters.PlaylistsAdapter
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.databinding.FragmentLibraryBinding
import com.github.libretube.dialogs.CreatePlaylistDialog
import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.TAG
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.preferences.PreferenceKeys
import com.github.libretube.util.RetrofitInstance
import retrofit2.HttpException
import java.io.IOException
class LibraryFragment : BaseFragment() {
private val TAG = "LibraryFragment"
lateinit var token: String
private lateinit var binding: FragmentLibraryBinding
@ -92,11 +92,11 @@ class LibraryFragment : BaseFragment() {
RetrofitInstance.authApi.playlists(token)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} finally {
@ -115,7 +115,7 @@ class LibraryFragment : BaseFragment() {
playlistsAdapter.registerAdapterDataObserver(object :
RecyclerView.AdapterDataObserver() {
override fun onChanged() {
Log.e(TAG, playlistsAdapter.itemCount.toString())
Log.e(TAG(), playlistsAdapter.itemCount.toString())
if (playlistsAdapter.itemCount == 0) {
binding.loginOrRegister.visibility = View.VISIBLE
}

View File

@ -37,15 +37,19 @@ import com.github.libretube.activities.MainActivity
import com.github.libretube.adapters.ChaptersAdapter
import com.github.libretube.adapters.CommentsAdapter
import com.github.libretube.adapters.TrendingAdapter
import com.github.libretube.database.DatabaseHelper
import com.github.libretube.database.DatabaseHolder
import com.github.libretube.api.CronetHelper
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.SubscriptionHelper
import com.github.libretube.databinding.DoubleTapOverlayBinding
import com.github.libretube.databinding.ExoStyledPlayerControlViewBinding
import com.github.libretube.databinding.FragmentPlayerBinding
import com.github.libretube.db.DatabaseHelper
import com.github.libretube.db.DatabaseHolder
import com.github.libretube.dialogs.AddToPlaylistDialog
import com.github.libretube.dialogs.DownloadDialog
import com.github.libretube.dialogs.ShareDialog
import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.await
import com.github.libretube.interfaces.DoubleTapInterface
import com.github.libretube.interfaces.PlayerOptionsInterface
@ -59,11 +63,8 @@ import com.github.libretube.services.BackgroundMode
import com.github.libretube.util.AutoPlayHelper
import com.github.libretube.util.BackgroundHelper
import com.github.libretube.util.ConnectionHelper
import com.github.libretube.util.CronetHelper
import com.github.libretube.util.NowPlayingNotification
import com.github.libretube.util.PlayerHelper
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.SubscriptionHelper
import com.github.libretube.util.formatShort
import com.github.libretube.util.hideKeyboard
import com.github.libretube.util.toID
@ -102,7 +103,6 @@ import kotlin.math.abs
class PlayerFragment : BaseFragment() {
private val TAG = "PlayerFragment"
private lateinit var binding: FragmentPlayerBinding
private lateinit var playerBinding: ExoStyledPlayerControlViewBinding
private lateinit var doubleTapOverlayBinding: DoubleTapOverlayBinding
@ -581,12 +581,14 @@ class PlayerFragment : BaseFragment() {
currentAutoplayMode = if (autoplayEnabled) context.getString(R.string.enabled)
else context.getString(R.string.disabled)
// set the current caption language
currentCaptions = if (trackSelector.parameters.preferredTextLanguages.isNotEmpty()) {
trackSelector.parameters.preferredTextLanguages[0]
} else context.getString(R.string.none)
currentCaptions =
if (trackSelector.parameters.preferredTextLanguages.isNotEmpty()) {
trackSelector.parameters.preferredTextLanguages[0]
} else context.getString(R.string.none)
// set the playback speed
val playbackSpeeds = context.resources.getStringArray(R.array.playbackSpeed)
val playbackSpeedValues = context.resources.getStringArray(R.array.playbackSpeedValues)
val playbackSpeedValues =
context.resources.getStringArray(R.array.playbackSpeedValues)
val playbackSpeed = exoPlayer.playbackParameters.speed.toString()
currentPlaybackSpeed = playbackSpeeds[playbackSpeedValues.indexOf(playbackSpeed)]
// set the quality text
@ -598,9 +600,10 @@ class PlayerFragment : BaseFragment() {
else "${quality}p"
}
// set the repeat mode
currentRepeatMode = if (exoPlayer.repeatMode == RepeatModeUtil.REPEAT_TOGGLE_MODE_NONE) {
context.getString(R.string.repeat_mode_none)
} else context.getString(R.string.repeat_mode_current)
currentRepeatMode =
if (exoPlayer.repeatMode == RepeatModeUtil.REPEAT_TOGGLE_MODE_NONE) {
context.getString(R.string.repeat_mode_none)
} else context.getString(R.string.repeat_mode_current)
// set the aspect ratio mode
currentAspectRatio = when (exoPlayerView.resizeMode) {
AspectRatioFrameLayout.RESIZE_MODE_FIT -> context.getString(R.string.resize_mode_fit)
@ -854,11 +857,11 @@ class PlayerFragment : BaseFragment() {
RetrofitInstance.api.getStreams(videoId!!)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
}
@ -920,7 +923,7 @@ class PlayerFragment : BaseFragment() {
playerBinding.liveSeparator.visibility = View.GONE
playerBinding.liveDiff.text = ""
} else {
Log.e(TAG, "changing the time")
Log.e(TAG(), "changing the time")
// live stream but not watching at the end/live position
playerBinding.liveSeparator.visibility = View.VISIBLE
val diffText = DateUtils.formatElapsedTime(
@ -938,7 +941,7 @@ class PlayerFragment : BaseFragment() {
var position: Long? = null
Thread {
try {
position = DatabaseHolder.database.watchPositionDao().findById(videoId!!).position
position = DatabaseHolder.db.watchPositionDao().findById(videoId!!).position
} catch (e: Exception) {
position = null
}
@ -1564,11 +1567,11 @@ class PlayerFragment : BaseFragment() {
RetrofitInstance.api.getComments(videoId!!)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
return@launchWhenCreated
}
commentsAdapter = CommentsAdapter(videoId!!, commentsResponse.comments)
@ -1587,10 +1590,10 @@ class PlayerFragment : BaseFragment() {
RetrofitInstance.api.getCommentsNextPage(videoId!!, nextPage!!)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response," + e.response())
Log.e(TAG(), "HttpException, unexpected response," + e.response())
return@launchWhenCreated
}
nextPage = response.nextpage

View File

@ -11,16 +11,16 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R
import com.github.libretube.adapters.PlaylistAdapter
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.databinding.FragmentPlaylistBinding
import com.github.libretube.dialogs.PlaylistOptionsDialog
import com.github.libretube.extensions.BaseFragment
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.extensions.TAG
import com.github.libretube.util.toID
import retrofit2.HttpException
import java.io.IOException
class PlaylistFragment : BaseFragment() {
private val TAG = "PlaylistFragment"
private lateinit var binding: FragmentPlaylistBinding
private var playlistId: String? = null
@ -65,10 +65,10 @@ class PlaylistFragment : BaseFragment() {
else RetrofitInstance.api.getPlaylist(playlistId!!)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
return@launchWhenCreated
}
nextPage = response.nextpage
@ -103,7 +103,10 @@ class PlaylistFragment : BaseFragment() {
RecyclerView.AdapterDataObserver() {
override fun onChanged() {
binding.videoCount.text =
getString(R.string.videoCount, playlistAdapter!!.itemCount.toString())
getString(
R.string.videoCount,
playlistAdapter!!.itemCount.toString()
)
}
})
@ -169,10 +172,10 @@ class PlaylistFragment : BaseFragment() {
)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response," + e.response())
Log.e(TAG(), "HttpException, unexpected response," + e.response())
return@launchWhenCreated
}
nextPage = response.nextpage

View File

@ -11,17 +11,17 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.github.libretube.activities.MainActivity
import com.github.libretube.adapters.SearchHistoryAdapter
import com.github.libretube.adapters.SearchSuggestionsAdapter
import com.github.libretube.database.DatabaseHolder
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.databinding.FragmentSearchBinding
import com.github.libretube.db.DatabaseHolder
import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.await
import com.github.libretube.models.SearchViewModel
import com.github.libretube.util.RetrofitInstance
import retrofit2.HttpException
import java.io.IOException
class SearchFragment() : BaseFragment() {
private val TAG = "SearchFragment"
private lateinit var binding: FragmentSearchBinding
private val viewModel: SearchViewModel by activityViewModels()
@ -67,10 +67,10 @@ class SearchFragment() : BaseFragment() {
RetrofitInstance.api.getSuggestions(query)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
return@launchWhenCreated
}
// only load the suggestions if the input field didn't get cleared yet
@ -92,8 +92,8 @@ class SearchFragment() : BaseFragment() {
private fun showHistory() {
var historyList = listOf<String>()
Thread {
val history = DatabaseHolder.database.searchHistoryDao().getAll()
historyList = history.map { it.query!! }
val history = DatabaseHolder.db.searchHistoryDao().getAll()
historyList = history.map { it.query }
}.await()
if (historyList.isNotEmpty()) {
binding.suggestionsRecycler.adapter =

View File

@ -9,20 +9,20 @@ import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.github.libretube.R
import com.github.libretube.adapters.SearchAdapter
import com.github.libretube.database.DatabaseHolder
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.databinding.FragmentSearchResultBinding
import com.github.libretube.db.DatabaseHolder
import com.github.libretube.db.obj.SearchHistoryItem
import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.await
import com.github.libretube.obj.SearchHistoryItem
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.preferences.PreferenceKeys
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.hideKeyboard
import retrofit2.HttpException
import java.io.IOException
class SearchResultFragment : BaseFragment() {
private val TAG = "SearchResultFragment"
private lateinit var binding: FragmentSearchResultBinding
private var nextPage: String? = null
@ -86,10 +86,10 @@ class SearchResultFragment : BaseFragment() {
RetrofitInstance.api.getSearchResults(query, apiSearchFilter)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection $e")
Log.e(TAG(), "IOException, you might not have internet connection $e")
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
return@launchWhenCreated
}
runOnUiThread {
@ -116,10 +116,10 @@ class SearchResultFragment : BaseFragment() {
)
} catch (e: IOException) {
println(e)
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response," + e.response())
Log.e(TAG(), "HttpException, unexpected response," + e.response())
return@launchWhenCreated
}
nextPage = response.nextpage!!
@ -136,7 +136,7 @@ class SearchResultFragment : BaseFragment() {
PreferenceHelper.getBoolean(PreferenceKeys.SEARCH_HISTORY_TOGGLE, true)
if (searchHistoryEnabled && query != "") {
Thread {
DatabaseHolder.database.searchHistoryDao().insertAll(
DatabaseHolder.db.searchHistoryDao().insertAll(
SearchHistoryItem(
query = query
)

View File

@ -13,20 +13,20 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.github.libretube.R
import com.github.libretube.adapters.SubscriptionChannelAdapter
import com.github.libretube.adapters.TrendingAdapter
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.SubscriptionHelper
import com.github.libretube.databinding.FragmentSubscriptionsBinding
import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.TAG
import com.github.libretube.obj.StreamItem
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.preferences.PreferenceKeys
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.SubscriptionHelper
import com.github.libretube.util.toID
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import retrofit2.HttpException
import java.io.IOException
class SubscriptionsFragment : BaseFragment() {
val TAG = "SubFragment"
private lateinit var binding: FragmentSubscriptionsBinding
lateinit var token: String
@ -130,11 +130,11 @@ class SubscriptionsFragment : BaseFragment() {
SubscriptionHelper.getFormattedLocalSubscriptions()
)
} catch (e: IOException) {
Log.e(TAG, e.toString())
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), e.toString())
Log.e(TAG(), "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
return@launchWhenCreated
} finally {
binding.subRefresh.isRefreshing = false
@ -180,11 +180,11 @@ class SubscriptionsFragment : BaseFragment() {
SubscriptionHelper.getFormattedLocalSubscriptions()
)
} catch (e: IOException) {
Log.e(TAG, e.toString())
Log.e(TAG, "IOException, you might not have internet connection")
Log.e(TAG(), e.toString())
Log.e(TAG(), "IOException, you might not have internet connection")
return@launchWhenCreated
} catch (e: HttpException) {
Log.e(TAG, "HttpException, unexpected response")
Log.e(TAG(), "HttpException, unexpected response")
return@launchWhenCreated
} finally {
binding.subRefresh.isRefreshing = false

View File

@ -8,14 +8,13 @@ import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.adapters.WatchHistoryAdapter
import com.github.libretube.database.DatabaseHolder
import com.github.libretube.databinding.FragmentWatchHistoryBinding
import com.github.libretube.db.DatabaseHolder
import com.github.libretube.db.obj.WatchHistoryItem
import com.github.libretube.extensions.BaseFragment
import com.github.libretube.extensions.await
import com.github.libretube.obj.WatchHistoryItem
class WatchHistoryFragment : BaseFragment() {
private val TAG = "WatchHistoryFragment"
private lateinit var binding: FragmentWatchHistoryBinding
override fun onCreateView(
@ -33,7 +32,7 @@ class WatchHistoryFragment : BaseFragment() {
var watchHistory = listOf<WatchHistoryItem>()
Thread {
watchHistory = DatabaseHolder.database.watchHistoryDao().getAll()
watchHistory = DatabaseHolder.db.watchHistoryDao().getAll()
}.await()
if (watchHistory.isEmpty()) return

View File

@ -12,7 +12,6 @@ import com.github.libretube.views.MaterialPreferenceFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder
class AdvancedSettings : MaterialPreferenceFragment() {
val TAG = "AdvancedSettings"
/**
* result listeners for importing and exporting subscriptions

View File

@ -16,7 +16,6 @@ import com.github.libretube.views.MaterialPreferenceFragment
import com.google.android.material.color.DynamicColors
class AppearanceSettings : MaterialPreferenceFragment() {
private val TAG = "AppearanceSettings"
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.appearance_settings, rootKey)

View File

@ -9,7 +9,6 @@ import com.github.libretube.dialogs.RequireRestartDialog
import com.github.libretube.views.MaterialPreferenceFragment
class GeneralSettings : MaterialPreferenceFragment() {
val TAG = "SettingsFragment"
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.general_settings, rootKey)

View File

@ -4,7 +4,7 @@ import android.os.Bundle
import androidx.preference.Preference
import com.github.libretube.R
import com.github.libretube.activities.SettingsActivity
import com.github.libretube.database.DatabaseHolder
import com.github.libretube.db.DatabaseHolder
import com.github.libretube.views.MaterialPreferenceFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -20,7 +20,7 @@ class HistorySettings : MaterialPreferenceFragment() {
val clearHistory = findPreference<Preference>(PreferenceKeys.CLEAR_SEARCH_HISTORY)
clearHistory?.setOnPreferenceClickListener {
showClearDialog(R.string.clear_history) {
DatabaseHolder.database.searchHistoryDao().deleteAll()
DatabaseHolder.db.searchHistoryDao().deleteAll()
}
true
}
@ -29,7 +29,7 @@ class HistorySettings : MaterialPreferenceFragment() {
val clearWatchHistory = findPreference<Preference>(PreferenceKeys.CLEAR_WATCH_HISTORY)
clearWatchHistory?.setOnPreferenceClickListener {
showClearDialog(R.string.clear_history) {
DatabaseHolder.database.watchHistoryDao().deleteAll()
DatabaseHolder.db.watchHistoryDao().deleteAll()
}
true
}
@ -38,7 +38,7 @@ class HistorySettings : MaterialPreferenceFragment() {
val clearWatchPositions = findPreference<Preference>(PreferenceKeys.CLEAR_WATCH_POSITIONS)
clearWatchPositions?.setOnPreferenceClickListener {
showClearDialog(R.string.reset_watch_positions) {
DatabaseHolder.database.watchPositionDao().deleteAll()
DatabaseHolder.db.watchPositionDao().deleteAll()
}
true
}

View File

@ -12,20 +12,19 @@ import androidx.preference.Preference
import androidx.preference.SwitchPreferenceCompat
import com.github.libretube.R
import com.github.libretube.activities.SettingsActivity
import com.github.libretube.database.DatabaseHolder
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.db.DatabaseHolder
import com.github.libretube.db.obj.CustomInstance
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.extensions.await
import com.github.libretube.obj.CustomInstance
import com.github.libretube.util.ImportHelper
import com.github.libretube.util.PermissionHelper
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.views.MaterialPreferenceFragment
class InstanceSettings : MaterialPreferenceFragment() {
val TAG = "InstanceSettings"
/**
* result listeners for importing and exporting subscriptions
@ -107,7 +106,7 @@ class InstanceSettings : MaterialPreferenceFragment() {
val clearCustomInstances = findPreference<Preference>(PreferenceKeys.CLEAR_CUSTOM_INSTANCES)
clearCustomInstances?.setOnPreferenceClickListener {
Thread {
DatabaseHolder.database.customInstanceDao().deleteAll()
DatabaseHolder.db.customInstanceDao().deleteAll()
}.await()
activity?.recreate()
true
@ -162,7 +161,7 @@ class InstanceSettings : MaterialPreferenceFragment() {
lifecycleScope.launchWhenCreated {
var customInstances = listOf<CustomInstance>()
Thread {
customInstances = DatabaseHolder.database.customInstanceDao().getAll()
customInstances = DatabaseHolder.db.customInstanceDao().getAll()
}.await()
val instanceNames = arrayListOf<String>()

View File

@ -15,7 +15,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class MainSettings : MaterialPreferenceFragment() {
val TAG = "SettingsFragment"
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.settings, rootKey)

View File

@ -10,7 +10,6 @@ import com.github.libretube.util.NotificationHelper
import com.github.libretube.views.MaterialPreferenceFragment
class NotificationSettings : MaterialPreferenceFragment() {
val TAG = "SettingsFragment"
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.notification_settings, rootKey)

View File

@ -10,7 +10,6 @@ import com.github.libretube.views.MaterialPreferenceFragment
import java.util.*
class PlayerSettings : MaterialPreferenceFragment() {
val TAG = "PlayerSettings"
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.player_settings, rootKey)

View File

@ -7,10 +7,6 @@ import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
object PreferenceHelper {
private val TAG = "PreferenceHelper"
private lateinit var prefContext: Context
/**
* for normal preferences
*/
@ -29,9 +25,7 @@ object PreferenceHelper {
* set the context that is being used to access the shared preferences
*/
fun setContext(context: Context) {
prefContext = context
settings = getDefaultSharedPreferences(prefContext)
settings = getDefaultSharedPreferences(context)
editor = settings.edit()
authSettings = getAuthenticationPreferences(context)

View File

@ -6,7 +6,6 @@ import com.github.libretube.activities.SettingsActivity
import com.github.libretube.views.MaterialPreferenceFragment
class SponsorBlockSettings : MaterialPreferenceFragment() {
private val TAG = "SponsorBlockSettings"
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.sponsorblock_settings, rootKey)

View File

@ -15,6 +15,7 @@ import com.github.libretube.BACKGROUND_CHANNEL_ID
import com.github.libretube.Globals
import com.github.libretube.PLAYER_NOTIFICATION_ID
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.obj.Segment
import com.github.libretube.obj.Segments
import com.github.libretube.obj.Streams
@ -23,7 +24,6 @@ import com.github.libretube.preferences.PreferenceKeys
import com.github.libretube.util.AutoPlayHelper
import com.github.libretube.util.NowPlayingNotification
import com.github.libretube.util.PlayerHelper
import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.toID
import com.google.android.exoplayer2.C
import com.google.android.exoplayer2.ExoPlayer

View File

@ -9,7 +9,6 @@ import androidx.annotation.Nullable
import com.github.libretube.PLAYER_NOTIFICATION_ID
class ClosingService : Service() {
private val TAG = "ClosingService"
@Nullable
override fun onBind(intent: Intent?): IBinder? {

View File

@ -23,13 +23,13 @@ import com.github.libretube.DOWNLOAD_PENDING_NOTIFICATION_ID
import com.github.libretube.DOWNLOAD_SUCCESS_NOTIFICATION_ID
import com.github.libretube.Globals
import com.github.libretube.R
import com.github.libretube.extensions.TAG
import com.github.libretube.obj.DownloadType
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.preferences.PreferenceKeys
import java.io.File
class DownloadService : Service() {
val TAG = "DownloadService"
private lateinit var notification: NotificationCompat.Builder
@ -78,11 +78,11 @@ class DownloadService : Service() {
)
if (!tempDir.exists()) {
tempDir.mkdirs()
Log.e(TAG, "Directory make")
Log.e(TAG(), "Directory make")
} else {
tempDir.deleteRecursively()
tempDir.mkdirs()
Log.e(TAG, "Directory already have")
Log.e(TAG(), "Directory already have")
}
val downloadLocationPref = PreferenceHelper.getString(PreferenceKeys.DOWNLOAD_LOCATION, "")
@ -101,7 +101,7 @@ class DownloadService : Service() {
folderName
)
if (!libretubeDir.exists()) libretubeDir.mkdirs()
Log.i(TAG, libretubeDir.toString())
Log.i(TAG(), libretubeDir.toString())
// start download
try {
@ -130,7 +130,7 @@ class DownloadService : Service() {
}
}
} catch (e: IllegalArgumentException) {
Log.e(TAG, "download error $e")
Log.e(TAG(), "download error $e")
downloadFailedNotification()
}
}
@ -210,7 +210,7 @@ class DownloadService : Service() {
}
private fun downloadSucceededNotification() {
Log.i(TAG, "Download succeeded")
Log.i(TAG(), "Download succeeded")
val builder = NotificationCompat.Builder(this@DownloadService, DOWNLOAD_CHANNEL_ID)
.setSmallIcon(R.drawable.ic_download)
.setContentTitle(resources.getString(R.string.success))
@ -229,7 +229,7 @@ class DownloadService : Service() {
}
Globals.IS_DOWNLOAD_RUNNING = false
Log.d(TAG, "dl finished!")
Log.d(TAG(), "dl finished!")
stopForeground(true)
stopService(Intent(this@DownloadService, DownloadService::class.java))
super.onDestroy()

View File

@ -14,7 +14,6 @@ import com.github.libretube.R
import java.io.File
class UpdateService : Service() {
private val TAG = "UpdateService"
private lateinit var downloadUrl: String
private var downloadId: Long = -1
private lateinit var file: File

View File

@ -1,6 +1,7 @@
package com.github.libretube.util
import com.github.libretube.Globals
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.obj.StreamItem
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
@ -8,7 +9,6 @@ import kotlinx.coroutines.withContext
class AutoPlayHelper(
private val playlistId: String?
) {
private val TAG = "AutoPlayHelper"
private val playlistStreamIds = mutableListOf<String>()
private var playlistNextPage: String? = null

View File

@ -16,7 +16,6 @@ import java.io.ObjectOutputStream
class BackupHelper(
private val context: Context
) {
private val TAG = this::class.java.name
/**
* Backup the default shared preferences to a file
@ -25,7 +24,8 @@ class BackupHelper(
if (uri == null) return
var output: ObjectOutputStream? = null
try {
val fileDescriptor = context.contentResolver.openFileDescriptor(uri, "w")?.fileDescriptor
val fileDescriptor =
context.contentResolver.openFileDescriptor(uri, "w")?.fileDescriptor
output = ObjectOutputStream(FileOutputStream(fileDescriptor))
val pref: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
// write all preference objects to the output file
@ -53,7 +53,8 @@ class BackupHelper(
if (uri == null) return
var input: ObjectInputStream? = null
try {
val fileDescriptor = context.contentResolver.openFileDescriptor(uri, "r")?.fileDescriptor
val fileDescriptor =
context.contentResolver.openFileDescriptor(uri, "r")?.fileDescriptor
input = ObjectInputStream(FileInputStream(fileDescriptor))
val editor = PreferenceManager.getDefaultSharedPreferences(context).edit()

View File

@ -6,6 +6,9 @@ import android.util.Log
import android.widget.Toast
import com.fasterxml.jackson.databind.ObjectMapper
import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
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 com.github.libretube.preferences.PreferenceHelper
@ -20,7 +23,6 @@ import java.io.InputStreamReader
class ImportHelper(
private val activity: Activity
) {
private val TAG = "ImportHelper"
/**
* Import subscriptions by a file uri
@ -65,7 +67,7 @@ class ImportHelper(
Toast.makeText(activity, R.string.importsuccess, Toast.LENGTH_SHORT).show()
} catch (e: Exception) {
Log.e(TAG, e.toString())
Log.e(TAG(), e.toString())
Toast.makeText(
activity,
R.string.error,

View File

@ -14,6 +14,8 @@ import com.github.libretube.PUSH_CHANNEL_ID
import com.github.libretube.PUSH_NOTIFICATION_ID
import com.github.libretube.R
import com.github.libretube.activities.MainActivity
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.SubscriptionHelper
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.preferences.PreferenceKeys
import kotlinx.coroutines.async

View File

@ -9,7 +9,6 @@ import androidx.work.WorkerParameters
*/
class NotificationWorker(appContext: Context, parameters: WorkerParameters) :
Worker(appContext, parameters) {
private val TAG = "NotificationWorker"
override fun doWork(): Result {
// check whether there are new streams and notify if there are some

View File

@ -8,8 +8,6 @@ import com.github.libretube.preferences.PreferenceKeys
import com.google.android.exoplayer2.ui.CaptionStyleCompat
object PlayerHelper {
private val TAG = "PlayerHelper"
// get the audio source following the users preferences
fun getAudioSource(audios: List<PipedStream>): String {
val audioFormat = PreferenceHelper.getString(PreferenceKeys.PLAYER_AUDIO_FORMAT, "all")

View File

@ -14,7 +14,6 @@ internal class CustomExoPlayerView(
context: Context,
attributeSet: AttributeSet? = null
) : StyledPlayerView(context, attributeSet) {
val TAG = "CustomExoPlayerView"
val binding: ExoStyledPlayerControlViewBinding = ExoStyledPlayerControlViewBinding.bind(this)
private var doubleTapListener: DoubleTapInterface? = null

View File

@ -5,7 +5,6 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.github.libretube.R
import com.github.libretube.databinding.BottomSheetBinding
import com.github.libretube.interfaces.PlayerOptionsInterface
import com.google.android.material.bottomsheet.BottomSheetBehavior
@ -16,8 +15,6 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment
* Bottom Sheet including all the player options
*/
class PlayerOptionsBottomSheet : BottomSheetDialogFragment() {
private val TAG = this::class.java.name.toString()
lateinit var binding: BottomSheetBinding
private lateinit var playerOptionsInterface: PlayerOptionsInterface

View File

@ -4,7 +4,7 @@
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M6.719,19H10.24V5H6.719ZM13.76,5v14h3.521V5Z"
android:fillColor="@android:color/white"/>
<path
android:fillColor="@android:color/white"
android:pathData="M6.719,19H10.24V5H6.719ZM13.76,5v14h3.521V5Z" />
</vector>

View File

@ -51,13 +51,13 @@
<Preference
android:icon="@drawable/ic_backup"
app:title="@string/backup"
app:key="backup_settings" />
app:key="backup_settings"
app:title="@string/backup" />
<Preference
android:icon="@drawable/ic_restore"
app:title="@string/restore"
app:key="restore_settings" />
app:key="restore_settings"
app:title="@string/restore" />
</PreferenceCategory>