Skip to content
Snippets Groups Projects
Commit b509cbc2 authored by Duncan McNamara's avatar Duncan McNamara Committed by Nicolas Pomepuy
Browse files

Remove uses of mediawrapper type group

The implementation of groups was changed a couple of years ago, there is
now specific items in the medialibrary for groups and this type is now
deprecated.
parent 3da8e46e
No related branches found
No related tags found
1 merge request!1758VideoFolderGroups: add context btn to ban folder
Pipeline #381751 passed with stage
in 10 minutes and 44 seconds
......@@ -77,10 +77,9 @@ class CardPresenter(private val context: Activity, private val isPoster: Boolean
if (item is MediaWrapper) {
if (BuildConfig.DEBUG) Log.d("CardPresenter", "ITEM: ${item.title} // meta = ${item.hasFlag(FAVORITE_FLAG)}")
if (item.hasFlag(FAVORITE_FLAG)) cardView.badgeImage = ContextCompat.getDrawable(cardView.context, R.drawable.ic_favorite_tv_badge)
val group = item.type == MediaWrapper.TYPE_GROUP
val folder = item.type == MediaWrapper.TYPE_DIR
val video = item.type == MediaWrapper.TYPE_VIDEO
if (!folder && (group || video && !item.isThumbnailGenerated)) {
if (!folder && (video && !item.isThumbnailGenerated)) {
if (noArt) {
cardView.mainImageView.scaleType = ImageView.ScaleType.CENTER_INSIDE
cardView.mainImage = BitmapDrawable(cardView.resources, getDefaultImage(item))
......
......@@ -141,13 +141,6 @@ object TvUtil {
intent.data = item.uri
activity.startActivity(intent)
}
MediaWrapper.TYPE_GROUP -> {
val intent = Intent(activity, VerticalGridActivity::class.java)
intent.putExtra(MainTvActivity.BROWSER_TYPE, HEADER_VIDEO)
val title = item.title.substring(if (item.title.lowercase(Locale.getDefault()).startsWith("the")) 4 else 0)
intent.putExtra(KEY_GROUP, title)
activity.startActivity(intent)
}
else -> {
MediaUtils.openMedia(activity, item)
}
......@@ -184,13 +177,6 @@ object TvUtil {
intent.data = item.uri
activity.startActivity(intent)
}
MediaWrapper.TYPE_GROUP -> {
val intent = Intent(activity, VerticalGridActivity::class.java)
intent.putExtra(MainTvActivity.BROWSER_TYPE, HEADER_VIDEO)
val title = item.title.substring(if (item.title.lowercase(Locale.getDefault()).startsWith("the")) 4 else 0)
intent.putExtra(KEY_GROUP, title)
activity.startActivity(intent)
}
else -> {
model.run {
if (!Settings.getInstance(activity).getBoolean(FORCE_PLAY_ALL_VIDEO, Settings.tvUI)) {
......@@ -238,13 +224,6 @@ object TvUtil {
intent.data = item.uri
activity.startActivity(intent)
}
MediaWrapper.TYPE_GROUP -> {
val intent = Intent(activity, VerticalGridActivity::class.java)
intent.putExtra(MainTvActivity.BROWSER_TYPE, HEADER_VIDEO)
val title = item.title.substring(if (item.title.lowercase(Locale.getDefault()).startsWith("the")) 4 else 0)
intent.putExtra(KEY_GROUP, title)
activity.startActivity(intent)
}
else -> {
provider.loadPagedList(activity, {
(provider.getAll().toList() as List<MediaWrapper>).filter { it.type != MediaWrapper.TYPE_DIR }
......
......@@ -591,11 +591,10 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
is Folder -> showContext(requireActivity(), this@VideoGridFragment, position, item, CTX_FOLDER_FLAGS or if(item.isFavorite) CTX_FAV_REMOVE else CTX_FAV_ADD)
is VideoGroup -> if (item.presentCount == 0) UiTools.snackerMissing(requireActivity()) else showContext(requireActivity(), this@VideoGridFragment, position, item, CTX_VIDEO_GROUP_FLAGS or if(item.isFavorite) CTX_FAV_REMOVE else CTX_FAV_ADD)
is MediaWrapper -> {
val group = item.type == MediaWrapper.TYPE_GROUP
var flags = if (group) CTX_VIDEO_GROUP_FLAGS else CTX_VIDEO_FLAGS
var flags = CTX_VIDEO_FLAGS
flags = flags or if(item.isFavorite) CTX_FAV_REMOVE else CTX_FAV_ADD
flags = if (item.seen > 0) flags or CTX_MARK_AS_UNPLAYED else flags or CTX_MARK_AS_PLAYED
if (item.time != 0L && !group) flags = flags or CTX_PLAY_FROM_START
if (item.time != 0L) flags = flags or CTX_PLAY_FROM_START
if (viewModel.groupingType == VideoGroupingType.NAME || viewModel.group != null) flags = flags or if (viewModel.group != null) CTX_REMOVE_GROUP else flags or CTX_ADD_GROUP or CTX_GROUP_SIMILAR
//go to folder
if (item.uri.retrieveParent() != null) flags = flags or CTX_GO_TO_FOLDER
......
......@@ -170,22 +170,19 @@ class VideoListAdapter(private var isSeenMediaMarkerVisible: Boolean
holder.binding.setVariable(BR.isSD, item.uri.isSD())
holder.binding.setVariable(BR.isPresent, item.isPresent)
text = if (item.type == MediaWrapper.TYPE_GROUP) {
item.description
} else {
seen = if (isSeenMediaMarkerVisible) item.seen else 0L
/* Time / Duration */
if (item.length > 0) {
val lastTime = item.displayTime
if (lastTime > 0) {
max = (item.length / 1000).toInt()
progress = (lastTime / 1000).toInt()
}
if (isListMode && resolution !== null) {
"${Tools.millisToString(item.length)} • $resolution"
} else Tools.millisToString(item.length)
} else null
}
seen = if (isSeenMediaMarkerVisible) item.seen else 0L
/* Time / Duration */
text = if (item.length > 0) {
val lastTime = item.displayTime
if (lastTime > 0) {
max = (item.length / 1000).toInt()
progress = (lastTime / 1000).toInt()
}
if (isListMode && resolution !== null) {
"${Tools.millisToString(item.length)} • $resolution"
} else Tools.millisToString(item.length)
} else null
holder.binding.setVariable(BR.time, text)
holder.binding.setVariable(BR.max, max)
holder.binding.setVariable(BR.progress, progress)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment