Clean up the tethering settings screen a bit.

Change-Id: Iadd1cf9245a5ccd38537050a6b6c9d9390400b20
This commit is contained in:
Robert Greenwalt
2010-03-05 19:00:30 -08:00
parent b7411b49c7
commit 204e7c1a6e
3 changed files with 19 additions and 69 deletions

View File

@@ -726,8 +726,6 @@
<string name="bluetooth_dock_settings_remember">Remember settings</string> <string name="bluetooth_dock_settings_remember">Remember settings</string>
<!-- Wi-Fi Settings --> <skip /> <!-- Wi-Fi Settings --> <skip />
<!-- Used in the 2nd-level settings screen to turn on Wi-Fi -->
<string name="wifi">Wi-Fi</string>
<!-- Used in the 1st-level settings screen to turn on Wi-Fi --> <!-- Used in the 1st-level settings screen to turn on Wi-Fi -->
<string name="wifi_quick_toggle_title">Wi-Fi</string> <string name="wifi_quick_toggle_title">Wi-Fi</string>
<!-- Used in the 1st-level settings screen as the turn-on summary --> <!-- Used in the 1st-level settings screen as the turn-on summary -->
@@ -1398,11 +1396,6 @@
<!-- Thethering help button - calls up a web view with general tethering info --> <!-- Thethering help button - calls up a web view with general tethering info -->
<string name="tethering_help_button_text">Tethering help</string> <string name="tethering_help_button_text">Tethering help</string>
<!-- Tethered notification text - shown in the notification bar when tethering is active -->
<string name="tethered_notifcation_title">Tethering active</string>
<!-- Tethered notification message - shown under the notification title -->
<string name="tethered_notification_message">Touch to configure</string>
<!-- Wireless controls, item title to go into the network settings --> <!-- Wireless controls, item title to go into the network settings -->
<string name="network_settings_title">Mobile networks</string> <string name="network_settings_title">Mobile networks</string>
<!-- Wireless controls, the item summary for the user to go into the network settings --> <!-- Wireless controls, the item summary for the user to go into the network settings -->

View File

@@ -22,26 +22,20 @@
android:title="@string/usb_tethering_button_text" android:title="@string/usb_tethering_button_text"
android:persistent="false" /> android:persistent="false" />
<PreferenceCategory <CheckBoxPreference
android:key="wifi_category" android:key="enable_wifi_ap"
android:title="@string/wifi"> android:title="@string/wifi_tether_checkbox_text"
android:persistent="false" />
<CheckBoxPreference <PreferenceScreen
android:key="enable_wifi_ap" android:key="wifi_ap_settings"
android:title="@string/wifi_tether_checkbox_text" android:dependency="enable_wifi_ap"
android:persistent="false" /> android:title="@string/wifi_tether_settings_text"
android:summary="@string/wifi_tether_settings_subtext" >
<PreferenceScreen <intent
android:key="wifi_ap_settings" android:action="android.intent.action.MAIN"
android:dependency="enable_wifi_ap" android:targetPackage="com.android.settings"
android:title="@string/wifi_tether_settings_text" android:targetClass="com.android.settings.wifi.WifiApSettings" />
android:summary="@string/wifi_tether_settings_subtext" > </PreferenceScreen>
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.wifi.WifiApSettings" />
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View File

@@ -143,7 +143,6 @@ public class TetherSettings extends PreferenceActivity {
boolean massStorageActive = boolean massStorageActive =
Environment.MEDIA_SHARED.equals(Environment.getExternalStorageState()); Environment.MEDIA_SHARED.equals(Environment.getExternalStorageState());
boolean wifiErrored = false; boolean wifiErrored = false;
for (Object o : available) { for (Object o : available) {
String s = (String)o; String s = (String)o;
for (String regex : mUsbRegexs) { for (String regex : mUsbRegexs) {
@@ -182,15 +181,14 @@ public class TetherSettings extends PreferenceActivity {
} }
} }
if (usbTethered || wifiTethered) {
// showTetheredNotification();
}
if (usbTethered) { if (usbTethered) {
mUsbTether.setSummary(R.string.usb_tethering_active_subtext); mUsbTether.setSummary(R.string.usb_tethering_active_subtext);
mUsbTether.setEnabled(true); mUsbTether.setEnabled(true);
mUsbTether.setChecked(true);
} else if (massStorageActive) { } else if (massStorageActive) {
mUsbTether.setSummary(R.string.usb_tethering_storage_active_subtext); mUsbTether.setSummary(R.string.usb_tethering_storage_active_subtext);
mUsbTether.setEnabled(false); mUsbTether.setEnabled(false);
mUsbTether.setChecked(false);
} else if (usbAvailable) { } else if (usbAvailable) {
if (usbError == ConnectivityManager.TETHER_ERROR_NO_ERROR) { if (usbError == ConnectivityManager.TETHER_ERROR_NO_ERROR) {
mUsbTether.setSummary(R.string.usb_tethering_available_subtext); mUsbTether.setSummary(R.string.usb_tethering_available_subtext);
@@ -198,12 +196,15 @@ public class TetherSettings extends PreferenceActivity {
mUsbTether.setSummary(R.string.usb_tethering_errored_subtext); mUsbTether.setSummary(R.string.usb_tethering_errored_subtext);
} }
mUsbTether.setEnabled(true); mUsbTether.setEnabled(true);
mUsbTether.setChecked(false);
} else if (usbErrored) { } else if (usbErrored) {
mUsbTether.setSummary(R.string.usb_tethering_errored_subtext); mUsbTether.setSummary(R.string.usb_tethering_errored_subtext);
mUsbTether.setEnabled(false); mUsbTether.setEnabled(false);
mUsbTether.setChecked(false);
} else { } else {
mUsbTether.setSummary(R.string.usb_tethering_unavailable_subtext); mUsbTether.setSummary(R.string.usb_tethering_unavailable_subtext);
mUsbTether.setEnabled(false); mUsbTether.setEnabled(false);
mUsbTether.setChecked(false);
} }
} }
@@ -257,42 +258,4 @@ public class TetherSettings extends PreferenceActivity {
} }
return null; return null;
} }
// private showTetheredNotification() {
// NotificationManager notificationManager = (NotificationManager)mContext.
// getSystemService(Context.NOTIFICATION_SERVICE);
// if (notificationManager == null) {
// return;
// }
//
// Intent intent = new Intent();
//
// PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0);
//
// Resources r = Resources.getSystem();
// CharSequence title = r.getText(com.android.internal.R.string.
// tether_stop_notification_title);
// CharSequence message = r.getText(com.android.internal.R.string.
// tether_stop_notification_message);
//
// if(mTetheringNotification == null) {
// mTetheringNotification = new Notification();
// mTetheringNotification.when = 0;
// }
// mTetheringNotification.icon = com.android.internal.R.drawable.stat_sys_tether_usb;
//
// boolean playSounds = false;
// //playSounds = SystemProperties.get("persist.service.mount.playsnd", "1").equals("1");
// if (playSounds) {
// mTetheringNotification.defaults |= Notification.DEFAULT_SOUND;
// } else {
// mTetheringNotification.defaults &= ~Notification.DEFAULT_SOUND;
// }
// mTetheringNotification.flags = Notification.FLAG_ONGOING_EVENT;
// mTetheringNotification.tickerText = title;
// mTetheringNotification.setLatestEventInfo(mContext, title, message, pi);
//
// notificationManager.notify(mTetheringNotification.icon, mTetheringNotification);
// }
} }