[Android] Close button for video player playlist
Nicolas Pomepuy
git at videolan.org
Mon Jul 15 17:39:09 CEST 2019
vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Mon Jul 15 08:21:24 2019 +0200| [ea5ebcf69c491505674933348746da5a1deba6d1] | committer: Geoffrey Métais
Close button for video player playlist
> https://code.videolan.org/videolan/vlc-android/commit/ea5ebcf69c491505674933348746da5a1deba6d1
---
vlc-android/res/drawable/ic_close_small.xml | 9 ++++++
vlc-android/res/layout/player.xml | 37 ++++++++++++++++++----
.../videolan/vlc/gui/video/VideoPlayerActivity.kt | 3 ++
3 files changed, 42 insertions(+), 7 deletions(-)
diff --git a/vlc-android/res/drawable/ic_close_small.xml b/vlc-android/res/drawable/ic_close_small.xml
new file mode 100644
index 000000000..784a22a25
--- /dev/null
+++ b/vlc-android/res/drawable/ic_close_small.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#ffffff"
+ android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
+</vector>
diff --git a/vlc-android/res/layout/player.xml b/vlc-android/res/layout/player.xml
index 5510998b7..0c04ea8c5 100644
--- a/vlc-android/res/layout/player.xml
+++ b/vlc-android/res/layout/player.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:id="@+id/player_root"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
@@ -95,7 +96,30 @@
android:background="@color/playerbackground"
android:id="@+id/video_playlist_container"
android:visibility="gone"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ tools:visibility="visible">
+
+ <View
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:id="@+id/view"
+ android:background="@color/playerbackground"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toTopOf="@+id/video_playlist"/>
+
+ <ImageButton
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:srcCompat="@drawable/ic_close_small"
+ android:background="?attr/selectableItemBackgroundBorderless"
+ android:id="@+id/close_button"
+ android:padding="8dp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ android:layout_marginStart="8dp"
+ app:layout_constraintBottom_toBottomOf="@+id/view"/>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/playlist_search_text"
@@ -103,13 +127,12 @@
android:layout_height="wrap_content"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
- android:paddingLeft="8dp"
- android:paddingRight="8dp"
- android:background="@color/playerbackground"
- android:paddingTop="4dp"
- android:paddingBottom="2dp">
+ android:paddingTop="0dp"
+ app:layout_constraintStart_toEndOf="@+id/close_button"
+ android:layout_marginStart="8dp"
+ android:layout_marginEnd="8dp"
+ >
<EditText
android:layout_width="match_parent"
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
index 0814a2f65..ebe617303 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
@@ -125,6 +125,7 @@ open class VideoPlayerActivity : AppCompatActivity(), IPlaybackSettingsControlle
private var videoUri: Uri? = null
private var askResume = true
+ private lateinit var closeButton: View
private lateinit var playlistContainer: View
private lateinit var playlist: RecyclerView
private lateinit var playlistSearchText: TextInputLayout
@@ -428,6 +429,7 @@ open class VideoPlayerActivity : AppCompatActivity(), IPlaybackSettingsControlle
playlist = findViewById(R.id.video_playlist)
playlistSearchText = findViewById(R.id.playlist_search_text)
playlistContainer = findViewById(R.id.video_playlist_container)
+ closeButton = findViewById(R.id.close_button)
playlistSearchText.editText?.addTextChangedListener(this)
@@ -826,6 +828,7 @@ open class VideoPlayerActivity : AppCompatActivity(), IPlaybackSettingsControlle
hudBinding.playlistNext.setVisible()
}
hudRightBinding.playlistToggle.setOnClickListener(this at VideoPlayerActivity)
+ closeButton.setOnClickListener { togglePlaylist() }
val callback = SwipeDragItemTouchHelperCallback(playlistAdapter)
val touchHelper = ItemTouchHelper(callback)
More information about the Android
mailing list