Commit 39f74965 authored by Brais Gabín's avatar Brais Gabín Committed by Geoffrey Métais
Browse files

Use import instead of full class name


Signed-off-by: default avatarGeoffrey Métais <geoffrey.metais@gmail.com>
parent 4f8e4926
......@@ -37,6 +37,7 @@ import android.util.Log
import androidx.core.app.NotificationManagerCompat
import androidx.core.content.ContextCompat
import androidx.lifecycle.MutableLiveData
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.actor
......@@ -58,7 +59,7 @@ private const val NOTIFICATION_DELAY = 1000L
class MediaParsingService : Service(), DevicesDiscoveryCb, CoroutineScope {
override val coroutineContext = Dispatchers.Main.immediate
private lateinit var wakeLock: PowerManager.WakeLock
private lateinit var localBroadcastManager: androidx.localbroadcastmanager.content.LocalBroadcastManager
private lateinit var localBroadcastManager: LocalBroadcastManager
private val binder = LocalBinder()
private lateinit var medialibrary: Medialibrary
......@@ -90,7 +91,7 @@ class MediaParsingService : Service(), DevicesDiscoveryCb, CoroutineScope {
@SuppressLint("WakelockTimeout")
override fun onCreate() {
super.onCreate()
localBroadcastManager = androidx.localbroadcastmanager.content.LocalBroadcastManager.getInstance(this)
localBroadcastManager = LocalBroadcastManager.getInstance(this)
medialibrary = Medialibrary.getInstance()
medialibrary.addDeviceDiscoveryCb(this@MediaParsingService)
val filter = IntentFilter()
......
......@@ -49,6 +49,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import androidx.lifecycle.ServiceLifecycleDispatcher
import androidx.media.MediaBrowserServiceCompat
import androidx.media.session.MediaButtonReceiver
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.actor
......@@ -517,7 +518,7 @@ class PlaybackService : MediaBrowserServiceCompat(), CoroutineScope, LifecycleOw
dispatcher.onServicePreSuperOnStart()
when (intent?.action) {
Intent.ACTION_MEDIA_BUTTON -> {
if (AndroidDevices.hasTsp || AndroidDevices.hasPlayServices) androidx.media.session.MediaButtonReceiver.handleIntent(mediaSession, intent)
if (AndroidDevices.hasTsp || AndroidDevices.hasPlayServices) MediaButtonReceiver.handleIntent(mediaSession, intent)
}
ACTION_REMOTE_PLAYPAUSE,
ACTION_REMOTE_PLAY,
......@@ -553,7 +554,7 @@ class PlaybackService : MediaBrowserServiceCompat(), CoroutineScope, LifecycleOw
override fun onBind(intent: Intent): IBinder? {
dispatcher.onServicePreSuperOnBind()
return if (androidx.media.MediaBrowserServiceCompat.SERVICE_INTERFACE == intent.action) super.onBind(intent) else mBinder
return if (MediaBrowserServiceCompat.SERVICE_INTERFACE == intent.action) super.onBind(intent) else mBinder
}
val vout : IVLCVout?
......@@ -740,9 +741,9 @@ class PlaybackService : MediaBrowserServiceCompat(), CoroutineScope, LifecycleOw
private fun initMediaSession() {
val mediaButtonIntent = Intent(Intent.ACTION_MEDIA_BUTTON)
mediaButtonIntent.setClass(this, androidx.media.session.MediaButtonReceiver::class.java)
mediaButtonIntent.setClass(this, MediaButtonReceiver::class.java)
val mbrIntent = PendingIntent.getBroadcast(this, 0, mediaButtonIntent, 0)
val mbrName = ComponentName(this, androidx.media.session.MediaButtonReceiver::class.java)
val mbrName = ComponentName(this, MediaButtonReceiver::class.java)
mediaSession = MediaSessionCompat(this, "VLC", mbrName, mbrIntent)
mediaSession.setFlags(MediaSessionCompat.FLAG_HANDLES_MEDIA_BUTTONS or MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS)
......@@ -1293,18 +1294,18 @@ class PlaybackService : MediaBrowserServiceCompat(), CoroutineScope, LifecycleOw
* Browsing
*/
override fun onGetRoot(clientPackageName: String, clientUid: Int, rootHints: Bundle?): androidx.media.MediaBrowserServiceCompat.BrowserRoot? {
return if (Permissions.canReadStorage(this@PlaybackService)) androidx.media.MediaBrowserServiceCompat.BrowserRoot(BrowserProvider.ID_ROOT, null) else null
override fun onGetRoot(clientPackageName: String, clientUid: Int, rootHints: Bundle?): MediaBrowserServiceCompat.BrowserRoot? {
return if (Permissions.canReadStorage(this@PlaybackService)) MediaBrowserServiceCompat.BrowserRoot(BrowserProvider.ID_ROOT, null) else null
}
override fun onLoadChildren(parentId: String, result: androidx.media.MediaBrowserServiceCompat.Result<List<MediaBrowserCompat.MediaItem>>) {
override fun onLoadChildren(parentId: String, result: MediaBrowserServiceCompat.Result<List<MediaBrowserCompat.MediaItem>>) {
result.detach()
if (!medialibrary.isInitiated || libraryReceiver != null)
registerMedialibrary(Runnable { sendResults(result, parentId) })
else sendResults(result, parentId)
}
private fun sendResults(result: androidx.media.MediaBrowserServiceCompat.Result<List<MediaBrowserCompat.MediaItem>>, parentId: String) {
private fun sendResults(result: MediaBrowserServiceCompat.Result<List<MediaBrowserCompat.MediaItem>>, parentId: String) {
launch(Dispatchers.IO) {
try {
result.sendResult(BrowserProvider.browse(applicationContext, parentId))
......
......@@ -27,6 +27,8 @@ import android.view.ViewGroup
import android.webkit.WebView
import android.widget.ScrollView
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
......@@ -41,9 +43,9 @@ import org.videolan.vlc.util.Util
private const val TAG = "VLC/AboutFragment"
private const val MODE_TOTAL = 2 // Number of audio browser modes
class AboutFragment : androidx.fragment.app.Fragment() {
class AboutFragment : Fragment() {
private lateinit var viewPager: androidx.viewpager.widget.ViewPager
private lateinit var viewPager: ViewPager
private lateinit var tabLayout: com.google.android.material.tabs.TabLayout
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
......
......@@ -2,13 +2,14 @@ package org.videolan.vlc.gui
import androidx.annotation.MainThread
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.actor
@ObsoleteCoroutinesApi
@ExperimentalCoroutinesApi
abstract class DiffUtilAdapter<D, VH : androidx.recyclerview.widget.RecyclerView.ViewHolder> : androidx.recyclerview.widget.RecyclerView.Adapter<VH>(), CoroutineScope {
abstract class DiffUtilAdapter<D, VH : RecyclerView.ViewHolder> : RecyclerView.Adapter<VH>(), CoroutineScope {
override val coroutineContext = Dispatchers.Main.immediate
protected var dataset: List<D> = listOf()
......
......@@ -32,7 +32,7 @@ class SimpleAdapter(val handler: ClickHandler) : ListAdapter<MediaLibraryItem, S
fun isEmpty() = itemCount == 0
class ViewHolder(handler: ClickHandler, val binding: SimpleItemBinding) : androidx.recyclerview.widget.RecyclerView.ViewHolder(binding.root) {
class ViewHolder(handler: ClickHandler, val binding: SimpleItemBinding) : RecyclerView.ViewHolder(binding.root) {
init {
binding.handler = handler
}
......
......@@ -41,8 +41,11 @@ import android.widget.SeekBar.OnSeekBarChangeListener
import androidx.annotation.MainThread
import androidx.annotation.RequiresPermission
import androidx.appcompat.app.AppCompatActivity
import androidx.constraintlayout.widget.ConstraintSet
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.transition.AutoTransition
import androidx.transition.TransitionManager
import com.google.android.material.bottomsheet.BottomSheetBehavior
......@@ -77,7 +80,7 @@ private const val SEARCH_TIMEOUT_MILLIS = 5000
@ExperimentalCoroutinesApi
@Suppress("UNUSED_PARAMETER")
class AudioPlayer : androidx.fragment.app.Fragment(), PlaylistAdapter.IPlayer, TextWatcher {
class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher {
private lateinit var binding: AudioPlayerBinding
private lateinit var playlistAdapter: PlaylistAdapter
......@@ -127,7 +130,7 @@ class AudioPlayer : androidx.fragment.app.Fragment(), PlaylistAdapter.IPlayer, T
super.onViewCreated(view, savedInstanceState)
DEFAULT_BACKGROUND_DARKER_ID = UiTools.getResourceFromAttribute(view.context, R.attr.background_default_darker)
DEFAULT_BACKGROUND_ID = UiTools.getResourceFromAttribute(view.context, R.attr.background_default)
binding.songsList.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(view.context)
binding.songsList.layoutManager = LinearLayoutManager(view.context)
binding.songsList.adapter = playlistAdapter
binding.audioMediaSwitcher.setAudioMediaSwitcherListener(headerMediaSwitcherListener)
binding.coverMediaSwitcher.setAudioMediaSwitcherListener(mCoverMediaSwitcherListener)
......@@ -383,16 +386,16 @@ class AudioPlayer : androidx.fragment.app.Fragment(), PlaylistAdapter.IPlayer, T
binding.progressBar.visibility = if (progressBarVisible) View.VISIBLE else View.GONE
val cl = binding.header
TransitionManager.beginDelayedTransition(cl, AutoTransition().setDuration(200))
androidx.constraintlayout.widget.ConstraintSet().apply {
ConstraintSet().apply {
clone(cl)
setVisibility(R.id.playlist_ab_repeat, if (abVisible) androidx.constraintlayout.widget.ConstraintSet.VISIBLE else androidx.constraintlayout.widget.ConstraintSet.GONE)
setVisibility(R.id.playlist_search, if (searchVisible) androidx.constraintlayout.widget.ConstraintSet.VISIBLE else androidx.constraintlayout.widget.ConstraintSet.GONE)
setVisibility(R.id.playlist_switch, if (playlistSwitchVisible) androidx.constraintlayout.widget.ConstraintSet.VISIBLE else androidx.constraintlayout.widget.ConstraintSet.GONE)
setVisibility(R.id.adv_function, if (advFuncVisible) androidx.constraintlayout.widget.ConstraintSet.VISIBLE else androidx.constraintlayout.widget.ConstraintSet.GONE)
setVisibility(R.id.header_play_pause, if (headerPlayPauseVisible) androidx.constraintlayout.widget.ConstraintSet.VISIBLE else androidx.constraintlayout.widget.ConstraintSet.GONE)
setVisibility(R.id.header_time, if (headerTimeVisible) androidx.constraintlayout.widget.ConstraintSet.VISIBLE else androidx.constraintlayout.widget.ConstraintSet.GONE)
setVisibility(R.id.playlist_search_text, if (searchTextVisible) androidx.constraintlayout.widget.ConstraintSet.VISIBLE else androidx.constraintlayout.widget.ConstraintSet.GONE)
setVisibility(R.id.audio_media_switcher, if (searchTextVisible) androidx.constraintlayout.widget.ConstraintSet.GONE else androidx.constraintlayout.widget.ConstraintSet.VISIBLE)
setVisibility(R.id.playlist_ab_repeat, if (abVisible) ConstraintSet.VISIBLE else ConstraintSet.GONE)
setVisibility(R.id.playlist_search, if (searchVisible) ConstraintSet.VISIBLE else ConstraintSet.GONE)
setVisibility(R.id.playlist_switch, if (playlistSwitchVisible) ConstraintSet.VISIBLE else ConstraintSet.GONE)
setVisibility(R.id.adv_function, if (advFuncVisible) ConstraintSet.VISIBLE else ConstraintSet.GONE)
setVisibility(R.id.header_play_pause, if (headerPlayPauseVisible) ConstraintSet.VISIBLE else ConstraintSet.GONE)
setVisibility(R.id.header_time, if (headerTimeVisible) ConstraintSet.VISIBLE else ConstraintSet.GONE)
setVisibility(R.id.playlist_search_text, if (searchTextVisible) ConstraintSet.VISIBLE else ConstraintSet.GONE)
setVisibility(R.id.audio_media_switcher, if (searchTextVisible) ConstraintSet.GONE else ConstraintSet.VISIBLE)
applyTo(cl)
}
}
......
......@@ -30,8 +30,13 @@ import android.text.TextUtils
import android.view.*
import androidx.appcompat.view.ActionMode
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import kotlinx.coroutines.*
import org.videolan.medialibrary.media.MediaLibraryItem
import org.videolan.medialibrary.media.MediaWrapper
......@@ -63,10 +68,10 @@ internal const val MSG_HIDE_LOADING = 1
private const val MSG_REFRESH = 3
@ExperimentalCoroutinesApi
abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefreshable, androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener, View.OnClickListener, IEventsHandler, CtxActionReceiver {
abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefreshable, SwipeRefreshLayout.OnRefreshListener, View.OnClickListener, IEventsHandler, CtxActionReceiver {
protected val handler = BrowserFragmentHandler(this)
private lateinit var layoutManager: androidx.recyclerview.widget.LinearLayoutManager
private lateinit var layoutManager: LinearLayoutManager
var mrl: String? = null
protected var currentMedia: MediaWrapper? = null
private var savedPosition = -1
......@@ -80,7 +85,7 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
protected lateinit var browserFavRepository: BrowserFavRepository
protected abstract fun createFragment(): androidx.fragment.app.Fragment
protected abstract fun createFragment(): Fragment
protected abstract fun browseRoot()
override fun onCreate(bundle: Bundle?) {
......@@ -119,7 +124,7 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
if (!this::adapter.isInitialized) adapter = BaseBrowserAdapter(this)
layoutManager = androidx.recyclerview.widget.LinearLayoutManager(activity)
layoutManager = LinearLayoutManager(activity)
binding.networkList.layoutManager = layoutManager
binding.networkList.adapter = adapter
registerSwiperRefreshlayout()
......@@ -130,14 +135,14 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
open fun registerSwiperRefreshlayout() = mSwipeRefreshLayout.setOnRefreshListener(this)
override fun setBreadcrumb() {
val ariane = requireActivity().findViewById<androidx.recyclerview.widget.RecyclerView>(R.id.ariane) ?: return
val ariane = requireActivity().findViewById<RecyclerView>(R.id.ariane) ?: return
val media = currentMedia
if (media != null && isSchemeSupported(media.uri?.scheme)) {
ariane.visibility = View.VISIBLE
ariane.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(requireContext(), androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL, false)
ariane.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
ariane.adapter = PathAdapter(this, media)
if (ariane.itemDecorationCount == 0) {
val did = androidx.recyclerview.widget.DividerItemDecoration(requireContext(), androidx.recyclerview.widget.DividerItemDecoration.HORIZONTAL)
val did = DividerItemDecoration(requireContext(), DividerItemDecoration.HORIZONTAL)
did.setDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.divider_grey_50_18dp)!!)
ariane.addItemDecoration(did)
}
......@@ -146,7 +151,7 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
}
fun backTo(tag: String) {
requireActivity().supportFragmentManager.popBackStack(tag, androidx.fragment.app.FragmentManager.POP_BACK_STACK_INCLUSIVE)
requireActivity().supportFragmentManager.popBackStack(tag, FragmentManager.POP_BACK_STACK_INCLUSIVE)
}
......@@ -452,7 +457,7 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
}
}
override fun onUpdateFinished(adapter: androidx.recyclerview.widget.RecyclerView.Adapter<*>) {
override fun onUpdateFinished(adapter: RecyclerView.Adapter<*>) {
if (mSwipeRefreshLayout != null) mSwipeRefreshLayout.isRefreshing = false
handler.sendEmptyMessage(MSG_HIDE_LOADING)
updateEmptyView()
......
......@@ -29,6 +29,7 @@ import android.net.Uri
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProviders
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
......@@ -49,7 +50,7 @@ class FilePickerFragment : FileBrowserFragment() {
get() = false
override fun createFragment(): androidx.fragment.app.Fragment {
override fun createFragment(): Fragment {
return FilePickerFragment()
}
......
......@@ -67,7 +67,7 @@ import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.RecyclerView;
import androidx.transition.TransitionManager;
public abstract class MediaBrowserFragment<T extends SortableModel> extends Fragment implements androidx.appcompat.view.ActionMode.Callback, Filterable {
public abstract class MediaBrowserFragment<T extends SortableModel> extends Fragment implements ActionMode.Callback, Filterable {
public final static String TAG = "VLC/MediaBrowserFragment";
......
......@@ -11,9 +11,9 @@ import org.videolan.medialibrary.media.MediaWrapper
import org.videolan.vlc.R
import org.videolan.vlc.util.AndroidDevices
private val storages = androidx.collection.SimpleArrayMap<String, String>()
private val storages = SimpleArrayMap<String, String>()
class PathAdapter(val browser: BaseBrowserFragment, media: MediaWrapper) : androidx.recyclerview.widget.RecyclerView.Adapter<PathAdapter.ViewHolder>() {
class PathAdapter(val browser: BaseBrowserFragment, media: MediaWrapper) : RecyclerView.Adapter<PathAdapter.ViewHolder>() {
init {
if (media.hasStateFlags(MediaLibraryItem.FLAG_STORAGE)) storages.put(Uri.decode(media.uri.path), media.title)
......@@ -34,7 +34,7 @@ class PathAdapter(val browser: BaseBrowserFragment, media: MediaWrapper) : andro
holder.root.text = segments[position]
}
inner class ViewHolder(val root : TextView) : androidx.recyclerview.widget.RecyclerView.ViewHolder(root) {
inner class ViewHolder(val root : TextView) : RecyclerView.ViewHolder(root) {
init {
root.setOnClickListener {
browser.backTo(adapterPosition.let { when (it) {
......
......@@ -34,7 +34,9 @@ import android.view.View
import android.widget.CheckBox
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.AppCompatEditText
import androidx.collection.SimpleArrayMap
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProviders
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.launch
......@@ -62,14 +64,14 @@ const val KEY_IN_MEDIALIB = "key_in_medialib"
class StorageBrowserFragment : FileBrowserFragment(), EntryPointsEventsCb {
internal var mScannedDirectory = false
private val mProcessingFolders = androidx.collection.SimpleArrayMap<String, CheckBox>()
private val mProcessingFolders = SimpleArrayMap<String, CheckBox>()
private var mSnack: com.google.android.material.snackbar.Snackbar? = null
private var mAlertDialog: AlertDialog? = null
override val categoryTitle: String
get() = getString(R.string.directories_summary)
override fun createFragment(): androidx.fragment.app.Fragment {
override fun createFragment(): Fragment {
return StorageBrowserFragment()
}
......
......@@ -27,6 +27,9 @@ import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import kotlinx.coroutines.Dispatchers
......@@ -70,8 +73,8 @@ class ContextSheet : com.google.android.material.bottomsheet.BottomSheetDialogFr
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
view.findViewById<TextView>(R.id.ctx_title).text = arguments?.getString(CTX_TITLE_KEY) ?: ""
val list = view.findViewById<androidx.recyclerview.widget.RecyclerView>(R.id.ctx_list)
list.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(requireContext())
val list = view.findViewById<RecyclerView>(R.id.ctx_list)
list.layoutManager = LinearLayoutManager(requireContext())
list.adapter = ContextAdapter()
val flags = arguments?.getInt(CTX_FLAGS_KEY) ?: 0
options = populateOptions(flags)
......@@ -110,11 +113,11 @@ class ContextSheet : com.google.android.material.bottomsheet.BottomSheetDialogFr
if (flags and CTX_DELETE != 0) add(Simple(CTX_DELETE, getString(R.string.delete), R.drawable.ic_ctx_delete_normal))
}
inner class ContextAdapter : androidx.recyclerview.widget.RecyclerView.Adapter<ContextAdapter.ViewHolder>() {
inner class ContextAdapter : RecyclerView.Adapter<ContextAdapter.ViewHolder>() {
private val inflater: LayoutInflater by lazy(LazyThreadSafetyMode.NONE) { LayoutInflater.from(requireContext()) }
inner class ViewHolder(val binding : ContextItemBinding) : androidx.recyclerview.widget.RecyclerView.ViewHolder(binding.root) {
inner class ViewHolder(val binding : ContextItemBinding) : RecyclerView.ViewHolder(binding.root) {
private val textColor = binding.contextOptionTitle.currentTextColor
private val focusedColor by lazy(LazyThreadSafetyMode.NONE) { ContextCompat.getColor(itemView.context, R.color.orange500transparent) }
init {
......@@ -144,7 +147,7 @@ interface CtxActionReceiver {
fun onCtxAction(position: Int, option: Int)
}
fun showContext(activity: androidx.fragment.app.FragmentActivity, receiver: CtxActionReceiver, position: Int, title: String, flags: Int) {
fun showContext(activity: FragmentActivity, receiver: CtxActionReceiver, position: Int, title: String, flags: Int) {
val ctxDialog = ContextSheet()
ctxDialog.arguments = Bundle(3).apply {
putString(CTX_TITLE_KEY, title)
......
......@@ -22,7 +22,7 @@ class DeviceDialog : DialogFragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(androidx.fragment.app.DialogFragment.STYLE_NO_FRAME, 0)
setStyle(DialogFragment.STYLE_NO_FRAME, 0)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
......
......@@ -26,7 +26,9 @@ import android.view.View
import android.view.ViewGroup
import android.view.Window
import androidx.core.content.ContextCompat
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
import org.videolan.libvlc.RendererItem
......@@ -43,7 +45,7 @@ const private val TAG = "VLC/RenderersDialog"
@ObsoleteCoroutinesApi
@ExperimentalCoroutinesApi
class RenderersDialog : androidx.fragment.app.DialogFragment() {
class RenderersDialog : DialogFragment() {
private var renderers = RendererDelegate.renderers.value
private lateinit var mBinding: DialogRenderersBinding
private val mAdapter = RendererAdapter()
......@@ -69,14 +71,14 @@ class RenderersDialog : androidx.fragment.app.DialogFragment() {
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
setStyle(androidx.fragment.app.DialogFragment.STYLE_NO_FRAME, 0)
setStyle(DialogFragment.STYLE_NO_FRAME, 0)
mBinding = DialogRenderersBinding.inflate(inflater, container, false)
return mBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
mBinding.holder = mClickHandler;
mBinding.renderersList.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(view.context)
mBinding.renderersList.layoutManager = LinearLayoutManager(view.context)
mBinding.renderersList.adapter = mAdapter
mBinding.renderersDisconnect.isEnabled = PlaybackService.hasRenderer()
mBinding.renderersDisconnect.setTextColor(ContextCompat.getColor(view.context, if (PlaybackService.hasRenderer()) R.color.orange800 else R.color.grey400))
......
......@@ -13,8 +13,11 @@ import org.videolan.vlc.gui.helpers.UiTools
import org.videolan.vlc.util.AndroidDevices
import org.videolan.vlc.viewmodels.SubtitlesModel
import androidx.core.widget.NestedScrollView
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
class SubtitleDownloadFragment : androidx.fragment.app.Fragment() {
class SubtitleDownloadFragment : Fragment() {
private lateinit var viewModel: SubtitlesModel
private lateinit var adapter: SubtitlesAdapter
lateinit var mediaPath: String
......@@ -36,9 +39,9 @@ class SubtitleDownloadFragment : androidx.fragment.app.Fragment() {
adapter = SubtitlesAdapter((parentFragment as SubtitleDownloaderDialogFragment).listEventActor)
val recyclerView = binding.subtitleList
recyclerView.addItemDecoration(androidx.recyclerview.widget.DividerItemDecoration(activity, androidx.recyclerview.widget.DividerItemDecoration.VERTICAL))
recyclerView.addItemDecoration(DividerItemDecoration(activity, DividerItemDecoration.VERTICAL))
recyclerView.adapter = adapter
recyclerView.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(activity)
recyclerView.layoutManager = LinearLayoutManager(activity)
viewModel.result.observe(this, Observer {
adapter.setList(it)
if (it.isNotEmpty()) focusOnView(binding.scrollView, binding.swipeContainer)
......
......@@ -10,7 +10,11 @@ import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.annotation.StringRes
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import androidx.lifecycle.ViewModelProviders
import kotlinx.coroutines.NonCancellable.isActive
import kotlinx.coroutines.ObsoleteCoroutinesApi
import kotlinx.coroutines.channels.actor
import kotlinx.coroutines.isActive
......@@ -28,7 +32,7 @@ private const val MEDIA_PATHS = "MEDIA_PATHS"
const val MEDIA_PATH = "MEDIA_PATH"
@ObsoleteCoroutinesApi
class SubtitleDownloaderDialogFragment: androidx.fragment.app.DialogFragment() {
class SubtitleDownloaderDialogFragment: DialogFragment() {
private lateinit var adapter: ViewPagerAdapter
private lateinit var paths: List<String>
private lateinit var viewModel: SubtitlesModel
......@@ -117,7 +121,7 @@ class SubtitleDownloaderDialogFragment: androidx.fragment.app.DialogFragment() {
}
}
class ViewPagerAdapter(context: Context, fragmentManager: androidx.fragment.app.FragmentManager, private val paths: List<String>): androidx.fragment.app.FragmentPagerAdapter(fragmentManager) {
class ViewPagerAdapter(context: Context, fragmentManager: FragmentManager, private val paths: List<String>): FragmentPagerAdapter(fragmentManager) {
private val tabTitles = arrayOf(context.getString(R.string.download), context.getString(R.string.history))
override fun getPageTitle(position: Int): String? = tabTitles[position]
......
package org.videolan.vlc.gui.dialogs
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import org.videolan.vlc.databinding.SubtitleHistoryFragmentBinding
import org.videolan.vlc.viewmodels.SubtitlesModel
class SubtitleHistoryFragment : androidx.fragment.app.Fragment() {
class SubtitleHistoryFragment : Fragment() {
private lateinit var viewModel: SubtitlesModel
private lateinit var adapter: SubtitlesAdapter
lateinit var mediaPath: String
......@@ -27,9 +29,9 @@ class SubtitleHistoryFragment : androidx.fragment.app.Fragment() {
adapter = SubtitlesAdapter((parentFragment as SubtitleDownloaderDialogFragment).listEventActor)
val recyclerView = binding.subtitleList
recyclerView.addItemDecoration(androidx.recyclerview.widget.DividerItemDecoration(activity, androidx.recyclerview.widget.DividerItemDecoration.VERTICAL))
recyclerView.addItemDecoration(DividerItemDecoration(activity, DividerItemDecoration.VERTICAL))
recyclerView.adapter = adapter
recyclerView.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(activity)
recyclerView.layoutManager = LinearLayoutManager(activity)
viewModel.history.observe(this, Observer {
adapter.setList(it)
})
......
......@@ -3,11 +3,12 @@ package org.videolan.vlc.gui.dialogs
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.SendChannel
import org.videolan.vlc.databinding.SubtitleDownloadItemBinding
internal class SubtitlesAdapter(private val eventActor: SendChannel<SubtitleEvent>) : androidx.recyclerview.widget.RecyclerView.Adapter<SubtitlesAdapter.ViewHolder>() {
internal class SubtitlesAdapter(private val eventActor: SendChannel<SubtitleEvent>) : RecyclerView.Adapter<SubtitlesAdapter.ViewHolder>() {
private var dataset: List<SubtitleItem>? = null
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SubtitlesAdapter.ViewHolder {
......@@ -29,7 +30,7 @@ internal class SubtitlesAdapter(private val eventActor: SendChannel<SubtitleEven
override fun getItemCount() = dataset?.size ?: 0
@ExperimentalCoroutinesApi
inner class ViewHolder(val binding: SubtitleDownloadItemBinding) : androidx.recyclerview.widget.RecyclerView.ViewHolder(binding.root), View.OnClickListener, View.OnLongClickListener {
inner class ViewHolder(val binding: SubtitleDownloadItemBinding) : RecyclerView.ViewHolder(binding.root), View.OnClickListener, View.OnLongClickListener {
init {
itemView.setOnClickListener(this)
......
......@@ -26,6 +26,7 @@ import androidx.databinding.DataBindingUtil;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.ViewDataBinding;
import androidx.fragment.app.DialogFragment;