Search in sources :

Example 21 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by crdroidandroid.

the class LauncherActivityInterface method onLaunchTaskFailed.

@Override
public void onLaunchTaskFailed() {
    Launcher launcher = getCreatedActivity();
    if (launcher == null) {
        return;
    }
    launcher.getStateManager().goToState(OVERVIEW);
}
Also used : Launcher(com.android.launcher3.Launcher) BaseQuickstepLauncher(com.android.launcher3.BaseQuickstepLauncher)

Example 22 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by crdroidandroid.

the class LauncherActivityInterface method prepareRecentsUI.

@Override
public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState, boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback) {
    notifyRecentsOfOrientation(deviceState.getRotationTouchHelper());
    DefaultAnimationFactory factory = new DefaultAnimationFactory(callback) {

        @Override
        protected void createBackgroundToOverviewAnim(BaseQuickstepLauncher activity, PendingAnimation pa) {
            super.createBackgroundToOverviewAnim(activity, pa);
            // Animate the blur and wallpaper zoom
            float fromDepthRatio = BACKGROUND_APP.getDepth(activity);
            float toDepthRatio = OVERVIEW.getDepth(activity);
            pa.addFloat(getDepthController(), new ClampedDepthProperty(fromDepthRatio, toDepthRatio), fromDepthRatio, toDepthRatio, LINEAR);
        }
    };
    BaseQuickstepLauncher launcher = factory.initUI();
    // Since all apps is not visible, we can safely reset the scroll position.
    // This ensures then the next swipe up to all-apps starts from scroll 0.
    launcher.getAppsView().reset(false);
    return factory;
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) BaseQuickstepLauncher(com.android.launcher3.BaseQuickstepLauncher) ClampedDepthProperty(com.android.launcher3.statehandlers.DepthController.ClampedDepthProperty)

Example 23 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by crdroidandroid.

the class QuickstepLauncher method onStateOrResumeChanging.

/**
 * Recents logic that triggers when launcher state changes or launcher activity stops/resumes.
 */
private void onStateOrResumeChanging(boolean inTransition) {
    LauncherState state = getStateManager().getState();
    boolean started = ((getActivityFlags() & ACTIVITY_STATE_STARTED)) != 0;
    if (started) {
        DeviceProfile profile = getDeviceProfile();
        boolean willUserBeActive = (getActivityFlags() & ACTIVITY_STATE_USER_WILL_BE_ACTIVE) != 0;
        boolean visible = (state == NORMAL || state == OVERVIEW) && (willUserBeActive || isUserActive()) && !profile.isVerticalBarLayout() && profile.isPhone && !profile.isLandscape;
        UiThreadHelper.runAsyncCommand(this, SET_SHELF_HEIGHT, visible ? 1 : 0, profile.hotseatBarSizePx);
    }
    if (state == NORMAL && !inTransition) {
        ((RecentsView) getOverviewPanel()).setSwipeDownShouldLaunchApp(false);
    }
}
Also used : LauncherState(com.android.launcher3.LauncherState) DeviceProfile(com.android.launcher3.DeviceProfile) RecentsView(com.android.quickstep.views.RecentsView)

Example 24 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by crdroidandroid.

the class SecondaryDisplayLauncher method onNewIntent.

@Override
public void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    if (Intent.ACTION_MAIN.equals(intent.getAction())) {
        // Hide keyboard.
        final View v = getWindow().peekDecorView();
        if (v != null && v.getWindowToken() != null) {
            getSystemService(InputMethodManager.class).hideSoftInputFromWindow(v.getWindowToken(), 0);
        }
    }
    // A new intent will bring the launcher to top. Hide the app drawer to reset the state.
    showAppDrawer(false);
}
Also used : InputMethodManager(android.view.inputmethod.InputMethodManager) View(android.view.View) AbstractFloatingView(com.android.launcher3.AbstractFloatingView) AllAppsContainerView(com.android.launcher3.allapps.AllAppsContainerView)

Example 25 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by crdroidandroid.

the class PopupContainerWithArrow method showForIcon.

/**
 * Shows the notifications and deep shortcuts associated with {@param icon}.
 * @return the container if shown or null.
 */
