use of com.android.launcher3.touch.PagedOrientationHandler in project android_packages_apps_404Launcher by P-404.
the class TaskMenuView method orientAroundTaskView.
private void orientAroundTaskView(TaskIdAttributeContainer taskContainer) {
RecentsView recentsView = mActivity.getOverviewPanel();
PagedOrientationHandler orientationHandler = recentsView.getPagedOrientationHandler();
measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
orientationHandler.setTaskMenuAroundTaskView(this, mTaskInsetMargin);
// Get Position
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
mActivity.getDragLayer().getDescendantRectRelativeToSelf(mTaskView, sTempRect);
Rect insets = mActivity.getDragLayer().getInsets();
BaseDragLayer.LayoutParams params = (BaseDragLayer.LayoutParams) getLayoutParams();
int padding = getResources().getDimensionPixelSize(R.dimen.task_menu_vertical_padding);
params.width = orientationHandler.getTaskMenuWidth(taskContainer.getThumbnailView(), deviceProfile) - (2 * padding);
// Gravity set to Left instead of Start as sTempRect.left measures Left distance not Start
params.gravity = Gravity.LEFT;
setLayoutParams(params);
setScaleX(mTaskView.getScaleX());
setScaleY(mTaskView.getScaleY());
// Set divider spacing
ShapeDrawable divider = new ShapeDrawable(new RectShape());
divider.getPaint().setColor(getResources().getColor(android.R.color.transparent));
int dividerSpacing = (int) getResources().getDimension(R.dimen.task_menu_spacing);
mOptionLayout.setShowDividers(SHOW_DIVIDER_MIDDLE);
orientationHandler.setTaskOptionsMenuLayoutOrientation(deviceProfile, mOptionLayout, dividerSpacing, divider);
setPosition(sTempRect.left - insets.left, sTempRect.top - insets.top, 0);
}
use of com.android.launcher3.touch.PagedOrientationHandler in project android_packages_apps_404Launcher by P-404.
the class TaskMenuView method setPosition.
private void setPosition(float x, float y, int overscrollShift) {
PagedOrientationHandler pagedOrientationHandler = mTaskView.getPagedOrientationHandler();
// Inset due to margin
PointF additionalInset = pagedOrientationHandler.getAdditionalInsetForTaskMenu(mTaskInsetMargin);
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
int taskTopMargin = deviceProfile.overviewTaskThumbnailTopMarginPx;
float adjustedY = y + taskTopMargin - additionalInset.y;
float adjustedX = x - additionalInset.x;
// Changing pivot to make computations easier
// NOTE: Changing the pivots means the rotated view gets rotated about the new pivots set,
// which would render the X and Y position set here incorrect
setPivotX(0);
if (deviceProfile.overviewShowAsGrid) {
// In tablet, set pivotY to original position without mThumbnailTopMargin adjustment.
setPivotY(-taskTopMargin);
} else {
setPivotY(0);
}
setRotation(pagedOrientationHandler.getDegreesRotated());
setX(pagedOrientationHandler.getTaskMenuX(adjustedX, mTaskContainer.getThumbnailView(), overscrollShift, deviceProfile));
setY(pagedOrientationHandler.getTaskMenuY(adjustedY, mTaskContainer.getThumbnailView(), overscrollShift));
// TODO(b/193432925) temporary menu placement for split screen task menus
TaskIdAttributeContainer[] taskIdAttributeContainers = mTaskView.getTaskIdAttributeContainers();
if (taskIdAttributeContainers[0].getStagePosition() != STAGE_POSITION_UNDEFINED) {
if (mTaskContainer.getStagePosition() != STAGE_POSITION_BOTTOM_OR_RIGHT) {
return;
}
Rect r = new Rect();
mTaskContainer.getThumbnailView().getBoundsOnScreen(r);
if (deviceProfile.isLandscape) {
setX(r.left);
} else {
setY(r.top);
}
}
}
use of com.android.launcher3.touch.PagedOrientationHandler in project android_packages_apps_404Launcher by P-404.
the class ClearAllButton method applyPrimaryTranslation.
private void applyPrimaryTranslation() {
RecentsView recentsView = getRecentsView();
if (recentsView == null) {
return;
}
PagedOrientationHandler orientationHandler = recentsView.getPagedOrientationHandler();
orientationHandler.getPrimaryViewTranslate().set(this, orientationHandler.getPrimaryValue(0f, getOriginalTranslationY()) + mNormalTranslationPrimary + getFullscreenTrans(mFullscreenTranslationPrimary) + getGridTrans(mGridTranslationPrimary));
}
use of com.android.launcher3.touch.PagedOrientationHandler in project android_packages_apps_404Launcher by P-404.
the class ClearAllButton method onLayout.
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
PagedOrientationHandler orientationHandler = getRecentsView().getPagedOrientationHandler();
mSidePadding = orientationHandler.getClearAllSidePadding(getRecentsView(), mIsRtl);
}
use of com.android.launcher3.touch.PagedOrientationHandler in project android_packages_apps_404Launcher by P-404.
the class TaskOverlayFactory method addSplitOptions.
/**
* Does NOT add split options in the following scenarios:
* * The taskView to add split options is already showing split screen tasks
* * There aren't at least 2 tasks in overview to show split options for
* * Device is in "Lock task mode"
* * The taskView to show split options for is the focused task AND we haven't started
* scrolling in overview (if we haven't scrolled, there's a split overview action button so
* we don't need this menu option)
*/
private static void addSplitOptions(List<SystemShortcut> outShortcuts, BaseDraggingActivity activity, TaskView taskView, DeviceProfile deviceProfile) {
RecentsView recentsView = taskView.getRecentsView();
PagedOrientationHandler orientationHandler = recentsView.getPagedOrientationHandler();
int[] taskViewTaskIds = taskView.getTaskIds();
boolean taskViewHasMultipleTasks = taskViewTaskIds[0] != -1 && taskViewTaskIds[1] != -1;
boolean notEnoughTasksToSplit = recentsView.getTaskViewCount() < 2;
boolean isFocusedTask = deviceProfile.overviewShowAsGrid && taskView.isFocusedTask();
boolean isTaskInExpectedScrollPosition = recentsView.isTaskInExpectedScrollPosition(recentsView.indexOfChild(taskView));
ActivityManager activityManager = (ActivityManager) taskView.getContext().getSystemService(Context.ACTIVITY_SERVICE);
boolean isLockTaskMode = activityManager.isInLockTaskMode();
if (taskViewHasMultipleTasks || notEnoughTasksToSplit || isLockTaskMode || (isFocusedTask && isTaskInExpectedScrollPosition)) {
return;
}
List<SplitPositionOption> positions = orientationHandler.getSplitPositionOptions(deviceProfile);
for (SplitPositionOption option : positions) {
outShortcuts.add(new SplitSelectSystemShortcut(activity, taskView, option));
}
}
Aggregations