Loading packages/SystemUI/res/layout/quick_settings_tile_rotation_lock.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2012 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. --> <TextView xmlns:android="http://schemas.android.com/apk/res/android" style="@style/TextAppearance.QuickSettings.TileView" android:id="@+id/rotation_lock_textview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:text="@string/quick_settings_rotation_unlocked_label" /> No newline at end of file packages/SystemUI/res/values-sw600dp/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -25,4 +25,7 @@ <!-- The number of columns that the top level tiles span in the QuickSettings --> <integer name="quick_settings_user_time_settings_tile_span">1</integer> <!-- Whether rotation lock shows up in quick settings or not --> <bool name="quick_settings_show_rotation_lock">true</bool> </resources> packages/SystemUI/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -87,5 +87,8 @@ <!-- The number of columns that the top level tiles span in the QuickSettings --> <integer name="quick_settings_user_time_settings_tile_span">1</integer> <!-- Whether rotation lock shows up in quick settings or not --> <bool name="quick_settings_show_rotation_lock">false</bool> </resources> packages/SystemUI/res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -411,6 +411,10 @@ <string name="quick_settings_bluetooth_label">Bluetooth</string> <!-- QuickSettings: Brightness [CHAR LIMIT=NONE] --> <string name="quick_settings_brightness_label">Brightness</string> <!-- QuickSettings: Rotation Unlocked [CHAR LIMIT=NONE] --> <string name="quick_settings_rotation_unlocked_label">Auto Rotate</string> <!-- QuickSettings: Rotation Locked [CHAR LIMIT=NONE] --> <string name="quick_settings_rotation_locked_label">Rotation Locked</string> <!-- QuickSettings: IME [CHAR LIMIT=NONE] --> <string name="quick_settings_ime_label">Input Method</string> <!-- QuickSettings: Location [CHAR LIMIT=NONE] --> Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +33 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import com.android.internal.view.RotationPolicy; import com.android.systemui.R; import com.android.systemui.statusbar.phone.QuickSettingsModel.State; import com.android.systemui.statusbar.phone.QuickSettingsModel.UserState; Loading Loading @@ -89,6 +90,14 @@ class QuickSettings { private final ArrayList<QuickSettingsTileView> mDynamicSpannedTiles = new ArrayList<QuickSettingsTileView>(); private final RotationPolicy.RotationPolicyListener mRotationPolicyListener = new RotationPolicy.RotationPolicyListener() { @Override public void onChange() { mModel.onRotationLockChanged(); } }; public QuickSettings(Context context, QuickSettingsContainerView container) { mDisplayManager = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE); mContext = context; Loading Loading @@ -125,6 +134,7 @@ class QuickSettings { bluetoothController.addStateChangedCallback(mModel); batteryController.addStateChangedCallback(mModel); locationController.addStateChangedCallback(mModel); RotationPolicy.registerRotationPolicyListener(mContext, mRotationPolicyListener); } private void queryForUserInformation() { Loading Loading @@ -293,6 +303,29 @@ class QuickSettings { parent.addView(rssiTile); } // Rotation Lock if (mContext.getResources().getBoolean(R.bool.quick_settings_show_rotation_lock)) { QuickSettingsTileView rotationLockTile = (QuickSettingsTileView) inflater.inflate(R.layout.quick_settings_tile, parent, false); rotationLockTile.setContent(R.layout.quick_settings_tile_rotation_lock, inflater); rotationLockTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { boolean locked = RotationPolicy.isRotationLocked(mContext); RotationPolicy.setRotationLock(mContext, !locked); } }); mModel.addRotationLockTile(rotationLockTile, new QuickSettingsModel.RefreshCallback() { @Override public void refreshView(QuickSettingsTileView view, State state) { TextView tv = (TextView) view.findViewById(R.id.rotation_lock_textview); tv.setCompoundDrawablesRelativeWithIntrinsicBounds(0, state.iconId, 0, 0); tv.setText(state.label); } }); parent.addView(rotationLockTile); } // Battery QuickSettingsTileView batteryTile = (QuickSettingsTileView) inflater.inflate(R.layout.quick_settings_tile, parent, false); Loading Loading
packages/SystemUI/res/layout/quick_settings_tile_rotation_lock.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2012 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. --> <TextView xmlns:android="http://schemas.android.com/apk/res/android" style="@style/TextAppearance.QuickSettings.TileView" android:id="@+id/rotation_lock_textview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:text="@string/quick_settings_rotation_unlocked_label" /> No newline at end of file
packages/SystemUI/res/values-sw600dp/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -25,4 +25,7 @@ <!-- The number of columns that the top level tiles span in the QuickSettings --> <integer name="quick_settings_user_time_settings_tile_span">1</integer> <!-- Whether rotation lock shows up in quick settings or not --> <bool name="quick_settings_show_rotation_lock">true</bool> </resources>
packages/SystemUI/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -87,5 +87,8 @@ <!-- The number of columns that the top level tiles span in the QuickSettings --> <integer name="quick_settings_user_time_settings_tile_span">1</integer> <!-- Whether rotation lock shows up in quick settings or not --> <bool name="quick_settings_show_rotation_lock">false</bool> </resources>
packages/SystemUI/res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -411,6 +411,10 @@ <string name="quick_settings_bluetooth_label">Bluetooth</string> <!-- QuickSettings: Brightness [CHAR LIMIT=NONE] --> <string name="quick_settings_brightness_label">Brightness</string> <!-- QuickSettings: Rotation Unlocked [CHAR LIMIT=NONE] --> <string name="quick_settings_rotation_unlocked_label">Auto Rotate</string> <!-- QuickSettings: Rotation Locked [CHAR LIMIT=NONE] --> <string name="quick_settings_rotation_locked_label">Rotation Locked</string> <!-- QuickSettings: IME [CHAR LIMIT=NONE] --> <string name="quick_settings_ime_label">Input Method</string> <!-- QuickSettings: Location [CHAR LIMIT=NONE] --> Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +33 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import com.android.internal.view.RotationPolicy; import com.android.systemui.R; import com.android.systemui.statusbar.phone.QuickSettingsModel.State; import com.android.systemui.statusbar.phone.QuickSettingsModel.UserState; Loading Loading @@ -89,6 +90,14 @@ class QuickSettings { private final ArrayList<QuickSettingsTileView> mDynamicSpannedTiles = new ArrayList<QuickSettingsTileView>(); private final RotationPolicy.RotationPolicyListener mRotationPolicyListener = new RotationPolicy.RotationPolicyListener() { @Override public void onChange() { mModel.onRotationLockChanged(); } }; public QuickSettings(Context context, QuickSettingsContainerView container) { mDisplayManager = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE); mContext = context; Loading Loading @@ -125,6 +134,7 @@ class QuickSettings { bluetoothController.addStateChangedCallback(mModel); batteryController.addStateChangedCallback(mModel); locationController.addStateChangedCallback(mModel); RotationPolicy.registerRotationPolicyListener(mContext, mRotationPolicyListener); } private void queryForUserInformation() { Loading Loading @@ -293,6 +303,29 @@ class QuickSettings { parent.addView(rssiTile); } // Rotation Lock if (mContext.getResources().getBoolean(R.bool.quick_settings_show_rotation_lock)) { QuickSettingsTileView rotationLockTile = (QuickSettingsTileView) inflater.inflate(R.layout.quick_settings_tile, parent, false); rotationLockTile.setContent(R.layout.quick_settings_tile_rotation_lock, inflater); rotationLockTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { boolean locked = RotationPolicy.isRotationLocked(mContext); RotationPolicy.setRotationLock(mContext, !locked); } }); mModel.addRotationLockTile(rotationLockTile, new QuickSettingsModel.RefreshCallback() { @Override public void refreshView(QuickSettingsTileView view, State state) { TextView tv = (TextView) view.findViewById(R.id.rotation_lock_textview); tv.setCompoundDrawablesRelativeWithIntrinsicBounds(0, state.iconId, 0, 0); tv.setText(state.label); } }); parent.addView(rotationLockTile); } // Battery QuickSettingsTileView batteryTile = (QuickSettingsTileView) inflater.inflate(R.layout.quick_settings_tile, parent, false); Loading