diff options
author | Joe Onorato <joeo@google.com> | 2010-11-27 15:45:35 -0800 |
---|---|---|
committer | Joe Onorato <joeo@google.com> | 2010-11-27 15:45:35 -0800 |
commit | 755cc74e4cebdf67d21a2477512a4ac9b01e8323 (patch) | |
tree | 03bef3944f84671ce1780a951207142c5d889d2d /packages | |
parent | 2e76ccad0832eb51b2e6e8453990535625b5fc4c (diff) | |
download | frameworks_base-755cc74e4cebdf67d21a2477512a4ac9b01e8323.zip frameworks_base-755cc74e4cebdf67d21a2477512a4ac9b01e8323.tar.gz frameworks_base-755cc74e4cebdf67d21a2477512a4ac9b01e8323.tar.bz2 |
Rename the status bar layouts to more consistent names
Change-Id: Ic593e6c93794f2a2eb36576501d35be54a0a0681
Diffstat (limited to 'packages')
20 files changed, 28 insertions, 669 deletions
diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml b/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel.xml index fb4cf3f..fb4cf3f 100644 --- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel.xml diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notification_peek.xml b/packages/SystemUI/res/layout-xlarge/status_bar_notification_peek.xml index 02f9a90..02f9a90 100644 --- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notification_peek.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar_notification_peek.xml diff --git a/packages/SystemUI/res/layout-xlarge/status_bar_latest_event.xml b/packages/SystemUI/res/layout-xlarge/status_bar_notification_row.xml index 6b12d29..6b12d29 100644 --- a/packages/SystemUI/res/layout-xlarge/status_bar_latest_event.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar_notification_row.xml diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_pocket.xml b/packages/SystemUI/res/layout-xlarge/status_bar_pocket_panel.xml index e4a6da4..e4a6da4 100644 --- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_pocket.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar_pocket_panel.xml diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_recent_item.xml b/packages/SystemUI/res/layout-xlarge/status_bar_recent_item.xml index b1997b8..b1997b8 100644 --- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_recent_item.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar_recent_item.xml diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_recent.xml b/packages/SystemUI/res/layout-xlarge/status_bar_recent_panel.xml index ac038a7..ac038a7 100644 --- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_recent.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar_recent_panel.xml diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_settings.xml b/packages/SystemUI/res/layout-xlarge/status_bar_settings_view.xml index 8419f02..d4a0d95 100644 --- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_settings.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar_settings_view.xml @@ -15,7 +15,7 @@ * limitations under the License. --> -<com.android.systemui.statusbar.tablet.SettingsPanel +<com.android.systemui.statusbar.tablet.SettingsView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" @@ -166,5 +166,5 @@ </LinearLayout> <View style="@style/StatusBarPanelSettingsPanelSeparator" /> -</com.android.systemui.statusbar.tablet.SettingsPanel> +</com.android.systemui.statusbar.tablet.SettingsView> diff --git a/packages/SystemUI/res/layout-xlarge/ticker_compat.xml b/packages/SystemUI/res/layout-xlarge/status_bar_ticker_compat.xml index 5d9a680..5d9a680 100644 --- a/packages/SystemUI/res/layout-xlarge/ticker_compat.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar_ticker_compat.xml diff --git a/packages/SystemUI/res/layout-xlarge/ticker.xml b/packages/SystemUI/res/layout-xlarge/status_bar_ticker_panel.xml index cae6a77..cae6a77 100644 --- a/packages/SystemUI/res/layout-xlarge/ticker.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar_ticker_panel.xml diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_system.xml b/packages/SystemUI/res/layout-xlarge/sysbar_panel_system.xml deleted file mode 100644 index a1792fd..0000000 --- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_system.xml +++ /dev/null @@ -1,213 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* apps/common/assets/default/default/skins/StatusBar.xml -** -** Copyright 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. -*/ ---> - -<com.android.systemui.statusbar.tablet.SystemPanel - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_height="wrap_content" - android:layout_width="match_parent" - android:background="@drawable/sysbar_panel_bg" - android:orientation="vertical" - android:paddingLeft="70dip" - android:paddingRight="120dip" - > - - <!-- top row: quick settings buttons --> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="64dip" - android:orientation="horizontal" - android:gravity="center" - > - <ImageButton android:id="@+id/brightness" - android:layout_width="90dip" - android:layout_height="64dip" - android:src="@drawable/ic_sysbar_brightness" - android:background="@drawable/sysbar_toggle_bg_off" - /> - <ImageButton android:id="@+id/sound" - android:layout_width="90dip" - android:layout_height="64dip" - android:layout_marginLeft="8dip" - android:src="@drawable/ic_sysbar_sound_on" - android:background="@drawable/sysbar_toggle_bg_off" - /> - <ImageButton android:id="@+id/orientation" - android:layout_width="90dip" - android:layout_height="64dip" - android:layout_marginLeft="8dip" - android:src="@drawable/ic_sysbar_rotate_on" - android:background="@drawable/sysbar_toggle_bg_off" - /> - <ImageButton android:id="@+id/airplane" - android:layout_width="90dip" - android:layout_height="64dip" - android:layout_marginLeft="8dip" - android:src="@drawable/ic_sysbar_airplane_on" - android:background="@drawable/sysbar_toggle_bg_off" - /> - <ImageButton android:id="@+id/gps" - android:layout_width="90dip" - android:layout_height="64dip" - android:layout_marginLeft="8dip" - android:src="@drawable/ic_sysbar_gps_on" - android:background="@drawable/sysbar_toggle_bg_off" - /> - <ImageButton android:id="@+id/bluetooth" - android:layout_width="90dip" - android:layout_height="64dip" - android:layout_marginLeft="8dip" - android:src="@drawable/ic_sysbar_bluetooth_on" - android:background="@drawable/sysbar_toggle_bg_off" - /> - </LinearLayout> - - <!-- main row: meters, clock --> - <RelativeLayout - android:padding="8dip" - android:layout_width="match_parent" - android:layout_height="192dip" - > - <RelativeLayout - android:layout_width="256dip" - android:layout_height="192dip" - android:layout_alignParentLeft="true" - android:layout_marginLeft="48dip" - > - <ImageView android:id="@+id/battery_meter" - android:layout_width="256dip" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:scaleType="centerCrop" - /> - <TextView android:id="@+id/battery_info" - style="@style/TextAppearance.StatusBar.SystemPanel" - android:layout_width="match_parent" - android:layout_height="24dip" - android:gravity="center" - android:layout_above="@id/battery_meter" - /> - </RelativeLayout> - - <com.android.systemui.statusbar.policy.Clock - style="@style/TextAppearance.StatusBar.SystemPanel" - android:id="@+id/clock" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:singleLine="true" - android:textSize="50sp" - android:textStyle="normal" - android:textColor="#FFFFFFFF" - android:layout_centerHorizontal="true" - android:layout_alignParentBottom="true" - /> - - <RelativeLayout - android:layout_width="256dip" - android:layout_height="192dip" - android:layout_alignParentRight="true" - android:layout_marginRight="48dip" - > - <ImageView android:id="@+id/signal_meter" - android:layout_width="256dip" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:scaleType="centerCrop" - /> - - <TextView android:id="@+id/signal_info" - style="@style/TextAppearance.StatusBar.SystemPanel" - android:layout_width="match_parent" - android:layout_height="24dip" - android:gravity="center" - android:layout_above="@id/signal_meter" - /> - </RelativeLayout> - - <ImageView - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:layout_alignParentLeft="true" - android:layout_alignParentBottom="true" - android:layout_marginBottom="8dip" - android:layout_marginLeft="8dip" - android:src="@drawable/ic_sysbar_battery_on" - /> - <ImageView - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:layout_alignParentRight="true" - android:layout_alignParentBottom="true" - android:layout_marginBottom="8dip" - android:layout_marginRight="8dip" - android:src="@drawable/ic_sysbar_wifi_on" - /> - </RelativeLayout> - - <!-- bottom row: transient indicators, settings button --> - <View - android:layout_width="match_parent" - android:layout_height="1sp" - android:background="@android:drawable/divider_horizontal_dark" - /> - <RelativeLayout - android:layout_width="match_parent" - android:layout_height="48dip" - > - <TextView android:id="@+id/settings_button" - style="@style/TextAppearance.StatusBar.TextButton" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_alignParentRight="true" - android:paddingRight="32dip" - android:paddingLeft="32dip" - android:textSize="20sp" - android:gravity="center" - android:text="@string/system_panel_settings_button" - /> - <View - android:id="@+id/settings_left_divider" - android:layout_height="match_parent" - android:layout_width="1sp" - android:layout_toLeftOf="@id/settings_button" - android:background="@*android:drawable/divider_vertical_dark" - /> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_alignParentLeft="true" - android:layout_toLeftOf="@id/settings_left_divider" - android:orientation="horizontal" - android:gravity="left|center_vertical" - > - <!-- TODO: alarm --> - <!-- TODO: sync --> - <com.android.systemui.statusbar.policy.DateView - android:id="@+id/date" - style="@style/TextAppearance.StatusBar.SystemPanel" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:singleLine="true" - android:gravity="center" - /> - </LinearLayout> - - - </RelativeLayout> -</com.android.systemui.statusbar.tablet.SystemPanel> diff --git a/packages/SystemUI/res/layout-xlarge/ticker_icon.xml b/packages/SystemUI/res/layout-xlarge/ticker_icon.xml deleted file mode 100644 index 9efa987..0000000 --- a/packages/SystemUI/res/layout-xlarge/ticker_icon.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?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. ---> - -<ImageView - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="30dp" - android:layout_height="30dp" - android:layout_gravity="center" - android:layout_marginLeft="6dp" - /> - diff --git a/packages/SystemUI/res/layout/status_bar_latest_event.xml b/packages/SystemUI/res/layout/status_bar_notification_row.xml index 88d9739..88d9739 100644 --- a/packages/SystemUI/res/layout/status_bar_latest_event.xml +++ b/packages/SystemUI/res/layout/status_bar_notification_row.xml diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 5391178..0d6c5f6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -505,7 +505,7 @@ public class PhoneStatusBar extends StatusBar { // create the row view LayoutInflater inflater = (LayoutInflater)mContext.getSystemService( Context.LAYOUT_INFLATER_SERVICE); - View row = inflater.inflate(R.layout.status_bar_latest_event, parent, false); + View row = inflater.inflate(R.layout.status_bar_notification_row, parent, false); // bind the click event to the content area ViewGroup content = (ViewGroup)row.findViewById(R.id.content); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java index 5f49d8c..a5ff571 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java @@ -37,7 +37,7 @@ public class NotificationPanel extends LinearLayout implements StatusBarPanel, View mNotificationButton; View mNotificationScroller; FrameLayout mContentFrame; - View mSettingsPanel; + View mSettingsView; public NotificationPanel(Context context, AttributeSet attrs) { this(context, attrs, 0); @@ -103,15 +103,15 @@ public class NotificationPanel extends LinearLayout implements StatusBarPanel, } public void switchToSettingsMode() { - removeSettingsPanel(); - addSettingsPanel(); + removeSettingsView(); + addSettingsView(); mSettingsButton.setVisibility(View.INVISIBLE); mNotificationScroller.setVisibility(View.GONE); mNotificationButton.setVisibility(View.VISIBLE); } public void switchToNotificationMode() { - removeSettingsPanel(); + removeSettingsView(); mSettingsButton.setVisibility(View.VISIBLE); mNotificationScroller.setVisibility(View.VISIBLE); mNotificationButton.setVisibility(View.INVISIBLE); @@ -125,17 +125,17 @@ public class NotificationPanel extends LinearLayout implements StatusBarPanel, return x >= l && x < r && y >= t && y < b; } - void removeSettingsPanel() { - if (mSettingsPanel != null) { - mContentFrame.removeView(mSettingsPanel); - mSettingsPanel = null; + void removeSettingsView() { + if (mSettingsView != null) { + mContentFrame.removeView(mSettingsView); + mSettingsView = null; } } - void addSettingsPanel() { + void addSettingsView() { LayoutInflater infl = LayoutInflater.from(getContext()); - mSettingsPanel = infl.inflate(R.layout.sysbar_panel_settings, mContentFrame, false); - mContentFrame.addView(mSettingsPanel); + mSettingsView = infl.inflate(R.layout.status_bar_settings_view, mContentFrame, false); + mContentFrame.addView(mSettingsView); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java index 0c31304..546750b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java @@ -224,7 +224,7 @@ public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnC final int last = Math.min(mActivityDescriptions.size(), DISPLAY_TASKS) - 1; for (int i = last; i >= first; i--) { ActivityDescription activityDescription = mActivityDescriptions.get(i); - View view = View.inflate(mContext, R.layout.sysbar_panel_recent_item, null); + View view = View.inflate(mContext, R.layout.status_bar_recent_item, null); ImageView appThumbnail = (ImageView) view.findViewById(R.id.app_thumbnail); ImageView appIcon = (ImageView) view.findViewById(R.id.app_icon); TextView appDescription = (TextView) view.findViewById(R.id.app_label); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java index fea326e..f9ba908 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java @@ -32,17 +32,17 @@ import com.android.systemui.R; import com.android.systemui.statusbar.policy.AirplaneModeController; import com.android.systemui.statusbar.policy.AutoRotateController; -public class SettingsPanel extends LinearLayout implements View.OnClickListener { - static final String TAG = "SettingsPanel"; +public class SettingsView extends LinearLayout implements View.OnClickListener { + static final String TAG = "SettingsView"; AirplaneModeController mAirplane; AutoRotateController mRotate; - public SettingsPanel(Context context, AttributeSet attrs) { + public SettingsView(Context context, AttributeSet attrs) { this(context, attrs, 0); } - public SettingsPanel(Context context, AttributeSet attrs, int defStyle) { + public SettingsView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java index 0cb9249..d1e61a9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java @@ -184,7 +184,7 @@ public class ShirtPocket extends FrameLayout { }; private void setupWindow() { - mWindow = View.inflate(getContext(), R.layout.sysbar_panel_pocket, null); + mWindow = View.inflate(getContext(), R.layout.status_bar_pocket_panel, null); mPreviewIcon = (ImageView) mWindow.findViewById(R.id.icon); mDescription = (TextView) mWindow.findViewById(R.id.description); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SystemPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SystemPanel.java deleted file mode 100644 index 41b44c2..0000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SystemPanel.java +++ /dev/null @@ -1,403 +0,0 @@ -/* - * 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.tablet; - -import android.bluetooth.BluetoothAdapter; -import android.content.BroadcastReceiver; -import android.content.ContentResolver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.location.LocationManager; -import android.media.AudioManager; -import android.telephony.PhoneStateListener; -import android.telephony.ServiceState; -import android.os.IPowerManager; -import android.os.RemoteException; -import android.os.ServiceManager; -import android.provider.Settings; -import android.util.AttributeSet; -import android.util.Slog; -import android.view.View; -import android.view.IWindowManager; -import android.view.WindowManager; -import android.view.WindowManagerImpl; -import android.widget.ImageButton; -import android.widget.LinearLayout; -import android.widget.TextView; -import android.widget.Toast; - -import com.android.internal.telephony.IccCard; -import com.android.internal.telephony.TelephonyIntents; -import com.android.internal.telephony.cdma.EriInfo; -import com.android.internal.telephony.cdma.TtyIntent; - -import com.android.server.WindowManagerService; - -import com.android.systemui.statusbar.*; -import com.android.systemui.R; - -public class SystemPanel extends LinearLayout implements StatusBarPanel { - private static final String TAG = "SystemPanel"; - private static final boolean DEBUG = TabletStatusBar.DEBUG; - - private static final int MINIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_DIM + 5; - private static final int MAXIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_ON; - private static final int DEFAULT_BACKLIGHT = (int) (android.os.Power.BRIGHTNESS_ON * 0.4f); - - private TabletStatusBar mBar; - private boolean mAirplaneMode; - - private ImageButton mBrightnessButton; - private ImageButton mSoundButton; - private ImageButton mOrientationButton; - private ImageButton mAirplaneButton; - private ImageButton mGpsButton; - private ImageButton mBluetoothButton; - - private final IWindowManager mWM; - - private final AudioManager mAudioManager; - private final BluetoothAdapter mBluetoothAdapter; - - public boolean isInContentArea(int x, int y) { - final int l = getPaddingLeft(); - final int r = getWidth() - getPaddingRight(); - final int t = getPaddingTop(); - final int b = getHeight() - getPaddingBottom(); - return x >= l && x < r && y >= t && y < b; - } - - private BroadcastReceiver mReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - final String action = intent.getAction(); - if (action.equals(AudioManager.RINGER_MODE_CHANGED_ACTION)) { - refreshSound(); - } else if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) { - refreshBluetooth(); - } - } - }; - - public void setBar(TabletStatusBar bar) { - mBar = bar; - } - - public SystemPanel(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public SystemPanel(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - - // our mighty overlord - mWM = IWindowManager.Stub.asInterface( - ServiceManager.getService("window")); - - // audio status - mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); - - // Bluetooth - mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); - } - - public void onAttachedToWindow() { - TextView settingsButton = (TextView)findViewById(R.id.settings_button); - settingsButton.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - getContext().startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS) - .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); - mBar.animateCollapse(); - }}); - - mBrightnessButton = (ImageButton)findViewById(R.id.brightness); - mBrightnessButton.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - rotateBrightness(); - } - }); - - mSoundButton = (ImageButton)findViewById(R.id.sound); - mSoundButton.setAlpha(getSilentMode() ? 0x7F : 0xFF); - mSoundButton.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - setSilentMode(!getSilentMode()); - mSoundButton.setAlpha(getSilentMode() ? 0x7F : 0xFF); - } - }); - mOrientationButton = (ImageButton)findViewById(R.id.orientation); - mOrientationButton.setImageResource( - getAutoRotate() - ? R.drawable.ic_sysbar_rotate_on - : R.drawable.ic_sysbar_rotate_off); - mOrientationButton.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - setAutoRotate(!getAutoRotate()); - mOrientationButton.setImageResource( - getAutoRotate() - ? R.drawable.ic_sysbar_rotate_on - : R.drawable.ic_sysbar_rotate_off); - Toast.makeText(getContext(), - getAutoRotate() - ? R.string.toast_rotation_free - : R.string.toast_rotation_locked, - Toast.LENGTH_SHORT).show(); - } - }); - - mAirplaneButton = (ImageButton)findViewById(R.id.airplane); - mAirplaneButton.setAlpha(mAirplaneMode ? 0xFF : 0x7F); - mAirplaneButton.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - boolean newMode = !getAirplaneMode(); - Toast.makeText(getContext(), "Attempting to turn " - + (newMode ? "on" : "off") + " airplane mode (flaky).", - Toast.LENGTH_SHORT).show(); - setAirplaneMode(newMode); - } - }); - - mGpsButton = (ImageButton)findViewById(R.id.gps); - mGpsButton.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - toggleGps(); - refreshGps(); - } - }); - - mBluetoothButton = (ImageButton)findViewById(R.id.bluetooth); - mBluetoothButton.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - toggleBluetooth(); - refreshBluetooth(); - } - }); - - // register for broadcasts - IntentFilter filter = new IntentFilter(); - filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION); - filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED); - getContext().registerReceiver(mReceiver, filter); - - refreshBluetooth(); - refreshGps(); - } - - public void onDetachedFromWindow() { - getContext().unregisterReceiver(mReceiver); - } - - // ---------------------------------------------------------------------- - -// private boolean isAutoBrightness() { -// Context context = getContext(); -// try { -// IPowerManager power = IPowerManager.Stub.asInterface( -// ServiceManager.getService("power")); -// if (power != null) { -// int brightnessMode = Settings.System.getInt(context.getContentResolver(), -// Settings.System.SCREEN_BRIGHTNESS_MODE); -// return brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC; -// } -// } catch (RemoteException e) { -// } catch (Settings.SettingNotFoundException e) { -// } -// return false; -// } - - private void rotateBrightness() { - int icon = R.drawable.ic_sysbar_brightness; - int bg = R.drawable.sysbar_toggle_bg_on; - Context context = getContext(); - try { - IPowerManager power = IPowerManager.Stub.asInterface( - ServiceManager.getService("power")); - if (power != null) { - ContentResolver cr = context.getContentResolver(); - int brightness = Settings.System.getInt(cr, - Settings.System.SCREEN_BRIGHTNESS); - int brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL; - //Only get brightness setting if available - if (context.getResources().getBoolean( - com.android.internal.R.bool.config_automatic_brightness_available)) { - brightnessMode = Settings.System.getInt(cr, - Settings.System.SCREEN_BRIGHTNESS_MODE); - } - - // Rotate AUTO -> MINIMUM -> DEFAULT -> MAXIMUM - // Technically, not a toggle... - if (brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) { - brightness = MINIMUM_BACKLIGHT; - icon = R.drawable.ic_sysbar_brightness_low; - brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL; - } else if (brightness < DEFAULT_BACKLIGHT) { - brightness = DEFAULT_BACKLIGHT; - } else if (brightness < MAXIMUM_BACKLIGHT) { - brightness = MAXIMUM_BACKLIGHT; - } else { - brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC; - brightness = MINIMUM_BACKLIGHT; - icon = R.drawable.ic_sysbar_brightness_auto; - } - - if (context.getResources().getBoolean( - com.android.internal.R.bool.config_automatic_brightness_available)) { - // Set screen brightness mode (automatic or manual) - Settings.System.putInt(context.getContentResolver(), - Settings.System.SCREEN_BRIGHTNESS_MODE, - brightnessMode); - } else { - // Make sure we set the brightness if automatic mode isn't available - brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL; - } - if (brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL) { - power.setBacklightBrightness(brightness); - Settings.System.putInt(cr, Settings.System.SCREEN_BRIGHTNESS, brightness); - } - } - } catch (RemoteException e) { - } catch (Settings.SettingNotFoundException e) { - } - - mBrightnessButton.setImageResource(icon); - mBrightnessButton.setBackgroundResource(bg); - } - - PhoneStateListener mPhoneStateListener = new PhoneStateListener() { - @Override - public void onServiceStateChanged(ServiceState serviceState) { - if (DEBUG) { - Slog.d(TAG, "phone service state changed: " + serviceState.getState()); - } - mAirplaneMode = serviceState.getState() == ServiceState.STATE_POWER_OFF; - if (mAirplaneButton != null) { - mAirplaneButton.setImageResource(mAirplaneMode - ? R.drawable.ic_sysbar_airplane_on - : R.drawable.ic_sysbar_airplane_off); - mAirplaneButton.setBackgroundResource(mAirplaneMode - ? R.drawable.sysbar_toggle_bg_on - : R.drawable.sysbar_toggle_bg_off); - } - } - }; - - private boolean getAirplaneMode() { - return mAirplaneMode; - } - - private void setAirplaneMode(boolean on) { - Settings.System.putInt( - mContext.getContentResolver(), - Settings.System.AIRPLANE_MODE_ON, - on ? 1 : 0); - Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); - intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); - intent.putExtra("state", on); - getContext().sendBroadcast(intent); - } - - boolean getSilentMode() { - return mAudioManager.getRingerMode() != AudioManager.RINGER_MODE_NORMAL; - } - - void setSilentMode(boolean on) { - if (on) { - mAudioManager.setRingerMode((Settings.System.getInt(mContext.getContentResolver(), - Settings.System.VIBRATE_IN_SILENT, 1) == 1) - ? AudioManager.RINGER_MODE_VIBRATE - : AudioManager.RINGER_MODE_SILENT); - } else { - mAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL); - } - } - - void refreshSound() { - boolean silent = getSilentMode(); - mSoundButton.setImageResource(!silent - ? R.drawable.ic_sysbar_sound_on - : R.drawable.ic_sysbar_sound_off); - mSoundButton.setBackgroundResource(!silent - ? R.drawable.sysbar_toggle_bg_on - : R.drawable.sysbar_toggle_bg_off); - } - - void toggleBluetooth() { - if (mBluetoothAdapter == null) return; - if (mBluetoothAdapter.isEnabled()) { - mBluetoothAdapter.disable(); - } else { - mBluetoothAdapter.enable(); - } - } - - void refreshBluetooth() { - boolean on = mBluetoothAdapter != null && mBluetoothAdapter.isEnabled(); - mBluetoothButton.setImageResource(on ? R.drawable.ic_sysbar_bluetooth_on - : R.drawable.ic_sysbar_bluetooth_off); - mBluetoothButton.setBackgroundResource(on - ? R.drawable.sysbar_toggle_bg_on - : R.drawable.sysbar_toggle_bg_off); - } - - private boolean isGpsEnabled() { - ContentResolver res = mContext.getContentResolver(); - return Settings.Secure.isLocationProviderEnabled( - res, LocationManager.GPS_PROVIDER); - } - - private void toggleGps() { - Settings.Secure.setLocationProviderEnabled(mContext.getContentResolver(), - LocationManager.GPS_PROVIDER, !isGpsEnabled()); - } - - private void refreshGps() { - boolean on = isGpsEnabled(); - mGpsButton.setImageResource(on ? R.drawable.ic_sysbar_gps_on - : R.drawable.ic_sysbar_gps_off); - mGpsButton.setBackgroundResource(on - ? R.drawable.sysbar_toggle_bg_on - : R.drawable.sysbar_toggle_bg_off); - } - - void setAutoRotate(boolean rot) { - try { - ContentResolver cr = getContext().getContentResolver(); - if (rot) { - mWM.thawRotation(); - } else { - mWM.freezeRotation(); - } - } catch (RemoteException exc) { - } - } - - boolean getAutoRotate() { - ContentResolver cr = getContext().getContentResolver(); - return 1 == Settings.System.getInt(cr, - Settings.System.ACCELEROMETER_ROTATION, - 1); - } - - int getDisplayRotation() { - try { - return mWM.getRotation(); - } catch (RemoteException exc) { - return 0; - } - } -} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index 6db5b2b..3b27992 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -145,11 +145,11 @@ public class TabletStatusBar extends StatusBar { final Resources res = context.getResources(); final int barHeight= res.getDimensionPixelSize( - com.android.internal.R.dimen.status_bar_height); + com.android.internal.R.dimen.status_bar_height); // Notification Panel mNotificationPanel = (NotificationPanel)View.inflate(context, - R.layout.sysbar_panel_notifications, null); + R.layout.status_bar_notification_panel, null); mNotificationPanel.setVisibility(View.GONE); mNotificationPanel.setOnTouchListener( new TouchOutsideListener(MSG_CLOSE_NOTIFICATION_PANEL, mNotificationPanel)); @@ -180,7 +180,7 @@ public class TabletStatusBar extends StatusBar { // Notification preview window mNotificationPeekWindow = (NotificationPeekPanel) View.inflate(context, - R.layout.sysbar_panel_notification_peek, null); + R.layout.status_bar_notification_peek, null); mNotificationPeekRow = (ViewGroup) mNotificationPeekWindow.findViewById(R.id.content); mNotificationPeekWindow.setVisibility(View.GONE); mNotificationPeekWindow.setOnTouchListener( @@ -216,8 +216,8 @@ public class TabletStatusBar extends StatusBar { // Recents Panel if (USE_2D_RECENTS) { - mRecentsPanel = (RecentAppsPanel) View.inflate(context, R.layout.sysbar_panel_recent, - null); + mRecentsPanel = (RecentAppsPanel) View.inflate(context, + R.layout.status_bar_recent_panel, null); mRecentsPanel.setVisibility(View.GONE); mRecentsPanel.setOnTouchListener(new TouchOutsideListener(MSG_CLOSE_RECENTS_PANEL, mRecentsPanel)); @@ -987,7 +987,7 @@ public class TabletStatusBar extends StatusBar { // create the row view LayoutInflater inflater = (LayoutInflater)mContext.getSystemService( Context.LAYOUT_INFLATER_SERVICE); - View row = inflater.inflate(R.layout.status_bar_latest_event, parent, false); + View row = inflater.inflate(R.layout.status_bar_notification_row, parent, false); workAroundBadLayerDrawableOpacity(row); View vetoButton = row.findViewById(R.id.veto); if (entry.notification.isClearable()) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java index b05fe1a..5a464f4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java @@ -187,7 +187,7 @@ public class TabletTicker extends Handler { iconId = R.id.left_icon; } if (n.tickerView != null) { - group = (ViewGroup)inflater.inflate(R.layout.ticker, null, false); + group = (ViewGroup)inflater.inflate(R.layout.status_bar_ticker_panel, null, false); View expanded = null; Exception exception = null; try { @@ -209,7 +209,7 @@ public class TabletTicker extends Handler { lp.gravity = Gravity.BOTTOM; group.addView(expanded, lp); } else if (n.tickerText != null) { - group = (ViewGroup)inflater.inflate(R.layout.ticker_compat, mWindow, false); + group = (ViewGroup)inflater.inflate(R.layout.status_bar_ticker_compat, mWindow, false); final Drawable icon = StatusBarIconView.getIcon(mContext, new StatusBarIcon(notification.pkg, n.icon, n.iconLevel, 0)); ImageView iv = (ImageView)group.findViewById(iconId); |