[Android] Fix add to group for 1 media and remove useless info
Nicolas Pomepuy
git at videolan.org
Thu Apr 23 15:35:35 CEST 2020
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Apr 23 15:29:58 2020 +0200| [acf9e12e4c8e316a2c32c8296d94cf2aba3e1878] | committer: Nicolas Pomepuy
Fix add to group for 1 media and remove useless info
> https://code.videolan.org/videolan/vlc-android/commit/acf9e12e4c8e316a2c32c8296d94cf2aba3e1878
---
.../vlc-android/res/layout/dialog_add_to_group.xml | 21 ++-------------------
.../videolan/vlc/gui/dialogs/AddToGroupDialog.kt | 7 -------
.../org/videolan/vlc/gui/video/VideoGridFragment.kt | 8 +++++---
3 files changed, 7 insertions(+), 29 deletions(-)
diff --git a/application/vlc-android/res/layout/dialog_add_to_group.xml b/application/vlc-android/res/layout/dialog_add_to_group.xml
index 881978512..b904aad69 100644
--- a/application/vlc-android/res/layout/dialog_add_to_group.xml
+++ b/application/vlc-android/res/layout/dialog_add_to_group.xml
@@ -30,10 +30,6 @@
<import type="android.view.View" />
- <variable
- name="filesText"
- type="String" />
-
<variable
name="isLoading"
type="Boolean" />
@@ -60,19 +56,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
- <TextView
- android:id="@+id/medias"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="8dp"
- android:fontFamily="sans-serif-light"
- android:text="@{filesText}"
- android:textSize="12sp"
- android:visibility="@{isLoading ? View.GONE : View.VISIBLE}"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/textView8"
- tools:text="65 medias" />
-
<ProgressBar
android:id="@+id/progressBar2"
style="?android:attr/progressBarStyle"
@@ -88,10 +71,10 @@
android:id="@+id/dialog_list_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="8dp"
+ android:layout_marginTop="24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/medias">
+ app:layout_constraintTop_toBottomOf="@+id/textView8">
<androidx.recyclerview.widget.RecyclerView
android:id="@android:id/list"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AddToGroupDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AddToGroupDialog.kt
index 3c6b2cae9..4032a9ae6 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AddToGroupDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AddToGroupDialog.kt
@@ -56,11 +56,6 @@ class AddToGroupDialog : VLCBottomSheetDialogFragment(), SimpleAdapter.ClickHand
field = value
if (::binding.isInitialized) binding.isLoading = value
}
- private var filesText: String = ""
- set(value) {
- field = value
- if (::binding.isInitialized) binding.filesText = value
- }
private lateinit var binding: DialogAddToGroupBinding
private lateinit var adapter: SimpleAdapter
private lateinit var newTrack: Array<MediaWrapper>
@@ -82,7 +77,6 @@ class AddToGroupDialog : VLCBottomSheetDialogFragment(), SimpleAdapter.ClickHand
newTrack = try {
@Suppress("UNCHECKED_CAST")
val tracks = requireArguments().getParcelableArray(KEY_TRACKS) as Array<MediaWrapper>
- filesText = resources.getQuantityString(R.plurals.media_quantity, tracks.size, tracks.size)
tracks
} catch (e: Exception) {
emptyArray()
@@ -92,7 +86,6 @@ class AddToGroupDialog : VLCBottomSheetDialogFragment(), SimpleAdapter.ClickHand
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
binding = DialogAddToGroupBinding.inflate(layoutInflater, container, false)
binding.isLoading = isLoading
- binding.filesText = filesText
return binding.root
}
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
index 10650fbf3..25a391f19 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
@@ -386,9 +386,11 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
R.id.action_ungroup -> viewModel.ungroup(selection.first() as VideoGroup)
R.id.action_rename -> renameGroup(selection.first() as VideoGroup)
R.id.action_add_to_group -> lifecycleScope.launch {
- viewModel.createGroup(selection.getAll())?.let {
- activity?.open(it)
- }
+ if (selection.size > 1) {
+ viewModel.createGroup(selection.getAll())?.let {
+ activity?.open(it)
+ }
+ } else requireActivity().addToGroup(selection.getAll())
}
else -> return false
}
More information about the Android
mailing list