[Android] Licence view for TV

Geoffrey Métais git at videolan.org
Wed Jan 27 17:33:29 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jan 27 17:33:05 2016 +0100| [a3a388b21f7239394f359857cb6053105fb088fd] | committer: Geoffrey Métais

Licence view for TV

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

 vlc-android/AndroidManifest.xml                      |  2 ++
 .../src/org/videolan/vlc/gui/tv/LicenceActivity.java | 20 ++++++++++++++++++++
 .../src/org/videolan/vlc/gui/tv/MainTvActivity.java  |  4 ++++
 3 files changed, 26 insertions(+)

diff --git a/vlc-android/AndroidManifest.xml b/vlc-android/AndroidManifest.xml
index 33e6bdb..f7279ba 100644
--- a/vlc-android/AndroidManifest.xml
+++ b/vlc-android/AndroidManifest.xml
@@ -526,6 +526,8 @@
             android:theme="@style/Theme.VLC.Leanback.Preferences" />
         <activity android:name=".gui.tv.AboutActivity"
             android:theme="@style/Theme.Leanback" />
+        <activity android:name=".gui.tv.LicenceActivity"
+            android:theme="@style/Theme.Leanback" />
 
         <service
             android:name="org.videolan.vlc.gui.tv.RecommendationsService"
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/LicenceActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/LicenceActivity.java
new file mode 100644
index 0000000..317ad39
--- /dev/null
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/LicenceActivity.java
@@ -0,0 +1,20 @@
+package org.videolan.vlc.gui.tv;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.webkit.WebView;
+
+import org.videolan.vlc.R;
+import org.videolan.vlc.util.Util;
+
+public class LicenceActivity extends Activity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        String revision = getString(R.string.build_revision);
+        WebView licence = new WebView(this);
+        licence.loadData(Util.readAsset("licence.htm", "").replace("!COMMITID!", revision), "text/html", "UTF8");
+        setContentView(licence);
+    }
+}
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
index 5677c95..f457de9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -88,6 +88,7 @@ public class MainTvActivity extends BaseTvActivity implements IVideoBrowser, OnI
 
     public static final long ID_SETTINGS = 0;
     public static final long ID_ABOUT = 1;
+    public static final long ID_LICENCE = 2;
 
     private static final int ACTIVITY_RESULT_PREFERENCES = 1;
 
@@ -339,6 +340,8 @@ public class MainTvActivity extends BaseTvActivity implements IVideoBrowser, OnI
                 startActivityForResult(new Intent(this, org.videolan.vlc.gui.tv.preferences.PreferencesActivity.class), ACTIVITY_RESULT_PREFERENCES);
             else if (id == ID_ABOUT)
                 startActivity(new Intent(this, org.videolan.vlc.gui.tv.AboutActivity.class));
+            else if (id == ID_LICENCE)
+                startActivity(new Intent(this, org.videolan.vlc.gui.tv.LicenceActivity.class));
         } else {
             TvUtil.openMedia(mContext, item, row);
         }
@@ -421,6 +424,7 @@ public class MainTvActivity extends BaseTvActivity implements IVideoBrowser, OnI
 
             mOtherAdapter.add(new CardPresenter.SimpleCard(ID_SETTINGS, getString(R.string.preferences), R.drawable.ic_menu_preferences_big));
             mOtherAdapter.add(new CardPresenter.SimpleCard(ID_ABOUT, getString(R.string.about), R.drawable.ic_menu_preferences_big));
+            mOtherAdapter.add(new CardPresenter.SimpleCard(ID_LICENCE, getString(R.string.licence), R.drawable.ic_menu_preferences_big));
             mRowsAdapter.add(new ListRow(miscHeader, mOtherAdapter));
             mBrowseFragment.setAdapter(mRowsAdapter);
         }



More information about the Android mailing list