Merge "DO NOT MERGE. Experimental compatibility mode UI." into honeycomb-mr2

This commit is contained in:
Dianne Hackborn
2011-06-07 15:36:51 -07:00
committed by Android (Google) Code Review
8 changed files with 96 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/ic_sysbar_zoom_pressed" />
<item android:drawable="@drawable/ic_sysbar_zoom_default" />
</selector>

View File

@@ -75,6 +75,13 @@
systemui:keyCode="82" systemui:keyCode="82"
android:visibility="invisible" 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> </LinearLayout>
<!-- fake space bar zone --> <!-- fake space bar zone -->

View File

@@ -0,0 +1,63 @@
/*
* Copyright (C) 2008 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.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.ImageView;
import com.android.systemui.R;
public class CompatModeButton extends ImageView implements View.OnClickListener {
private static final String TAG = "StatusBar.CompatModeButton";
private ActivityManager mAM;
public CompatModeButton(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public CompatModeButton(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs);
setClickable(true);
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() {
setVisibility(
(mAM.getFrontActivityScreenCompatMode() == ActivityManager.COMPAT_MODE_NEVER)
? View.GONE
: View.VISIBLE
);
}
}

View File

@@ -69,6 +69,7 @@ import com.android.systemui.R;
import com.android.systemui.statusbar.*; import com.android.systemui.statusbar.*;
import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.BluetoothController; import com.android.systemui.statusbar.policy.BluetoothController;
import com.android.systemui.statusbar.policy.CompatModeButton;
import com.android.systemui.statusbar.policy.LocationController; import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.NetworkController; import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.Prefs; import com.android.systemui.statusbar.policy.Prefs;
@@ -962,6 +963,10 @@ public class TabletStatusBar extends StatusBar implements
// See above re: lights-out policy for legacy apps. // See above re: lights-out policy for legacy apps.
if (visible) setLightsOn(true); if (visible) 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();
} }
public void setImeWindowStatus(IBinder token, int vis, int backDisposition) { public void setImeWindowStatus(IBinder token, int vis, int backDisposition) {