Search in sources :

Example 76 with DeviceProfile

use of com.android.launcher3.DeviceProfile in project Neo-Launcher by NeoApplications.

the class SuperGContainerView method onMeasure.

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int qsbOverlapMargin = -getResources().getDimensionPixelSize(R.dimen.qsb_overlap_margin);
    DeviceProfile deviceProfile = LauncherAppState.getIDP(getContext()).getDeviceProfile(getContext());
    int size = MeasureSpec.getSize(widthMeasureSpec) - qsbOverlapMargin;
    int qsbWidth;
    int marginStart;
    if (deviceProfile.isVerticalBarLayout()) {
        qsbWidth = size;
        marginStart = qsbOverlapMargin + getResources().getDimensionPixelSize(R.dimen.qsb_button_elevation);
    } else {
        Rect workspacePadding = deviceProfile.workspacePadding;
        int fullWidth = size - workspacePadding.left - workspacePadding.right;
        qsbWidth = DeviceProfile.calculateCellWidth(fullWidth, deviceProfile.inv.numColumns) * deviceProfile.inv.numColumns;
        marginStart = 0;
    }
    if (mQsbView != null) {
        LayoutParams layoutParams = (LayoutParams) mQsbView.getLayoutParams();
        layoutParams.width = qsbWidth / deviceProfile.inv.numColumns;
        if (deviceProfile.isVerticalBarLayout()) {
            layoutParams.width = Math.max(layoutParams.width, getResources().getDimensionPixelSize(R.dimen.qsb_min_width_with_mic));
        } else {
            layoutParams.width = Math.max(layoutParams.width, getResources().getDimensionPixelSize(R.dimen.qsb_min_width_portrait));
        }
        layoutParams.setMarginStart(marginStart);
        layoutParams.resolveLayoutDirection(layoutParams.getLayoutDirection());
    }
    if (mConnectorView != null) {
        LayoutParams layoutParams = (LayoutParams) mConnectorView.getLayoutParams();
        layoutParams.width = marginStart + layoutParams.height / 2;
    }
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
Also used : DeviceProfile(com.android.launcher3.DeviceProfile) Rect(android.graphics.Rect)

Example 77 with DeviceProfile

use of com.android.launcher3.DeviceProfile in project Neo-Launcher by NeoApplications.

the class BaseSwipeUpHandler method getStackBounds.

private Rect getStackBounds(DeviceProfile dp) {
    if (mActivity != null) {
        int[] loc = new int[2];
        View rootView = mActivity.getRootView();
        rootView.getLocationOnScreen(loc);
        return new Rect(loc[0], loc[1], loc[0] + rootView.getWidth(), loc[1] + rootView.getHeight());
    } else {
        return new Rect(0, 0, dp.widthPx, dp.heightPx);
    }
}
Also used : Rect(android.graphics.Rect) View(android.view.View) FloatingIconView(com.android.launcher3.views.FloatingIconView) TaskView(com.android.quickstep.views.TaskView) RecentsView(com.android.quickstep.views.RecentsView)

Example 78 with DeviceProfile

use of com.android.launcher3.DeviceProfile in project Neo-Launcher by NeoApplications.

the class BaseSwipeUpHandler method onRecentsAnimationStart.

@Override
public void onRecentsAnimationStart(SwipeAnimationTargetSet targetSet) {
    DeviceProfile dp = InvariantDeviceProfile.INSTANCE.get(mContext).getDeviceProfile(mContext);
    final Rect overviewStackBounds;
    RemoteAnimationTargetCompat runningTaskTarget = targetSet.findTask(mRunningTaskId);
    if (targetSet.minimizedHomeBounds != null && runningTaskTarget != null) {
        overviewStackBounds = mActivityControlHelper.getOverviewWindowBounds(targetSet.minimizedHomeBounds, runningTaskTarget);
        dp = dp.getMultiWindowProfile(mContext, new Point(overviewStackBounds.width(), overviewStackBounds.height()));
    } else {
        // If we are not in multi-window mode, home insets should be same as system insets.
        dp = dp.copy(mContext);
        overviewStackBounds = getStackBounds(dp);
    }
    dp.updateInsets(targetSet.homeContentInsets);
    dp.updateIsSeascape(mContext);
    if (runningTaskTarget != null) {
        mClipAnimationHelper.updateSource(overviewStackBounds, runningTaskTarget);
    }
    mClipAnimationHelper.prepareAnimation(dp, false);
    initTransitionEndpoints(dp);
    mRecentsAnimationWrapper.setController(targetSet);
}
Also used : DeviceProfile(com.android.launcher3.DeviceProfile) InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) Rect(android.graphics.Rect) RemoteAnimationTargetCompat(com.android.systemui.shared.system.RemoteAnimationTargetCompat) Point(android.graphics.Point)

Example 79 with DeviceProfile

use of com.android.launcher3.DeviceProfile in project Neo-Launcher by NeoApplications.

