下面列出了android.app.ActivityOptions#makeScaleUpAnimation ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public static void show(Context ctx, String packagename, View source) {
Intent i = new Intent();
ActivityOptions opts = null;
if (source != null) {
opts = ActivityOptions.makeScaleUpAnimation(source, 0, 0, 0, 0);
}
i.setClass(ctx, AppConfigActivity.class);
i.putExtra(EXTRA_PACKAGENAME, packagename);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK
| Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
if (opts != null) {
ctx.startActivity(i, opts.toBundle());
} else {
ctx.startActivity(i);
}
}
boolean startActivity(View v, Intent intent, Object tag) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
// Only launch using the new animation if the shortcut has not opted
// out (this is a
// private contract between launcher and may be ignored in the
// future).
boolean useLaunchAnimation = (v != null)
&& !intent.hasExtra(INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION);
if (useLaunchAnimation) {
ActivityOptions opts = ActivityOptions.makeScaleUpAnimation(v,
0, 0, v.getMeasuredWidth(), v.getMeasuredHeight());
startActivity(intent, opts.toBundle());
} else {
startActivity(intent);
}
return true;
} catch (SecurityException e) {
Toast.makeText(this, R.string.activity_not_found,
Toast.LENGTH_SHORT).show();
}
return false;
}
@Override
public void onMovieClick(@Nullable View movieView, Movie movie) {
if (! mTwoPane) {
Intent intent = new Intent(this, MovieDetailsActivity.class);
intent.putExtra(BundleKeys.MOVIE, Movie.toParcelable(movie));
if (movieView != null) {
ActivityOptions opts = ActivityOptions.makeScaleUpAnimation(movieView, 0, 0,
movieView.getWidth(), movieView.getHeight());
startActivity(intent, opts.toBundle());
} else {
startActivity(intent);
}
} else {
showMovieDetails(movie);
}
}
@TargetApi(VERSION_CODES.JELLY_BEAN)
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
final Intent i = new Intent(getActivity(), ImageDetailActivity.class);
i.putExtra(ImageDetailActivity.EXTRA_IMAGE, (int) id);
if (Utils.hasJellyBean()) {
// makeThumbnailScaleUpAnimation() looks kind of ugly here as the loading spinner may
// show plus the thumbnail image in GridView is cropped. so using
// makeScaleUpAnimation() instead.
ActivityOptions options =
ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getWidth(), v.getHeight());
getActivity().startActivity(i, options.toBundle());
} else {
startActivity(i);
}
}
public static void show(Context ctx, String packagename, final CharSequence editText, final int nodeId, final boolean imeWasVisible, View source) {
Intent i = new Intent();
i.setClass(ctx, EncryptionParamsActivity.class);
i.putExtra(EXTRA_IME_WAS_VISIBLE, imeWasVisible);
i.putExtra(EXTRA_EDIT_NODE_ID, nodeId);
i.putExtra(EXTRA_MODE, MODE_DEFAULT);
i.putExtra(EXTRA_PACKAGENAME, packagename);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK
| Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
| Intent.FLAG_ACTIVITY_NO_USER_ACTION
);
//this should be called with _UN_encrypted text, so check first and if text is encrypted, open EncryptionInfo instead
try {
String s = editText == null ? null : editText.toString();
BaseDecryptResult aResult = Core.getInstance(ctx).getEncryptionHandler().decrypt(s, null);
if (aResult != null) {
EncryptionInfoActivity.Companion.show(ctx, packagename, editText.toString(), source);
}
} catch (final UserInteractionRequiredException e) {
EncryptionInfoActivity.Companion.show(ctx, packagename, editText.toString(), source);
return;
}
ActivityOptions opts = null;
if (source != null) {
opts = ActivityOptions.makeScaleUpAnimation(source, 0, 0, 0, 0);
}
if (opts != null) {
ctx.startActivity(i, opts.toBundle());
} else {
ctx.startActivity(i);
}
}
private void startRegisterPager() {
ActivityOptions options = ActivityOptions.makeScaleUpAnimation(mRegisterBtn,
mRegisterBtn.getWidth() / 2,
mRegisterBtn.getHeight() / 2,
0 ,
0);
startActivity(new Intent(this, RegisterActivity.class), options.toBundle());
}
private void startNavigationPager(View view, int position1, FlowLayout parent2, List<FeedArticleData> mArticles) {
ActivityOptions options = ActivityOptions.makeScaleUpAnimation(view,
view.getWidth() / 2,
view.getHeight() / 2,
0 ,
0);
JudgeUtils.startArticleDetailActivity(parent2.getContext(),
options,
mArticles.get(position1).getId(),
mArticles.get(position1).getTitle(),
mArticles.get(position1).getLink(),
mArticles.get(position1).isCollect(),
false,
false);
}
private Bundle getActivityAnimationOpts(View view) {
Bundle bundle = null;
if (view == null) {
return null;
}
ActivityOptions options = null;
if (VERSION.SDK_INT >= 23) {
int left = 0;
int top = 0;
int width = view.getMeasuredWidth();
int height = view.getMeasuredHeight();
if (view instanceof AppItemView) {
width = (int) ((AppItemView) view).getIconSize();
left = (int) ((AppItemView) view).getDrawIconLeft();
top = (int) ((AppItemView) view).getDrawIconTop();
}
options = ActivityOptions.makeClipRevealAnimation(view, left, top, width, height);
} else if (VERSION.SDK_INT < 21) {
options = ActivityOptions.makeScaleUpAnimation(view, 0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
}
if (options != null) {
bundle = options.toBundle();
}
return bundle;
}
@TargetApi(16)
private void animateActivity16(Intent intent) {
View root = findViewById(R.id.popupRoot);
ActivityOptions options = ActivityOptions.makeScaleUpAnimation(root,root.getLeft(), root.getTop(), root.getWidth(), root.getHeight());
startActivity(intent, options.toBundle());
}
public static ActivityOptionsCompatJB makeScaleUpAnimation(View source,
int startX, int startY, int startWidth, int startHeight) {
return new ActivityOptionsCompatJB(
ActivityOptions.makeScaleUpAnimation(source, startX, startY, startWidth, startHeight));
}
public static ActivityOptionsCompatJB makeScaleUpAnimation(View source,
int startX, int startY, int startWidth, int startHeight) {
return new ActivityOptionsCompatJB(
ActivityOptions.makeScaleUpAnimation(source, startX, startY, startWidth, startHeight));
}
public static ActivityOptionsCompatJB makeScaleUpAnimation(View source,
int startX, int startY, int startWidth, int startHeight) {
return new ActivityOptionsCompatJB(
ActivityOptions.makeScaleUpAnimation(source, startX, startY, startWidth, startHeight));
}
public static ActivityOptionsCompatJB makeScaleUpAnimation(View source,
int startX, int startY, int startWidth, int startHeight) {
return new ActivityOptionsCompatJB(
ActivityOptions.makeScaleUpAnimation(source, startX, startY, startWidth, startHeight));
}
public void onClick(View view) {
Intent intent = new Intent(this, SecondActivity.class);
ActivityOptions options = ActivityOptions.makeScaleUpAnimation(view, 0,
0, view.getWidth(), view.getHeight());
startActivity(intent, options.toBundle());
}
public void onClick(View view) {
Intent intent = new Intent(this, SecondActivity.class);
ActivityOptions options = ActivityOptions.makeScaleUpAnimation(view, 0,
0, view.getWidth(), view.getHeight());
startActivity(intent, options.toBundle());
}