[Android] Fix subtitle downloader size on orientation

Habib Kazemi git at videolan.org
Wed Dec 5 11:10:40 CET 2018


vlc-android | branch: master | Habib Kazemi <kazemihabib1996 at gmail.com> | Fri Nov 30 15:16:06 2018 +0330| [acab3563b3b3ff234af2d77b282ab12c6d0a4555] | committer: Geoffrey Métais

Fix subtitle downloader size on orientation

Signed-off-by: Geoffrey Métais <geoffrey.metais at gmail.com>

> https://code.videolan.org/videolan/vlc-android/commit/acab3563b3b3ff234af2d77b282ab12c6d0a4555
---

 .../vlc/gui/dialogs/SubtitleDownloaderDialogFragment.kt     | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/SubtitleDownloaderDialogFragment.kt b/vlc-android/src/org/videolan/vlc/gui/dialogs/SubtitleDownloaderDialogFragment.kt
index da8bc53eb..d8eab7267 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/SubtitleDownloaderDialogFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/SubtitleDownloaderDialogFragment.kt
@@ -1,6 +1,7 @@
 package org.videolan.vlc.gui.dialogs
 
 import android.content.Context
+import android.content.res.Configuration
 import android.net.Uri
 import android.os.Bundle
 import android.view.Gravity
@@ -17,6 +18,7 @@ import org.videolan.vlc.R
 import org.videolan.vlc.databinding.SubtitleDownloaderDialogBinding
 import org.videolan.vlc.gui.DialogActivity
 import org.videolan.vlc.gui.helpers.UiTools.deleteSubtitleDialog
+import org.videolan.vlc.gui.video.VideoPlayerActivity
 import org.videolan.vlc.media.MediaUtils
 import org.videolan.vlc.util.VLCDownloadManager
 import org.videolan.vlc.viewmodels.SubtitlesModel
@@ -82,6 +84,17 @@ class SubtitleDownloaderDialogFragment: androidx.fragment.app.DialogFragment() {
         return binding.root
     }
 
+    override fun onConfigurationChanged(newConfig: Configuration?) {
+        super.onConfigurationChanged(newConfig)
+        // In manifest for VideoPlayerActivity defined
+        // android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout"
+        // so dialog size breaks on orientation
+        if (requireActivity() is VideoPlayerActivity) {
+            MediaUtils.showSubtitleDownloaderDialogFragment(requireActivity(), paths)
+            dismiss()
+        }
+    }
+
     override fun onSaveInstanceState(outState: Bundle) {
         super.onSaveInstanceState(outState)
         outState.putStringArrayList(MEDIA_PATHS, ArrayList(paths))



More information about the Android mailing list