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
This commit is contained in:
Robert Greenwalt
2010-03-18 15:31:48 -07:00
parent b3be4d0c50
commit 38925c0b96
3 changed files with 67 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
<html>
<head>
<style>
P {
font-size: 14 px;
}
B {
font-size: 16px;
}
A {
color: #OOC;
}
.style1 {
font-size: 16px;
}
</style>
</head>
<body>
<p><b>USB tethering</b></p>
<span class="style1">You can tether your phone to your computer with a USB cable, to share your phone's internet connection with your computer</span>
<ul>
<li>Tethering works with Windows Vista, Windows 7, and Linux</li><br>
<li>You can't mount your phone's SD card on your computer when USB tethered</li><br>
<li>For more information, including using USB tethering with other OSs, see <a href="http://www.google.com/phone/tether#usb">http://www.google.com/phone/tether#usb</a></li><br>
</ul>
</body>
</html>

View File

@@ -0,0 +1,27 @@
<html>
<head>
<style>
P {
font-size: 14 px;
}
B {
font-size: 16px;
}
A {
color: #OOC;
}
.style1 {
font-size: 16px;
}
</style>
</head>
<body>
<p><b>Wi-Fi tethering</b></p>
<span class="style1">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</span>
<ul>
<li>When your phone is acting as an access point, you can't use your phone's applications to access the internet via its Wi-Fi connection</li><br>
<li>You configure a Wi-Fi access point in Wi-Fi tethering settings</li><br>
<li>For more information, visit <a href="http://www.google.com/phone/tether#wifi">http://www.google.com/phone/tether#wifi</a></li><br>
</ul>
</body>
</html>

View File

@@ -46,7 +46,9 @@ public class TetherSettings extends PreferenceActivity {
private static final String ENABLE_WIFI_AP = "enable_wifi_ap"; private static final String ENABLE_WIFI_AP = "enable_wifi_ap";
private static final String WIFI_AP_SETTINGS = "wifi_ap_settings"; private static final String WIFI_AP_SETTINGS = "wifi_ap_settings";
private static final String TETHERING_HELP = "tethering_help"; 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; private CheckBoxPreference mUsbTether;
@@ -245,6 +247,16 @@ public class TetherSettings extends PreferenceActivity {
Locale locale = Locale.getDefault(); Locale locale = Locale.getDefault();
String url = HELP_URL.replace("%y", locale.getLanguage().toLowerCase()); String url = HELP_URL.replace("%y", locale.getLanguage().toLowerCase());
url = url.replace("%z", locale.getCountry().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); WebView view = new WebView(this);
view.loadUrl(url); view.loadUrl(url);