Merge "Fix regression: recents did not dismiss after launching apps (5252649)"

This commit is contained in:
Michael Jurka
2011-09-02 15:02:08 -07:00
committed by Android (Google) Code Review
8 changed files with 27 additions and 11 deletions

View File

@@ -37,7 +37,6 @@
android:layout_alignParentTop="true"
android:layout_marginLeft="@dimen/status_bar_recents_thumbnail_left_margin"
android:scaleType="center"
android:clickable="true"
android:background="@drawable/recents_thumbnail_overlay">
<ImageView android:id="@+id/app_thumbnail_image"
android:layout_width="match_parent"

View File

@@ -33,7 +33,6 @@
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:clickable="true"
android:layout_marginLeft="@dimen/status_bar_recents_thumbnail_left_margin"
android:scaleType="center"
android:background="@drawable/recents_thumbnail_overlay">

View File

@@ -38,6 +38,7 @@
android:orientation="horizontal"
android:clipChildren="false"
android:layout_marginTop="@*android:dimen/status_bar_height">
<com.android.systemui.recent.RecentsVerticalScrollView
android:id="@+id/recents_container"
android:layout_width="match_parent"
@@ -62,7 +63,6 @@
</com.android.systemui.recent.RecentsVerticalScrollView>
</LinearLayout>
</FrameLayout>

View File

@@ -29,7 +29,6 @@
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:clickable="true"
android:layout_marginLeft="@dimen/status_bar_recents_thumbnail_left_margin"
android:scaleType="center"
android:background="@drawable/recents_thumbnail_overlay">

View File

@@ -196,7 +196,11 @@ public class SwipeHelper {
final View animView = mCallback.getChildContentView(view);
final boolean canAnimViewBeDismissed = mCallback.canChildBeDismissed(view);
float newPos;
if (velocity < 0 || (velocity == 0 && getTranslation(animView) < 0)) {
if (velocity < 0
|| (velocity == 0 && getTranslation(animView) < 0)
// if we use the Menu to dismiss an item in landscape, animate up
|| (velocity == 0 && getTranslation(animView) == 0 && mSwipeDirection == Y)) {
newPos = -getSize(animView);
} else {
newPos = getSize(animView);

View File

@@ -28,6 +28,7 @@ public interface RecentsCallback {
void handleSwipe(View selectedView);
void handleLongPress(View selectedView, View anchorView);
void handleShowBackground(boolean show);
void dismiss();
// TODO: find another way to get this info from RecentsPanelView
boolean isRecentsVisible();

View File

@@ -243,8 +243,11 @@ public class RecentsPanelView extends RelativeLayout
}
}
public void dismiss() {
hide(true);
}
public void hide(boolean animate) {
mShowing = false;
if (!animate) {
setVisibility(View.GONE);
}

View File

@@ -84,15 +84,26 @@ public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper
if (old == null) {
view.setClickable(true);
view.setOnLongClickListener(mOnLongClick);
final View thumbnail = view.findViewById(R.id.app_thumbnail);
// thumbnail is set to clickable in the layout file
thumbnail.setOnClickListener(new OnClickListener() {
view.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
mCallback.handleOnClick(view);
mCallback.dismiss();
}
});
OnClickListener launchAppListener = new OnClickListener() {
public void onClick(View v) {
mCallback.handleOnClick(view);
}
};
final View thumbnail = view.findViewById(R.id.app_thumbnail);
thumbnail.setClickable(true);
thumbnail.setOnClickListener(launchAppListener);
final View appTitle = view.findViewById(R.id.app_label);
appTitle.setClickable(true);
appTitle.setOnClickListener(launchAppListener);
final View calloutLine = view.findViewById(R.id.recents_callout_line);
calloutLine.setClickable(true);
calloutLine.setOnClickListener(launchAppListener);
mLinearLayout.addView(view);
}
}