mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Merge pull request #4354 from Bnyro/master
chore: remove unneeded type annotations
This commit is contained in:
commit
e7bf196b0e
@ -9,9 +9,7 @@ import com.github.libretube.constants.PLAYER_NOTIFICATION_ID
|
||||
|
||||
class ClosingService : Service() {
|
||||
|
||||
override fun onBind(intent: Intent?): IBinder? {
|
||||
return null
|
||||
}
|
||||
override fun onBind(intent: Intent?) = null
|
||||
|
||||
// Handle application closing
|
||||
override fun onTaskRemoved(rootIntent: Intent?) {
|
||||
|
@ -183,7 +183,7 @@ class DownloadService : LifecycleService() {
|
||||
val sourceByte = con.inputStream.source()
|
||||
|
||||
var lastTime = System.currentTimeMillis() / 1000
|
||||
var lastRead: Long = 0
|
||||
var lastRead = 0L
|
||||
|
||||
try {
|
||||
// Check if downloading is still active and read next bytes.
|
||||
|
@ -77,9 +77,8 @@ class OnlinePlayerService : LifecycleService() {
|
||||
/**
|
||||
* SponsorBlock Segment data
|
||||
*/
|
||||
private var segments: List<Segment> = listOf()
|
||||
private var sponsorBlockConfig: MutableMap<String, SbSkipOptions> =
|
||||
PlayerHelper.getSponsorBlockCategories()
|
||||
private var segments = listOf<Segment>()
|
||||
private var sponsorBlockConfig = PlayerHelper.getSponsorBlockCategories()
|
||||
|
||||
/**
|
||||
* [Notification] for the player
|
||||
|
@ -60,7 +60,7 @@ class MainActivity : BaseActivity() {
|
||||
|
||||
private var savedSearchQuery: String? = null
|
||||
|
||||
val autoRotationEnabled: Boolean by lazy {
|
||||
val autoRotationEnabled by lazy {
|
||||
PreferenceHelper.getBoolean(
|
||||
PreferenceKeys.AUTO_ROTATION,
|
||||
resources.getBoolean(R.bool.config_default_auto_rotation_pref)
|
||||
|
@ -19,8 +19,7 @@ class LogoutDialog(
|
||||
|
||||
val user = PreferenceHelper.getUsername()
|
||||
|
||||
binding.user.text =
|
||||
binding.user.text.toString() + " (" + user + ")"
|
||||
binding.user.text = binding.user.text.toString() + " ($user)"
|
||||
binding.logout.setOnClickListener {
|
||||
Toast.makeText(context, R.string.loggedout, Toast.LENGTH_SHORT).show()
|
||||
|
||||
|
@ -16,6 +16,7 @@ class StatsDialog(
|
||||
) : DialogFragment() {
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class)
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val binding = DialogStatsBinding.inflate(layoutInflater)
|
||||
binding.videoId.setText(videoId)
|
||||
|
@ -53,11 +53,11 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions {
|
||||
private val viewModel: PlayerViewModel by activityViewModels()
|
||||
|
||||
// for the transition
|
||||
private var sId: Int = 0
|
||||
private var eId: Int = 0
|
||||
private var transitionStartId = 0
|
||||
private var transitionEndId = 0
|
||||
|
||||
private var handler = Handler(Looper.getMainLooper())
|
||||
private var isPaused: Boolean = false
|
||||
private var isPaused = false
|
||||
|
||||
private var playerService: OnlinePlayerService? = null
|
||||
|
||||
@ -215,15 +215,15 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions {
|
||||
progress: Float
|
||||
) {
|
||||
mainMotionLayout.progress = abs(progress)
|
||||
eId = endId
|
||||
sId = startId
|
||||
transitionEndId = endId
|
||||
transitionStartId = startId
|
||||
}
|
||||
|
||||
override fun onTransitionCompleted(motionLayout: MotionLayout?, currentId: Int) {
|
||||
if (currentId == eId) {
|
||||
if (currentId == transitionEndId) {
|
||||
viewModel.isMiniPlayerVisible.value = true
|
||||
mainMotionLayout.progress = 1F
|
||||
} else if (currentId == sId) {
|
||||
} else if (currentId == transitionStartId) {
|
||||
viewModel.isMiniPlayerVisible.value = false
|
||||
mainMotionLayout.progress = 0F
|
||||
}
|
||||
|
@ -146,8 +146,8 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
||||
private lateinit var videoId: String
|
||||
private var playlistId: String? = null
|
||||
private var channelId: String? = null
|
||||
private var keepQueue: Boolean = false
|
||||
private var timeStamp: Long = 0
|
||||
private var keepQueue = false
|
||||
private var timeStamp = 0L
|
||||
|
||||
/**
|
||||
* Video information fetched at runtime
|
||||
@ -157,8 +157,8 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
||||
/**
|
||||
* for the transition
|
||||
*/
|
||||
private var sId: Int = 0
|
||||
private var eId: Int = 0
|
||||
private var transitionStartId = 0
|
||||
private var transitionEndId = 0
|
||||
private var isTransitioning = true
|
||||
|
||||
/**
|
||||
@ -166,7 +166,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
||||
*/
|
||||
private lateinit var exoPlayer: ExoPlayer
|
||||
private lateinit var trackSelector: DefaultTrackSelector
|
||||
private var captionLanguage: String? = PlayerHelper.defaultSubtitleCode
|
||||
private var captionLanguage = PlayerHelper.defaultSubtitleCode
|
||||
|
||||
private val cronetDataSourceFactory = CronetDataSource.Factory(
|
||||
CronetHelper.cronetEngine,
|
||||
@ -323,14 +323,14 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
||||
binding.player.hideController()
|
||||
binding.player.useController = false
|
||||
commentsViewModel.setCommentSheetExpand(false)
|
||||
eId = endId
|
||||
sId = startId
|
||||
transitionEndId = endId
|
||||
transitionStartId = startId
|
||||
}
|
||||
|
||||
override fun onTransitionCompleted(motionLayout: MotionLayout?, currentId: Int) {
|
||||
if (_binding == null) return
|
||||
|
||||
if (currentId == eId) {
|
||||
if (currentId == transitionEndId) {
|
||||
viewModel.isMiniPlayerVisible.value = true
|
||||
// disable captions temporarily
|
||||
updateCaptionsLanguage(null)
|
||||
@ -339,7 +339,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
||||
binding.sbSkipBtn.isGone = true
|
||||
mainMotionLayout.progress = 1F
|
||||
(activity as MainActivity).requestOrientationChange()
|
||||
} else if (currentId == sId) {
|
||||
} else if (currentId == transitionStartId) {
|
||||
viewModel.isMiniPlayerVisible.value = false
|
||||
// re-enable captions
|
||||
updateCaptionsLanguage(captionLanguage)
|
||||
|
@ -51,7 +51,7 @@ class PlaylistFragment : Fragment() {
|
||||
// general playlist information
|
||||
private var playlistId: String? = null
|
||||
private var playlistName: String? = null
|
||||
private var playlistType: PlaylistType = PlaylistType.PUBLIC
|
||||
private var playlistType = PlaylistType.PUBLIC
|
||||
|
||||
// runtime variables
|
||||
private var playlistFeed = mutableListOf<StreamItem>()
|
||||
|
@ -29,7 +29,6 @@ import kotlinx.coroutines.withContext
|
||||
class SearchFragment : Fragment() {
|
||||
private var _binding: FragmentSearchBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private val viewModel: SearchViewModel by activityViewModels()
|
||||
|
||||
private var query: String? = null
|
||||
|
@ -34,10 +34,10 @@ class SearchResultFragment : Fragment() {
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private var nextPage: String? = null
|
||||
private var query: String = ""
|
||||
private var query = ""
|
||||
|
||||
private lateinit var searchAdapter: SearchAdapter
|
||||
private var apiSearchFilter: String = "all"
|
||||
private var apiSearchFilter = "all"
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -42,7 +42,7 @@ class SubscriptionsFragment : Fragment() {
|
||||
|
||||
private val viewModel: SubscriptionsViewModel by activityViewModels()
|
||||
private val playerModel: PlayerViewModel by activityViewModels()
|
||||
private var channelGroups: List<SubscriptionGroup> = listOf()
|
||||
private var channelGroups = listOf<SubscriptionGroup>()
|
||||
private var selectedFilterGroup = 0
|
||||
private var isCurrentTabSubChannels = false
|
||||
|
||||
|
@ -17,13 +17,9 @@ import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class SubscriptionsViewModel : ViewModel() {
|
||||
var videoFeed = MutableLiveData<List<StreamItem>?>().apply {
|
||||
value = null
|
||||
}
|
||||
var videoFeed = MutableLiveData<List<StreamItem>?>()
|
||||
|
||||
var subscriptions = MutableLiveData<List<Subscription>?>().apply {
|
||||
value = null
|
||||
}
|
||||
var subscriptions = MutableLiveData<List<Subscription>?>()
|
||||
|
||||
fun fetchFeed(context: Context) {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
|
@ -25,7 +25,7 @@ class EditChannelGroupSheet(
|
||||
) : ExpandedBottomSheet() {
|
||||
private val subscriptionsModel: SubscriptionsViewModel by activityViewModels()
|
||||
private lateinit var binding: DialogEditChannelGroupBinding
|
||||
private var channels: List<Subscription> = listOf()
|
||||
private var channels = listOf<Subscription>()
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
|
@ -26,7 +26,7 @@ class MarkableTimeBar(
|
||||
attributeSet: AttributeSet? = null
|
||||
) : DefaultTimeBar(context, attributeSet) {
|
||||
|
||||
private var segments: List<Segment> = listOf()
|
||||
private var segments = listOf<Segment>()
|
||||
private var player: Player? = null
|
||||
private var length: Int = 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user