Java Code Examples for android.app.ActivityOptions#makeScaleUpAnimation()

The following examples show how to use android.app.ActivityOptions#makeScaleUpAnimation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppConfigActivity.java    From oversec with GNU General Public License v3.0 6 votes vote down vote up
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);
    }
}
 
Example 2
Source File: Launcher.java    From TurboLauncher with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: MoviesActivity.java    From udacity-p1-p2-popular-movies with MIT License 6 votes vote down vote up
@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);
    }
}
 
Example 4
Source File: ImageGridFragment.java    From android-DisplayingBitmaps with Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example 5
Source File: EncryptionParamsActivity.java    From oversec with GNU General Public License v3.0 5 votes vote down vote up
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);
    }

}
 
Example 6
Source File: LoginActivity.java    From Awesome-WanAndroid with Apache License 2.0 5 votes vote down vote up
private void startRegisterPager() {
    ActivityOptions options = ActivityOptions.makeScaleUpAnimation(mRegisterBtn,
            mRegisterBtn.getWidth() / 2,
            mRegisterBtn.getHeight() / 2,
            0 ,
            0);
    startActivity(new Intent(this, RegisterActivity.class), options.toBundle());
}
 
Example 7
Source File: NavigationAdapter.java    From Awesome-WanAndroid with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 8
Source File: HomeActivity.java    From openlauncher with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 9
Source File: PopupActivity.java    From MensaGuthaben with GNU General Public License v3.0 5 votes vote down vote up
@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());
}
 
Example 10
Source File: ActivityOptionsCompatJB.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
public static ActivityOptionsCompatJB makeScaleUpAnimation(View source,
        int startX, int startY, int startWidth, int startHeight) {
    return new ActivityOptionsCompatJB(
        ActivityOptions.makeScaleUpAnimation(source, startX, startY, startWidth, startHeight));
}
 
Example 11
Source File: ActivityOptionsCompatJB.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
public static ActivityOptionsCompatJB makeScaleUpAnimation(View source,
        int startX, int startY, int startWidth, int startHeight) {
    return new ActivityOptionsCompatJB(
        ActivityOptions.makeScaleUpAnimation(source, startX, startY, startWidth, startHeight));
}
 
Example 12
Source File: ActivityOptionsCompatJB.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
public static ActivityOptionsCompatJB makeScaleUpAnimation(View source,
        int startX, int startY, int startWidth, int startHeight) {
    return new ActivityOptionsCompatJB(
        ActivityOptions.makeScaleUpAnimation(source, startX, startY, startWidth, startHeight));
}
 
Example 13
Source File: ActivityOptionsCompatJB.java    From guideshow with MIT License 4 votes vote down vote up
public static ActivityOptionsCompatJB makeScaleUpAnimation(View source,
        int startX, int startY, int startWidth, int startHeight) {
    return new ActivityOptionsCompatJB(
        ActivityOptions.makeScaleUpAnimation(source, startX, startY, startWidth, startHeight));
}
 
Example 14
Source File: MainActivity.java    From codeexamples-android with Eclipse Public License 1.0 4 votes vote down vote up
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());
}
 
Example 15
Source File: MainActivity.java    From codeexamples-android with Eclipse Public License 1.0 4 votes vote down vote up
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());
}