[Android] Move setCompatVectorFromResourcesEnabled to VLCApplication

Nicolas Pomepuy git at videolan.org
Fri Jun 21 14:07:09 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Fri Jun 21 12:03:11 2019 +0200| [1017357cf60c5717e98655adb032a3a13788639b] | committer: Geoffrey Métais

Move setCompatVectorFromResourcesEnabled to VLCApplication

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

 vlc-android/src/org/videolan/vlc/VLCApplication.kt                | 3 +++
 vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt              | 4 ----
 vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.kt | 4 ----
 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt | 3 ---
 4 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/VLCApplication.kt b/vlc-android/src/org/videolan/vlc/VLCApplication.kt
index 530184b08..5c069203f 100644
--- a/vlc-android/src/org/videolan/vlc/VLCApplication.kt
+++ b/vlc-android/src/org/videolan/vlc/VLCApplication.kt
@@ -28,6 +28,7 @@ import android.content.res.Configuration
 import android.content.res.Resources
 import android.os.Build
 import android.util.Log
+import androidx.appcompat.app.AppCompatDelegate
 import androidx.collection.SimpleArrayMap
 import androidx.fragment.app.DialogFragment
 import androidx.lifecycle.Lifecycle
@@ -86,6 +87,8 @@ class VLCApplication : Application() {
 
     init {
         instance = this
+        AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
+
     }
 
     @TargetApi(Build.VERSION_CODES.O)
diff --git a/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt b/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt
index 680627a9f..769a46885 100644
--- a/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt
@@ -4,7 +4,6 @@ import android.content.SharedPreferences
 import android.os.Bundle
 import android.view.KeyEvent
 import androidx.appcompat.app.AppCompatActivity
-import androidx.appcompat.app.AppCompatDelegate
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.MainScope
 import org.videolan.vlc.gui.helpers.KeyHelper
@@ -13,9 +12,6 @@ import org.videolan.vlc.util.Settings
 
 open class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
 
-    init {
-        AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
-    }
 
     lateinit var settings: SharedPreferences
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.kt b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.kt
index 1c853cf71..dab4616e1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.kt
@@ -31,7 +31,6 @@ import android.os.Bundle
 import android.view.KeyEvent
 import android.view.View
 import android.widget.TextView
-import androidx.appcompat.app.AppCompatDelegate
 import androidx.fragment.app.FragmentActivity
 import androidx.lifecycle.Observer
 import kotlinx.coroutines.*
@@ -55,9 +54,6 @@ abstract class BaseTvActivity : FragmentActivity(), CoroutineScope by MainScope(
     @Volatile
     private var currentlyVisible = false
 
-    init {
-        AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
-    }
 
     override fun onCreate(savedInstanceState: Bundle?) {
         //Init Medialibrary if KO
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 56a78cca1..03b8eb406 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
@@ -110,9 +110,6 @@ import java.util.*
 @ExperimentalCoroutinesApi
 open class VideoPlayerActivity : AppCompatActivity(), IPlaybackSettingsController, PlaybackService.Callback, PlaylistAdapter.IPlayer, OnClickListener, OnLongClickListener, StoragePermissionsDelegate.CustomActionController, Observer<PlaybackService> {
 
-    init {
-        AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
-    }
 
     private var wasPlaying = true
     private val controlsConstraintSetPortrait = ConstraintSet()



More information about the Android mailing list