diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-06-07 15:52:38 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-06-07 15:52:38 -0700 |
commit | 891266e36e230fa0a4f4466672834a8e3e97598e (patch) | |
tree | eae2c480e9856340a0d7dd633adc06e0d1a67844 /packages | |
parent | 3eb9f8326e6d72be671bf0226965ca3231a25d7d (diff) | |
parent | b5b98f877a09907a9a3b0c7e590e6e0ddd575158 (diff) | |
download | frameworks_base-891266e36e230fa0a4f4466672834a8e3e97598e.zip frameworks_base-891266e36e230fa0a4f4466672834a8e3e97598e.tar.gz frameworks_base-891266e36e230fa0a4f4466672834a8e3e97598e.tar.bz2 |
am b5b98f87: am dfe824ef: Merge "DO NOT MERGE. Experimental compatibility mode UI." into honeycomb-mr2
* commit 'b5b98f877a09907a9a3b0c7e590e6e0ddd575158':
DO NOT MERGE. Experimental compatibility mode UI.
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_zoom_default.png | bin | 0 -> 4050 bytes | |||
-rw-r--r-- | packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_zoom_pressed.png | bin | 0 -> 7760 bytes | |||
-rw-r--r-- | packages/SystemUI/res/drawable-sw600dp-mdpi/ic_sysbar_zoom_default.png | bin | 0 -> 2642 bytes | |||
-rw-r--r-- | packages/SystemUI/res/drawable-sw600dp-mdpi/ic_sysbar_zoom_pressed.png | bin | 0 -> 4140 bytes | |||
-rw-r--r-- | packages/SystemUI/res/drawable/ic_sysbar_zoom.xml | 21 | ||||
-rw-r--r-- | packages/SystemUI/res/layout-sw600dp/status_bar.xml | 7 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/CompatModeButton.java | 63 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java | 5 |
8 files changed, 96 insertions, 0 deletions
diff --git a/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_zoom_default.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_zoom_default.png Binary files differnew file mode 100644 index 0000000..e2584e3 --- /dev/null +++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_zoom_default.png diff --git a/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_zoom_pressed.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_zoom_pressed.png Binary files differnew file mode 100644 index 0000000..58b8510 --- /dev/null +++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/ic_sysbar_zoom_pressed.png diff --git a/packages/SystemUI/res/drawable-sw600dp-mdpi/ic_sysbar_zoom_default.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/ic_sysbar_zoom_default.png Binary files differnew file mode 100644 index 0000000..2795c34 --- /dev/null +++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/ic_sysbar_zoom_default.png diff --git a/packages/SystemUI/res/drawable-sw600dp-mdpi/ic_sysbar_zoom_pressed.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/ic_sysbar_zoom_pressed.png Binary files differnew file mode 100644 index 0000000..bbed6a6 --- /dev/null +++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/ic_sysbar_zoom_pressed.png diff --git a/packages/SystemUI/res/drawable/ic_sysbar_zoom.xml b/packages/SystemUI/res/drawable/ic_sysbar_zoom.xml new file mode 100644 index 0000000..977e002 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_sysbar_zoom.xml @@ -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> + diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar.xml b/packages/SystemUI/res/layout-sw600dp/status_bar.xml index d9f3f23..707a8cb 100644 --- a/packages/SystemUI/res/layout-sw600dp/status_bar.xml +++ b/packages/SystemUI/res/layout-sw600dp/status_bar.xml @@ -75,6 +75,13 @@ 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 --> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CompatModeButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CompatModeButton.java new file mode 100644 index 0000000..9b44f78 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CompatModeButton.java @@ -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 + ); + } +} 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 1b73e29..4e10770 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -69,6 +69,7 @@ import com.android.systemui.R; import com.android.systemui.statusbar.*; import com.android.systemui.statusbar.policy.BatteryController; 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.NetworkController; 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. 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) { |