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);
}
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);
}
}
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);
}
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();
}
};
}
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);
}
}
Aggregations