Merge "Final UI for compatibility mode." into honeycomb-mr2
|
Before Width: | Height: | Size: 787 B |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 663 B |
|
Before Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 749 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 641 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 762 B |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -16,6 +16,7 @@
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/ic_sysbar_zoom_pressed" />
|
||||
<item android:state_selected="true" android:drawable="@drawable/ic_sysbar_zoom_pressed" />
|
||||
<item android:drawable="@drawable/ic_sysbar_zoom_default" />
|
||||
</selector>
|
||||
|
||||
|
||||
@@ -75,13 +75,6 @@
|
||||
systemui:keyCode="82"
|
||||
android:visibility="invisible"
|
||||
/>
|
||||
<com.android.systemui.statusbar.policy.CompatModeButton
|
||||
android:id="@+id/compat_button"
|
||||
android:layout_width="80dip"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/ic_sysbar_zoom"
|
||||
android:visibility="invisible"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- fake space bar zone -->
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
**
|
||||
** Copyright 2011, 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.CompatModePanel
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:paddingBottom="@dimen/panel_float"
|
||||
android:paddingRight="20dp"
|
||||
>
|
||||
<RadioGroup android:id="@+id/compat_mode_radio_group"
|
||||
android:background="@*android:drawable/dialog_full_holo_dark"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp"
|
||||
>
|
||||
<RadioButton android:id="@+id/compat_mode_on_radio"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/compat_mode_on" />
|
||||
<RadioButton android:id="@+id/compat_mode_off_radio"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/compat_mode_off" />
|
||||
</RadioGroup>
|
||||
</com.android.systemui.statusbar.tablet.CompatModePanel>
|
||||
@@ -27,7 +27,7 @@
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/notificationAndImeArea"
|
||||
android:id="@+id/feedbackIconArea"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
@@ -41,7 +41,16 @@
|
||||
android:src="@drawable/ic_sysbar_ime_default"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
|
||||
<com.android.systemui.statusbar.policy.CompatModeButton
|
||||
android:id="@+id/compatModeButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="8dip"
|
||||
android:src="@drawable/ic_sysbar_zoom"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<com.android.systemui.statusbar.tablet.NotificationIconArea
|
||||
android:id="@+id/notificationIcons"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -144,4 +153,3 @@
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -26,5 +26,6 @@
|
||||
<dimen name="notification_panel_width">512dp</dimen>
|
||||
<!-- The minimum height of the notification panel window -->
|
||||
<dimen name="notification_panel_min_height">770dp</dimen>
|
||||
<!-- Bottom margin (from display edge) for status bar panels -->
|
||||
<dimen name="panel_float">56dp</dimen>
|
||||
</resources>
|
||||
|
||||
|
||||
@@ -143,4 +143,11 @@
|
||||
<!-- Checkbox label for USB accessory dialogs. [CHAR LIMIT=50] -->
|
||||
<string name="always_use_accessory">Use by default for this USB accessory</string>
|
||||
|
||||
<!-- Checkbox label for application compatibility mode ON (zooming app to look like it's running
|
||||
on a phone). [CHAR LIMIT=25] -->
|
||||
<string name="compat_mode_on">Zoom to fill screen</string>
|
||||
|
||||
<!-- Checkbox label for application compatibility mode OFF (normal mode on tablets).
|
||||
[CHAR LIMIT=25] -->
|
||||
<string name="compat_mode_off">Stretch to fill screen</string>
|
||||
</resources>
|
||||
|
||||
@@ -27,7 +27,8 @@ import android.widget.ImageView;
|
||||
|
||||
import com.android.systemui.R;
|
||||
|
||||
public class CompatModeButton extends ImageView implements View.OnClickListener {
|
||||
public class CompatModeButton extends ImageView {
|
||||
private static final boolean DEBUG = false;
|
||||
private static final String TAG = "StatusBar.CompatModeButton";
|
||||
|
||||
private ActivityManager mAM;
|
||||
@@ -43,22 +44,14 @@ public class CompatModeButton extends ImageView implements View.OnClickListener
|
||||
|
||||
mAM = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
|
||||
setOnClickListener(this);
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mAM.setFrontActivityScreenCompatMode(ActivityManager.COMPAT_MODE_TOGGLE);
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
int mode = mAM.getFrontActivityScreenCompatMode();
|
||||
setVisibility((mode == ActivityManager.COMPAT_MODE_NEVER
|
||||
|| mode == ActivityManager.COMPAT_MODE_ALWAYS)
|
||||
? View.GONE
|
||||
: View.VISIBLE
|
||||
);
|
||||
final boolean vis = (mode != ActivityManager.COMPAT_MODE_NEVER
|
||||
&& mode != ActivityManager.COMPAT_MODE_ALWAYS);
|
||||
if (DEBUG) Slog.d(TAG, "compat mode is " + mode + "; icon will " + (vis ? "show" : "hide"));
|
||||
setVisibility(vis ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.RemoteException;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Slog;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import com.android.systemui.R;
|
||||
|
||||
public class CompatModePanel extends FrameLayout implements StatusBarPanel,
|
||||
View.OnClickListener {
|
||||
private static final boolean DEBUG = TabletStatusBar.DEBUG;
|
||||
private static final String TAG = "CompatModePanel";
|
||||
|
||||
private ActivityManager mAM;
|
||||
|
||||
private boolean mAttached = false;
|
||||
private Context mContext;
|
||||
private RadioButton mOnButton, mOffButton;
|
||||
|
||||
private View mTrigger;
|
||||
// private InputMethodButton mInputMethodSwitchButton;
|
||||
|
||||
public CompatModePanel(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mContext = context;
|
||||
mAM = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinishInflate() {
|
||||
mOnButton = (RadioButton) findViewById(R.id.compat_mode_on_radio);
|
||||
mOffButton = (RadioButton) findViewById(R.id.compat_mode_off_radio);
|
||||
mOnButton.setOnClickListener(this);
|
||||
mOffButton.setOnClickListener(this);
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
if (mAttached) {
|
||||
mAttached = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
if (!mAttached) {
|
||||
mAttached = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v == mOnButton) {
|
||||
mAM.setFrontActivityScreenCompatMode(ActivityManager.COMPAT_MODE_ENABLED);
|
||||
} else if (v == mOffButton) {
|
||||
mAM.setFrontActivityScreenCompatMode(ActivityManager.COMPAT_MODE_DISABLED);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInContentArea(int x, int y) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setTrigger(View v) {
|
||||
mTrigger = v;
|
||||
}
|
||||
|
||||
public void openPanel() {
|
||||
setVisibility(View.VISIBLE);
|
||||
if (mTrigger != null) mTrigger.setSelected(true);
|
||||
refresh();
|
||||
}
|
||||
|
||||
public void closePanel() {
|
||||
setVisibility(View.GONE);
|
||||
if (mTrigger != null) mTrigger.setSelected(false);
|
||||
}
|
||||
|
||||
private void refresh() {
|
||||
int mode = mAM.getFrontActivityScreenCompatMode();
|
||||
final boolean on = (mode == ActivityManager.COMPAT_MODE_ENABLED);
|
||||
mOnButton.setChecked(on);
|
||||
mOffButton.setChecked(!on);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -92,6 +92,8 @@ public class TabletStatusBar extends StatusBar implements
|
||||
public static final int MSG_HIDE_CHROME = 1031;
|
||||
public static final int MSG_OPEN_INPUT_METHODS_PANEL = 1040;
|
||||
public static final int MSG_CLOSE_INPUT_METHODS_PANEL = 1041;
|
||||
public static final int MSG_OPEN_COMPAT_MODE_PANEL = 1050;
|
||||
public static final int MSG_CLOSE_COMPAT_MODE_PANEL = 1051;
|
||||
public static final int MSG_STOP_TICKER = 2000;
|
||||
|
||||
// Fitts' Law assistance for LatinIME; see policy.EventHole
|
||||
@@ -125,8 +127,9 @@ public class TabletStatusBar extends StatusBar implements
|
||||
View mMenuButton;
|
||||
View mRecentButton;
|
||||
|
||||
ViewGroup mNotificationAndImeArea;
|
||||
ViewGroup mFeedbackIconArea; // notification icons, IME icon, compat icon
|
||||
InputMethodButton mInputMethodSwitchButton;
|
||||
CompatModeButton mCompatModeButton;
|
||||
|
||||
NotificationPanel mNotificationPanel;
|
||||
WindowManager.LayoutParams mNotificationPanelParams;
|
||||
@@ -165,6 +168,7 @@ public class TabletStatusBar extends StatusBar implements
|
||||
|
||||
private RecentAppsPanel mRecentsPanel;
|
||||
private InputMethodsPanel mInputMethodsPanel;
|
||||
private CompatModePanel mCompatModePanel;
|
||||
|
||||
public Context getContext() { return mContext; }
|
||||
|
||||
@@ -304,6 +308,29 @@ public class TabletStatusBar extends StatusBar implements
|
||||
lp.windowAnimations = R.style.Animation_RecentPanel;
|
||||
|
||||
WindowManagerImpl.getDefault().addView(mInputMethodsPanel, lp);
|
||||
|
||||
// Compatibility mode selector panel
|
||||
mCompatModePanel = (CompatModePanel) View.inflate(context,
|
||||
R.layout.status_bar_compat_mode_panel, null);
|
||||
mCompatModePanel.setOnTouchListener(new TouchOutsideListener(
|
||||
MSG_CLOSE_COMPAT_MODE_PANEL, mCompatModePanel));
|
||||
mCompatModePanel.setTrigger(mCompatModeButton);
|
||||
mCompatModePanel.setVisibility(View.GONE);
|
||||
mStatusBarView.setIgnoreChildren(4, mCompatModeButton, mCompatModePanel);
|
||||
lp = new WindowManager.LayoutParams(
|
||||
250,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
|
||||
| WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
|
||||
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
|
||||
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
|
||||
PixelFormat.TRANSLUCENT);
|
||||
lp.gravity = Gravity.BOTTOM | Gravity.RIGHT;
|
||||
lp.setTitle("CompatModePanel");
|
||||
lp.windowAnimations = android.R.style.Animation_Dialog;
|
||||
|
||||
WindowManagerImpl.getDefault().addView(mCompatModePanel, lp);
|
||||
}
|
||||
|
||||
private int getNotificationPanelHeight() {
|
||||
@@ -430,11 +457,14 @@ public class TabletStatusBar extends StatusBar implements
|
||||
mNavigationArea.setLayoutTransition(mBarContentsLayoutTransition);
|
||||
|
||||
// The bar contents buttons
|
||||
mNotificationAndImeArea = (ViewGroup)sb.findViewById(R.id.notificationAndImeArea);
|
||||
mFeedbackIconArea = (ViewGroup)sb.findViewById(R.id.feedbackIconArea);
|
||||
mInputMethodSwitchButton = (InputMethodButton) sb.findViewById(R.id.imeSwitchButton);
|
||||
// Overwrite the lister
|
||||
mInputMethodSwitchButton.setOnClickListener(mOnClickListener);
|
||||
|
||||
mCompatModeButton = (CompatModeButton) sb.findViewById(R.id.compatModeButton);
|
||||
mCompatModeButton.setOnClickListener(mOnClickListener);
|
||||
|
||||
// for redirecting errant bar taps to the IME
|
||||
mFakeSpaceBar = sb.findViewById(R.id.fake_space_bar);
|
||||
|
||||
@@ -646,6 +676,14 @@ public class TabletStatusBar extends StatusBar implements
|
||||
if (DEBUG) Slog.d(TAG, "closing input methods panel");
|
||||
if (mInputMethodsPanel != null) mInputMethodsPanel.closePanel(false);
|
||||
break;
|
||||
case MSG_OPEN_COMPAT_MODE_PANEL:
|
||||
if (DEBUG) Slog.d(TAG, "opening compat panel");
|
||||
if (mCompatModePanel != null) mCompatModePanel.openPanel();
|
||||
break;
|
||||
case MSG_CLOSE_COMPAT_MODE_PANEL:
|
||||
if (DEBUG) Slog.d(TAG, "closing compat panel");
|
||||
if (mCompatModePanel != null) mCompatModePanel.closePanel();
|
||||
break;
|
||||
case MSG_SHOW_CHROME:
|
||||
if (DEBUG) Slog.d(TAG, "hiding shadows (lights on)");
|
||||
mBarContents.setVisibility(View.VISIBLE);
|
||||
@@ -914,14 +952,14 @@ public class TabletStatusBar extends StatusBar implements
|
||||
if (0 == (mDisabled & (StatusBarManager.DISABLE_NOTIFICATION_ICONS
|
||||
| StatusBarManager.DISABLE_NOTIFICATION_TICKER))) {
|
||||
mTicker.add(key, n);
|
||||
mNotificationAndImeArea.setVisibility(View.GONE);
|
||||
mFeedbackIconArea.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// called by TabletTicker when it's done with all queued ticks
|
||||
public void doneTicking() {
|
||||
mNotificationAndImeArea.setVisibility(View.VISIBLE);
|
||||
mFeedbackIconArea.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
public void animateExpand() {
|
||||
@@ -939,6 +977,8 @@ public class TabletStatusBar extends StatusBar implements
|
||||
mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL);
|
||||
mHandler.removeMessages(MSG_CLOSE_INPUT_METHODS_PANEL);
|
||||
mHandler.sendEmptyMessage(MSG_CLOSE_INPUT_METHODS_PANEL);
|
||||
mHandler.removeMessages(MSG_CLOSE_COMPAT_MODE_PANEL);
|
||||
mHandler.sendEmptyMessage(MSG_CLOSE_COMPAT_MODE_PANEL);
|
||||
mHandler.removeMessages(MSG_CLOSE_NOTIFICATION_PEEK);
|
||||
mHandler.sendEmptyMessage(MSG_CLOSE_NOTIFICATION_PEEK);
|
||||
}
|
||||
@@ -965,9 +1005,8 @@ public class TabletStatusBar extends StatusBar implements
|
||||
// See above re: lights-out policy for legacy apps.
|
||||
if (windowVisible) setLightsOn(true);
|
||||
|
||||
// XXX: HACK: not sure if this is the best way to catch a new activity that might require a
|
||||
// change in compatibility features, but it's a start.
|
||||
((CompatModeButton) mBarContents.findViewById(R.id.compat_button)).refresh();
|
||||
// XXX: this is broken: http://b/4603422
|
||||
mCompatModeButton.refresh();
|
||||
}
|
||||
|
||||
public void setImeWindowStatus(IBinder token, int vis, int backDisposition) {
|
||||
@@ -1060,6 +1099,8 @@ public class TabletStatusBar extends StatusBar implements
|
||||
onClickRecentButton();
|
||||
} else if (v == mInputMethodSwitchButton) {
|
||||
onClickInputMethodSwitchButton();
|
||||
} else if (v == mCompatModeButton) {
|
||||
onClickCompatModeButton();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1102,6 +1143,13 @@ public class TabletStatusBar extends StatusBar implements
|
||||
mHandler.sendEmptyMessage(msg);
|
||||
}
|
||||
|
||||
public void onClickCompatModeButton() {
|
||||
int msg = (mCompatModePanel.getVisibility() == View.GONE) ?
|
||||
MSG_OPEN_COMPAT_MODE_PANEL : MSG_CLOSE_COMPAT_MODE_PANEL;
|
||||
mHandler.removeMessages(msg);
|
||||
mHandler.sendEmptyMessage(msg);
|
||||
}
|
||||
|
||||
public NotificationClicker makeClicker(PendingIntent intent, String pkg, String tag, int id) {
|
||||
return new NotificationClicker(intent, pkg, tag, id);
|
||||
}
|
||||
@@ -1438,13 +1486,13 @@ public class TabletStatusBar extends StatusBar implements
|
||||
|
||||
ArrayList<View> toShow = new ArrayList<View>();
|
||||
|
||||
// When IME button is visible, the number of notification icons should be decremented
|
||||
// to fit the upper limit.
|
||||
// IME switcher icon is big and occupy width of one icon
|
||||
final int maxNotificationIconsImeButtonVisible = mMaxNotificationIcons - 1;
|
||||
final int maxNotificationIconsCount =
|
||||
(mInputMethodSwitchButton.getVisibility() != View.GONE) ?
|
||||
maxNotificationIconsImeButtonVisible : mMaxNotificationIcons;
|
||||
// Extra Special Icons
|
||||
// The IME switcher and compatibility mode icons take the place of notifications. You didn't
|
||||
// need to see all those new emails, did you?
|
||||
int maxNotificationIconsCount = mMaxNotificationIcons;
|
||||
if (mInputMethodSwitchButton.getVisibility() != View.GONE) maxNotificationIconsCount --;
|
||||
if (mCompatModeButton.getVisibility() != View.GONE) maxNotificationIconsCount --;
|
||||
|
||||
for (int i=0; i< maxNotificationIconsCount; i++) {
|
||||
if (i>=N) break;
|
||||
toShow.add(mNotificationData.get(N-i-1).icon);
|
||||
|
||||
@@ -27,8 +27,9 @@ import android.widget.FrameLayout;
|
||||
public class TabletStatusBarView extends FrameLayout {
|
||||
private Handler mHandler;
|
||||
|
||||
private final View[] mIgnoreChildren = new View[4];
|
||||
private final View[] mPanels = new View[4];
|
||||
private final int MAX_PANELS = 5;
|
||||
private final View[] mIgnoreChildren = new View[MAX_PANELS];
|
||||
private final View[] mPanels = new View[MAX_PANELS];
|
||||
private final int[] mPos = new int[2];
|
||||
|
||||
public TabletStatusBarView(Context context) {
|
||||
|
||||