Java Code Examples for android.support.v4.app.ActivityOptionsCompat

The following examples show how to use android.support.v4.app.ActivityOptionsCompat. These examples are extracted from open source projects. 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 Project: Movie-Check   Source File: HomeActivity.java    License: 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 2
Source Project: native-navigation   Source File: ReactNativeIntents.java    License: 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 3
Source Project: 365browser   Source File: SearchWidgetProvider.java    License: 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 4
Source Project: materialize   Source File: MainActivity.java    License: 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 5
@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 6
Source Project: todo-android   Source File: TodoListActivity.java    License: 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 7
Source Project: kernel_adiutor   Source File: KernelCardView.java    License: 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 8
Source Project: Wrox-ProfessionalAndroid-4E   Source File: MainActivity.java    License: 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 9
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 10
Source Project: LuxVilla   Source File: separadoraveiro.java    License: 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 11
Source Project: BuildingForAndroidTV   Source File: MovieDetailsFragment.java    License: 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 12
@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 13
Source Project: Ency   Source File: ImageAdapter.java    License: 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 14
Source Project: Mizuu   Source File: MovieLibraryFragment.java    License: 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 15
Source Project: AndroidBlueprints   Source File: MainActivity.java    License: 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 16
Source Project: SimpleNews   Source File: NewsListFragment.java    License: 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 17
Source Project: android-topeka   Source File: SignInFragment.java    License: 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 18
Source Project: TouchNews   Source File: JokeImageListRecyclerAdapter.java    License: 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 19
Source Project: ESeal   Source File: NfcDeviceFragment.java    License: 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 20
Source Project: ESeal   Source File: DeviceOperationActivity.java    License: 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 21
Source Project: LuxVilla   Source File: separadorbraga.java    License: 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 22
Source Project: Tok-Android   Source File: BasePageJump.java    License: GNU General Public License v3.0 5 votes vote down vote up
protected static void jumpWithTransition(Context context, Intent intent,
    Pair<View, String>... sharedElements) {
    if (context instanceof Activity
        && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1
        && sharedElements != null
        && sharedElements.length > 0) {
        ActivityOptionsCompat compat =
            ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context,
                sharedElements);
        ActivityCompat.startActivity(context, intent, compat.toBundle());
    } else {
        jump(context, intent);
    }
}
 
Example 23
/**
 * Sets the exit animations.
 *
 * @param context Application context.
 * @param enterResId Resource ID of the "enter" animation for the application.
 * @param exitResId Resource ID of the "exit" animation for the browser.
 */
public Builder setExitAnimations(
        @NonNull Context context, @AnimRes int enterResId, @AnimRes int exitResId) {
    Bundle bundle = ActivityOptionsCompat.makeCustomAnimation(
            context, enterResId, exitResId).toBundle();
    mIntent.putExtra(EXTRA_EXIT_ANIMATION_BUNDLE, bundle);
    return this;
}
 
Example 24
@Override
public boolean onOptionsItemSelected(MenuItem item) {
  switch (item.getItemId()) {
    case R.id.menu_expand:
      saveDraft().addListener(new ListenableFuture.Listener<Long>() {
        @Override
        public void onSuccess(Long result) {
          ActivityOptionsCompat transition = ActivityOptionsCompat.makeScaleUpAnimation(getWindow().getDecorView(), 0, 0, getWindow().getAttributes().width, getWindow().getAttributes().height);
          Intent intent = new Intent(ConversationPopupActivity.this, ConversationActivity.class);
          intent.putExtra(ConversationActivity.RECIPIENTS_EXTRA, getRecipients().getIds());
          intent.putExtra(ConversationActivity.THREAD_ID_EXTRA, result);

          if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
            startActivity(intent, transition.toBundle());
          } else {
            startActivity(intent);
            overridePendingTransition(R.anim.fade_scale_in, R.anim.slide_to_right);
          }

          finish();
        }

        @Override
        public void onFailure(ExecutionException e) {
          Log.w(TAG, e);
        }
      });
      return true;
  }

  return false;
}
 
