[Android] Open extension settings activity from browser

Geoffrey Métais git at videolan.org
Mon Dec 21 17:22:03 CET 2015


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Dec 18 16:27:56 2015 +0100| [c5673c353caf13af9c9487e16a7e51eb7b229a0e] | committer: Geoffrey Métais

Open extension settings activity from browser

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

 .../src/org/videolan/vlc/gui/browser/ExtensionBrowser.java       | 9 ++++++++-
 vlc-android/src/org/videolan/vlc/plugin/PluginService.java       | 7 ++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/ExtensionBrowser.java b/vlc-android/src/org/videolan/vlc/gui/browser/ExtensionBrowser.java
index b0f092d..bdb2223 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/ExtensionBrowser.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/ExtensionBrowser.java
@@ -1,5 +1,6 @@
 package org.videolan.vlc.gui.browser;
 
+import android.content.Intent;
 import android.os.Bundle;
 import android.support.design.widget.FloatingActionButton;
 import android.support.v4.app.Fragment;
@@ -20,6 +21,7 @@ import org.videolan.vlc.gui.view.DividerItemDecoration;
 import org.videolan.vlc.gui.view.SwipeRefreshLayout;
 import org.videolan.vlc.media.MediaUtils;
 import org.videolan.vlc.media.MediaWrapper;
+import org.videolan.vlc.plugin.ExtensionListing;
 import org.videolan.vlc.plugin.PluginService;
 import org.videolan.vlc.plugin.Utils;
 import org.videolan.vlc.plugin.api.VLCExtensionItem;
@@ -114,7 +116,12 @@ public class ExtensionBrowser extends Fragment implements View.OnClickListener,
     @Override
     public void onClick(View v) {
         if (v.getId() == mAddDirectoryFAB.getId()){
-            //TODO start plugin activity
+            ExtensionListing plugin = mPluginService.getCurrentPlugin();
+            if (plugin == null)
+                return;
+            Intent intent = new Intent(Intent.ACTION_VIEW);
+            intent.setComponent(plugin.settingsActivity());
+            startActivity(intent);
         }
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/plugin/PluginService.java b/vlc-android/src/org/videolan/vlc/plugin/PluginService.java
index 2fbc81c..c30cd95 100644
--- a/vlc-android/src/org/videolan/vlc/plugin/PluginService.java
+++ b/vlc-android/src/org/videolan/vlc/plugin/PluginService.java
@@ -135,6 +135,11 @@ public class PluginService extends Service {
             connectService(index);
 
     }
+
+    public ExtensionListing getCurrentPlugin() {
+        return mPlugins.get(mCurrentIndex);
+    }
+
     public void connectService(final int index) {
         ExtensionListing info = mPlugins.get(index);
 
@@ -207,7 +212,7 @@ public class PluginService extends Service {
     public void disconnect() {
         if (mCurrentIndex == -1)
             return;
-        ExtensionListing plugin = mPlugins.get(mCurrentIndex);
+        ExtensionListing plugin = getCurrentPlugin();
         Connection conn = plugin.getConnection();
         if (conn != null) {
             try {



More information about the Android mailing list