diff options
-rw-r--r-- | remoting/android/java/src/org/chromium/chromoting/Chromoting.java | 21 | ||||
-rw-r--r-- | remoting/resources/android/layout/main.xml | 22 | ||||
-rw-r--r-- | remoting/resources/android/values/styles.xml | 7 | ||||
-rw-r--r-- | remoting/resources/remoting_strings.grd | 3 |
4 files changed, 48 insertions, 5 deletions
diff --git a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java index 05523c7..8727d95 100644 --- a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java +++ b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java @@ -38,8 +38,8 @@ import java.util.Arrays; * also requests and renews authentication tokens using the system account manager. */ public class Chromoting extends Activity implements JniInterface.ConnectionListener, - AccountManagerCallback<Bundle>, ActionBar.OnNavigationListener, - HostListLoader.Callback { + AccountManagerCallback<Bundle>, ActionBar.OnNavigationListener, HostListLoader.Callback, + View.OnClickListener { /** Only accounts of this type will be selectable for authentication. */ private static final String ACCOUNT_TYPE = "com.google"; @@ -51,6 +51,10 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe private static final String HELP_URL = "http://support.google.com/chrome/?p=mobile_crd_hostslist"; + /** Web page to be displayed when user triggers the hyperlink for setting up hosts. */ + private static final String HOST_SETUP_URL = + "https://support.google.com/chrome/answer/1649523"; + /** User's account details. */ private Account mAccount; @@ -123,6 +127,11 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe private void setHostListProgressVisible(boolean visible) { mHostListView.setVisibility(visible ? View.GONE : View.VISIBLE); mProgressView.setVisibility(visible ? View.VISIBLE : View.GONE); + + // Hiding the host-list does not automatically hide the empty view, so do that here. + if (visible) { + mHostListView.getEmptyView().setVisibility(View.GONE); + } } /** @@ -142,6 +151,8 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe mHostListView.setEmptyView(findViewById(R.id.hostList_empty)); mProgressView = findViewById(R.id.hostList_progress); + findViewById(R.id.host_setup_link_android).setOnClickListener(this); + // Bring native components online. JniInterface.loadLibrary(this); @@ -230,6 +241,12 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe } } + /** Called when the user touches hyperlinked text. */ + @Override + public void onClick(View view) { + HelpActivity.launch(this, HOST_SETUP_URL); + } + /** Called when the user taps on a host entry. */ public void connectToHost(HostInfo host) { mProgressIndicator = ProgressDialog.show(this, diff --git a/remoting/resources/android/layout/main.xml b/remoting/resources/android/layout/main.xml index b3a6754..975cd6b 100644 --- a/remoting/resources/android/layout/main.xml +++ b/remoting/resources/android/layout/main.xml @@ -11,11 +11,27 @@ <ListView android:id="@+id/hostList_chooser" android:layout_height="match_parent" android:layout_width="match_parent"/> - <TextView android:id="@+id/hostList_empty" + <LinearLayout android:id="@+id/hostList_empty" + android:gravity="center" android:layout_height="match_parent" android:layout_width="match_parent" - android:text="@string/host_list_empty_android" - android:visibility="gone"/> + android:orientation="vertical" + android:visibility="gone"> + <ImageView android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:src="@drawable/empty_host_list"/> + <TextView android:gravity="center" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:text="@string/host_list_empty_android" + style="@style/EmptyStateText"/> + <TextView android:id="@+id/host_setup_link_android" + android:gravity="center" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:text="@string/host_setup_link_android" + style="@style/EmptyStateText.Hyperlink"/> + </LinearLayout> <ProgressBar android:id="@+id/hostList_progress" android:layout_height="wrap_content" android:layout_width="wrap_content" diff --git a/remoting/resources/android/values/styles.xml b/remoting/resources/android/values/styles.xml index a78a6d9..881d2bb 100644 --- a/remoting/resources/android/values/styles.xml +++ b/remoting/resources/android/values/styles.xml @@ -12,4 +12,11 @@ <style name="MainActionBar" parent="@android:style/Widget.Holo.ActionBar"> <item name="android:displayOptions">showHome</item> </style> + <style name="EmptyStateText" parent="@android:style/TextAppearance.Holo.Large"> + <item name="android:textColor">#888</item> + </style> + <style name="EmptyStateText.Hyperlink"> + <item name="android:textColor">@android:color/holo_blue_light</item> + <item name="android:textStyle">italic</item> + </style> </resources> diff --git a/remoting/resources/remoting_strings.grd b/remoting/resources/remoting_strings.grd index fe9342b..467caa4 100644 --- a/remoting/resources/remoting_strings.grd +++ b/remoting/resources/remoting_strings.grd @@ -396,6 +396,9 @@ <message desc="Message displayed to the user if there are no hosts registered to their account" name="IDS_HOST_LIST_EMPTY_ANDROID" formatter_data="android_java"> You have no computers registered. </message> + <message desc="Message displayed to the user if there are no hosts registered to their account. This is styled to look like a hyperlink. When a user activates the link, they are taken to a web page that explains how to set up a Chromoting host." name="IDS_HOST_SETUP_LINK_ANDROID" formatter_data="android_java"> + Learn how to set up a computer for remote access. + </message> <message desc="Title of the authentication dialog" name="IDS_TITLE_AUTHENTICATE" formatter_data="android_java"> Authenticate to host </message> |