the class LauncherActivityControllerHelper method prepareHomeUI.

@NonNull
@Override
public HomeAnimationFactory prepareHomeUI(Launcher activity) {
    final DeviceProfile dp = activity.getDeviceProfile();
    final RecentsView recentsView = activity.getOverviewPanel();
    final TaskView runningTaskView = recentsView.getRunningTaskView();
    final View workspaceView;
    if (runningTaskView != null && runningTaskView.getTask().key.getComponent() != null) {
        workspaceView = activity.getWorkspace().getFirstMatchForAppClose(runningTaskView.getTask().key.getComponent().getPackageName(), UserHandle.of(runningTaskView.getTask().key.userId));
    } else {
        workspaceView = null;
    }
    final RectF iconLocation = new RectF();
    boolean canUseWorkspaceView = workspaceView != null && workspaceView.isAttachedToWindow();
    FloatingIconView floatingIconView = canUseWorkspaceView ? FloatingIconView.getFloatingIconView(activity, workspaceView, true, /* hideOriginal */
    iconLocation, false) : null;
    return new HomeAnimationFactory() {

        @Nullable
        @Override
        public View getFloatingView() {
            return floatingIconView;
        }

        @NonNull
        @Override
        public RectF getWindowTargetRect() {
            if (canUseWorkspaceView) {
                return iconLocation;
            } else {
                return HomeAnimationFactory.getDefaultWindowTargetRect(dp);
            }
        }

        @NonNull
        @Override
        public AnimatorPlaybackController createActivityAnimationToHome() {
            // Return an empty APC here since we have an non-user controlled animation to home.
            long accuracy = 2 * Math.max(dp.widthPx, dp.heightPx);
            return activity.getStateManager().createAnimationToNewWorkspace(NORMAL, accuracy, 0);
        }

        @Override
        public void playAtomicAnimation(float velocity) {
            new StaggeredWorkspaceAnim(activity, velocity, true).start();
        }
    };
}
Also used : RectF(android.graphics.RectF) DeviceProfile(com.android.launcher3.DeviceProfile) TaskView(com.android.quickstep.views.TaskView) FloatingIconView(com.android.launcher3.views.FloatingIconView) StaggeredWorkspaceAnim(com.android.quickstep.util.StaggeredWorkspaceAnim) LauncherRecentsView(com.android.quickstep.views.LauncherRecentsView) RecentsView(com.android.quickstep.views.RecentsView) View(android.view.View) FloatingIconView(com.android.launcher3.views.FloatingIconView) TaskView(com.android.quickstep.views.TaskView) LauncherRecentsView(com.android.quickstep.views.LauncherRecentsView) RecentsView(com.android.quickstep.views.RecentsView) NonNull(androidx.annotation.NonNull)

Example 80 with DeviceProfile

use of com.android.launcher3.DeviceProfile in project Neo-Launcher by NeoApplications.

the class RecentsUiFactory method onLauncherStateOrResumeChanged.

/**
 * Recents logic that triggers when launcher state changes or launcher activity stops/resumes.
 *
 * @param launcher the launcher activity
 */
public static void onLauncherStateOrResumeChanged(Launcher launcher) {
    LauncherState state = launcher.getStateManager().getState();
    DeviceProfile profile = launcher.getDeviceProfile();
    boolean visible = (state == NORMAL || state == OVERVIEW) && launcher.isUserActive() && !profile.isVerticalBarLayout();
    UiThreadHelper.runAsyncCommand(launcher, SET_SHELF_HEIGHT_CMD, visible ? 1 : 0, profile.hotseatBarSizePx);
    if (state == NORMAL) {
        launcher.<RecentsView>getOverviewPanel().setSwipeDownShouldLaunchApp(false);
    }
}
Also used : LauncherState(com.android.launcher3.LauncherState) DeviceProfile(com.android.launcher3.DeviceProfile)

Aggregations

DeviceProfile (com.android.launcher3.DeviceProfile)333 Rect (android.graphics.Rect)123 Point (android.graphics.Point)83 InvariantDeviceProfile (com.android.launcher3.InvariantDeviceProfile)61 Paint (android.graphics.Paint)40 ArrayList (java.util.ArrayList)38 View (android.view.View)31 PagedOrientationHandler (com.android.launcher3.touch.PagedOrientationHandler)31 Context (android.content.Context)28 SuppressLint (android.annotation.SuppressLint)27 Size (android.util.Size)25 DragLayer (com.android.launcher3.dragndrop.DragLayer)25 ViewGroup (android.view.ViewGroup)23 Launcher (com.android.launcher3.Launcher)23 RecentsView (com.android.quickstep.views.RecentsView)23 RectF (android.graphics.RectF)22 PendingAnimation (com.android.launcher3.anim.PendingAnimation)22 FrameLayout (android.widget.FrameLayout)21 AnimatorPlaybackController (com.android.launcher3.anim.AnimatorPlaybackController)21 Drawable (android.graphics.drawable.Drawable)20