summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/recent
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2012-02-27 17:15:41 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-02-27 17:15:41 -0800
commitcbaa666955003928aa8fb710011e1966e64f820d (patch)
tree36f600399cf9880cb59f8984c3eaac3388c28eb1 /packages/SystemUI/src/com/android/systemui/recent
parent6835237f6f55d8a7c7b43b8e0f174f5ea258bfee (diff)
parentf16fc51d96be53a844877674b98cb70e60b45278 (diff)
downloadframeworks_base-cbaa666955003928aa8fb710011e1966e64f820d.zip
frameworks_base-cbaa666955003928aa8fb710011e1966e64f820d.tar.gz
frameworks_base-cbaa666955003928aa8fb710011e1966e64f820d.tar.bz2
Merge "Remove unnecessary code"
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/recent')
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java17
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java42
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java121
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java17
5 files changed, 13 insertions, 188 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java
index 78050a2..deb5670 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java
@@ -27,9 +27,5 @@ public interface RecentsCallback {
void handleOnClick(View selectedView);
void handleSwipe(View selectedView);
void handleLongPress(View selectedView, View anchorView, View thumbnailView);
- void handleShowBackground(boolean show);
void dismiss();
-
- // TODO: find another way to get this info from RecentsPanelView
- boolean isRecentsVisible();
}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
index 4dc3e33..76e6ee8 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
@@ -217,14 +217,6 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
}
@Override
- protected void onLayout (boolean changed, int left, int top, int right, int bottom) {
- super.onLayout(changed, left, top, right, bottom);
- if (mPerformanceHelper != null) {
- mPerformanceHelper.onLayoutCallback();
- }
- }
-
- @Override
public void draw(Canvas canvas) {
super.draw(canvas);
@@ -327,12 +319,6 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
});
}
- public void onRecentsVisibilityChanged() {
- if (mPerformanceHelper != null) {
- mPerformanceHelper.updateShowBackground();
- }
- }
-
@Override
protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
@@ -379,9 +365,6 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
@Override
public void setLayoutTransition(LayoutTransition transition) {
- if (mPerformanceHelper != null) {
- mPerformanceHelper.setLayoutTransitionCallback(transition);
- }
// The layout transition applies to our embedded LinearLayout
mLinearLayout.setLayoutTransition(transition);
}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index 7896720..18132ff 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -32,13 +32,14 @@ import android.net.Uri;
import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Log;
+import android.view.Display;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
-import android.view.ViewRootImpl;
+import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
@@ -325,18 +326,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
}
}
- public void handleShowBackground(boolean show) {
- if (show) {
- mRecentsScrim.setBackgroundResource(R.drawable.status_bar_recents_background_solid);
- } else {
- mRecentsScrim.setBackgroundDrawable(null);
- }
- }
-
- public boolean isRecentsVisible() {
- return getVisibility() == VISIBLE;
- }
-
public void onAnimationCancel(Animator animation) {
}
@@ -457,9 +446,15 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
mRecentsNoApps = findViewById(R.id.recents_no_apps);
mChoreo = new Choreographer(this, mRecentsScrim, mRecentsContainer, mRecentsNoApps, this);
- // In order to save space, we make the background texture repeat in the Y direction
- if (mRecentsScrim != null && mRecentsScrim.getBackground() instanceof BitmapDrawable) {
- ((BitmapDrawable) mRecentsScrim.getBackground()).setTileModeY(TileMode.REPEAT);
+ if (mRecentsScrim != null) {
+ Display d = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
+ .getDefaultDisplay();
+ if (!ActivityManager.isHighEndGfx(d)) {
+ mRecentsScrim.setBackgroundDrawable(null);
+ } else if (mRecentsScrim.getBackground() instanceof BitmapDrawable) {
+ // In order to save space, we make the background texture repeat in the Y direction
+ ((BitmapDrawable) mRecentsScrim.getBackground()).setTileModeY(TileMode.REPEAT);
+ }
}
mPreloadTasksRunnable = new Runnable() {
@@ -478,21 +473,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
transitioner.setAnimator(LayoutTransition.DISAPPEARING, null);
}
- @Override
- protected void onVisibilityChanged(View changedView, int visibility) {
- super.onVisibilityChanged(changedView, visibility);
- if (DEBUG) Log.v(TAG, "onVisibilityChanged(" + changedView + ", " + visibility + ")");
-
- if (mRecentsContainer instanceof RecentsHorizontalScrollView) {
- ((RecentsHorizontalScrollView) mRecentsContainer).onRecentsVisibilityChanged();
- } else if (mRecentsContainer instanceof RecentsVerticalScrollView) {
- ((RecentsVerticalScrollView) mRecentsContainer).onRecentsVisibilityChanged();
- } else {
- throw new IllegalArgumentException("missing Recents[Horizontal]ScrollView");
- }
- }
-
-
private void updateIcon(ViewHolder h, Drawable icon, boolean show, boolean anim) {
if (icon != null) {
h.iconView.setImageDrawable(icon);
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java
index 813099a..5529d0c 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java
@@ -78,39 +78,13 @@ public class RecentsScrollViewPerformanceHelper {
mScrollView.setVerticalFadingEdgeEnabled(false);
mScrollView.setHorizontalFadingEdgeEnabled(false);
}
- if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) {
- mCallback = callback;
- mLinearLayout = layout;
- mAttachedToWindow = true;
- mBackgroundDrawable = mContext.getResources()
- .getDrawable(R.drawable.status_bar_recents_background_solid).getConstantState();
- updateShowBackground();
- }
-
}
public void addViewCallback(View newLinearLayoutChild) {
if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) {
final View view = newLinearLayoutChild;
- if (mShowBackground) {
- view.setBackgroundDrawable(mBackgroundDrawable.newDrawable());
- view.setDrawingCacheEnabled(true);
- view.buildDrawingCache();
- } else {
- view.setBackgroundDrawable(null);
- view.setDrawingCacheEnabled(false);
- view.destroyDrawingCache();
- }
- }
- }
-
- public void onLayoutCallback() {
- if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) {
- mScrollView.post(new Runnable() {
- public void run() {
- updateShowBackground();
- }
- });
+ view.setDrawingCacheEnabled(true);
+ view.buildDrawingCache();
}
}
@@ -118,37 +92,6 @@ public class RecentsScrollViewPerformanceHelper {
int left, int right, int top, int bottom, int scrollX, int scrollY,
float topFadingEdgeStrength, float bottomFadingEdgeStrength,
float leftFadingEdgeStrength, float rightFadingEdgeStrength) {
- if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) {
- if (mIsVertical) {
- if (scrollY < 0) {
- Drawable d = mBackgroundDrawable.newDrawable().getCurrent();
- d.setBounds(0, scrollY, mScrollView.getWidth(), 0);
- d.draw(canvas);
- } else {
- final int childHeight = mLinearLayout.getHeight();
- if (scrollY + mScrollView.getHeight() > childHeight) {
- Drawable d = mBackgroundDrawable.newDrawable().getCurrent();
- d.setBounds(0, childHeight, mScrollView.getWidth(),
- scrollY + mScrollView.getHeight());
- d.draw(canvas);
- }
- }
- } else {
- if (scrollX < 0) {
- Drawable d = mBackgroundDrawable.newDrawable().getCurrent();
- d.setBounds(scrollX, 0, 0, mScrollView.getHeight());
- d.draw(canvas);
- } else {
- final int childWidth = mLinearLayout.getWidth();
- if (scrollX + mScrollView.getWidth() > childWidth) {
- Drawable d = mBackgroundDrawable.newDrawable().getCurrent();
- d.setBounds(childWidth, 0,
- scrollX + mScrollView.getWidth(), mScrollView.getHeight());
- d.draw(canvas);
- }
- }
- }
- }
if ((mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS)
|| USE_DARK_FADE_IN_HW_ACCELERATED_MODE) {
@@ -241,64 +184,4 @@ public class RecentsScrollViewPerformanceHelper {
return mFadingEdgeLength;
}
- public void setLayoutTransitionCallback(LayoutTransition transition) {
- if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) {
- if (transition != null) {
- transition.addTransitionListener(new LayoutTransition.TransitionListener() {
- @Override
- public void startTransition(LayoutTransition transition,
- ViewGroup container, View view, int transitionType) {
- updateShowBackground();
- }
-
- @Override
- public void endTransition(LayoutTransition transition,
- ViewGroup container, View view, int transitionType) {
- updateShowBackground();
- }
- });
- }
- }
- }
-
- // Turn on/off drawing the background in our ancestor, and turn on/off drawing
- // in the items in LinearLayout contained by this scrollview.
- // Moving the background drawing to our children, and turning on a drawing cache
- // for each of them, gives us a ~20fps gain when Recents is rendered in software
- public void updateShowBackground() {
- if (!mAttachedToWindow) {
- // We haven't been initialized yet-- we'll get called again when we are
- return;
- }
- if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) {
- LayoutTransition transition = mLinearLayout.getLayoutTransition();
- int linearLayoutSize =
- mIsVertical ? mLinearLayout.getHeight() : mLinearLayout.getWidth();
- int scrollViewSize =
- mIsVertical ? mScrollView.getHeight() : mScrollView.getWidth();
- boolean show = !mScrollView.isHardwareAccelerated() &&
- (linearLayoutSize > scrollViewSize) &&
- !(transition != null && transition.isRunning()) &&
- mCallback.isRecentsVisible();
-
- if (!mFirstTime && show == mShowBackground) return;
- mShowBackground = show;
- mFirstTime = false;
-
- mCallback.handleShowBackground(!show);
- for (int i = 0; i < mLinearLayout.getChildCount(); i++) {
- View v = mLinearLayout.getChildAt(i);
- if (show) {
- v.setBackgroundDrawable(mBackgroundDrawable.newDrawable());
- v.setDrawingCacheEnabled(true);
- v.buildDrawingCache();
- } else {
- v.setDrawingCacheEnabled(false);
- v.destroyDrawingCache();
- v.setBackgroundDrawable(null);
- }
- }
- }
- }
-
}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
index 19fce37..1bfd000 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -224,14 +224,6 @@ public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper
}
@Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- super.onLayout(changed, left, top, right, bottom);
- if (mPerformanceHelper != null) {
- mPerformanceHelper.onLayoutCallback();
- }
- }
-
- @Override
public void draw(Canvas canvas) {
super.draw(canvas);
@@ -334,12 +326,6 @@ public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper
});
}
- public void onRecentsVisibilityChanged() {
- if (mPerformanceHelper != null) {
- mPerformanceHelper.updateShowBackground();
- }
- }
-
@Override
protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
@@ -387,9 +373,6 @@ public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper
@Override
public void setLayoutTransition(LayoutTransition transition) {
- if (mPerformanceHelper != null) {
- mPerformanceHelper.setLayoutTransitionCallback(transition);
- }
// The layout transition applies to our embedded LinearLayout
mLinearLayout.setLayoutTransition(transition);
}