Example usage for android.app ActivityOptions makeScaleUpAnimation

List of usage examples for android.app ActivityOptions makeScaleUpAnimation

Introduction

In this page you can find the example usage for android.app ActivityOptions makeScaleUpAnimation.

Prototype

public static ActivityOptions makeScaleUpAnimation(View source, int startX, int startY, int width, int height) 

Source Link

Document

Create an ActivityOptions specifying an animation where the new activity is scaled from a small originating area of the screen to its final full representation.

Usage

From source file:net.sf.diningout.app.ui.NotificationsActivity.java

@Override
public void onNotificationClick(View view, Type syncType, long id, Review.Type reviewType) {
    switch (syncType) {
    case USER:/*from w  w  w  .j  av  a2  s .c  o m*/
        startActivity(new Intent(this, FriendsActivity.class));
        overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
        break;
    case REVIEW:
        RestaurantActivity.sPlaceholder = ((NotificationHolder) ViewHolder.get(view)).mPhoto.getDrawable();
        Intent intent = new Intent(this, RestaurantActivity.class).putExtra(EXTRA_ID, id);
        if (reviewType == GOOGLE) {
            intent.putExtra(EXTRA_TAB, TAB_PUBLIC);
        }
        startActivity(intent,
                ActivityOptions.makeScaleUpAnimation(view, 0, 0, view.getWidth(), view.getHeight()).toBundle());
        break;
    }
}

From source file:com.uwetrottmann.movies.ui.MoviesFragment.java

@TargetApi(16)
@Override/* ww  w . ja v  a  2 s  .c  om*/
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
    Movie movie = (Movie) parent.getItemAtPosition(position);
    if (movie != null && movie.id != null) {
        // display details about this movie in a new activity
        Intent i = new Intent(getActivity(), MovieDetailsActivity.class);
        i.putExtra(MovieDetailsFragment.InitBundle.TMDBID, movie.id);
        if (AndroidUtils.isJellyBeanOrHigher()) {
            Bundle options = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getWidth(), v.getHeight())
                    .toBundle();
            getActivity().startActivity(i, options);
        } else {
            startActivity(i);
        }
    }
}

From source file:com.uwetrottmann.movies.ui.LocalMoviesFragment.java

@TargetApi(16)
@Override/*from   www.ja  v  a 2  s  .c o  m*/
public void onListItemClick(ListView l, View v, int position, long id) {
    Cursor movie = (Cursor) l.getItemAtPosition(position);
    if (movie != null) {
        final int tmdbId = movie.getInt(MoviesQuery.TMDBID);
        if (tmdbId != 0) {
            // display details about this movie in a new activity
            Intent i = new Intent(getActivity(), MovieDetailsActivity.class);
            i.putExtra(MovieDetailsFragment.InitBundle.TMDBID, tmdbId);
            if (AndroidUtils.isJellyBeanOrHigher()) {
                Bundle options = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getWidth(), v.getHeight())
                        .toBundle();
                getActivity().startActivity(i, options);
            } else {
                startActivity(i);
            }
        }
    }
}

From source file:com.brkc.traffic.ui.image.ImageListFragment.java

@TargetApi(VERSION_CODES.JELLY_BEAN)
@Override/*from  w w w.j a v  a 2 s.  c o  m*/
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
    Log.d(TAG, "v=" + v.getId() + ",id=" + id + ",position=" + position);
    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);
    }
}

From source file:uk.org.downiesoft.slideshow.GridViewFragment.java

