[Android] Upgrade preferences to 1.1.0-alpha02

Geoffrey Métais git at videolan.org
Tue Jan 22 11:54:48 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan 22 11:12:24 2019 +0100| [c0bc6a3d6544cb561dbd840c2d49169a7177f583] | committer: Geoffrey Métais

Upgrade preferences to 1.1.0-alpha02

This allows to fix the preference categories displaying with a space
reserved for icons.
Fix #700

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

 build.gradle                                                   |  1 +
 vlc-android/build.gradle                                       |  2 +-
 .../src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt    |  6 +++---
 .../src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt | 10 +++++-----
 vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt   |  2 +-
 vlc-android/src/org/videolan/vlc/gui/dialogs/DeviceDialog.kt   |  2 +-
 .../vlc/gui/dialogs/SubtitleDownloaderDialogFragment.kt        |  3 +--
 .../src/org/videolan/vlc/gui/folders/FoldersFragment.kt        |  6 +++---
 .../src/org/videolan/vlc/gui/network/MRLPanelFragment.kt       |  2 +-
 vlc-android/src/org/videolan/vlc/gui/tv/SearchFragment.kt      |  2 +-
 10 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/build.gradle b/build.gradle
index 20c9175c1..6e2c41154 100644
--- a/build.gradle
+++ b/build.gradle
@@ -35,6 +35,7 @@ ext {
     targetSdkVersion = 28
     compileSdkVersion = 28
     androidxCoreVersion = '1.0.1'
+    androidxPreferencesVersion = '1.1.0-alpha02'
     androidxVersion = '1.0.0'
     androidxAnnotationVersion = '1.0.1'
     androidxAppcompatVersion = '1.0.2'
diff --git a/vlc-android/build.gradle b/vlc-android/build.gradle
index f95aa94f1..5632232f5 100644
--- a/vlc-android/build.gradle
+++ b/vlc-android/build.gradle
@@ -215,7 +215,7 @@ dependencies {
     implementation "androidx.recyclerview:recyclerview:$rootProject.ext.androidxVersion"
     implementation "com.google.android.material:material:$rootProject.ext.androidxVersion"
     implementation "androidx.annotation:annotation:$rootProject.ext.androidxAnnotationVersion"
-    implementation "androidx.preference:preference:$rootProject.ext.androidxVersion"
+    implementation "androidx.preference:preference:$androidxPreferencesVersion"
     implementation "androidx.constraintlayout:constraintlayout:$rootProject.ext.constraintLayoutVersion"
 
     //TV
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
index 1e6c41a56..41403be10 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
@@ -106,9 +106,9 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
         browserFavRepository = BrowserFavRepository.getInstance(requireContext())
     }
 
-    override fun onPrepareOptionsMenu(menu: Menu?) {
+    override fun onPrepareOptionsMenu(menu: Menu) {
         super.onPrepareOptionsMenu(menu)
-        val item = menu!!.findItem(R.id.ml_menu_filter)
+        val item = menu.findItem(R.id.ml_menu_filter)
         if (item != null) item.isVisible = enableSearchOption()
         val sortItem = menu.findItem(R.id.ml_menu_sortby)
         if (sortItem != null) sortItem.isVisible = !isRootDirectory
@@ -353,7 +353,7 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
         adapter.multiSelectHelper.clearSelection()
     }
 
-    override fun onOptionsItemSelected(item: MenuItem?): Boolean {
+    override fun onOptionsItemSelected(item: MenuItem): Boolean {
         when (item!!.itemId) {
             R.id.ml_menu_save -> {
                 toggleFavorite()
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
index f3c5f30c5..9de72af41 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
@@ -114,14 +114,14 @@ class StorageBrowserFragment : FileBrowserFragment(), EntryPointsEventsCb {
         outState.putBoolean(KEY_IN_MEDIALIB, mScannedDirectory)
     }
 
-    override fun onPrepareOptionsMenu(menu: Menu?) {
+    override fun onPrepareOptionsMenu(menu: Menu) {
         super.onPrepareOptionsMenu(menu)
-        menu?.findItem(R.id.ml_menu_custom_dir)?.isVisible = true
-        menu?.findItem(R.id.ml_menu_refresh)?.isVisible = false
+        menu.findItem(R.id.ml_menu_custom_dir)?.isVisible = true
+        menu.findItem(R.id.ml_menu_refresh)?.isVisible = false
     }
 
-    override fun onOptionsItemSelected(item: MenuItem?): Boolean {
-        if (item?.itemId == R.id.ml_menu_custom_dir) {
+    override fun onOptionsItemSelected(item: MenuItem): Boolean {
+        if (item.itemId == R.id.ml_menu_custom_dir) {
             showAddDirectoryDialog()
             return true
         }
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt b/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
index a2a0e0506..ab9c74f89 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
@@ -79,7 +79,7 @@ class ContextSheet : com.google.android.material.bottomsheet.BottomSheetDialogFr
         val flags = arguments?.getInt(CTX_FLAGS_KEY) ?: 0
         options = populateOptions(flags)
         AppScope.launch(Dispatchers.Main) {
-            dialog.window?.setLayout(resources.getDimensionPixelSize(R.dimen.default_context_width), ViewGroup.LayoutParams.MATCH_PARENT)
+            dialog?.window?.setLayout(resources.getDimensionPixelSize(R.dimen.default_context_width), ViewGroup.LayoutParams.MATCH_PARENT)
             (dialog as BottomSheetDialog).findViewById<FrameLayout>(com.google.android.material.R.id.design_bottom_sheet)?.let {
                 val bsb = BottomSheetBehavior.from(it)
                 if (bsb.state == BottomSheetBehavior.STATE_COLLAPSED) bsb.state = BottomSheetBehavior.STATE_EXPANDED
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/DeviceDialog.kt b/vlc-android/src/org/videolan/vlc/gui/dialogs/DeviceDialog.kt
index 03eac3e45..226e43003 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/DeviceDialog.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/DeviceDialog.kt
@@ -26,7 +26,7 @@ class DeviceDialog : DialogFragment() {
     }
 
     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
-        dialog.setTitle(getString(R.string.device_dialog_title))
+        dialog?.setTitle(getString(R.string.device_dialog_title))
         val binding = DialogExtDeviceBinding.inflate(inflater, container, false)
         binding.handler = clickHandler
         if (scan) binding.extDeviceScan.visibility = View.VISIBLE
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 afb12ee1b..1c758dae9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/SubtitleDownloaderDialogFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/SubtitleDownloaderDialogFragment.kt
@@ -14,7 +14,6 @@ import androidx.fragment.app.DialogFragment
 import androidx.fragment.app.FragmentManager
 import androidx.fragment.app.FragmentPagerAdapter
 import androidx.lifecycle.ViewModelProviders
-import kotlinx.coroutines.NonCancellable.isActive
 import kotlinx.coroutines.ObsoleteCoroutinesApi
 import kotlinx.coroutines.channels.actor
 import kotlinx.coroutines.isActive
@@ -90,7 +89,7 @@ class SubtitleDownloaderDialogFragment: DialogFragment() {
         return binding.root
     }
 
-    override fun onConfigurationChanged(newConfig: Configuration?) {
+    override fun onConfigurationChanged(newConfig: Configuration) {
         super.onConfigurationChanged(newConfig)
         // In manifest for VideoPlayerActivity defined
         // android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout"
diff --git a/vlc-android/src/org/videolan/vlc/gui/folders/FoldersFragment.kt b/vlc-android/src/org/videolan/vlc/gui/folders/FoldersFragment.kt
index ba3f63050..e98cba00c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/folders/FoldersFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/folders/FoldersFragment.kt
@@ -90,12 +90,12 @@ class FoldersFragment : MediaBrowserFragment<PagedFoldersModel>(), CoroutineScop
     }
 
 
-    override fun onPrepareOptionsMenu(menu: Menu?) {
+    override fun onPrepareOptionsMenu(menu: Menu) {
         super.onPrepareOptionsMenu(menu)
-        menu!!.findItem(R.id.ml_menu_last_playlist).isVisible = true
+        menu.findItem(R.id.ml_menu_last_playlist).isVisible = true
     }
 
-    override fun onOptionsItemSelected(item: MenuItem?)= when (item!!.itemId) {
+    override fun onOptionsItemSelected(item: MenuItem)= when (item.itemId) {
         R.id.ml_menu_last_playlist -> {
             MediaUtils.loadlastPlaylist(activity, PLAYLIST_TYPE_VIDEO)
             true
diff --git a/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt b/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
index b2581d167..63357dd1f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
@@ -91,7 +91,7 @@ class MRLPanelFragment : DialogFragment(), View.OnKeyListener, TextView.OnEditor
         viewModel.observableHistory.observe(this, Observer { adapter.setList(it) })
         binding.play.setOnClickListener(this)
 
-        dialog.setTitle(R.string.open_mrl_dialog_title)
+        dialog?.setTitle(R.string.open_mrl_dialog_title)
         return binding.root
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/SearchFragment.kt b/vlc-android/src/org/videolan/vlc/gui/tv/SearchFragment.kt
index 5126ecb19..8a002e01d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/SearchFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/SearchFragment.kt
@@ -118,7 +118,7 @@ class SearchFragment : SearchSupportFragment(), SearchSupportFragment.SearchResu
         (activity as? SearchActivity)?.updateEmptyView(empty)
     }
 
-    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
+    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
         if (requestCode == REQUEST_SPEECH && resultCode == Activity.RESULT_OK) setSearchQuery(data, true)
     }
 }



More information about the Android mailing list