aec9d3136f
- Focus task is only removed under ENABLE_GRID_ONLY_OVERVIEW, but many fixes/refactoring are generic and apply with the flag off - Keep moving running task to front if go to overvied after quick switch, so live tile is always on top right Grid calculation: - Fixed some top/bottom calculation assumption that assume focus task is always present Size calculation: - With ENABLE_GRID_ONLY_OVERVIEW, taskSize == gridTaskSize, and task is aligned to top-right of gridRect (instead of focusTaskRect) Bug: 257952455 Test: Enter overview from home Test: Enter overview from app, with variations that quick switch and enter Test: Dismiss task from different position Test: Split select task from different position Test: Repeat with/without GRID_ONLY_OVERVIEW flag Test: Repeat with handheld Change-Id: I6580a8ac6c2c2059c33c4daca05b7d0354513e74
65 lines
2.3 KiB
Java
65 lines
2.3 KiB
Java
/*
|
|
* 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.util;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Rect;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
|
|
import com.android.launcher3.DeviceProfile;
|
|
import com.android.launcher3.touch.PagedOrientationHandler;
|
|
import com.android.launcher3.util.DisplayController;
|
|
import com.android.launcher3.util.NavigationMode;
|
|
import com.android.quickstep.LauncherActivityInterface;
|
|
|
|
public class LayoutUtils {
|
|
|
|
/**
|
|
* The height for the swipe up motion
|
|
*/
|
|
public static float getDefaultSwipeHeight(Context context, DeviceProfile dp) {
|
|
float swipeHeight = dp.allAppsCellHeightPx - dp.allAppsIconTextSizePx;
|
|
if (DisplayController.getNavigationMode(context) == NavigationMode.NO_BUTTON) {
|
|
swipeHeight -= dp.getInsets().bottom;
|
|
}
|
|
return swipeHeight;
|
|
}
|
|
|
|
public static int getShelfTrackingDistance(Context context, DeviceProfile dp,
|
|
PagedOrientationHandler orientationHandler) {
|
|
// Track the bottom of the window.
|
|
Rect taskSize = new Rect();
|
|
LauncherActivityInterface.INSTANCE.calculateTaskSize(context, dp, taskSize,
|
|
orientationHandler);
|
|
return orientationHandler.getDistanceToBottomOfRect(dp, taskSize);
|
|
}
|
|
|
|
/**
|
|
* Recursively sets view and all children enabled/disabled.
|
|
* @param view Top most parent view to change.
|
|
* @param enabled True = enable, False = disable.
|
|
*/
|
|
public static void setViewEnabled(View view, boolean enabled) {
|
|
view.setEnabled(enabled);
|
|
if (view instanceof ViewGroup) {
|
|
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
|
|
setViewEnabled(((ViewGroup) view).getChildAt(i), enabled);
|
|
}
|
|
}
|
|
}
|
|
}
|