Search in sources :

Example 86 with ActivityOptions

use of android.app.ActivityOptions in project android_frameworks_base by crdroidandroid.

the class PipOverlayActivity method showPipOverlay.

/**
     * Shows PIP overlay UI only if it's not there.
     */
static void showPipOverlay(Context context) {
    if (!sActivityCreated) {
        Intent intent = new Intent(context, PipOverlayActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        final ActivityOptions options = ActivityOptions.makeBasic();
        options.setLaunchStackId(PINNED_STACK_ID);
        context.startActivity(intent, options.toBundle());
    }
}
Also used : Intent(android.content.Intent) ActivityOptions(android.app.ActivityOptions)

Example 87 with ActivityOptions

use of android.app.ActivityOptions in project android_frameworks_base by crdroidandroid.

the class ActivityTransition method clicked.

public void clicked(View v) {
    mHero = (ImageView) v;
    Intent intent = new Intent(this, ActivityTransitionDetails.class);
    intent.putExtra(KEY_ID, v.getTransitionName());
    ActivityOptions activityOptions = ActivityOptions.makeSceneTransitionAnimation(this, mHero, "hero");
    startActivity(intent, activityOptions.toBundle());
}
Also used : Intent(android.content.Intent) ActivityOptions(android.app.ActivityOptions)

Example 88 with ActivityOptions

use of android.app.ActivityOptions in project android_frameworks_base by crdroidandroid.

the class AssistManager method startAssistActivity.

private void startAssistActivity(Bundle args, @NonNull ComponentName assistComponent) {
    if (!mBar.isDeviceProvisioned()) {
        return;
    }
    // Close Recent Apps if needed
    mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL | CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL);
    boolean structureEnabled = Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1, UserHandle.USER_CURRENT) != 0;
    final Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)).getAssistIntent(structureEnabled);
    if (intent == null) {
        return;
    }
    intent.setComponent(assistComponent);
    intent.putExtras(args);
    if (structureEnabled) {
        showDisclosure();
    }
    try {
        final ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, R.anim.search_launch_enter, R.anim.search_launch_exit);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        AsyncTask.execute(new Runnable() {

            @Override
            public void run() {
                mContext.startActivityAsUser(intent, opts.toBundle(), new UserHandle(UserHandle.USER_CURRENT));
            }
        });
    } catch (ActivityNotFoundException e) {
        Log.w(TAG, "Activity not found for " + intent.getAction());
    }
}
Also used : SearchManager(android.app.SearchManager) ActivityNotFoundException(android.content.ActivityNotFoundException) UserHandle(android.os.UserHandle) Intent(android.content.Intent) ActivityOptions(android.app.ActivityOptions)

Example 89 with ActivityOptions

use of android.app.ActivityOptions in project android_frameworks_base by crdroidandroid.

the class RecentsTvImpl method startRecentsActivity.

@Override
protected void startRecentsActivity(ActivityManager.RunningTaskInfo runningTask, boolean isHomeStackVisible, boolean animate, int growTarget) {
    RecentsTaskLoader loader = Recents.getTaskLoader();
    // the stacks might have changed.
    if (mTriggeredFromAltTab || sInstanceLoadPlan == null) {
        // Create a new load plan if preloadRecents() was never triggered
        sInstanceLoadPlan = loader.createLoadPlan(mContext);
    }
    if (mTriggeredFromAltTab || !sInstanceLoadPlan.hasTasks()) {
        loader.preloadTasks(sInstanceLoadPlan, runningTask.id, !isHomeStackVisible);
    }
    TaskStack stack = sInstanceLoadPlan.getTaskStack();
    if (!animate) {
        ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, -1, -1);
        startRecentsActivity(runningTask, opts, false, /* fromHome */
        false);
        return;
    }
    boolean hasRecentTasks = stack.getTaskCount() > 0;
    boolean useThumbnailTransition = (runningTask != null) && !isHomeStackVisible && hasRecentTasks;
    if (useThumbnailTransition) {
        // Try starting with a thumbnail transition
        ActivityOptions opts = getThumbnailTransitionActivityOptionsForTV(runningTask, stack.getTaskCount());
        if (opts != null) {
            startRecentsActivity(runningTask, opts, false, /* fromHome */
            true);
        } else {
            // Fall through below to the non-thumbnail transition
            useThumbnailTransition = false;
        }
    }
    if (!useThumbnailTransition) {
        startRecentsActivity(runningTask, null, true, /* fromHome */
        false);
    }
    mLastToggleTime = SystemClock.elapsedRealtime();
}
Also used : TaskStack(com.android.systemui.recents.model.TaskStack) RecentsTaskLoader(com.android.systemui.recents.model.RecentsTaskLoader) ActivityOptions(android.app.ActivityOptions)

Example 90 with ActivityOptions

use of android.app.ActivityOptions in project android_frameworks_base by crdroidandroid.

the class RecentsTvTransitionHelper method launchTaskFromRecents.

public void launchTaskFromRecents(final TaskStack stack, @Nullable final Task task, final TaskStackHorizontalGridView stackView, final TaskCardView taskView, final Rect bounds, int destinationStack) {
    final ActivityOptions opts = ActivityOptions.makeBasic();
    if (bounds != null) {
        opts.setLaunchBounds(bounds.isEmpty() ? null : bounds);
    }
    final ActivityOptions.OnAnimationStartedListener animStartedListener;
    if (task.thumbnail != null && task.thumbnail.getWidth() > 0 && task.thumbnail.getHeight() > 0) {
        animStartedListener = new ActivityOptions.OnAnimationStartedListener() {

            @Override
            public void onAnimationStarted() {
                // If we are launching into another task, cancel the previous task's
                // window transition
                EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
                EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
            }
        };
    } else {
        // This is only the case if the task is not on screen (scrolled offscreen for example)
        animStartedListener = new ActivityOptions.OnAnimationStartedListener() {

            @Override
            public void onAnimationStarted() {
                EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
            }
        };
    }
    if (taskView == null) {
        // If there is no task view, then we do not need to worry about animating out occluding
        // task views, and we can launch immediately
        startTaskActivity(stack, task, taskView, opts, animStartedListener);
    } else {
        LaunchTvTaskStartedEvent launchStartedEvent = new LaunchTvTaskStartedEvent(taskView);
        EventBus.getDefault().send(launchStartedEvent);
        startTaskActivity(stack, task, taskView, opts, animStartedListener);
    }
}
Also used : ActivityOptions(android.app.ActivityOptions)

Aggregations

ActivityOptions (android.app.ActivityOptions)178 Intent (android.content.Intent)88 RemoteException (android.os.RemoteException)33 Point (android.graphics.Point)30 RecentsTaskLoader (com.android.systemui.recents.model.RecentsTaskLoader)20 TaskStack (com.android.systemui.recents.model.TaskStack)20 PendingIntent (android.app.PendingIntent)18 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)15 ActivityManager (android.app.ActivityManager)14 ComponentName (android.content.ComponentName)13 ActivityInfo (android.content.pm.ActivityInfo)13 ResolveInfo (android.content.pm.ResolveInfo)12 UserHandle (android.os.UserHandle)12 Configuration (android.content.res.Configuration)10 ReferrerIntent (com.android.internal.content.ReferrerIntent)10 RecentsTaskLoadPlan (com.android.systemui.recents.model.RecentsTaskLoadPlan)10 Task (com.android.systemui.recents.model.Task)10 Bundle (android.os.Bundle)9 ActivityNotFoundException (android.content.ActivityNotFoundException)8 RecyclerView (android.support.v7.widget.RecyclerView)8