public static PopupContainerWithArrow showForIcon(BubbleTextView icon) {
    Launcher launcher = Launcher.getLauncher(icon.getContext());
    if (getOpen(launcher) != null) {
        // There is already an items container open, so don't open this one.
        icon.clearFocus();
        return null;
    }
    ItemInfo item = (ItemInfo) icon.getTag();
    if (!canShow(icon, item)) {
        return null;
    }
    final PopupContainerWithArrow container = (PopupContainerWithArrow) launcher.getLayoutInflater().inflate(R.layout.popup_container, launcher.getDragLayer(), false);
    container.configureForLauncher(launcher);
    PopupDataProvider popupDataProvider = launcher.getPopupDataProvider();
    container.populateAndShow(icon, popupDataProvider.getShortcutCountForItem(item), popupDataProvider.getNotificationKeysForItem(item), launcher.getSupportedShortcuts().map(s -> s.getShortcut(launcher, item)).filter(Objects::nonNull).collect(Collectors.toList()));
    launcher.refreshAndBindWidgetsForPackageUser(PackageUserKey.fromItemInfo(item));
    container.requestFocus();
    return container;
}
Also used : Rect(android.graphics.Rect) PointF(android.graphics.PointF) Arrays(java.util.Arrays) ImageView(android.widget.ImageView) DraggableView(com.android.launcher3.dragndrop.DraggableView) BubbleTextView(com.android.launcher3.BubbleTextView) LayoutTransition(android.animation.LayoutTransition) AttributeSet(android.util.AttributeSet) Handler(android.os.Handler) Looper(android.os.Looper) Map(java.util.Map) View(android.view.View) TargetApi(android.annotation.TargetApi) MAX_SHORTCUTS_IF_NOTIFICATIONS(com.android.launcher3.popup.PopupPopulator.MAX_SHORTCUTS_IF_NOTIFICATIONS) Utilities(com.android.launcher3.Utilities) ShortcutMenuAccessibilityDelegate(com.android.launcher3.accessibility.ShortcutMenuAccessibilityDelegate) Launcher(com.android.launcher3.Launcher) ShortcutDragPreviewProvider(com.android.launcher3.shortcuts.ShortcutDragPreviewProvider) Predicate(java.util.function.Predicate) Collectors(java.util.stream.Collectors) ViewGroup(android.view.ViewGroup) LauncherAccessibilityDelegate(com.android.launcher3.accessibility.LauncherAccessibilityDelegate) NotificationInfo(com.android.launcher3.notification.NotificationInfo) DragOptions(com.android.launcher3.dragndrop.DragOptions) Objects(java.util.Objects) List(java.util.List) ShortcutUtil(com.android.launcher3.util.ShortcutUtil) Context(android.content.Context) MODEL_EXECUTOR(com.android.launcher3.util.Executors.MODEL_EXECUTOR) ItemInfo(com.android.launcher3.model.data.ItemInfo) Utilities.squaredTouchSlop(com.android.launcher3.Utilities.squaredTouchSlop) NotificationKeyData(com.android.launcher3.notification.NotificationKeyData) ArrayList(java.util.ArrayList) BaseDragLayer(com.android.launcher3.views.BaseDragLayer) NotificationContainer(com.android.launcher3.notification.NotificationContainer) ItemLongClickListener(com.android.launcher3.touch.ItemLongClickListener) Utilities.squaredHypot(com.android.launcher3.Utilities.squaredHypot) MAX_SHORTCUTS(com.android.launcher3.popup.PopupPopulator.MAX_SHORTCUTS) MotionEvent(android.view.MotionEvent) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) DragObject(com.android.launcher3.DropTarget.DragObject) AnimatorSet(android.animation.AnimatorSet) Build(android.os.Build) DragSource(com.android.launcher3.DragSource) DropTarget(com.android.launcher3.DropTarget) PopupDataChangeListener(com.android.launcher3.popup.PopupDataProvider.PopupDataChangeListener) CONTAINER_SHORTCUTS(com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SHORTCUTS) DragController(com.android.launcher3.dragndrop.DragController) StatefulActivity(com.android.launcher3.statemanager.StatefulActivity) PackageUserKey(com.android.launcher3.util.PackageUserKey) Point(android.graphics.Point) DeepShortcutView(com.android.launcher3.shortcuts.DeepShortcutView) BaseDraggingActivity(com.android.launcher3.BaseDraggingActivity) LauncherState(com.android.launcher3.LauncherState) R(com.android.launcher3.R) AbstractFloatingView(com.android.launcher3.AbstractFloatingView) DragView(com.android.launcher3.dragndrop.DragView) DotInfo(com.android.launcher3.dot.DotInfo) ItemInfoWithIcon(com.android.launcher3.model.data.ItemInfoWithIcon) ItemInfo(com.android.launcher3.model.data.ItemInfo) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) Objects(java.util.Objects) Launcher(com.android.launcher3.Launcher)

Aggregations

Launcher (com.android.launcher3.Launcher)194 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)102 Test (org.junit.Test)102 View (android.view.View)87 LargeTest (androidx.test.filters.LargeTest)83 ItemInfo (com.android.launcher3.model.data.ItemInfo)83 Rect (android.graphics.Rect)80 Point (android.graphics.Point)77 Intent (android.content.Intent)71 ArrayList (java.util.ArrayList)69 DeviceProfile (com.android.launcher3.DeviceProfile)66 BaseQuickstepLauncher (com.android.launcher3.BaseQuickstepLauncher)64 Context (android.content.Context)61 LauncherAppWidgetInfo (com.android.launcher3.model.data.LauncherAppWidgetInfo)49 RecentsView (com.android.quickstep.views.RecentsView)46 DragLayer (com.android.launcher3.dragndrop.DragLayer)45 ComponentName (android.content.ComponentName)43 FolderInfo (com.android.launcher3.model.data.FolderInfo)42 ViewGroup (android.view.ViewGroup)41 AllApps (com.android.launcher3.tapl.AllApps)40