From 38925c0b964b7aef23c8a03af4d1a9499474f1b2 Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Thu, 18 Mar 2010 15:31:48 -0700 Subject: [PATCH] Choose the Tether help file based on device config Don't show wifi Tethering help on devices that don't support it, etc. bug:2520021 Change-Id: I905d1b66fc239d5a5f5028715623d8781041f9ca --- assets/html/en_us/tethering_usb_help.html | 27 ++++++++++++++++++++ assets/html/en_us/tethering_wifi_help.html | 27 ++++++++++++++++++++ src/com/android/settings/TetherSettings.java | 14 +++++++++- 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 assets/html/en_us/tethering_usb_help.html create mode 100644 assets/html/en_us/tethering_wifi_help.html diff --git a/assets/html/en_us/tethering_usb_help.html b/assets/html/en_us/tethering_usb_help.html new file mode 100644 index 00000000000..143a09f6d55 --- /dev/null +++ b/assets/html/en_us/tethering_usb_help.html @@ -0,0 +1,27 @@ + + + + + +

USB tethering

+You can tether your phone to your computer with a USB cable, to share your phone's internet connection with your computer + + + diff --git a/assets/html/en_us/tethering_wifi_help.html b/assets/html/en_us/tethering_wifi_help.html new file mode 100644 index 00000000000..9519e9a47f4 --- /dev/null +++ b/assets/html/en_us/tethering_wifi_help.html @@ -0,0 +1,27 @@ + + + + + +

Wi-Fi tethering

+You can turn your phone into a Wi-Fi access point, to share your phone's internet connection with one or more computers or other devices + + + diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java index 4095e86a0da..049f912f82b 100644 --- a/src/com/android/settings/TetherSettings.java +++ b/src/com/android/settings/TetherSettings.java @@ -46,7 +46,9 @@ public class TetherSettings extends PreferenceActivity { private static final String ENABLE_WIFI_AP = "enable_wifi_ap"; private static final String WIFI_AP_SETTINGS = "wifi_ap_settings"; private static final String TETHERING_HELP = "tethering_help"; - private static final String HELP_URL = "file:///android_asset/html/%y_%z/tethering_help.html"; + private static final String USB_HELP_MODIFIER = "usb_"; + private static final String WIFI_HELP_MODIFIER = "wifi_"; + private static final String HELP_URL = "file:///android_asset/html/%y_%z/tethering_%xhelp.html"; private CheckBoxPreference mUsbTether; @@ -245,6 +247,16 @@ public class TetherSettings extends PreferenceActivity { Locale locale = Locale.getDefault(); String url = HELP_URL.replace("%y", locale.getLanguage().toLowerCase()); url = url.replace("%z", locale.getCountry().toLowerCase()); + + if ((mUsbRegexs.length != 0) && (mWifiRegexs.length == 0)) { + url = url.replace("%x", USB_HELP_MODIFIER); + } else if ((mWifiRegexs.length != 0) && (mUsbRegexs.length == 0)) { + url = url.replace("%x", WIFI_HELP_MODIFIER); + } else { + // could assert that both wifi and usb have regexs, but the default + // is to use this anyway so no check is needed + url = url.replace("%x", ""); + } WebView view = new WebView(this); view.loadUrl(url);