Merge "Fix app close animation for two panel home" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ea2b30d7fd
@@ -29,6 +29,7 @@ import android.widget.FrameLayout;
|
|||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -226,7 +227,7 @@ public class Hotseat extends CellLayout implements Insettable {
|
|||||||
* Returns the first View for which the given itemOperator returns true, or null.
|
* Returns the first View for which the given itemOperator returns true, or null.
|
||||||
*/
|
*/
|
||||||
public View getFirstItemMatch(Workspace.ItemOperator itemOperator) {
|
public View getFirstItemMatch(Workspace.ItemOperator itemOperator) {
|
||||||
return mWorkspace.getFirstMatch(new CellLayout[] { this }, itemOperator);
|
return mWorkspace.getFirstMatch(Arrays.asList(this), itemOperator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2978,8 +2978,10 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
|||||||
* @param user The user of the app to match.
|
* @param user The user of the app to match.
|
||||||
*/
|
*/
|
||||||
public View getFirstMatchForAppClose(String packageName, UserHandle user) {
|
public View getFirstMatchForAppClose(String packageName, UserHandle user) {
|
||||||
final int curPage = getCurrentPage();
|
List<CellLayout> cellLayouts = new ArrayList<>(getPanelCount() + 1);
|
||||||
final CellLayout currentPage = (CellLayout) getPageAt(curPage);
|
cellLayouts.add(getHotseat());
|
||||||
|
getVisiblePages().forEach(page -> cellLayouts.add((CellLayout) page));
|
||||||
|
|
||||||
final Workspace.ItemOperator packageAndUser = (ItemInfo info, View view) -> info != null
|
final Workspace.ItemOperator packageAndUser = (ItemInfo info, View view) -> info != null
|
||||||
&& info.getTargetComponent() != null
|
&& info.getTargetComponent() != null
|
||||||
&& TextUtils.equals(info.getTargetComponent().getPackageName(), packageName)
|
&& TextUtils.equals(info.getTargetComponent().getPackageName(), packageName)
|
||||||
@@ -3000,13 +3002,11 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
|||||||
|
|
||||||
// Order: App icons, app in folder. Items in hotseat get returned first.
|
// Order: App icons, app in folder. Items in hotseat get returned first.
|
||||||
if (ADAPTIVE_ICON_WINDOW_ANIM.get()) {
|
if (ADAPTIVE_ICON_WINDOW_ANIM.get()) {
|
||||||
return getFirstMatch(new CellLayout[] { getHotseat(), currentPage },
|
return getFirstMatch(cellLayouts, packageAndUserAndApp, packageAndUserAndAppInFolder);
|
||||||
packageAndUserAndApp, packageAndUserAndAppInFolder);
|
|
||||||
} else {
|
} else {
|
||||||
// Do not use Folder as a criteria, since it'll cause a crash when trying to draw
|
// Do not use Folder as a criteria, since it'll cause a crash when trying to draw
|
||||||
// FolderAdaptiveIcon as the background.
|
// FolderAdaptiveIcon as the background.
|
||||||
return getFirstMatch(new CellLayout[] { getHotseat(), currentPage },
|
return getFirstMatch(cellLayouts, packageAndUserAndApp);
|
||||||
packageAndUserAndApp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3040,7 +3040,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
|||||||
* @param operators List of operators, in order starting from best matching operator.
|
* @param operators List of operators, in order starting from best matching operator.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
View getFirstMatch(CellLayout[] cellLayouts, final ItemOperator... operators) {
|
View getFirstMatch(Iterable<CellLayout> cellLayouts, final ItemOperator... operators) {
|
||||||
// This array is filled with the first match for each operator.
|
// This array is filled with the first match for each operator.
|
||||||
final View[] matches = new View[operators.length];
|
final View[] matches = new View[operators.length];
|
||||||
// For efficiency, the outer loop should be CellLayout.
|
// For efficiency, the outer loop should be CellLayout.
|
||||||
|
|||||||
Reference in New Issue
Block a user