summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--remoting/android/java/AndroidManifest.xml.jinja23
-rw-r--r--remoting/android/java/src/org/chromium/chromoting/Chromoting.java23
-rw-r--r--remoting/android/java/src/org/chromium/chromoting/Desktop.java14
-rw-r--r--remoting/android/java/src/org/chromium/chromoting/HelpActivity.java83
-rw-r--r--remoting/remoting_android.gypi1
-rw-r--r--remoting/resources/android/menu/help_actionbar.xml16
-rw-r--r--remoting/resources/remoting_strings.grd11
7 files changed, 148 insertions, 3 deletions
diff --git a/remoting/android/java/AndroidManifest.xml.jinja2 b/remoting/android/java/AndroidManifest.xml.jinja2
index a08b72a..a163721 100644
--- a/remoting/android/java/AndroidManifest.xml.jinja2
+++ b/remoting/android/java/AndroidManifest.xml.jinja2
@@ -21,5 +21,8 @@
<activity android:name="org.chromium.chromoting.Desktop"
android:configChanges="orientation|screenSize"
android:windowSoftInputMode="adjustResize"/>
+ <activity android:name="org.chromium.chromoting.HelpActivity"
+ android:configChanges="orientation|screenSize"
+ android:uiOptions="splitActionBarWhenNarrow"/>
</application>
</manifest>
diff --git a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java
index 477976d..15879c8 100644
--- a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java
+++ b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java
@@ -17,6 +17,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
+import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
@@ -45,6 +46,10 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe
private static final String TOKEN_SCOPE = "oauth2:https://www.googleapis.com/auth/chromoting " +
"https://www.googleapis.com/auth/googletalk";
+ /** Web page to be displayed in the Help screen when launched from this activity. */
+ private static final String HELP_URL =
+ "http://support.google.com/chrome/?p=mobile_crd_hostslist";
+
/** User's account details. */
private Account mAccount;
@@ -171,8 +176,22 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe
/** Called whenever an action bar button is pressed. */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
- refreshHostList();
- return true;
+ switch (item.getItemId()) {
+ case R.id.actionbar_directoryrefresh:
+ refreshHostList();
+ return true;
+
+ case R.id.actionbar_help:
+ {
+ Intent intent = new Intent(this, HelpActivity.class);
+ intent.setData(Uri.parse(HELP_URL));
+ startActivity(intent);
+ }
+ return true;
+
+ default:
+ return super.onOptionsItemSelected(item);
+ }
}
/** Called when the user taps on a host entry. */
diff --git a/remoting/android/java/src/org/chromium/chromoting/Desktop.java b/remoting/android/java/src/org/chromium/chromoting/Desktop.java
index dfad7e7..f426ae1 100644
--- a/remoting/android/java/src/org/chromium/chromoting/Desktop.java
+++ b/remoting/android/java/src/org/chromium/chromoting/Desktop.java
@@ -5,7 +5,9 @@
package org.chromium.chromoting;
import android.app.Activity;
+import android.content.Intent;
import android.content.res.Configuration;
+import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
@@ -20,6 +22,10 @@ import org.chromium.chromoting.jni.JniInterface;
* A simple screen that does nothing except display a DesktopView and notify it of rotations.
*/
public class Desktop extends Activity {
+ /** Web page to be displayed in the Help screen when launched from this activity. */
+ private static final String HELP_URL =
+ "http://support.google.com/chrome/?p=mobile_crd_connecthost";
+
/** The surface that displays the remote host's desktop feed. */
private DesktopView mRemoteHostDesktop;
@@ -107,6 +113,14 @@ public class Desktop extends Activity {
}
return true;
+ case R.id.actionbar_help:
+ {
+ Intent intent = new Intent(this, HelpActivity.class);
+ intent.setData(Uri.parse(HELP_URL));
+ startActivity(intent);
+ }
+ return true;
+
default:
return super.onOptionsItemSelected(item);
}
diff --git a/remoting/android/java/src/org/chromium/chromoting/HelpActivity.java b/remoting/android/java/src/org/chromium/chromoting/HelpActivity.java
new file mode 100644
index 0000000..0404827
--- /dev/null
+++ b/remoting/android/java/src/org/chromium/chromoting/HelpActivity.java
@@ -0,0 +1,83 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chromoting;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.net.Uri;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+
+/**
+ * The Activity for showing the Help screen.
+ */
+public class HelpActivity extends Activity {
+ private static final String PLAY_STORE_URL = "market://details?id=";
+
+ /** Launches an external web browser or application. */
+ private void openUrl(String url) {
+ Uri uri = Uri.parse(url);
+ Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+
+ // Verify that the device can launch an application for this intent, otherwise
+ // startActivity() may crash the application.
+ if (intent.resolveActivity(getPackageManager()) != null) {
+ startActivity(intent);
+ }
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ WebView webView = new WebView(this);
+ setContentView(webView);
+
+ getActionBar().setTitle(getString(R.string.actionbar_help_title));
+
+ CharSequence appName = getTitle();
+ CharSequence versionName = null;
+ try {
+ PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 0);
+ versionName = info.versionName;
+ } catch (PackageManager.NameNotFoundException ex) {
+ throw new RuntimeException("Unable to get version: " + ex);
+ }
+
+ CharSequence subtitle = TextUtils.concat(appName, " ", versionName);
+ getActionBar().setSubtitle(subtitle);
+
+ // This line ensures the WebView remains embedded in this activity and doesn't launch an
+ // external Chrome browser.
+ webView.setWebViewClient(new WebViewClient());
+ webView.getSettings().setJavaScriptEnabled(true);
+ String url = getIntent().getDataString();
+ webView.loadUrl(url);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.help_actionbar, menu);
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.actionbar_play_store:
+ openUrl(PLAY_STORE_URL + getPackageName());
+ return true;
+
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+}
diff --git a/remoting/remoting_android.gypi b/remoting/remoting_android.gypi
index 08c7366..e7f127e 100644
--- a/remoting/remoting_android.gypi
+++ b/remoting/remoting_android.gypi
@@ -91,6 +91,7 @@
'files': [
'resources/android/menu/chromoting_actionbar.xml',
'resources/android/menu/desktop_actionbar.xml',
+ 'resources/android/menu/help_actionbar.xml',
],
},
{
diff --git a/remoting/resources/android/menu/help_actionbar.xml b/remoting/resources/android/menu/help_actionbar.xml
new file mode 100644
index 0000000..934f095
--- /dev/null
+++ b/remoting/resources/android/menu/help_actionbar.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- Copyright 2014 The Chromium Authors. All rights reserved.
+ Use of this source code is governed by a BSD-style license that can be
+ found in the LICENSE file.
+-->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/actionbar_feedback"
+ android:title="@string/actionbar_feedback"
+ android:showAsAction="ifRoom|withText"
+ android:visible="false"/>
+ <item android:id="@+id/actionbar_play_store"
+ android:title="@string/actionbar_play_store"
+ android:showAsAction="never"/>
+</menu>
diff --git a/remoting/resources/remoting_strings.grd b/remoting/resources/remoting_strings.grd
index 48cd896..9b1bc3d 100644
--- a/remoting/resources/remoting_strings.grd
+++ b/remoting/resources/remoting_strings.grd
@@ -378,9 +378,18 @@
</if>
<if expr="is_android">
- <message desc="Text displayed in the Android action-bar overflow menu for showing the Help and Feedback screen" name="IDS_ACTIONBAR_HELP" formatter_data="android_java">
+ <message desc="Title displayed in the action-bar for the Android Help screen" name="IDS_ACTIONBAR_HELP_TITLE" formatter_data="android_java">
+ Help
+ </message>
+ <message desc="Android action-bar menu item for showing the Help and Feedback screen" name="IDS_ACTIONBAR_HELP" formatter_data="android_java">
Help &amp; feedback
</message>
+ <message desc="Label for the Feedback button displayed in the Android Help screen. Pressing this button causes the Feedback screen to be shown." name="IDS_ACTIONBAR_FEEDBACK" formatter_data="android_java">
+ Feedback
+ </message>
+ <message desc="Android action-bar menu item for viewing the Play Store page for the application" name="IDS_ACTIONBAR_PLAY_STORE" formatter_data="android_java">
+ View in Google Play Store
+ </message>
</if>
<message desc="Label for the access code entry box. This is where the client user enters the code that permits access to the host." name="IDS_ACCESS_CODE">