android.support.v4.app.ActivityOptionsCompat Java Examples

The following examples show how to use android.support.v4.app.ActivityOptionsCompat. 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: MyRecyclerViewAdapter.java    From Android-Animation-Set with Apache License 2.0 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
    holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ActivityOptionsCompat activityOptionsCompat;
            if (holder.getAdapterPosition() % 2 == 0) {
                Pair<View, String> pair1 = new Pair<View, String>(holder.mImageView, mContext.getString(R.string.share_element_imageview));
                Pair<View, String> pair2 = new Pair<View, String>(holder.mHeader, mContext.getString(R.string.share_element_header));
                Pair<View, String> pair3 = new Pair<View, String>(holder.mTextView, mContext.getString(R.string.share_element_tv_info));
                activityOptionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(((Activity) mContext), pair1, pair2, pair3);
            } else {
                final Pair<View, String>[] pairs = TransitionHelper.createSafeTransitionParticipants(
                        ((Activity) mContext), true,
                        new Pair<>(holder.mImageView, mContext.getString(R.string.share_element_imageview)),
                        new Pair<>(holder.mHeader, mContext.getString(R.string.share_element_header)),
                        new Pair<>(holder.mTextView, mContext.getString(R.string.share_element_tv_info)));
                activityOptionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(((Activity) mContext), pairs);
            }

            Intent intent = new Intent(mContext, ShareElementsActivity.class);
            mContext.startActivity(intent, activityOptionsCompat.toBundle());
        }
    });
}
 
Example #2
Source File: separadorbraga.java    From LuxVilla with Apache License 2.0 6 votes vote down vote up
@Override
public void onClickListener(View view, int position) {
    List<listacasas> casas;
    casas = ids;
    listacasas cs = casas.get(position);
    Intent infocasa = new Intent(getActivity(), casaactivity.class);
    infocasa.putExtra("localcasa", cs.Local);
    infocasa.putExtra("precocasa", cs.Preço);
    infocasa.putExtra("imgurl", cs.IMGurl);
    infocasa.putExtra("infocs", cs.info);
    infocasa.putExtra("csid",cs.idcs);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        View iv = view.findViewById(R.id.imgcasa);
        ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), Pair.create(iv, "elementimg"));
        getActivity().startActivity(infocasa, optionsCompat.toBundle());
    } else {
        startActivity(infocasa);
    }
}
 
Example #3
Source File: DeviceOperationActivity.java    From ESeal with Apache License 2.0 6 votes vote down vote up
private void performTakePictureWithTransition(View v) {
        Activity activity = DeviceOperationActivity.this;

        final int[] startLocation = new int[2];
        v.getLocationOnScreen(startLocation);
        startLocation[0] += v.getWidth() / 2;

        if (v == null || ApiLevelHelper.isLowerThan(Build.VERSION_CODES.LOLLIPOP)) {
            TakePictueActivity.start(activity, startLocation);
            return;
        }
        if (ApiLevelHelper.isAtLeast(Build.VERSION_CODES.LOLLIPOP)) {
//            ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeBasic();
            ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeScaleUpAnimation(v,
                    startLocation[0],
                    startLocation[1],
                    0,
                    0);
            TakePictueActivity.start(activity, startLocation, optionsCompat);
        }
    }
 
Example #4
Source File: NfcDeviceFragment.java    From ESeal with Apache License 2.0 6 votes vote down vote up
private void performTakePictureWithTransition(View v) {
        Activity activity = getActivity();

        final int[] startLocation = new int[2];
        v.getLocationOnScreen(startLocation);
        startLocation[0] += v.getWidth() / 2;

        if (v == null || ApiLevelHelper.isLowerThan(Build.VERSION_CODES.LOLLIPOP)) {
            TakePictueActivity.start(activity, startLocation);
            return;
        }
        if (ApiLevelHelper.isAtLeast(Build.VERSION_CODES.LOLLIPOP)) {
//            ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeBasic();
            ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeScaleUpAnimation(v,
                    startLocation[0],
                    startLocation[1],
                    0,
                    0);
            TakePictueActivity.start(activity, startLocation, optionsCompat);
        }
    }
 
Example #5
Source File: JokeImageListRecyclerAdapter.java    From TouchNews with Apache License 2.0 6 votes vote down vote up
@Override
    public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) {
        if (holder instanceof MViewHolder) {
            JokeImageRoot.Contentlist contentEntity = mData.get(position);
            ((MViewHolder) holder).mTitle.setText(contentEntity.getTitle());
            final ImageView imageView = ((MViewHolder) holder).mImage;
            ImageUtil.displayImage(mContext, contentEntity.getImg(), imageView);

            imageView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(mContext, ImageBrowseActivity.class);
                    intent.putExtra("url", mData.get(position).getImg());
//                     View transitionView = view.findViewById(R.id.ivNews);
                    ActivityOptionsCompat options =
                        ActivityOptionsCompat.makeSceneTransitionAnimation((HomeActivity) mContext,
                            imageView, mContext.getString(R.string.transition__img));

                    ActivityCompat.startActivity((HomeActivity) mContext, intent, options.toBundle());

                }
            });
        }
    }
 
Example #6
Source File: SearchWidgetProvider.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
static void startSearchActivity(Intent intent, boolean startVoiceSearch) {
    Log.d(TAG, "Launching SearchActivity: VOICE=" + startVoiceSearch);
    Context context = getDelegate().getContext();

    // Abort if the user needs to go through First Run.
    if (FirstRunFlowSequencer.launch(context, intent, true)) return;

    // Launch the SearchActivity.
    Intent searchIntent = new Intent();
    searchIntent.setClass(context, SearchActivity.class);
    searchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    searchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
    searchIntent.putExtra(EXTRA_START_VOICE_SEARCH, startVoiceSearch);

    Bundle optionsBundle =
            ActivityOptionsCompat.makeCustomAnimation(context, R.anim.activity_open_enter, 0)
                    .toBundle();
    IntentUtils.safeStartActivity(context, searchIntent, optionsBundle);
}
 
Example #7
Source File: MainActivity.java    From materialize with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onItemClick(AppInfoAdapter.ViewHolder holder) {
    int index = holder.getLayoutPosition();
    AppInfo app = apps.data.get(index);

    Intent intent = new Intent(this, AdjustActivity.class);
    intent.putExtra("index", index);
    intent.putExtra("activity", app.activityInfo);

    int y = Build.VERSION.SDK_INT >= 23
            ? (int) (getResources().getDisplayMetrics().heightPixels * 0.16f)
            : 0;

    ActivityOptionsCompat options = ActivityOptionsCompatCompat.makeClipRevealAnimation(
            holder.itemView, 0, -y, holder.itemView.getWidth(), holder.itemView.getHeight());

    ActivityCompat.startActivityForResult(this, intent, REQUEST_MAKE_ICON, options.toBundle());
}
 
Example #8
Source File: ReactNativeIntents.java    From native-navigation with MIT License 6 votes vote down vote up
static Bundle getSharedElementOptionsBundle(
        Activity activity, Intent intent, @Nullable ReadableMap options) {
  ViewGroup transitionGroup = null;
  if (activity instanceof ReactInterface && options != null &&
          options.hasKey(SHARED_ELEMENT_TRANSITION_GROUP_OPTION)) {
    ReactRootView reactRootView = ((ReactInterface) activity).getReactRootView();
    transitionGroup = ViewUtils.findViewGroupWithTag(
            reactRootView,
            R.id.react_shared_element_group_id,
            options.getString(SHARED_ELEMENT_TRANSITION_GROUP_OPTION));
  }

  if (transitionGroup == null) {
    // Even though there is no transition group, we want the activity options to include a scene
    // transition so that we can postpone the enter transition.
    //noinspection unchecked
    return ActivityOptionsCompat.makeSceneTransitionAnimation(activity).toBundle();
  } else {
    ReactNativeUtils.setIsSharedElementTransition(intent);
    return AutoSharedElementCallback.getActivityOptionsBundle(activity, transitionGroup);
  }
}
 
Example #9
Source File: HomeActivity.java    From Movie-Check with Apache License 2.0 6 votes vote down vote up
@Override
public void showLoggedUser(User user) {
    textViewGoogleSignIn.setVisibility(View.GONE);
    linearLayoutUser.setVisibility(View.VISIBLE);
    textViewUserName.setText(user.getName());
    Picasso.with(this).load(user.getPhotoUrl()).transform(new PicassoCircleTransform()).into(imageViewUserPhoto);

    MenuItem menuItemDiscovery = navigationView.getMenu().getItem(1);
    menuItemDiscovery.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            startActivity(DiscoveryActivity.newIntent(HomeActivity.this), ActivityOptionsCompat.makeSceneTransitionAnimation(HomeActivity.this).toBundle());
            return true;
        }
    });
    SpannableString spannableString = new SpannableString(getString(R.string.discoveryactivity_title));
    spannableString.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.gray_dark)), 0, spannableString.length(), 0);
    menuItemDiscovery.setTitle(spannableString);
}
 
