diff options
author | Artur Dryomov <artur.dryomov@gmail.com> | 2013-07-02 23:37:04 +0300 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-07-25 18:01:50 +0100 |
commit | fc961aeaf667fbcbc4990678b987bf4291b06572 (patch) | |
tree | 956b4a2c18886d588f11f09eb668e647bddbb42c /android | |
parent | ba412940872cfb309980bdd97584ba803ed1c1d4 (diff) |
Add the licenses activity for showing open source licenses.
Change-Id: I2198cea9ef27cfbdf760a8da41e0c7af8e04f20e
Diffstat (limited to 'android')
7 files changed, 114 insertions, 0 deletions
diff --git a/android/sdremote/AndroidManifest.xml b/android/sdremote/AndroidManifest.xml index f85e1dfb275b..36064da7ac4c 100644 --- a/android/sdremote/AndroidManifest.xml +++ b/android/sdremote/AndroidManifest.xml @@ -63,6 +63,11 @@ android:label="@string/reconnect"> </activity> + <activity + android:name=".LicensesActivity" + android:label="@string/title_licenses"> + </activity> + <service android:name=".communication.CommunicationService" android:label="@string/startpresentation_title"> diff --git a/android/sdremote/res/layout/activity_licenses.xml b/android/sdremote/res/layout/activity_licenses.xml new file mode 100644 index 000000000000..5bc5886e243e --- /dev/null +++ b/android/sdremote/res/layout/activity_licenses.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<WebView xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/view_licenses" + android:layout_width="match_parent" + android:layout_height="match_parent"/>
\ No newline at end of file diff --git a/android/sdremote/res/menu/menu_action_bar_computers.xml b/android/sdremote/res/menu/menu_action_bar_computers.xml new file mode 100644 index 000000000000..ee7cfb8c1ef2 --- /dev/null +++ b/android/sdremote/res/menu/menu_action_bar_computers.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android"> + + <item + android:id="@+id/menu_licenses" + android:title="@string/menu_licenses" + android:showAsAction="never"/> + +</menu>
\ No newline at end of file diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml index 981b6f1a8a69..865067de9d28 100644 --- a/android/sdremote/res/values/strings.xml +++ b/android/sdremote/res/values/strings.xml @@ -68,5 +68,8 @@ <string name="title_computers">Computers</string> <string name="title_bluetooth" translatable="false">Bluetooth</string> <string name="title_wifi" translatable="false">WiFi</string> + <string name="title_licenses">Open source licenses</string> + + <string name="menu_licenses">Open source licenses</string> </resources> diff --git a/android/sdremote/res/values/themes.xml b/android/sdremote/res/values/themes.xml index d53ae532c1a0..2dcde14acfcf 100644 --- a/android/sdremote/res/values/themes.xml +++ b/android/sdremote/res/values/themes.xml @@ -14,6 +14,9 @@ <style name="Theme.ImpressRemote.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse"> <item name="android:background">@color/background_action_bar</item> <item name="background">@color/background_action_bar</item> + + <item name="android:displayOptions">showTitle|showHome|homeAsUp|useLogo</item> + <item name="displayOptions">showTitle|showHome|homeAsUp|useLogo</item> </style> <style name="Theme.ImpressRemote.ActionBar.Tab" parent="Widget.Sherlock.Light.ActionBar.TabView.Inverse"> @@ -29,6 +32,9 @@ <style name="Theme.ImpressRemote.Computers.ActionBar" parent="Theme.ImpressRemote.ActionBar"> <item name="android:navigationMode">tabMode</item> <item name="navigationMode">tabMode</item> + + <item name="android:displayOptions">showTitle|showHome|useLogo</item> + <item name="displayOptions">showTitle|showHome|useLogo</item> </style> <style name="Theme.ImpressRemote.ActionBarWidget" parent="android:style/Widget.Holo.Light"> diff --git a/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java b/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java index e4e9d5fdec89..0a5ea2f689a7 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java @@ -8,11 +8,14 @@ */ package org.libreoffice.impressremote; +import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.SherlockFragmentActivity; +import com.actionbarsherlock.view.Menu; +import com.actionbarsherlock.view.MenuItem; public class ComputersActivity extends SherlockFragmentActivity { @Override @@ -51,6 +54,30 @@ public class ComputersActivity extends SherlockFragmentActivity { return buildActionBarTab(aFragment, R.string.title_wifi); } + + @Override + public boolean onCreateOptionsMenu(Menu aMenu) { + getSupportMenuInflater().inflate(R.menu.menu_action_bar_computers, aMenu); + + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem aMenuItem) { + switch (aMenuItem.getItemId()) { + case R.id.menu_licenses: + callLicensesActivity(); + return true; + + default: + return super.onOptionsItemSelected(aMenuItem); + } + } + + private void callLicensesActivity() { + Intent aIntent = new Intent(this, LicensesActivity.class); + startActivity(aIntent); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/android/sdremote/src/org/libreoffice/impressremote/LicensesActivity.java b/android/sdremote/src/org/libreoffice/impressremote/LicensesActivity.java new file mode 100644 index 000000000000..ae97c2f4882e --- /dev/null +++ b/android/sdremote/src/org/libreoffice/impressremote/LicensesActivity.java @@ -0,0 +1,59 @@ +package org.libreoffice.impressremote; + +import android.content.ContentResolver; +import android.content.Intent; +import android.os.Bundle; +import android.support.v4.app.NavUtils; +import android.webkit.WebView; + +import com.actionbarsherlock.app.SherlockActivity; +import com.actionbarsherlock.view.MenuItem; + +public class LicensesActivity extends SherlockActivity { + private static final String SCHEME = ContentResolver.SCHEME_FILE; + private static final String AUTHORITY = "android_asset"; + private static final String PATH = "licenses.html"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_licenses); + + setUpHomeButton(); + + setUpLicenses(); + } + + private void setUpHomeButton() { + getSupportActionBar().setHomeButtonEnabled(true); + } + + private void setUpLicenses() { + getLicensesView().loadUrl(buildLicensesUri()); + } + + private WebView getLicensesView() { + return (WebView) findViewById(R.id.view_licenses); + } + + private String buildLicensesUri() { + return String.format("%s:///%s/%s", SCHEME, AUTHORITY, PATH); + } + + @Override + public boolean onOptionsItemSelected(MenuItem aMenuItem) { + switch (aMenuItem.getItemId()) { + case android.R.id.home: + navigateUp(); + return true; + + default: + return super.onOptionsItemSelected(aMenuItem); + } + } + + private void navigateUp() { + Intent aIntent = new Intent(this, ComputersActivity.class); + NavUtils.navigateUpTo(this, aIntent); + } +} |