Example 25
Source Project: Loop   Source File: SearchableFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
    public void onItemClick(int position, View view) {
        Video video = videosAdapter.getItem(position);
        if (video != null) {
            Intent intent = new Intent(getActivity(), VideoDetailsActivity.class);

            Bundle bundle = new Bundle();
            bundle.putParcelable(LikedVideosFragment.KEY_VIDEO, video);
            intent.putExtras(bundle);

            Pair<View, String> p1 = Pair.create(view.findViewById(R.id.video_thumbnail_iv), "videoTransition");
//                Pair<View, String> p2 = Pair.create((View) view.findViewById(R.id.title_tv), "titleTransition");
//                Pair<View, String> p3 = Pair.create((View) view.findViewById(R.id.subtitle_tv), "subtitleTransition");
//        Pair<View, String> p4 = Pair.create((View)view.findViewById(R.id.uploaded_tv), "uploadedTransition");

//                ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),
//                        p1, p2, p3);

            ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),
                    p1);

//            ActivityCompat.startActivity(getActivity(), intent, options.toBundle());

                startActivity(intent);
        }

    }
 
Example 26
Source Project: iroha-android   Source File: RegistrationActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void didRegistrationSuccess() {
    dismissProgressDialog();
    Intent intent = new Intent(this, MainActivity.class);
    ActivityOptionsCompat options = ActivityOptionsCompat.
            makeSceneTransitionAnimation(this, binding.logoImage, "profile");
    startActivity(intent, options.toBundle());
    finish();
}
 
Example 27
Source Project: Villains-and-Heroes   Source File: CharacterActivity.java    License: Apache License 2.0 5 votes vote down vote up
public static void start(@NonNull Activity activity, @NonNull View characterView, @NonNull CharacterVO character) {

        ActivityOptionsCompat options = ActivityOptionsCompat
                .makeSceneTransitionAnimation(activity,
                        characterView, ViewCompat.getTransitionName(characterView));
        Intent intent = new Intent(activity, CharacterActivity.class);
        intent.putExtra(EXTRA_CHARACTER, character);

        ActivityCompat.startActivity(activity, intent, options.toBundle());
    }
 
Example 28
Source Project: apkextractor   Source File: ImportFragment.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onItemClicked(ImportItem importItem, RecyclerViewAdapter.ViewHolder viewHolder, int position) {
    if(getActivity()==null)return;
    Intent intent =new Intent(getActivity(), PackageDetailActivity.class);
    //intent.putExtra(PackageDetailActivity.EXTRA_IMPORT_ITEM_POSITION,position);
    intent.putExtra(PackageDetailActivity.EXTRA_IMPORT_ITEM_PATH,importItem.getFileItem().getPath());
    ActivityOptionsCompat compat = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),new Pair<View, String>(viewHolder.icon,"icon"));
    try{
        ActivityCompat.startActivity(getActivity(), intent, compat.toBundle());
    }catch (Exception e){e.printStackTrace();}
}
 
Example 29
Source Project: apkextractor   Source File: AppFragment.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onItemClicked(AppItem appItem, RecyclerViewAdapter.ViewHolder viewHolder, int position) {
    if(getActivity()==null)return;
    Intent intent=new Intent(getActivity(), AppDetailActivity.class);
    intent.putExtra(BaseActivity.EXTRA_PACKAGE_NAME,appItem.getPackageName());
    ActivityOptionsCompat compat = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),new Pair<View, String>(viewHolder.icon,"icon"));
    try{
        ActivityCompat.startActivity(getActivity(), intent, compat.toBundle());
    }catch (Exception e){e.printStackTrace();}
}
 
Example 30
Source Project: LollipopShowcase   Source File: MainActivity.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * helper class to start the new detailActivity animated
 *
 * @param appInfo
 * @param appIcon
 */
public void animateActivity(AppInfo appInfo, View appIcon) {
    Intent i = new Intent(this, DetailActivity.class);
    i.putExtra("appInfo", appInfo.getComponentName());

    ActivityOptionsCompat transitionActivityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(this, Pair.create((View) mFabButton, "fab"), Pair.create(appIcon, "appIcon"));
    startActivity(i, transitionActivityOptions.toBundle());
}