Example #10
Source File: SignInFragment.java    From android-topeka with Apache License 2.0 6 votes vote down vote up
private void performSignInWithTransition(View v) {
    final Activity activity = getActivity();
    if (v == null || ApiLevelHelper.isLowerThan(Build.VERSION_CODES.LOLLIPOP)) {
        // Don't run a transition if the passed view is null
        CategorySelectionActivity.start(activity, mPlayer);
        activity.finish();
        return;
    }

    if (ApiLevelHelper.isAtLeast(Build.VERSION_CODES.LOLLIPOP)) {
        activity.getWindow().getSharedElementExitTransition().addListener(
                new TransitionListenerAdapter() {
                    @Override
                    public void onTransitionEnd(Transition transition) {
                        activity.finish();
                    }
                });

        final Pair[] pairs = TransitionHelper.createSafeTransitionParticipants(activity, true,
                new Pair<>(v, activity.getString(R.string.transition_avatar)));
        @SuppressWarnings("unchecked")
        ActivityOptionsCompat activityOptions = ActivityOptionsCompat
                .makeSceneTransitionAnimation(activity, pairs);
        CategorySelectionActivity.start(activity, mPlayer, activityOptions);
    }
}
 
Example #11
Source File: TodoListActivity.java    From todo-android with Apache License 2.0 6 votes vote down vote up
@OnItemLongClick(R.id.todo_list_listview)
boolean onItemLongClick(int position, View view) {
    Todo todo = adapter.getItem(position);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Pair<View, String> pair =
                new Pair<>(view.findViewById(R.id.item_todo_textview), getString(R.string.transition_name_todo_name));
        ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this, pair);

        startActivity(TodoCreateActivity.createIntent(this, todo.getId()), options.toBundle());
    } else {
        startActivity(TodoCreateActivity.createIntent(this, todo.getId()));
    }

    return true;
}
 
Example #12
Source File: MovieDetailsFragment.java    From BuildingForAndroidTV with MIT License 6 votes vote down vote up
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Movie movie = (Movie) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), MovieDetailsActivity.class);
        intent.putExtra(MovieDetailsActivity.MOVIE, movie);

        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                MovieDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
 
Example #13
Source File: separadoraveiro.java    From LuxVilla with Apache License 2.0 6 votes vote down vote up
@Override
public void onClickListener(View view, int position) {
    List<listacasas> casas;
    casas = ids;
    listacasas cs = casas.get(position);
    Intent infocasa = new Intent(getActivity(), casaactivity.class);
    infocasa.putExtra("localcasa", cs.Local);
    infocasa.putExtra("precocasa", cs.Preço);
    infocasa.putExtra("imgurl", cs.IMGurl);
    infocasa.putExtra("infocs", cs.info);
    infocasa.putExtra("csid",cs.idcs);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        View iv = view.findViewById(R.id.imgcasa);
        ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), Pair.create(iv, "elementimg"));
        getActivity().startActivity(infocasa, optionsCompat.toBundle());
    } else {
        startActivity(infocasa);
    }
}
 
Example #14
Source File: TableFragment.java    From android-periodic-table with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onItemClick(PeriodicTableView parent, View view, int position) {
    TableItem item = mAdapter.getItem(position);

    if (item instanceof TableElementItem) {
        parent.setEnabled(false);

        Intent intent = new Intent(getActivity(), PropertiesActivity.class);
        intent.putExtra(PropertiesActivity.EXTRA_ATOMIC_NUMBER,
                ((TableElementItem) item).getNumber());

        ActivityCompat.startActivity(getActivity(), intent,
                ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), view,
                        getString(R.string.transition_table_item)).toBundle());
    }
}
 
