Commit e331834c authored by Geoffrey Métais's avatar Geoffrey Métais Committed by Nicolas Pomepuy
Browse files

Code cleaning

parent 20f66ec4
......@@ -25,6 +25,8 @@
package org.videolan.vlc.gui.browser
import android.app.Activity
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import org.videolan.vlc.interfaces.IEventsHandler
interface BrowserContainer<T> : IEventsHandler<T> {
......@@ -36,4 +38,22 @@ interface BrowserContainer<T> : IEventsHandler<T> {
val isNetwork: Boolean
val isFile: Boolean
val inCards: Boolean
}
class BrowserContainerImpl<T>(
override val scannedDirectory: Boolean,
override val mrl: String?,
override val isRootDirectory: Boolean,
override val isNetwork: Boolean,
override val isFile: Boolean,
override val inCards: Boolean
) : BrowserContainer<T> {
override fun containerActivity() = throw NotImplementedError()
override fun onClick(v: View, position: Int, item: T) {}
override fun onLongClick(v: View, position: Int, item: T) = false
override fun onImageClick(v: View, position: Int, item: T) {}
override fun onCtxClick(v: View, position: Int, item: T) {}
override fun onUpdateFinished(adapter: RecyclerView.Adapter<*>) {}
override fun onMainActionClick(v: View, position: Int, item: T) {}
override fun onItemFocused(v: View, item: T) {}
}
\ No newline at end of file
......@@ -208,7 +208,14 @@ class MainBrowserFragment : BaseFragment(), View.OnClickListener, CtxActionRecei
dialog.show(fm, "fragment_add_server")
}
inner class MainBrowserContainer(override val scannedDirectory: Boolean = false, override val mrl: String? = null, override val isRootDirectory: Boolean = true, override val isNetwork: Boolean, override val isFile: Boolean, override val inCards: Boolean = true) : BrowserContainer<MediaLibraryItem> {
inner class MainBrowserContainer(
override val scannedDirectory: Boolean = false,
override val mrl: String? = null,
override val isRootDirectory: Boolean = true,
override val isNetwork: Boolean,
override val isFile: Boolean,
override val inCards: Boolean = true
) : BrowserContainer<MediaLibraryItem> by BrowserContainerImpl(scannedDirectory, mrl, isRootDirectory, isNetwork, isFile, inCards) {
override fun containerActivity() = requireActivity()
fun requireAdapter() = containerAdapterAssociation[this]?.first
......@@ -293,13 +300,6 @@ class MainBrowserFragment : BaseFragment(), View.OnClickListener, CtxActionRecei
}
}
}
override fun onUpdateFinished(adapter: RecyclerView.Adapter<*>) {
}
override fun onMainActionClick(v: View, position: Int, item: MediaLibraryItem) {}
override fun onItemFocused(v: View, item: MediaLibraryItem) {}
}
override fun onCtxAction(position: Int, option: Int) {
......
......@@ -2,7 +2,6 @@ package org.videolan.vlc.interfaces
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import org.videolan.medialibrary.media.MediaLibraryItem
interface IEventsHandler<T> {
fun onClick(v: View, position: Int, item: T)
......@@ -12,4 +11,4 @@ interface IEventsHandler<T> {
fun onUpdateFinished(adapter: RecyclerView.Adapter<*>)
fun onMainActionClick(v: View, position: Int, item: T)
fun onItemFocused(v: View, item: T)
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment