Loading quickstep/res/layout/overview_clear_all_button.xml +2 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <TextView <com.android.quickstep.views.ClearAllButton xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/clear_all_button" style="@android:style/Widget.DeviceDefault.Button.Borderless" Loading @@ -10,5 +10,6 @@ android:fontFamily="sans-serif-medium" android:text="@string/recents_clear_all" android:textColor="?attr/workspaceTextColor" android:visibility="invisible" android:textSize="14sp" /> No newline at end of file quickstep/src/com/android/quickstep/views/ClearAllButton.java 0 → 100644 +55 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 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.quickstep.views; import static android.view.accessibility.AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.TextView; public class ClearAllButton extends TextView { RecentsView mRecentsView; public ClearAllButton(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public void setRecentsView(RecentsView recentsView) { mRecentsView = recentsView; } @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); // Should be visible to accessibility even when completely covered by the task. // Otherwise, we won't be able to scroll to it. info.setVisibleToUser(true); } @Override public boolean performAccessibilityAction(int action, Bundle arguments) { final boolean res = super.performAccessibilityAction(action, arguments); if (action == ACTION_ACCESSIBILITY_FOCUS) { mRecentsView.revealClearAllButton(); } return res; } } quickstep/src/com/android/quickstep/views/RecentsView.java +14 −2 Original line number Diff line number Diff line Loading @@ -272,6 +272,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl loader.unloadTaskData(task); loader.getHighResThumbnailLoader().onTaskInvisible(task); } onChildViewsChanged(); } public boolean isTaskViewVisible(TaskView tv) { Loading Loading @@ -366,7 +367,6 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl if (mClearAllButton != null) { final float alpha = calculateClearAllButtonAlpha(); mClearAllButton.setAlpha(alpha * mContentAlpha); mClearAllButton.setVisibility(alpha == 0 ? INVISIBLE : VISIBLE); } } Loading @@ -379,7 +379,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl @Override public boolean onTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN && mTouchState == TOUCH_STATE_REST && mScroller.isFinished() && mClearAllButton.getVisibility() == View.VISIBLE) { && mScroller.isFinished() && mClearAllButton.getAlpha() > 0) { mClearAllButton.getHitRect(mTempRect); mTempRect.offset(-getLeft(), -getTop()); if (mTempRect.contains((int) ev.getX(), (int) ev.getY())) { Loading Loading @@ -1019,6 +1019,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl super.onViewAdded(child); child.setAlpha(mContentAlpha); setAdjacentScale(mAdjacentScale); onChildViewsChanged(); } @Override Loading Loading @@ -1251,4 +1252,15 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl mClearAllButton = clearAllButton; updateClearAllButtonAlpha(); } private void onChildViewsChanged() { final int childCount = getChildCount(); mClearAllButton.setAccessibilityTraversalAfter( childCount == 0 ? NO_ID : getChildAt(childCount - 1).getId()); mClearAllButton.setVisibility(childCount == 0 ? INVISIBLE : VISIBLE); } public void revealClearAllButton() { scrollTo(mIsRtl ? 0 : computeMaxScrollX(), 0); } } quickstep/src/com/android/quickstep/views/RecentsViewContainer.java +20 −3 Original line number Diff line number Diff line /* * Copyright (C) 2018 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.quickstep.views; import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP; Loading @@ -9,7 +25,6 @@ import android.util.AttributeSet; import android.util.FloatProperty; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import com.android.launcher3.InsettableFrameLayout; import com.android.launcher3.R; Loading @@ -31,7 +46,7 @@ public class RecentsViewContainer extends InsettableFrameLayout { private final Rect mTempRect = new Rect(); private RecentsView mRecentsView; private View mClearAllButton; private ClearAllButton mClearAllButton; public RecentsViewContainer(Context context, AttributeSet attrs) { super(context, attrs); Loading @@ -48,13 +63,15 @@ public class RecentsViewContainer extends InsettableFrameLayout { mRecentsView.dismissAllTasks(); }); mRecentsView = (RecentsView) findViewById(R.id.overview_panel); mRecentsView = findViewById(R.id.overview_panel); final InsettableFrameLayout.LayoutParams params = (InsettableFrameLayout.LayoutParams) mClearAllButton.getLayoutParams(); params.gravity = Gravity.TOP | (RecentsView.FLIP_RECENTS ? Gravity.START : Gravity.END); mClearAllButton.setLayoutParams(params); mClearAllButton.forceHasOverlappingRendering(false); mRecentsView.setClearAllButton(mClearAllButton); mClearAllButton.setRecentsView(mRecentsView); } @Override Loading Loading
quickstep/res/layout/overview_clear_all_button.xml +2 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <TextView <com.android.quickstep.views.ClearAllButton xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/clear_all_button" style="@android:style/Widget.DeviceDefault.Button.Borderless" Loading @@ -10,5 +10,6 @@ android:fontFamily="sans-serif-medium" android:text="@string/recents_clear_all" android:textColor="?attr/workspaceTextColor" android:visibility="invisible" android:textSize="14sp" /> No newline at end of file
quickstep/src/com/android/quickstep/views/ClearAllButton.java 0 → 100644 +55 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 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.quickstep.views; import static android.view.accessibility.AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.TextView; public class ClearAllButton extends TextView { RecentsView mRecentsView; public ClearAllButton(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public void setRecentsView(RecentsView recentsView) { mRecentsView = recentsView; } @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); // Should be visible to accessibility even when completely covered by the task. // Otherwise, we won't be able to scroll to it. info.setVisibleToUser(true); } @Override public boolean performAccessibilityAction(int action, Bundle arguments) { final boolean res = super.performAccessibilityAction(action, arguments); if (action == ACTION_ACCESSIBILITY_FOCUS) { mRecentsView.revealClearAllButton(); } return res; } }
quickstep/src/com/android/quickstep/views/RecentsView.java +14 −2 Original line number Diff line number Diff line Loading @@ -272,6 +272,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl loader.unloadTaskData(task); loader.getHighResThumbnailLoader().onTaskInvisible(task); } onChildViewsChanged(); } public boolean isTaskViewVisible(TaskView tv) { Loading Loading @@ -366,7 +367,6 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl if (mClearAllButton != null) { final float alpha = calculateClearAllButtonAlpha(); mClearAllButton.setAlpha(alpha * mContentAlpha); mClearAllButton.setVisibility(alpha == 0 ? INVISIBLE : VISIBLE); } } Loading @@ -379,7 +379,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl @Override public boolean onTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN && mTouchState == TOUCH_STATE_REST && mScroller.isFinished() && mClearAllButton.getVisibility() == View.VISIBLE) { && mScroller.isFinished() && mClearAllButton.getAlpha() > 0) { mClearAllButton.getHitRect(mTempRect); mTempRect.offset(-getLeft(), -getTop()); if (mTempRect.contains((int) ev.getX(), (int) ev.getY())) { Loading Loading @@ -1019,6 +1019,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl super.onViewAdded(child); child.setAlpha(mContentAlpha); setAdjacentScale(mAdjacentScale); onChildViewsChanged(); } @Override Loading Loading @@ -1251,4 +1252,15 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl mClearAllButton = clearAllButton; updateClearAllButtonAlpha(); } private void onChildViewsChanged() { final int childCount = getChildCount(); mClearAllButton.setAccessibilityTraversalAfter( childCount == 0 ? NO_ID : getChildAt(childCount - 1).getId()); mClearAllButton.setVisibility(childCount == 0 ? INVISIBLE : VISIBLE); } public void revealClearAllButton() { scrollTo(mIsRtl ? 0 : computeMaxScrollX(), 0); } }
quickstep/src/com/android/quickstep/views/RecentsViewContainer.java +20 −3 Original line number Diff line number Diff line /* * Copyright (C) 2018 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.quickstep.views; import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP; Loading @@ -9,7 +25,6 @@ import android.util.AttributeSet; import android.util.FloatProperty; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import com.android.launcher3.InsettableFrameLayout; import com.android.launcher3.R; Loading @@ -31,7 +46,7 @@ public class RecentsViewContainer extends InsettableFrameLayout { private final Rect mTempRect = new Rect(); private RecentsView mRecentsView; private View mClearAllButton; private ClearAllButton mClearAllButton; public RecentsViewContainer(Context context, AttributeSet attrs) { super(context, attrs); Loading @@ -48,13 +63,15 @@ public class RecentsViewContainer extends InsettableFrameLayout { mRecentsView.dismissAllTasks(); }); mRecentsView = (RecentsView) findViewById(R.id.overview_panel); mRecentsView = findViewById(R.id.overview_panel); final InsettableFrameLayout.LayoutParams params = (InsettableFrameLayout.LayoutParams) mClearAllButton.getLayoutParams(); params.gravity = Gravity.TOP | (RecentsView.FLIP_RECENTS ? Gravity.START : Gravity.END); mClearAllButton.setLayoutParams(params); mClearAllButton.forceHasOverlappingRendering(false); mRecentsView.setClearAllButton(mClearAllButton); mClearAllButton.setRecentsView(mRecentsView); } @Override Loading