Example #15
Source File: ImageAdapter.java    From Ency with Apache License 2.0 6 votes vote down vote up
@Override
public Object instantiateItem(ViewGroup container, final int position) {
    final ImageView imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    if (isPTP && AppNetWorkUtil.getNetworkType(context) == AppNetWorkUtil.TYPE_MOBILE) {
        ImageLoader.loadDefault(context,imageView);
    } else {
        ImageLoader.loadAllAsBitmap(context,imgs.get(position),R.drawable.icon_default,imageView);
    }
    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(context, ImageActivity.class);
            intent.putExtra("imgurl", imgs.get(position));
            ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context, imageView, context.getString(R.string.transition_img));
            ActivityCompat.startActivity(context, intent, options.toBundle());
        }
    });
    container.addView(imageView);
    return imageView;
}
 
Example #16
Source File: KernelCardView.java    From kernel_adiutor with Apache License 2.0 6 votes vote down vote up
public KernelCardView(Context context, @NonNull final Downloads.KernelContent kernelContent) {
    super(context, R.layout.kernel_cardview);

    Utils.loadImagefromUrl(kernelContent.getLogo(), logoView);

    nameView.setText(Html.fromHtml(kernelContent.getName()));
    nameView.setMovementMethod(LinkMovementMethod.getInstance());

    descriptionView.setText(Html.fromHtml(kernelContent.getShortDescription()));
    descriptionView.setMovementMethod(LinkMovementMethod.getInstance());

    setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent i = new Intent(getContext(), KernelActivity.class);
            Bundle bundle = new Bundle();
            bundle.putString(KernelActivity.KERNEL_JSON_ARG, kernelContent.getJSON());
            i.putExtras(bundle);

            ActivityOptionsCompat activityOptions =
                    ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) getContext(),
                            logoView, KernelActivity.LOGO_ARG);
            ActivityCompat.startActivity((Activity) getContext(), i, activityOptions.toBundle());
        }
    });
}
 
Example #17
Source File: MainActivity.java    From Wrox-ProfessionalAndroid-4E with Apache License 2.0 6 votes vote down vote up
private void listing12_5(Context context) {
  TextView userNameView = findViewById(R.id.username_view);
  ImageView avatarView = findViewById(R.id.avatar_view);

  // Listing 12-5: Initiating a shared element Activity transition
  Intent intent = new Intent(context, SecondActivity.class);

  Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
    this,
    Pair.create((View) avatarView,
      ViewCompat.getTransitionName(avatarView)),
    Pair.create((View) userNameView,
      ViewCompat.getTransitionName(userNameView))
  ).toBundle();

  startActivity(intent, bundle);
}
 
Example #18
Source File: NewsListFragment.java    From SimpleNews with Apache License 2.0 6 votes vote down vote up
@Override
public void onItemClick(View view, int position) {
    if (mData.size() <= 0) {
        return;
    }
    NewsBean news = mAdapter.getItem(position);
    Intent intent = new Intent(getActivity(), NewsDetailActivity.class);
    intent.putExtra("news", news);

    View transitionView = view.findViewById(R.id.ivNews);
    ActivityOptionsCompat options =
            ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),
                    transitionView, getString(R.string.transition_news_img));

    ActivityCompat.startActivity(getActivity(), intent, options.toBundle());
}
 
Example #19
Source File: ConditionalAlbumListFragment.java    From PainlessMusicPlayer with Apache License 2.0 6 votes vote down vote up
private void onQueueLoaded(@NonNull final List<Media> queue,
                           @Nullable final View itemView,
                           @Nullable final String queueName) {
    if (queue.isEmpty()) {
        onQueueEmpty();
    } else {
        final Activity activity = getActivity();
        if (activity != null) {
            final Intent intent = Henson.with(activity).gotoQueueActivity()
                    .hasCoverTransition(false)
                    .hasItemViewTransition(false)
                    .isNowPlayingQueue(false)
                    .queue(queue)
                    .title(queueName)
                    .build();

            Bundle options = null;
            if (itemView != null) {
                options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, itemView,
                        QueueActivity.TRANSITION_NAME_ROOT).toBundle();
            }

            startActivity(intent, options);
        }
    }
}
 
Example #20
Source File: MainActivity.java    From AndroidBlueprints with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    if (id == android.R.id.home) {
        //TODO: This is for sub activities, don't use for MainActivity
        //super.onBackPressed();
        //return true;
    } else if (id == R.id.action_settings) {
        Intent intent = new Intent(this, SettingsActivity.class);
        ActivityOptionsCompat activityOptionsCompat = ActivityOptionsCompat.makeBasic();
        ActivityCompat.startActivity(this, intent, activityOptionsCompat.toBundle());
    }

    return super.onOptionsItemSelected(item);
}
 
