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