Loading packages/SystemUI/res/layout-xlarge/sysbar_panel_settings.xml +150 −5 Original line number Diff line number Diff line Loading @@ -18,8 +18,153 @@ <com.android.systemui.statusbar.tablet.SettingsPanel xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="200dip" android:background="#ff000000" android:layout_height="wrap_content" android:orientation="vertical" android:background="@drawable/status_bar_item_background" android:paddingLeft="16dp" > <!-- Airplane mode --> <LinearLayout android:id="@+id/airplane" style="@style/StatusBarPanelSettingsRow" > <ImageView android:id="@+id/airplane_icon" style="@style/StatusBarPanelSettingsIcon" android:src="@drawable/ic_sysbar_airplane_on" /> <TextView android:id="@+id/airplane_label" style="@style/StatusBarPanelSettingsContents" android:text="@string/system_panel_airplane" /> <CheckBox android:id="@+id/airplane_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" /> </LinearLayout> <View style="@style/StatusBarPanelSettingsPanelSeparator" /> <!-- Network --> <LinearLayout android:id="@+id/network" style="@style/StatusBarPanelSettingsRow" > <ImageView android:id="@+id/network_icon" style="@style/StatusBarPanelSettingsIcon" android:src="@drawable/ic_sysbar_wifi_on" /> <TextView android:id="@+id/network_label" style="@style/StatusBarPanelSettingsContents" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" android:layout_marginTop="16dp" android:layout_marginRight="8dp" android:src="@drawable/ic_notification_open" /> </LinearLayout> <View style="@style/StatusBarPanelSettingsPanelSeparator" /> <!-- Rotation lock --> <LinearLayout android:id="@+id/rotate" style="@style/StatusBarPanelSettingsRow" > <ImageView android:id="@+id/rotate_icon" style="@style/StatusBarPanelSettingsIcon" android:src="@drawable/ic_sysbar_rotate_on" /> <TextView android:id="@+id/rotate_label" style="@style/StatusBarPanelSettingsContents" android:text="@string/system_panel_rotation_lock" /> <CheckBox android:id="@+id/rotate_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" /> </LinearLayout> <View style="@style/StatusBarPanelSettingsPanelSeparator" /> <!-- Brightness --> <LinearLayout style="@style/StatusBarPanelSettingsRow" > <ImageView android:id="@+id/brightness_icon" style="@style/StatusBarPanelSettingsIcon" android:src="@drawable/ic_sysbar_brightness" /> </LinearLayout> <View style="@style/StatusBarPanelSettingsPanelSeparator" /> <!-- Volume --> <LinearLayout style="@style/StatusBarPanelSettingsRow" > <ImageView android:id="@+id/volume_icon" style="@style/StatusBarPanelSettingsIcon" android:src="@drawable/ic_sysbar_sound_on" /> </LinearLayout> <View style="@style/StatusBarPanelSettingsPanelSeparator" /> <!-- Notifications / Do not disturb --> <LinearLayout android:id="@+id/do_not_disturb" style="@style/StatusBarPanelSettingsRow" > <ImageView android:id="@+id/do_not_disturb_icon" style="@style/StatusBarPanelSettingsIcon" android:src="@drawable/ic_sysbar_gps_on" /> <TextView style="@style/StatusBarPanelSettingsContents" android:text="@string/system_panel_notifications" /> <CheckBox android:id="@+id/do_not_disturb_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" /> </LinearLayout> <View style="@style/StatusBarPanelSettingsPanelSeparator" /> <!-- Link to settings --> <LinearLayout android:id="@+id/settings" style="@style/StatusBarPanelSettingsRow" > <ImageView android:id="@+id/settings" style="@style/StatusBarPanelSettingsIcon" android:src="@drawable/ic_sysbar_quicksettings" /> <TextView style="@style/StatusBarPanelSettingsContents" android:text="@string/system_panel_settings_button" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" android:layout_marginTop="16dp" android:layout_marginRight="8dp" android:src="@drawable/ic_notification_open" /> </LinearLayout> <View style="@style/StatusBarPanelSettingsPanelSeparator" /> </com.android.systemui.statusbar.tablet.SettingsPanel> packages/SystemUI/res/values-xlarge/styles.xml 0 → 100644 +45 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2010 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="StatusBarPanelSettingsRow"> <item name="android:layout_height">64dp</item> <item name="android:layout_width">match_parent</item> <item name="android:orientation">horizontal</item> </style> <style name="StatusBarPanelSettingsIcon"> <item name="android:layout_height">match_parent</item> <item name="android:layout_width">64dp</item> <item name="android:scaleType">center</item> </style> <style name="StatusBarPanelSettingsContents"> <item name="android:layout_height">wrap_content</item> <item name="android:layout_width">0dp</item> <item name="android:layout_weight">1</item> <item name="android:layout_gravity">left|center_vertical</item> <item name="android:textColor">?android:attr/textColorPrimary</item> </style> <style name="StatusBarPanelSettingsPanelSeparator"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">1dp</item> <item name="android:background">@android:drawable/divider_horizontal_dark</item> </style> </resources> packages/SystemUI/res/values/strings.xml +9 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,15 @@ <!-- Name of the button that links to the Settings app. [CHAR LIMIT=NONE] --> <string name="system_panel_settings_button">Settings</string> <!-- Label in the system panel for airplane mode (all radios are turned off)[CHAR LIMIT=30] --> <string name="system_panel_airplane">Airplane mode</string> <!-- Label in system panel saying the device will use the orientation sensor to rotate [CHAR LIMIT=30] --> <string name="system_panel_rotation_lock">Lock screen orientation</string> <!-- Label in system panel saying the device will show notifications [CHAR LIMIT=30] --> <string name="system_panel_notifications">Notifications</string> <!-- Text to display next to the graphical battery meter. [CHAR LIMIT=3] --> <string name="system_panel_battery_meter_format" translatable="false"> <xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g> Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/AirplaneModeController.java 0 → 100644 +92 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.policy; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; import android.util.Slog; import android.widget.CompoundButton; public class AirplaneModeController extends BroadcastReceiver implements CompoundButton.OnCheckedChangeListener { private static final String TAG = "StatusBar.AirplaneModeController"; private Context mContext; private CompoundButton mCheckBox; private boolean mAirplaneMode; public AirplaneModeController(Context context, CompoundButton checkbox) { mContext = context; mAirplaneMode = getAirplaneMode(); mCheckBox = checkbox; checkbox.setChecked(mAirplaneMode); checkbox.setOnCheckedChangeListener(this); IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED); context.registerReceiver(this, filter); } public void release() { mContext.unregisterReceiver(this); } public void onCheckedChanged(CompoundButton view, boolean checked) { Slog.d(TAG, "onCheckedChanged checked=" + checked + " mAirplaneMode=" + mAirplaneMode); if (checked != mAirplaneMode) { mAirplaneMode = checked; unsafe(checked); } } public void onReceive(Context context, Intent intent) { if (Intent.ACTION_AIRPLANE_MODE_CHANGED.equals(intent.getAction())) { final boolean enabled = intent.getBooleanExtra("state", false); if (enabled != mAirplaneMode) { mAirplaneMode = enabled; mCheckBox.setChecked(enabled); } } } private boolean getAirplaneMode() { ContentResolver cr = mContext.getContentResolver(); return 0 != Settings.System.getInt(cr, Settings.System.AIRPLANE_MODE_ON, 0); } // TODO: Fix this racy API by adding something better to TelephonyManager or // ConnectivityService. private void unsafe(boolean enabled) { Settings.System.putInt( mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, enabled ? 1 : 0); Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); intent.putExtra("state", enabled); mContext.sendBroadcast(intent); } } packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java 0 → 100644 +73 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.policy; import android.content.ContentResolver; import android.content.Context; import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; import android.util.Slog; import android.view.IWindowManager; import android.widget.CompoundButton; /** * TODO: Listen for changes to the setting. */ public class AutoRotateController implements CompoundButton.OnCheckedChangeListener { private static final String TAG = "StatusBar.AutoRotateController"; private Context mContext; private CompoundButton mCheckBox; private boolean mLockRotation; public AutoRotateController(Context context, CompoundButton checkbox) { mContext = context; mLockRotation = getLockRotation(); mCheckBox = checkbox; checkbox.setChecked(mLockRotation); checkbox.setOnCheckedChangeListener(this); } public void onCheckedChanged(CompoundButton view, boolean checked) { Slog.d(TAG, "onCheckedChanged checked=" + checked + " mLockRotation=" + mLockRotation); if (checked != mLockRotation) { setLockRotation(checked); } } private boolean getLockRotation() { ContentResolver cr = mContext.getContentResolver(); return 0 == Settings.System.getInt(cr, Settings.System.ACCELEROMETER_ROTATION, 0); } private void setLockRotation(boolean locked) { mLockRotation = locked; try { IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.getService( Context.WINDOW_SERVICE)); ContentResolver cr = mContext.getContentResolver(); if (locked) { wm.freezeRotation(); } else { wm.thawRotation(); } } catch (RemoteException exc) { } } } Loading
packages/SystemUI/res/layout-xlarge/sysbar_panel_settings.xml +150 −5 Original line number Diff line number Diff line Loading @@ -18,8 +18,153 @@ <com.android.systemui.statusbar.tablet.SettingsPanel xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="200dip" android:background="#ff000000" android:layout_height="wrap_content" android:orientation="vertical" android:background="@drawable/status_bar_item_background" android:paddingLeft="16dp" > <!-- Airplane mode --> <LinearLayout android:id="@+id/airplane" style="@style/StatusBarPanelSettingsRow" > <ImageView android:id="@+id/airplane_icon" style="@style/StatusBarPanelSettingsIcon" android:src="@drawable/ic_sysbar_airplane_on" /> <TextView android:id="@+id/airplane_label" style="@style/StatusBarPanelSettingsContents" android:text="@string/system_panel_airplane" /> <CheckBox android:id="@+id/airplane_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" /> </LinearLayout> <View style="@style/StatusBarPanelSettingsPanelSeparator" /> <!-- Network --> <LinearLayout android:id="@+id/network" style="@style/StatusBarPanelSettingsRow" > <ImageView android:id="@+id/network_icon" style="@style/StatusBarPanelSettingsIcon" android:src="@drawable/ic_sysbar_wifi_on" /> <TextView android:id="@+id/network_label" style="@style/StatusBarPanelSettingsContents" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" android:layout_marginTop="16dp" android:layout_marginRight="8dp" android:src="@drawable/ic_notification_open" /> </LinearLayout> <View style="@style/StatusBarPanelSettingsPanelSeparator" /> <!-- Rotation lock --> <LinearLayout android:id="@+id/rotate" style="@style/StatusBarPanelSettingsRow" > <ImageView android:id="@+id/rotate_icon" style="@style/StatusBarPanelSettingsIcon" android:src="@drawable/ic_sysbar_rotate_on" /> <TextView android:id="@+id/rotate_label" style="@style/StatusBarPanelSettingsContents" android:text="@string/system_panel_rotation_lock" /> <CheckBox android:id="@+id/rotate_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" /> </LinearLayout> <View style="@style/StatusBarPanelSettingsPanelSeparator" /> <!-- Brightness --> <LinearLayout style="@style/StatusBarPanelSettingsRow" > <ImageView android:id="@+id/brightness_icon" style="@style/StatusBarPanelSettingsIcon" android:src="@drawable/ic_sysbar_brightness" /> </LinearLayout> <View style="@style/StatusBarPanelSettingsPanelSeparator" /> <!-- Volume --> <LinearLayout style="@style/StatusBarPanelSettingsRow" > <ImageView android:id="@+id/volume_icon" style="@style/StatusBarPanelSettingsIcon" android:src="@drawable/ic_sysbar_sound_on" /> </LinearLayout> <View style="@style/StatusBarPanelSettingsPanelSeparator" /> <!-- Notifications / Do not disturb --> <LinearLayout android:id="@+id/do_not_disturb" style="@style/StatusBarPanelSettingsRow" > <ImageView android:id="@+id/do_not_disturb_icon" style="@style/StatusBarPanelSettingsIcon" android:src="@drawable/ic_sysbar_gps_on" /> <TextView style="@style/StatusBarPanelSettingsContents" android:text="@string/system_panel_notifications" /> <CheckBox android:id="@+id/do_not_disturb_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" /> </LinearLayout> <View style="@style/StatusBarPanelSettingsPanelSeparator" /> <!-- Link to settings --> <LinearLayout android:id="@+id/settings" style="@style/StatusBarPanelSettingsRow" > <ImageView android:id="@+id/settings" style="@style/StatusBarPanelSettingsIcon" android:src="@drawable/ic_sysbar_quicksettings" /> <TextView style="@style/StatusBarPanelSettingsContents" android:text="@string/system_panel_settings_button" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" android:layout_marginTop="16dp" android:layout_marginRight="8dp" android:src="@drawable/ic_notification_open" /> </LinearLayout> <View style="@style/StatusBarPanelSettingsPanelSeparator" /> </com.android.systemui.statusbar.tablet.SettingsPanel>
packages/SystemUI/res/values-xlarge/styles.xml 0 → 100644 +45 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2010 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="StatusBarPanelSettingsRow"> <item name="android:layout_height">64dp</item> <item name="android:layout_width">match_parent</item> <item name="android:orientation">horizontal</item> </style> <style name="StatusBarPanelSettingsIcon"> <item name="android:layout_height">match_parent</item> <item name="android:layout_width">64dp</item> <item name="android:scaleType">center</item> </style> <style name="StatusBarPanelSettingsContents"> <item name="android:layout_height">wrap_content</item> <item name="android:layout_width">0dp</item> <item name="android:layout_weight">1</item> <item name="android:layout_gravity">left|center_vertical</item> <item name="android:textColor">?android:attr/textColorPrimary</item> </style> <style name="StatusBarPanelSettingsPanelSeparator"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">1dp</item> <item name="android:background">@android:drawable/divider_horizontal_dark</item> </style> </resources>
packages/SystemUI/res/values/strings.xml +9 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,15 @@ <!-- Name of the button that links to the Settings app. [CHAR LIMIT=NONE] --> <string name="system_panel_settings_button">Settings</string> <!-- Label in the system panel for airplane mode (all radios are turned off)[CHAR LIMIT=30] --> <string name="system_panel_airplane">Airplane mode</string> <!-- Label in system panel saying the device will use the orientation sensor to rotate [CHAR LIMIT=30] --> <string name="system_panel_rotation_lock">Lock screen orientation</string> <!-- Label in system panel saying the device will show notifications [CHAR LIMIT=30] --> <string name="system_panel_notifications">Notifications</string> <!-- Text to display next to the graphical battery meter. [CHAR LIMIT=3] --> <string name="system_panel_battery_meter_format" translatable="false"> <xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g> Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/AirplaneModeController.java 0 → 100644 +92 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.policy; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; import android.util.Slog; import android.widget.CompoundButton; public class AirplaneModeController extends BroadcastReceiver implements CompoundButton.OnCheckedChangeListener { private static final String TAG = "StatusBar.AirplaneModeController"; private Context mContext; private CompoundButton mCheckBox; private boolean mAirplaneMode; public AirplaneModeController(Context context, CompoundButton checkbox) { mContext = context; mAirplaneMode = getAirplaneMode(); mCheckBox = checkbox; checkbox.setChecked(mAirplaneMode); checkbox.setOnCheckedChangeListener(this); IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED); context.registerReceiver(this, filter); } public void release() { mContext.unregisterReceiver(this); } public void onCheckedChanged(CompoundButton view, boolean checked) { Slog.d(TAG, "onCheckedChanged checked=" + checked + " mAirplaneMode=" + mAirplaneMode); if (checked != mAirplaneMode) { mAirplaneMode = checked; unsafe(checked); } } public void onReceive(Context context, Intent intent) { if (Intent.ACTION_AIRPLANE_MODE_CHANGED.equals(intent.getAction())) { final boolean enabled = intent.getBooleanExtra("state", false); if (enabled != mAirplaneMode) { mAirplaneMode = enabled; mCheckBox.setChecked(enabled); } } } private boolean getAirplaneMode() { ContentResolver cr = mContext.getContentResolver(); return 0 != Settings.System.getInt(cr, Settings.System.AIRPLANE_MODE_ON, 0); } // TODO: Fix this racy API by adding something better to TelephonyManager or // ConnectivityService. private void unsafe(boolean enabled) { Settings.System.putInt( mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, enabled ? 1 : 0); Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); intent.putExtra("state", enabled); mContext.sendBroadcast(intent); } }
packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java 0 → 100644 +73 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.policy; import android.content.ContentResolver; import android.content.Context; import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; import android.util.Slog; import android.view.IWindowManager; import android.widget.CompoundButton; /** * TODO: Listen for changes to the setting. */ public class AutoRotateController implements CompoundButton.OnCheckedChangeListener { private static final String TAG = "StatusBar.AutoRotateController"; private Context mContext; private CompoundButton mCheckBox; private boolean mLockRotation; public AutoRotateController(Context context, CompoundButton checkbox) { mContext = context; mLockRotation = getLockRotation(); mCheckBox = checkbox; checkbox.setChecked(mLockRotation); checkbox.setOnCheckedChangeListener(this); } public void onCheckedChanged(CompoundButton view, boolean checked) { Slog.d(TAG, "onCheckedChanged checked=" + checked + " mLockRotation=" + mLockRotation); if (checked != mLockRotation) { setLockRotation(checked); } } private boolean getLockRotation() { ContentResolver cr = mContext.getContentResolver(); return 0 == Settings.System.getInt(cr, Settings.System.ACCELEROMETER_ROTATION, 0); } private void setLockRotation(boolean locked) { mLockRotation = locked; try { IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.getService( Context.WINDOW_SERVICE)); ContentResolver cr = mContext.getContentResolver(); if (locked) { wm.freezeRotation(); } else { wm.thawRotation(); } } catch (RemoteException exc) { } } }