Example #21
Source File: MovieLibraryFragment.java    From Mizuu with Apache License 2.0 6 votes vote down vote up
private void viewMovieDetails(int position, View view) {
    Intent intent = new Intent();
    if (mMovieLoader.getType() == MovieLibraryType.COLLECTIONS) { // Collection
        intent.putExtra("collectionId", mAdapter.getItem(position).getCollectionId());
        intent.putExtra("collectionTitle", mAdapter.getItem(position).getCollection());
        intent.setClass(mContext, MovieCollection.class);
        startActivity(intent);
    } else {
        intent.putExtra("tmdbId", mAdapter.getItem(position).getTmdbId());
        intent.setClass(mContext, MovieDetails.class);

        if (view != null) {
            Pair<View, String> pair = new Pair<>(view.findViewById(R.id.cover), "cover");
            ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), pair);
            ActivityCompat.startActivityForResult(getActivity(), intent, 0, options.toBundle());
        } else {
            startActivityForResult(intent, 0);
        }
    }
}
 
Example #22
Source File: CommitDetailActivity.java    From OpenHub with GNU General Public License v3.0 5 votes vote down vote up
public static void show(@NonNull Activity activity, @NonNull String user, @NonNull String repo,
                        @NonNull RepoCommit commit, @NonNull View userAvatar) {
    Intent intent = new Intent(activity, CommitDetailActivity.class);
    intent.putExtras(BundleHelper.builder().put("user", user).put("repo", repo)
            .put("commit", commit).build());
    ActivityOptionsCompat optionsCompat = ActivityOptionsCompat
            .makeSceneTransitionAnimation(activity, userAvatar, "userAvatar");
    activity.startActivity(intent, optionsCompat.toBundle());
}
 
Example #23
Source File: Launcher.java    From materialup with Apache License 2.0 5 votes vote down vote up
public static void openPhoteView(Activity activity, Post shot, View view) {
    Intent intent = new Intent(activity, PhotoActivity.class);

    intent.putExtra(EXTRA_URL, shot.getImageUrl());
    intent.putExtra(EXTRA_TITLE, shot.getTitle());
    intent.putExtra(EXTRA_PRE_URL, shot.getTeaserUrl());
    String name = activity.getString(R.string.transition_shot);
    ViewCompat.setTransitionName(view, name);
    ActivityOptionsCompat options =
            ActivityOptionsCompat.makeSceneTransitionAnimation(activity,
                    Pair.create(view, name));

    ActivityCompat.startActivity(activity, intent, options.toBundle());
}
 
Example #24
Source File: Navigator.java    From yahnac with Apache License 2.0 5 votes vote down vote up
public void toComments(View v, Story story) {
    ActivityOptionsCompat activityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(
            activity, new Pair<>(v, CommentsPresenter.VIEW_NAME_HEADER_TITLE)
    );

    Intent commentIntent = new Intent(activity, CommentsActivity.class);
    commentIntent.putExtra(CommentsActivity.ARG_STORY, story);

    ActivityCompat.startActivity(activity, commentIntent, activityOptions.toBundle());
}
 
Example #25
Source File: ListNowPlayingMoviesActivity.java    From Movie-Check with Apache License 2.0 5 votes vote down vote up
@Override
public void showMovies(final List<Movie> newMovieList) {
    if (movieList == null) {
        movieList = newMovieList;
    } else {
        movieList.addAll(newMovieList);
    }
    linearLayoutAnyFounded.setVisibility(View.GONE);
    linearLayoutLoadFailed.setVisibility(View.GONE);
    recyclerViewMovies.setVisibility(View.VISIBLE);
    final GridLayoutManager layoutManager = new GridLayoutManager(this, columns, GridLayoutManager.VERTICAL, false);
    recyclerViewMovies.setLayoutManager(layoutManager);
    recyclerViewMovies.setItemAnimator(new DefaultItemAnimator());
    listViewAdapter = new ListViewAdapterWithPagination(
            new NowPlayingMovieListAdapter(movieList, new OnItemClickListener<Movie>() {
                @Override
                public void onClick(Movie movie, View view) {
                    startActivity(MovieProfileActivity.newIntent(ListNowPlayingMoviesActivity.this, movie), ActivityOptionsCompat.makeSceneTransitionAnimation(ListNowPlayingMoviesActivity.this, view.findViewById(R.id.imageview_backdrop), "movieBackdrop").toBundle());
                }

                @Override
                public void onLongClick(Movie movie, View view) {

                }
            }),
            new OnShowMoreListener() {
                @Override
                public void showMore() {
                    scrollToItem = layoutManager.findFirstVisibleItemPosition();
                    presenter.loadMovies(++page);
                }
            },
            itensPerPage);
    recyclerViewMovies.setAdapter(listViewAdapter);
    recyclerViewMovies.scrollToPosition(scrollToItem);
}
 
