Commit 20f66ec4 authored by Nicolas Pomepuy's avatar Nicolas Pomepuy
Browse files

New main browser fragment

parent 1e1e0001
<?xml version="1.0" encoding="utf-8"?><!--
~ *************************************************************************
~ browser_entry.xml
~ **************************************************************************
~ Copyright © 2020 VLC authors and VideoLAN
~ Author: Nicolas POMEPUY
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 2 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
~ ***************************************************************************
~
~
-->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Theme.VLC.HorizontalListTitle"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?><!--
~ *************************************************************************
~ card_browser_item.xml
~ **************************************************************************
~ Copyright © 2020 VLC authors and VideoLAN
~ Author: Nicolas POMEPUY
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 2 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
~ ***************************************************************************
~
~
-->
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:targetApi="jelly_bean">
<data>
<import type="android.view.View" />
<import type="android.text.TextUtils" />
<import type="org.videolan.medialibrary.media.MediaLibraryItem" />
<variable
name="holder"
type="org.videolan.vlc.gui.browser.BaseBrowserAdapter.ViewHolder" />
<variable
name="item"
type="MediaLibraryItem" />
<variable
name="filename"
type="String" />
<variable
name="hasContextMenu"
type="boolean" />
<variable
name="checkEnabled"
type="boolean" />
<variable
name="protocol"
type="String" />
<variable
name="cover"
type="android.graphics.drawable.BitmapDrawable" />
<variable
name="bgColor"
type="int" />
</data>
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="4dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@{bgColor}"
android:clickable="@{holder != null}"
android:focusable="true"
android:longClickable="@{hasContextMenu || item.getItemType() == MediaLibraryItem.TYPE_STORAGE}"
android:minWidth="150dp"
android:onClick="@{holder::onClick}"
android:onLongClick="@{holder::onLongClick}"
android:padding="2dp">
<org.videolan.vlc.gui.helpers.ThreeStatesCheckbox
android:id="@+id/browser_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="@{checkEnabled}"
android:focusable="false"
android:onClick="@{holder::onCheckBoxClick}"
android:visibility="@{item.getItemType() == MediaLibraryItem.TYPE_STORAGE ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- Image downloading is handled by org.videolan.vlc.gui.helpers.ImageLoader.loadImage() -->
<ImageView
android:id="@+id/item_icon"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_marginTop="8dp"
android:contentDescription="@string/cover_art"
android:onClick="@{holder::onImageClick}"
android:scaleType="centerCrop"
android:src="@{cover}"
android:visibility="@{item.getItemType() == MediaLibraryItem.TYPE_STORAGE ? View.GONE : View.VISIBLE}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:media="@{item}" />
<TextView
android:id="@+id/dvi_icon"
android:layout_width="0dp"
android:layout_height="0dp"
android:gravity="center"
android:text="@{protocol}"
android:textColor="@color/whitetransparent"
android:textSize="11sp"
android:visibility="@{ TextUtils.isEmpty(protocol) ? View.GONE : View.VISIBLE, default=gone}"
app:layout_constraintBottom_toBottomOf="@+id/item_icon"
app:layout_constraintEnd_toEndOf="@+id/item_icon"
app:layout_constraintStart_toStartOf="@+id/item_icon"
app:layout_constraintTop_toTopOf="@+id/item_icon" />
<TextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:ellipsize="marquee"
android:lineSpacingMultiplier="1.1"
android:marqueeRepeatLimit="1"
android:scrollHorizontally="true"
android:singleLine="true"
android:text="@{filename ?? item.title}"
android:textColor="?attr/list_title"
android:textSize="16sp"
app:ellipsizeMode="@{true}"
app:layout_constraintBottom_toTopOf="@+id/text"
app:layout_constraintEnd_toStartOf="@+id/item_more"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/item_icon"
app:layout_constraintVertical_chainStyle="packed"
app:layout_goneMarginBottom="8dp" />
<TextView
android:id="@+id/text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:maxLines="1"
android:text="@{item.description}"
android:textColor="?attr/list_subtitle"
android:textSize="12sp"
android:visibility="@{TextUtils.isEmpty(item.description) ? View.INVISIBLE : View.VISIBLE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/item_more"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title"
tools:visibility="visible" />
<ImageView
android:id="@+id/item_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_more"
android:clickable="@{hasContextMenu}"
android:onClick="@{holder::onMoreClick}"
android:visibility="@{hasContextMenu ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</layout>
<?xml version="1.0" encoding="utf-8"?><!--
~ *************************************************************************
~ main_browser_fragment.xml
~ **************************************************************************
~ Copyright © 2020 VLC authors and VideoLAN
~ Author: Nicolas POMEPUY
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 2 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
~ ***************************************************************************
~
~
-->
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/fav_browser_entry"
layout="@layout/browser_entry"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<include
android:id="@+id/local_browser_entry"
layout="@layout/browser_entry"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/fav_browser_entry" />
<include
android:id="@+id/network_browser_entry"
layout="@layout/browser_entry"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/local_browser_entry" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
\ No newline at end of file
......@@ -613,7 +613,7 @@
<style name="Theme.VLC.HorizontalListTitle">
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textColor">?attr/font_default</item>
<item name="android:textColor">?attr/colorAccent</item>
<item name="android:textSize">18sp</item>
</style>
......
......@@ -43,6 +43,8 @@ import org.videolan.tools.RESULT_RESTART
import org.videolan.vlc.R
import org.videolan.vlc.gui.audio.AudioAlbumsSongsFragment
import org.videolan.vlc.gui.audio.AudioBrowserFragment
import org.videolan.vlc.gui.browser.FileBrowserFragment
import org.videolan.vlc.gui.browser.KEY_MEDIA
import org.videolan.vlc.gui.browser.StorageBrowserFragment
import org.videolan.vlc.gui.helpers.UiTools
import org.videolan.vlc.gui.video.VideoGridFragment
......@@ -149,6 +151,13 @@ class SecondaryActivity : ContentActivity() {
fragment = StorageBrowserFragment()
setResult(RESULT_RESTART)
}
FILE_BROWSER -> {
fragment = FileBrowserFragment().apply {
arguments = Bundle(2).apply {
putParcelable(KEY_MEDIA, intent.getParcelableExtra(KEY_MEDIA))
}
}
}
else -> throw IllegalArgumentException("Wrong fragment id.")
}
}
......@@ -164,5 +173,6 @@ class SecondaryActivity : ContentActivity() {
const val ABOUT = "about"
const val VIDEO_GROUP_LIST = "videoGroupList"
const val STORAGE_BROWSER = "storage_browser"
const val FILE_BROWSER = "file_browser"
}
}
......@@ -49,8 +49,8 @@ import org.videolan.tools.Settings
import org.videolan.vlc.R
import org.videolan.vlc.databinding.BrowserItemBinding
import org.videolan.vlc.databinding.BrowserItemSeparatorBinding
import org.videolan.vlc.databinding.CardBrowserItemBinding
import org.videolan.vlc.gui.DiffUtilAdapter
import org.videolan.vlc.gui.helpers.BitmapUtil
import org.videolan.vlc.gui.helpers.MarqueeViewHolder
import org.videolan.vlc.gui.helpers.SelectorViewHolder
import org.videolan.vlc.gui.helpers.enableMarqueeEffect
......@@ -60,7 +60,7 @@ import java.util.*
@ExperimentalCoroutinesApi
@ObsoleteCoroutinesApi
open class BaseBrowserAdapter(protected val fragment: BaseBrowserFragment) : DiffUtilAdapter<MediaLibraryItem, BaseBrowserAdapter.ViewHolder<ViewDataBinding>>(), MultiSelectAdapter<MediaLibraryItem> {
open class BaseBrowserAdapter(val browserContainer: BrowserContainer<MediaLibraryItem>) : DiffUtilAdapter<MediaLibraryItem, BaseBrowserAdapter.ViewHolder<ViewDataBinding>>(), MultiSelectAdapter<MediaLibraryItem> {
protected val TAG = "VLC/BaseBrowserAdapter"
......@@ -82,29 +82,29 @@ open class BaseBrowserAdapter(protected val fragment: BaseBrowserFragment) : Dif
private val handler by lazy(LazyThreadSafetyMode.NONE) { Handler() }
init {
val root = fragment.isRootDirectory
val fileBrowser = fragment is FileBrowserFragment
val root = browserContainer.isRootDirectory
val fileBrowser = browserContainer.isFile
val filesRoot = root && fileBrowser
networkRoot = root && fragment is NetworkBrowserFragment
val mrl = fragment.mrl
networkRoot = root && browserContainer.isNetwork
val mrl = browserContainer.mrl
specialIcons = filesRoot || fileBrowser && mrl != null && mrl.endsWith(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY)
// Setup resources
val res = fragment.requireContext().resources
folderDrawable = BitmapDrawable(res, fragment.requireActivity().getBitmapFromDrawable(R.drawable.ic_menu_folder))
audioDrawable = BitmapDrawable(res, fragment.requireActivity().getBitmapFromDrawable(R.drawable.ic_browser_audio_normal))
videoDrawable = BitmapDrawable(res, fragment.requireActivity().getBitmapFromDrawable(R.drawable.ic_browser_video_normal))
subtitleDrawable = BitmapDrawable(res, fragment.requireActivity().getBitmapFromDrawable(R.drawable.ic_browser_subtitle_normal))
unknownDrawable = BitmapDrawable(res, fragment.requireActivity().getBitmapFromDrawable(R.drawable.ic_browser_unknown_normal))
qaMoviesDrawable = BitmapDrawable(res, fragment.requireActivity().getBitmapFromDrawable(R.drawable.ic_browser_movies_normal))
qaMusicDrawable = BitmapDrawable(res, fragment.requireActivity().getBitmapFromDrawable(R.drawable.ic_browser_music_normal))
qaPodcastsDrawable = BitmapDrawable(res, fragment.requireActivity().getBitmapFromDrawable(R.drawable.ic_browser_podcasts_normal))
qaDownloadDrawable = BitmapDrawable(res, fragment.requireActivity().getBitmapFromDrawable(R.drawable.ic_browser_download_normal))
val res = browserContainer.containerActivity().resources
folderDrawable = BitmapDrawable(res, browserContainer.containerActivity().getBitmapFromDrawable(R.drawable.ic_menu_folder))
audioDrawable = BitmapDrawable(res, browserContainer.containerActivity().getBitmapFromDrawable(R.drawable.ic_browser_audio_normal))
videoDrawable = BitmapDrawable(res, browserContainer.containerActivity().getBitmapFromDrawable(R.drawable.ic_browser_video_normal))
subtitleDrawable = BitmapDrawable(res, browserContainer.containerActivity().getBitmapFromDrawable(R.drawable.ic_browser_subtitle_normal))
unknownDrawable = BitmapDrawable(res, browserContainer.containerActivity().getBitmapFromDrawable(R.drawable.ic_browser_unknown_normal))
qaMoviesDrawable = BitmapDrawable(res, browserContainer.containerActivity().getBitmapFromDrawable(R.drawable.ic_browser_movies_normal))
qaMusicDrawable = BitmapDrawable(res, browserContainer.containerActivity().getBitmapFromDrawable(R.drawable.ic_browser_music_normal))
qaPodcastsDrawable = BitmapDrawable(res, browserContainer.containerActivity().getBitmapFromDrawable(R.drawable.ic_browser_podcasts_normal))
qaDownloadDrawable = BitmapDrawable(res, browserContainer.containerActivity().getBitmapFromDrawable(R.drawable.ic_browser_download_normal))
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder<ViewDataBinding> {
val inflater = LayoutInflater.from(parent.context)
return if (viewType == TYPE_MEDIA || viewType == TYPE_STORAGE)
MediaViewHolder(BrowserItemBinding.inflate(inflater, parent, false)) as ViewHolder<ViewDataBinding>
MediaViewHolder(if (browserContainer.inCards) BrowserItemBindingContainer(CardBrowserItemBinding.inflate(inflater, parent, false)) else BrowserItemBindingContainer(BrowserItemBinding.inflate(inflater, parent, false)))
else
SeparatorViewHolder(BrowserItemSeparatorBinding.inflate(inflater, parent, false)) as ViewHolder<ViewDataBinding>
}
......@@ -133,8 +133,8 @@ open class BaseBrowserAdapter(protected val fragment: BaseBrowserFragment) : Dif
if (payloads.isEmpty())
onBindViewHolder(holder, position)
else if (payloads[0] is CharSequence) {
(holder as MediaViewHolder).binding.text.visibility = View.VISIBLE
(holder as MediaViewHolder).binding.text.text = payloads[0] as CharSequence
(holder as MediaViewHolder).bindingContainer.text.visibility = View.VISIBLE
holder.bindingContainer.text.text = payloads[0] as CharSequence
} else if (payloads[0] is Int) {
val value = payloads[0] as Int
if (value == UPDATE_SELECTION) holder.selectView(multiSelectHelper.isSelected(position))
......@@ -144,14 +144,14 @@ open class BaseBrowserAdapter(protected val fragment: BaseBrowserFragment) : Dif
private fun onBindMediaViewHolder(vh: MediaViewHolder, position: Int) {
val media = getItem(position) as MediaWrapper
val isFavorite = media.hasStateFlags(MediaLibraryItem.FLAG_FAVORITE)
vh.binding.item = media
vh.bindingContainer.setItem(media)
val scheme = media.uri.scheme
vh.binding.hasContextMenu = ((!networkRoot || isFavorite)
vh.bindingContainer.setHasContextMenu(((!networkRoot || isFavorite)
&& "content" != scheme
&& "otg" != scheme)
vh.binding.filename = if (media.type != MediaWrapper.TYPE_DIR && "file" == scheme) media.fileName else null
if (networkRoot) vh.binding.protocol = getProtocol(media)
vh.binding.cover = getIcon(media, specialIcons)
&& "otg" != scheme))
vh.bindingContainer.setFileName(if (media.type != MediaWrapper.TYPE_DIR && "file" == scheme) media.fileName else null)
if (networkRoot) vh.bindingContainer.setProtocol(getProtocol(media))
vh.bindingContainer.setCover(getIcon(media, specialIcons))
vh.selectView(multiSelectHelper.isSelected(position))
}
......@@ -182,18 +182,18 @@ open class BaseBrowserAdapter(protected val fragment: BaseBrowserFragment) : Dif
}
@TargetApi(Build.VERSION_CODES.M)
internal inner class MediaViewHolder(binding: BrowserItemBinding) : ViewHolder<BrowserItemBinding>(binding), MarqueeViewHolder {
override val titleView: TextView? = binding.title
internal inner class MediaViewHolder(val bindingContainer: BrowserItemBindingContainer) : ViewHolder<ViewDataBinding>(bindingContainer.binding), MarqueeViewHolder {
override val titleView: TextView? = bindingContainer.title
var job : Job? = null
init {
binding.holder = this
bindingContainer.setHolder(this)
if (AndroidUtil.isMarshMallowOrLater) itemView.setOnContextClickListener { v ->
onMoreClick(v)
true
}
if (this@BaseBrowserAdapter is FilePickerAdapter) {
binding.itemIcon.isFocusable = false
bindingContainer.itemIcon.isFocusable = false
}
}
......@@ -210,30 +210,30 @@ open class BaseBrowserAdapter(protected val fragment: BaseBrowserFragment) : Dif
override fun onClick(v: View) {
val position = layoutPosition
if (position < dataset.size && position >= 0)
fragment.onClick(v, position, dataset[position])
browserContainer.onClick(v, position, dataset[position])
}
override fun onImageClick(v: View) {
val position = layoutPosition
if (position < dataset.size && position >= 0)
fragment.onImageClick(v, position, dataset[position])
browserContainer.onImageClick(v, position, dataset[position])
}
override fun onMoreClick(v: View) {
val position = layoutPosition
if (position < dataset.size && position >= 0)
fragment.onCtxClick(v, position, dataset[position])
browserContainer.onCtxClick(v, position, dataset[position])
}
override fun onLongClick(v: View): Boolean {
val position = layoutPosition
if (getItem(position).itemType == TYPE_STORAGE && Settings.showTvUi) {
binding.browserCheckbox.toggle()
onCheckBoxClick(binding.browserCheckbox)
bindingContainer.browserCheckbox.toggle()
onCheckBoxClick(bindingContainer.browserCheckbox)
return true
}
return (position < dataset.size && position >= 0
&& fragment.onLongClick(v, position, dataset[position]))
&& browserContainer.onLongClick(v, position, dataset[position]))
}
override fun isSelected(): Boolean {
......@@ -306,6 +306,6 @@ open class BaseBrowserAdapter(protected val fragment: BaseBrowserFragment) : Dif
}
override fun onUpdateFinished() {
fragment.onUpdateFinished(this)
browserContainer.onUpdateFinished(this)
}
}
\ No newline at end of file
......@@ -50,7 +50,6 @@ import org.videolan.vlc.BuildConfig
import org.videolan.vlc.R
import org.videolan.vlc.databinding.DirectoryBrowserBinding
import org.videolan.vlc.gui.AudioPlayerContainerActivity
import org.videolan.vlc.gui.InfoActivity
import org.videolan.vlc.gui.MainActivity
import org.videolan.vlc.gui.dialogs.CtxActionReceiver
import org.videolan.vlc.gui.dialogs.SavePlaylistDialog
......@@ -59,6 +58,7 @@ import org.videolan.vlc.gui.helpers.MedialibraryUtils
import org.videolan.vlc.gui.helpers.UiTools
import org.videolan.vlc.gui.helpers.UiTools.addToPlaylist
import org.videolan.vlc.gui.helpers.UiTools.addToPlaylistAsync
import org.videolan.vlc.gui.helpers.UiTools.showMediaInfo
import org.videolan.vlc.gui.helpers.hf.OTG_SCHEME
import org.videolan.vlc.gui.view.EmptyLoadingState
import org.videolan.vlc.gui.view.VLCDividerItemDecoration
......@@ -82,15 +82,17 @@ private const val MSG_REFRESH = 3
@ObsoleteCoroutinesApi
@ExperimentalCoroutinesApi
abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefreshable, SwipeRefreshLayout.OnRefreshListener, View.OnClickListener, IEventsHandler<MediaLibraryItem>, CtxActionReceiver, PathAdapterListener {
abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefreshable, SwipeRefreshLayout.OnRefreshListener, View.OnClickListener, IEventsHandler<MediaLibraryItem>, CtxActionReceiver, PathAdapterListener, BrowserContainer<MediaLibraryItem> {
private lateinit var addPlaylistFolderOnly: MenuItem
protected val handler = BrowserFragmentHandler(this)
private lateinit var layoutManager: LinearLayoutManager
var mrl: String? = null
override var mrl: String? = null
protected var currentMedia: MediaWrapper? = null
private var savedPosition = -1
var isRootDirectory: Boolean = false
override var isRootDirectory: Boolean = false
override val scannedDirectory = false
override val inCards = false
protected var showHiddenFiles: Boolean = false
protected lateinit var adapter: BaseBrowserAdapter
protected abstract val categoryTitle: String
......@@ -343,12 +345,6 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
return true
}
private fun showMediaInfo(mw: MediaWrapper) {
val i = Intent(activity, InfoActivity::class.java)
i.putExtra(TAG_ITEM, mw)
startActivity(i)
}
private fun playAll(mw: MediaWrapper?) {
var positionInPlaylist = 0
val mediaLocations = LinkedList<MediaWrapper>()
......@@ -395,7 +391,7 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
R.id.action_mode_file_play -> MediaUtils.openList(activity, list, 0)
R.id.action_mode_file_append -> MediaUtils.appendMedia(activity, list)
R.id.action_mode_file_add_playlist -> requireActivity().addToPlaylist(list)
R.id.action_mode_file_info -> showMediaInfo(list[0])
R.id.action_mode_file_info -> requireActivity().showMediaInfo(list[0])
R.id.action_mode_file_delete -> removeItems(list)
else -> {
stopActionMode()
......@@ -541,7 +537,7 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
}
CTX_APPEND -> MediaUtils.appendMedia(activity, mw)
CTX_DELETE -> removeItem(mw)
CTX_INFORMATION -> showMediaInfo(mw)
CTX_INFORMATION -> requireActivity().showMediaInfo(mw)
CTX_PLAY_AS_AUDIO -> {
mw.addFlags(MediaWrapper.MEDIA_FORCE_AUDIO)
MediaUtils.openMedia(activity, mw)
......
/*
* ************************************************************************
* BrowserContainer.kt