/**
 * {@inheritDoc}//from   www  . ja  va  2 s.  c  om
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    SlideShowActivity.debug(1, TAG, "onCreateView: %d %s", mCurrentImage,
            savedInstanceState == null ? "null" : savedInstanceState.toString());
    View parent = inflater.inflate(R.layout.gridview_fragment, container, false);
    mGridView = (GridView) parent.findViewById(R.id.gridview);
    mGridView.setEmptyView(parent.findViewById(R.id.emtpygridview));
    mProgressBar = (ProgressBar) parent.findViewById(R.id.gridviewProgressBar);
    mThumbSize = getThumbSizeSetting();
    mGridView.setColumnWidth(mThumbSize);
    mPreview = (PreviewFragment) getFragmentManager().findFragmentByTag(PreviewFragment.TAG);
    setHasOptionsMenu(true);
    // define actions to be taken when a thumbnail is clicked
    mGridView.setOnItemClickListener(new GridView.OnItemClickListener() {
        /**
         * {@inheritDoc}
         */
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (mPreview == null || mGridView.getChoiceMode() == ListView.CHOICE_MODE_NONE) {
                // Preview not visible so switch to slidshow view
                mCurrentImage = position;
                mGridView.setItemChecked(position, true);
                ActivityOptions options = ActivityOptions.makeScaleUpAnimation(mGridView, (int) view.getX(),
                        (int) view.getY(), view.getWidth(), view.getHeight());
                startSlideshow(mCurrentFile, position, false, options);
            } else {
                // Preview visible so action depends on which icon was clicked
                if (mCurrentImage == position) {
                    // currently selected icon so switch to slideshow view
                    ActivityOptions options = ActivityOptions.makeScaleUpAnimation(mGridView, (int) view.getX(),
                            (int) view.getY(), view.getWidth(), view.getHeight());
                    startSlideshow(mCurrentFile, position, false, options);
                } else {
                    // different icon so select it
                    mCurrentImage = position;
                    mCurrentScrollY = mGridView.getFirstVisiblePosition();
                    mGridView.setItemChecked(position, true);
                    mPreview.setImage(mCurrentImage);
                }
            }
        }

    });
    mGridView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
        /**
         * {@inheritDoc}
         */
        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            // begin action mode
            mGridView.setMultiChoiceModeListener(new GridViewMultiChoiceModeListener());
            mGridView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
            mGridView.setItemChecked(position, true);
            return true;
        }
    });
    if (savedInstanceState != null) {
        SlideShowActivity.debug(1, TAG, "savedInstance: %s", savedInstanceState.toString());
        mShowingFavourites = savedInstanceState.getBoolean("showingFavourites");
        mCurrentFile = new ZFile(savedInstanceState.getString("currentFile", ""));
        if (mCurrentFile.toString().endsWith(getString(R.string.text_images_placeholder))) {
            mCurrentFile = new ZFile(mCurrentFile.getParentPath());
        }
        mCurrentImage = savedInstanceState.getInt("currentImage", 0);
        mPreviousFile = new ZFile(savedInstanceState.getString("previousFile"));
        if (mThumbnailAdapter == null) {
            mThumbnailAdapter = new ThumbnailAdapter(getActivity(), mCurrentFile, mCurrentImage, mThumbSize,
                    this);
        }
    } else {
        String defaultPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)
                .toString();
        mCurrentFile = new ZFile(mSettings.getString(SettingsActivity.PREFS_LASTDIR, defaultPath));
        if (mCurrentFile.toString().endsWith(getString(R.string.text_images_placeholder))) {
            mCurrentFile = new ZFile(mCurrentFile.getParentPath());
        }
        if (!mCurrentFile.exists()) {
            mCurrentFile = new ZFile(defaultPath);
            mCurrentImage = mSettings.getInt(SettingsActivity.PREFS_CURRENTIMAGE, 0);
        }
        mPreviousFile = mCurrentFile;
        mThumbnailAdapter = new ThumbnailAdapter(getActivity(), mCurrentFile, mCurrentImage, mThumbSize, this);
    }
    mFavourites = FavouritesManager.getInstance(getActivity());
    if (savedInstanceState != null) {
        SlideShowActivity.debug(1, TAG, "onCreateView: %s", savedInstanceState.toString());
        mCurrentImage = savedInstanceState.getInt("currentImage", 0);
    }
    SlideShowActivity.debug(1, TAG, "onCreateView end: %d", mCurrentImage);
    return parent;
}

From source file:com.vbehl.connections.ui.ImageGridFragment.java

@TargetApi(16)
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 {/*  ww w  .  j av  a  2  s. co  m*/
        startActivity(i);
    }
}

From source file:com.ces.cloudnote.app.bitmapfun.ui.ImageGridFragment.java

@TargetApi(16)
@Override/*from w  w  w.ja v  a  2s . c o  m*/
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);
    }
}

From source file:com.bluetech.gallery5.ui.ImageGridFragment.java

@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);
    i.putExtra("PATH", this.path);

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

From source file:com.sughimura.samplebitmaps.ui.ImageGridFragment.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override/*from www . ja  v a2  s  . co  m*/
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);
    }
}

From source file:com.volley.demo.SimpleCacheFragment.java

@TargetApi(VERSION_CODES.JELLY_BEAN)
@Override//from   w ww .  j ava2s  . c  o m
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);
    }
}