Example #26
Source File: DetailActivity.java    From Dashboard with MIT License 5 votes vote down vote up
public static void launch(BaseActivity activity, View transitionView, String url) {
    ActivityOptionsCompat options =
            ActivityOptionsCompat.makeSceneTransitionAnimation(
                    activity, transitionView, EXTRA_IMAGE);
    Intent intent = new Intent(activity, DetailActivity.class);
    intent.putExtra(EXTRA_IMAGE, url);
    ActivityCompat.startActivity(activity, intent, options.toBundle());
}
 
Example #27
Source File: PaperFragment.java    From DelegateAdapter with Apache License 2.0 5 votes vote down vote up
@Override
public void onViewEvent(int eventCode, View view, Photo t, Bundle bundle, PhotoHolder viewHolder,
                        int position, DelegateAdapter adapter) {
    Intent it = new Intent(getContext(), PhotoActivity.class);
    ActivityOptionsCompat optionsCompat =
            ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),
                    view, getString(R.string.translation_name_photo));
    it.putExtra("photo", t);
    startActivity(it, optionsCompat.toBundle());
}
 
Example #28
Source File: ConfigurationActivity.java    From Noyze with Apache License 2.0 5 votes vote down vote up
private void launchAbout(View view) {
    Intent about = new Intent(getApplicationContext(), NoyzeLibActivity.class);
    about.putExtra(Libs.BUNDLE_FIELDS, Libs.toStringArray(R.string.class.getFields()));
    about.putExtra(Libs.BUNDLE_VERSION, true);
    about.putExtra(Libs.BUNDLE_LICENSE, true);
    about.putExtra(Libs.BUNDLE_TITLE, getString(R.string.about_settings));
    about.putExtra(Libs.BUNDLE_THEME, R.style.AboutTheme);
    if (null == view) {
        startActivity(about);
    } else {
        ActivityOptionsCompat anim = ActivityOptionsCompat.makeSceneTransitionAnimation(this, view, "Google Plus");
        ActivityCompat.startActivity(this, about, anim.toBundle());
    }
}
 
Example #29
Source File: SectionActivity.java    From Villains-and-Heroes with Apache License 2.0 5 votes vote down vote up
public static void start(Activity activity, @SectionVO.Type int type, View heroView, String attribution, List<SectionVO> entries, int position) {

        ActivityOptionsCompat options = ActivityOptionsCompat
                .makeSceneTransitionAnimation(activity,
                        heroView, ViewCompat.getTransitionName(heroView));
        Intent intent = new Intent(activity, SectionActivity.class);
        intent.putExtra(EXTRA_TYPE, type);
        intent.putExtra(EXTRA_ATTRIBUTION, attribution);
        intent.putExtra(EXTRA_ENTRIES, (Serializable) entries);
        intent.putExtra(EXTRA_POSITION, position);

        ActivityCompat.startActivity(activity, intent, options.toBundle());
    }
 
Example #30
Source File: VideoListFragment.java    From TutosAndroidFrance with MIT License 5 votes vote down vote up
@Override
public void onVideoClicked(View view, Video video) {
    Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
            getActivity(),
            Pair.create(view.findViewById(R.id.image),getResources().getString(R.string.transitionImage)),
            Pair.create(view.findViewById(R.id.title),getResources().getString(R.string.transitionTitle))
    ).toBundle();

    Intent intent = new Intent(getActivity(), DetailActivity.class);
    intent.putExtra(DetailActivity.VIDEO, video);

    ActivityCompat.startActivity(getActivity(),intent,bundle);
}