Java 类android.app.ActivityOptions 实例源码

项目:KomaMusic    文件:ArtistsAdapter.java   
@Override
public void onClick(View view) {
    int position = (int) view.getTag();

    long artistId = mData.get(position).mArtistId;

    String artistName = mData.get(position).mArtistName;

    Intent intent = new Intent();
    intent.putExtra(Constants.ARTIST_ID, artistId);
    intent.putExtra(Constants.ARTIST_NAME, artistName);
    intent.putExtra(Constants.WHICH_DETAIL_PAGE, Constants.ARTIST_DETAIL);

    ComponentName componentName = new ComponentName(Constants.MUSIC_PACKAGE_NAME,
            Constants.DETAIL_PACKAGE_NAME);

    intent.setComponent(componentName);

    mContext.startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(
            ((AppCompatActivity) mContext), new Pair<View, String>(mAlbum,
                    mAlbumTransitionName)).toBundle());
}
项目:boohee_v5.6    文件:SwipeBackActivityHelper.java   
@SuppressLint({"NewApi"})
public void convertActivityToTranslucent() {
    try {
        Class<?> translucentConversionListenerClazz = null;
        for (Class<?> clazz : Activity.class.getDeclaredClasses()) {
            if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
                translucentConversionListenerClazz = clazz;
            }
        }
        Method method;
        if (VERSION.SDK_INT > 19) {
            method = Activity.class.getDeclaredMethod("convertToTranslucent", new
                    Class[]{translucentConversionListenerClazz, ActivityOptions.class});
            method.setAccessible(true);
            method.invoke(this.mActivity, new Object[]{null, null});
            return;
        }
        method = Activity.class.getDeclaredMethod("convertToTranslucent", new
                Class[]{translucentConversionListenerClazz});
        method.setAccessible(true);
        method.invoke(this.mActivity, new Object[]{null});
    } catch (Throwable th) {
    }
}
项目:android-instant-apps    文件:MainActivity.java   
private void populateGrid() {
    grid.setAdapter(new PhotoAdapter(this, relevantPhotos));
    grid.addOnItemTouchListener(new OnItemSelectedListener(MainActivity.this) {
        public void onItemSelected(RecyclerView.ViewHolder holder, int position) {
            if (!(holder instanceof PhotoViewHolder)) {
                return;
            }
            MainActivity activity = MainActivity.this;
            PhotoViewHolder pvh = (PhotoViewHolder) holder;
            final Intent intent = getDetailActivityStartIntent(
                    activity, position, pvh);
            final ActivityOptions activityOptions = getActivityOptions(pvh);

            activity.startActivityForResult(
                    intent, IntentUtil.REQUEST_CODE, activityOptions.toBundle());
        }
    });
    empty.setVisibility(View.GONE);
}
项目:android-instant-apps    文件:MainActivity.java   
private ActivityOptions getActivityOptions(PhotoViewHolder holder) {
    TextView author =
            holder.itemView.findViewById(com.example.android.unsplash.base.R.id.author);
    ImageView photo =
            holder.itemView.findViewById(com.example.android.unsplash.base.R.id.photo);
    Pair authorPair = Pair.create(author, author.getTransitionName());
    Pair photoPair = Pair.create(photo, photo.getTransitionName());
    View decorView = getWindow().getDecorView();
    View statusBackground = decorView.findViewById(android.R.id.statusBarBackground);
    View navBackground = decorView.findViewById(android.R.id.navigationBarBackground);
    Pair statusPair = Pair.create(statusBackground,
            statusBackground.getTransitionName());

    final ActivityOptions options;
    if (navBackground == null) {
        options = ActivityOptions.makeSceneTransitionAnimation(this,
                authorPair, photoPair, statusPair);
    } else {
        Pair navPair = Pair.create(navBackground, navBackground.getTransitionName());
        options = ActivityOptions.makeSceneTransitionAnimation(this,
                authorPair, photoPair, statusPair, navPair);
    }
    return options;
}
项目:showroom-android    文件:GarlandViewProfileActivity.java   
public static void start(Activity activity,
                         String url, String name, String info, String status,
                         View avatar, View card, View image, View list,
                         ArrayList<DetailsData> listData) {
    Intent starter = new Intent(activity, GarlandViewProfileActivity.class);
    starter.putExtra(BUNDLE_NAME, name);
    starter.putExtra(BUNDLE_INFO, info);
    starter.putExtra(BUNDLE_STATUS, status);
    starter.putExtra(BUNDLE_AVATAR_URL, url);
    starter.putParcelableArrayListExtra(BUNDLE_LIST_DATA, listData);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        final Pair<View, String> p1 = Pair.create(avatar, activity.getString(R.string.gv_transition_avatar_border));
        final Pair<View, String> p2 = Pair.create(card, activity.getString(R.string.gv_transition_card));
        final Pair<View, String> p3 = Pair.create(image, activity.getString(R.string.gv_transition_background));
        final Pair<View, String> p4 = Pair.create(list, activity.getString(R.string.gv_transition_list));

        final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(activity, p1, p2, p3, p4);
        activity.startActivity(starter, options.toBundle());
    } else {
        activity.startActivity(starter);
    }
}
项目:showroom-android    文件:GarlandViewDetailsActivity.java   
public static void start(final GarlandViewMainActivity activity,
                         final String name, final String address, final String url,
                         final View card, final View avatar) {
    Intent starter = new Intent(activity, GarlandViewDetailsActivity.class);

    starter.putExtra(BUNDLE_NAME, name);
    starter.putExtra(BUNDLE_INFO, address);
    starter.putExtra(BUNDLE_AVATAR_URL, url);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        final Pair<View, String> p1 = Pair.create(card, activity.getString(R.string.gv_transition_card));
        final Pair<View, String> p2 = Pair.create(avatar, activity.getString(R.string.gv_transition_avatar_border));

        final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(activity, p1, p2);
        activity.startActivity(starter, options.toBundle());
    } else {
        activity.startActivity(starter);
    }
}
项目:ConnectU    文件:AnimTransHelper.java   
public static Bundle circleSlideUp(Context context, View v) {
    Bundle optsBundle;
    ActivityOptions opts = null;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        int left = 0, top = 0;
        int width = v.getMeasuredWidth(), height = v.getMeasuredHeight();
        opts = ActivityOptions.makeClipRevealAnimation(v, left, top, width, height);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        // Below L, we use a scale up animation
        opts = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getMeasuredWidth(), v.getMeasuredHeight());
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
        // On L devices, we use the device default slide-up transition.
        // On L MR1 devices, we use a custom version of the slide-up transition which
        // doesn't have the delay present in the device default.
        opts = ActivityOptions.makeCustomAnimation(context, R.anim.task_open_enter, R.anim.no_anim);
    }
    optsBundle = opts != null ? opts.toBundle() : null;
    return optsBundle;
}
项目:Espresso    文件:PackageDetailsAdapter.java   
public HeaderViewHolder(View itemView) {
    super(itemView);
    textViewCompany = (AppCompatTextView) itemView.findViewById(R.id.textViewCompany);
    textViewNumber = (AppCompatTextView) itemView.findViewById(R.id.textViewPackageNumber);
    textViewName = (AppCompatTextView) itemView.findViewById(R.id.textViewName);

    textViewCompany.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (aPackage.getCompany() != null) {
                Intent intent = new Intent(context, CompanyDetailActivity.class);
                intent.putExtra(CompanyDetailActivity.COMPANY_ID, aPackage.getCompany());
                context.startActivity(intent, ActivityOptions.makeSceneTransitionAnimation((PackageDetailsActivity)context).toBundle());
            }
        }
    });
}
项目:yyox    文件:Utils.java   
/**
 * Calling the convertToTranslucent method on platforms after Android 5.0
 */
private static void convertActivityToTranslucentAfterL(Activity activity) {
    try {
        Method getActivityOptions = Activity.class.getDeclaredMethod("getActivityOptions");
        getActivityOptions.setAccessible(true);
        Object options = getActivityOptions.invoke(activity);

        Class<?>[] classes = Activity.class.getDeclaredClasses();
        Class<?> translucentConversionListenerClazz = null;
        for (Class clazz : classes) {
            if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
                translucentConversionListenerClazz = clazz;
            }
        }
        Method convertToTranslucent = Activity.class.getDeclaredMethod("convertToTranslucent",
                translucentConversionListenerClazz, ActivityOptions.class);
        convertToTranslucent.setAccessible(true);
        convertToTranslucent.invoke(activity, null, options);
    } catch (Throwable t) {
    }
}
项目:Hello-Music-droid    文件:NavigationUtils.java   
@TargetApi(21)
public static void navigateToPlaylistDetail(Activity context, String action, long firstAlbumID, String playlistName, int foregroundcolor, long playlistID, ArrayList<Pair> transitionViews) {
    final Intent intent = new Intent(context, PlaylistDetailActivity.class);
    if (!PreferencesUtility.getInstance(context).getSystemAnimations()) {
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    }
    intent.setAction(action);
    intent.putExtra(Constants.PLAYLIST_ID, playlistID);
    intent.putExtra(Constants.PLAYLIST_FOREGROUND_COLOR, foregroundcolor);
    intent.putExtra(Constants.ALBUM_ID, firstAlbumID);
    intent.putExtra(Constants.PLAYLIST_NAME, playlistName);
    intent.putExtra(Constants.ACTIVITY_TRANSITION, transitionViews != null);

    if (transitionViews != null && TimberUtils.isLollipop() && PreferencesUtility.getInstance(context).getAnimations()) {
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(MainActivity.getInstance(), transitionViews.get(0), transitionViews.get(1), transitionViews.get(2));
        context.startActivityForResult(intent, Constants.ACTION_DELETE_PLAYLIST, options.toBundle());
    } else {
        context.startActivityForResult(intent, Constants.ACTION_DELETE_PLAYLIST);
    }
}
项目:KomaMusic    文件:AlbumsAdapter.java   
@Override
public void onClick(View view) {
    Intent intent = new Intent();

    int position = (int) view.getTag();

    long albumId = mData.get(position).mAlbumId;

    String albumName = mData.get(position).mAlbumName;

    intent.putExtra(Constants.ALBUM_ID, albumId);
    intent.putExtra(Constants.ALBUM_NAME, albumName);
    intent.putExtra(Constants.WHICH_DETAIL_PAGE, Constants.ALBUM_DETAIL);

    ComponentName componentName = new ComponentName(Constants.MUSIC_PACKAGE_NAME,
            Constants.DETAIL_PACKAGE_NAME);

    intent.setComponent(componentName);

    mContext.startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(
            ((AppCompatActivity) mContext), new Pair<View, String>(mAlbum,
                    mAlbumTransitionName),
            new Pair<View, String>(mFabPlay, mFabTransitionName)).toBundle());
}
项目:Mire    文件:AdapterWallpaper.java   
@Override
public boolean onLongClick(View view)
{
    int id = view.getId();
    int position = getAdapterPosition();
    if (id == R.id.id_open_image)
    {
        Intent intent = new Intent(context, ActivityWallpaperInfo.class);
        intent.putExtra("id_img", item_data.get(position).getImageUrl());
        intent.putExtra("id_title", item_data.get(position).getTitle());
        intent.putExtra("id_text", item_data.get(position).getText());

        context.startActivity(intent, ActivityOptions.makeSceneTransitionAnimation((Activity)context).toBundle());
    }

    return true;
}
项目:editor-sql    文件:Utils.java   
/**
 * Calling the convertToTranslucent method on platforms after Android 5.0
 */
private static void convertActivityToTranslucentAfterL(Activity activity) {
    try {
        Method getActivityOptions = Activity.class.getDeclaredMethod("getActivityOptions");
        getActivityOptions.setAccessible(true);
        Object options = getActivityOptions.invoke(activity);

        Class<?>[] classes = Activity.class.getDeclaredClasses();
        Class<?> translucentConversionListenerClazz = null;
        for (Class clazz : classes) {
            if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
                translucentConversionListenerClazz = clazz;
            }
        }
        Method convertToTranslucent = Activity.class.getDeclaredMethod("convertToTranslucent",
                translucentConversionListenerClazz, ActivityOptions.class);
        convertToTranslucent.setAccessible(true);
        convertToTranslucent.invoke(activity, null, options);
    } catch (Throwable t) {
    }
}
项目:SelectName    文件:Utils.java   
/**
 * Calling the convertToTranslucent method on platforms after Android 5.0
 */
private static void convertActivityToTranslucentAfterL(Activity activity) {
    try {
        Method getActivityOptions = Activity.class.getDeclaredMethod("getActivityOptions");
        getActivityOptions.setAccessible(true);
        Object options = getActivityOptions.invoke(activity);

        Class<?>[] classes = Activity.class.getDeclaredClasses();
        Class<?> translucentConversionListenerClazz = null;
        for (Class clazz : classes) {
            if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
                translucentConversionListenerClazz = clazz;
            }
        }
        Method convertToTranslucent = Activity.class.getDeclaredMethod("convertToTranslucent",
                translucentConversionListenerClazz, ActivityOptions.class);
        convertToTranslucent.setAccessible(true);
        convertToTranslucent.invoke(activity, null, options);
    } catch (Throwable t) {
    }
}
项目:TakeRest    文件:ShotsFragment.java   
@Override
public void onSuccess(final List<Shot> list) {
    adapter = new ShotsAdapter(getActivity(), list);
    mRecyclerView.setAdapter(adapter);
    adapter.setOnItemClickLitener(new ShotsAdapter.OnItemClickLitener() {
        @Override
        public void onItemClick(View avator, int position) {
            Shot shot = list.get(position);
            Intent intent = new Intent(getActivity(),ShotDetailActivity.class);
            intent.putExtra("shot_id",shot.getId());
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
                ActivityOptions options = ActivityOptions
                        .makeSceneTransitionAnimation(getActivity(), avator, "avator");
                startActivity(intent, options.toBundle());
            }else {
                startActivity(intent);
            }
        }
    });
}
项目:TakeRest    文件:OnShownMovieFragment.java   
@Override
public void onSuccess(final List<Movie> list) {
    adapter = new MovieAdapter(getActivity(), list);
    recyclerView.setAdapter(adapter);
    adapter.setOnItemClickLitener(new MovieAdapter.OnItemClickLitener() {
        @Override
        public void onItemClick(View view, int position) {
            int id = list.get(position).getId();
            Intent intent = new Intent(getActivity(), MovieBasicActivity.class);
            intent.putExtra("id", id);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                ActivityOptions options = ActivityOptions
                        .makeSceneTransitionAnimation(getActivity(), view, "movie_image");
                startActivity(intent, options.toBundle());
            } else {
                startActivity(intent);
            }
        }
    });
}
项目:garland-view-android    文件:ProfileActivity.java   
public static void start(Activity activity,
                         String url, String name, String info, String status,
                         View avatar, View card, View image, View list,
                         ArrayList<DetailsData> listData) {
    Intent starter = new Intent(activity, ProfileActivity.class);
    starter.putExtra(BUNDLE_NAME, name);
    starter.putExtra(BUNDLE_INFO, info);
    starter.putExtra(BUNDLE_STATUS, status);
    starter.putExtra(BUNDLE_AVATAR_URL, url);
    starter.putParcelableArrayListExtra(BUNDLE_LIST_DATA, listData);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        final Pair<View, String> p1 = Pair.create(avatar, activity.getString(R.string.transition_avatar_border));
        final Pair<View, String> p2 = Pair.create(card, activity.getString(R.string.transition_card));
        final Pair<View, String> p3 = Pair.create(image, activity.getString(R.string.transition_background));
        final Pair<View, String> p4 = Pair.create(list, activity.getString(R.string.transition_list));

        final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(activity, p1, p2, p3, p4);
        activity.startActivity(starter, options.toBundle());
    } else {
        activity.startActivity(starter);
    }
}
项目:garland-view-android    文件:DetailsActivity.java   
public static void start(final MainActivity activity,
                         final String name, final String address, final String url,
                         final View card, final View avatar) {
    Intent starter = new Intent(activity, DetailsActivity.class);

    starter.putExtra(BUNDLE_NAME, name);
    starter.putExtra(BUNDLE_INFO, address);
    starter.putExtra(BUNDLE_AVATAR_URL, url);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        final Pair<View, String> p1 = Pair.create(card, activity.getString(R.string.transition_card));
        final Pair<View, String> p2 = Pair.create(avatar, activity.getString(R.string.transition_avatar_border));

        final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(activity, p1, p2);
        activity.startActivity(starter, options.toBundle());
    } else {
        activity.startActivity(starter);
    }
}
项目:SmartChart    文件:SwipeBackUtils.java   
/**
 * Calling the convertToTranslucent method on platforms after Android 5.0
 */
private static void convertActivityToTranslucentAfterL(Activity activity) {
    try {
        Method getActivityOptions = Activity.class.getDeclaredMethod("getActivityOptions");
        getActivityOptions.setAccessible(true);
        Object options = getActivityOptions.invoke(activity);

        Class<?>[] classes = Activity.class.getDeclaredClasses();
        Class<?> translucentConversionListenerClazz = null;
        for (Class clazz : classes) {
            if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
                translucentConversionListenerClazz = clazz;
            }
        }
        Method convertToTranslucent = Activity.class.getDeclaredMethod("convertToTranslucent",
                translucentConversionListenerClazz, ActivityOptions.class);
        convertToTranslucent.setAccessible(true);
        convertToTranslucent.invoke(activity, null, options);
    } catch (Throwable t) {
    }
}
项目:RoomDemo2017    文件:ListFragment.java   
public void startDetailActivity(String itemId, View viewRoot) {
    Activity container = getActivity();
    Intent i = new Intent(container, DetailActivity.class);
    i.putExtra(EXTRA_ITEM_ID, itemId);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        container.getWindow().setEnterTransition(new Fade(Fade.IN));
        container.getWindow().setEnterTransition(new Fade(Fade.OUT));

        ActivityOptions options = ActivityOptions
                .makeSceneTransitionAnimation(container,
                        new Pair<>(viewRoot.findViewById(R.id.imv_list_item_circle),
                                getString(R.string.transition_drawable)),
                        new Pair<>(viewRoot.findViewById(R.id.lbl_message),
                                getString(R.string.transition_message)),
                        new Pair<>(viewRoot.findViewById(R.id.lbl_date_and_time),
                                getString(R.string.transition_time_and_date)));

        startActivity(i, options.toBundle());

    } else {
        startActivity(i);
    }
}
项目:Synapse    文件:MainActivity.java   
/**
 * Transition animation may cause exception
 */
private void startNeuralNetworkConfig(@NonNull final View view) {
    view.setClickable(false);
    view.postDelayed(new Runnable() {
        @Override
        public void run() {
            view.setClickable(true);
        }
    }, 1000);

    try {
        final Intent intent = new Intent(this, NeuralModelActivity.class);

        FabTransform.addExtras(intent,
                ContextCompat.getColor(this, R.color.color_accent),
                R.drawable.ic_add_white_24dp);

        final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(
                this, view, getString(R.string.transition_neural_config));

        startActivity(intent, options.toBundle());
    } catch (Exception e) {
        ExceptionHelper.getInstance()
                .caught(e);
    }
}
项目:Aurora    文件:Utils.java   
/**
 * Calling the convertToTranslucent method on platforms after Android 5.0
 */
private static void convertActivityToTranslucentAfterL(Activity activity) {
    try {
        Method getActivityOptions = Activity.class.getDeclaredMethod("getActivityOptions");
        getActivityOptions.setAccessible(true);
        Object options = getActivityOptions.invoke(activity);

        Class<?>[] classes = Activity.class.getDeclaredClasses();
        Class<?> translucentConversionListenerClazz = null;
        for (Class clazz : classes) {
            if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
                translucentConversionListenerClazz = clazz;
            }
        }
        Method convertToTranslucent = Activity.class.getDeclaredMethod("convertToTranslucent",
                translucentConversionListenerClazz, ActivityOptions.class);
        convertToTranslucent.setAccessible(true);
        convertToTranslucent.invoke(activity, null, options);
    } catch (Throwable t) {
    }
}
项目:QiangHongBao    文件:Utils.java   
/**
 * Calling the convertToTranslucent method on platforms after Android 5.0
 */
private static void convertActivityToTranslucentAfterL(Activity activity) {
    try {
        Method getActivityOptions = Activity.class.getDeclaredMethod("getActivityOptions");
        getActivityOptions.setAccessible(true);
        Object options = getActivityOptions.invoke(activity);

        Class<?>[] classes = Activity.class.getDeclaredClasses();
        Class<?> translucentConversionListenerClazz = null;
        for (Class clazz : classes) {
            if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
                translucentConversionListenerClazz = clazz;
            }
        }
        Method convertToTranslucent = Activity.class.getDeclaredMethod("convertToTranslucent",
                translucentConversionListenerClazz, ActivityOptions.class);
        convertToTranslucent.setAccessible(true);
        convertToTranslucent.invoke(activity, null, options);
    } catch (Throwable t) {
    }
}
项目:OSchina_resources_android    文件:Utils.java   
/**
 * Calling the convertToTranslucent method on platforms after Android 5.0
 */
private static void convertActivityToTranslucentAfterL(Activity activity) {
    try {
        Method getActivityOptions = Activity.class.getDeclaredMethod("getActivityOptions");
        getActivityOptions.setAccessible(true);
        Object options = getActivityOptions.invoke(activity);

        Class<?>[] classes = Activity.class.getDeclaredClasses();
        Class<?> translucentConversionListenerClazz = null;
        for (Class clazz : classes) {
            if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
                translucentConversionListenerClazz = clazz;
            }
        }
        Method convertToTranslucent = Activity.class.getDeclaredMethod("convertToTranslucent",
                translucentConversionListenerClazz, ActivityOptions.class);
        convertToTranslucent.setAccessible(true);
        convertToTranslucent.invoke(activity, null, options);
    } catch (Throwable t) {
    }
}
项目:AnimationShowcase    文件:ActivityTransitionNougatFixActivity.java   
@OnClick(android.R.id.content)
public void onClick() {
    View statusBar = findViewById(android.R.id.statusBarBackground);
    View navigationBar = findViewById(android.R.id.navigationBarBackground);

    List<Pair<View, String>> pairs = new ArrayList<>();
    if (statusBar != null) {
        pairs.add(Pair.create(statusBar, Window.STATUS_BAR_BACKGROUND_TRANSITION_NAME));
    }
    if (navigationBar != null) {
        pairs.add(Pair.create(navigationBar, Window.NAVIGATION_BAR_BACKGROUND_TRANSITION_NAME));
    }

    Bundle options = ActivityOptions.makeSceneTransitionAnimation(this,
            pairs.toArray(new Pair[pairs.size()])).toBundle();
    startActivity(new Intent(this, ActivityTransitionTargetActivity.class),
            options);

}
项目:AnimationShowcase    文件:ActivitySharedElementTransitionActivity.java   
@OnClick(R.id.square2)
public void onClick() {
    View statusBar = findViewById(android.R.id.statusBarBackground);
    View navigationBar = findViewById(android.R.id.navigationBarBackground);

    List<Pair<View, String>> pairs = new ArrayList<>();
    if (statusBar != null) {
        pairs.add(Pair.create(statusBar, Window.STATUS_BAR_BACKGROUND_TRANSITION_NAME));
    }
    if (navigationBar != null) {
        pairs.add(Pair.create(navigationBar, Window.NAVIGATION_BAR_BACKGROUND_TRANSITION_NAME));
    }
    pairs.add(Pair.create(square2, getString(R.string.custom_element_transition_name)));

    Bundle options = ActivityOptions.makeSceneTransitionAnimation(this,
            pairs.toArray(new Pair[pairs.size()])).toBundle();
    startActivity(new Intent(this, ActivitySharedElementTransitionTargetActivity.class),
            options);

}
项目:AndroidCollection    文件:ActivityTransition.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_transition);
    mImageView = (ImageView) findViewById(R.id.imageView);
    mImageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(ActivityTransition.this,ActivityTransitionDetail.class);
            intent.putExtra(KEY_ID, v.getTransitionName());
            ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(ActivityTransition.this,v,ELEMENT_NAME);
            startActivity(intent,options.toBundle());
        }
    });
    setup();
}
项目:starcraft-2-build-player    文件:RaceFragment.java   
@Override
public void onBuildClicked(BuildViewHolder buildViewHolder) {
    BuildViewModel model = buildViewHolder.viewModel;

    Intent i = new Intent(getActivity(), BriefActivity.class);
    i.putExtra(KEY_BUILD_ID, model.getBuildId());    // pass build order record ID

    // speed optimization - pass these so brief activity doesn't need to
    // requery them from the database and can display them instantly
    i.putExtra(KEY_FACTION_ENUM, mFaction);
    i.putExtra(KEY_EXPANSION_ENUM, mCurrentExpansion);
    i.putExtra(KEY_BUILD_NAME, model.getName());

    if (VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        // create the transition animation - the views in the layouts
        // of both activities are defined with android:transitionName="buildName"
        ActivityOptions options = ActivityOptions
                .makeSceneTransitionAnimation(
                        getActivity(),
                        buildViewHolder.nameText,
                        getString(R.string.transition_build_name));
        getActivity().startActivity(i, options.toBundle());
    } else {
        getActivity().startActivity(i);
    }
}
项目:FlickLauncher    文件:Launcher.java   
private Bundle getActivityLaunchOptions(View v) {
    if (Utilities.ATLEAST_MARSHMALLOW) {
        int left = 0, top = 0;
        int width = v.getMeasuredWidth(), height = v.getMeasuredHeight();
        if (v instanceof TextView) {
            // Launch from center of icon, not entire view
            Drawable icon = Workspace.getTextViewIcon((TextView) v);
            if (icon != null) {
                Rect bounds = icon.getBounds();
                left = (width - bounds.width()) / 2;
                top = v.getPaddingTop();
                width = bounds.width();
                height = bounds.height();
            }
        }
        return ActivityOptions.makeClipRevealAnimation(v, left, top, width, height).toBundle();
    } else if (Utilities.ATLEAST_LOLLIPOP_MR1) {
        // On L devices, we use the device default slide-up transition.
        // On L MR1 devices, we use a custom version of the slide-up transition which
        // doesn't have the delay present in the device default.
        return ActivityOptions.makeCustomAnimation(
                this, R.anim.task_open_enter, R.anim.no_anim).toBundle();
    }
    return null;
}
项目:social-app-android    文件:ProfileActivity.java   
private void openPostDetailsActivity(Post post, View v) {
    Intent intent = new Intent(ProfileActivity.this, PostDetailsActivity.class);
    intent.putExtra(PostDetailsActivity.POST_ID_EXTRA_KEY, post.getId());
    intent.putExtra(PostDetailsActivity.AUTHOR_ANIMATION_NEEDED_EXTRA_KEY, true);

    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        View imageView = v.findViewById(R.id.postImageView);

        ActivityOptions options = ActivityOptions.
                makeSceneTransitionAnimation(ProfileActivity.this,
                        new android.util.Pair<>(imageView, getString(R.string.post_image_transition_name))
                );
        startActivityForResult(intent, PostDetailsActivity.UPDATE_POST_REQUEST, options.toBundle());
    } else {
        startActivityForResult(intent, PostDetailsActivity.UPDATE_POST_REQUEST);
    }
}
项目:social-app-android    文件:MainActivity.java   
private void openPostDetailsActivity(Post post, View v) {
    Intent intent = new Intent(MainActivity.this, PostDetailsActivity.class);
    intent.putExtra(PostDetailsActivity.POST_ID_EXTRA_KEY, post.getId());

    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        View imageView = v.findViewById(R.id.postImageView);
        View authorImageView = v.findViewById(R.id.authorImageView);

        ActivityOptions options = ActivityOptions.
                makeSceneTransitionAnimation(MainActivity.this,
                        new android.util.Pair<>(imageView, getString(R.string.post_image_transition_name)),
                        new android.util.Pair<>(authorImageView, getString(R.string.post_author_image_transition_name))
                );
        startActivityForResult(intent, PostDetailsActivity.UPDATE_POST_REQUEST, options.toBundle());
    } else {
        startActivityForResult(intent, PostDetailsActivity.UPDATE_POST_REQUEST);
    }
}
项目:social-app-android    文件:MainActivity.java   
private void openProfileActivity(String userId, View view) {
    Intent intent = new Intent(MainActivity.this, ProfileActivity.class);
    intent.putExtra(ProfileActivity.USER_ID_EXTRA_KEY, userId);

    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && view != null) {

        View authorImageView = view.findViewById(R.id.authorImageView);

        ActivityOptions options = ActivityOptions.
                makeSceneTransitionAnimation(MainActivity.this,
                        new android.util.Pair<>(authorImageView, getString(R.string.post_author_image_transition_name)));
        startActivityForResult(intent, ProfileActivity.CREATE_POST_FROM_PROFILE_REQUEST, options.toBundle());
    } else {
        startActivityForResult(intent, ProfileActivity.CREATE_POST_FROM_PROFILE_REQUEST);
    }
}
项目:Android-Practice    文件:ImageGridFragment.java   
@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);
    }
}
项目:mDL-ILP    文件:ReadLicenseActivity.java   
@OnClick(R.id.license_image)
public void licensePressed() {
    final Intent intent = new Intent(this, PictureZoomActivity.class);
    final Bundle extras = new Bundle();

    extras.putByteArray("picture", licence.getPhoto());
    intent.putExtras(extras);

    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, headshot, "zoom");
    startActivity(intent, options.toBundle());
}
项目:FamilyBond    文件:LoginPresenter.java   
@Override
public void switchToRegister(FloatingActionButton fab) {
    mActivity.getWindow().setExitTransition(null);
    mActivity.getWindow().setEnterTransition(null);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ActivityOptions options =
                ActivityOptions.makeSceneTransitionAnimation(mActivity, fab, fab.getTransitionName());
        mActivity.startActivity(new Intent(mActivity, RegisterActivity.class), options.toBundle());
    } else {
        mActivity.startActivity(new Intent(mActivity, RegisterActivity.class));
    }
}
项目:mDL-ILP    文件:ViewLicenseActivity.java   
@OnClick(R.id.license_image)
void licensePressed() {

    final Intent intent = new Intent(this, PictureZoomActivity.class);
    final Bundle extras = new Bundle();
    extras.putByteArray("picture", licence.getPhoto());
    intent.putExtras(extras);

    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, headshot, "zoom");
    startActivity(intent, options.toBundle());
}
项目:GitHub    文件:HotFragment.java   
@Override
protected void initEventAndData() {
    mList = new ArrayList<>();
    ivProgress.start();
    mAdapter = new HotAdapter(mContext,mList);
    rvHotContent.setVisibility(View.INVISIBLE);
    rvHotContent.setLayoutManager(new LinearLayoutManager(mContext));
    rvHotContent.setAdapter(mAdapter);
    mPresenter.getHotData();
    swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            mPresenter.getHotData();
        }
    });
    mAdapter.setOnItemClickListener(new HotAdapter.OnItemClickListener() {
        @Override
        public void onItemClick(int position, View shareView) {
            mPresenter.insertReadToDB(mList.get(position).getNews_id());
            mAdapter.setReadState(position,true);
            mAdapter.notifyItemChanged(position);
            Intent intent = new Intent();
            intent.setClass(mContext, ZhihuDetailActivity.class);
            intent.putExtra("id",mList.get(position).getNews_id());
            ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(mActivity, shareView, "shareView");
            mContext.startActivity(intent,options.toBundle());
        }
    });
}
项目:GitHub    文件:DraweeTransitionFragment.java   
public void startTransition(View startView, Uri uri) {
  Intent intent = ImageDetailsActivity.getStartIntent(getContext(), uri);
  final String transitionName = getString(R.string.transition_name);
  final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(
      getActivity(),
      startView,
      transitionName);
  startActivity(intent, options.toBundle());
}
项目:GitHub    文件:HotFragment.java   
@Override
protected void initEventAndData() {
    super.initEventAndData();
    mList = new ArrayList<>();
    stateLoading();
    mAdapter = new HotAdapter(mContext,mList);
    rvHotContent.setVisibility(View.INVISIBLE);
    rvHotContent.setLayoutManager(new LinearLayoutManager(mContext));
    rvHotContent.setAdapter(mAdapter);
    mPresenter.getHotData();
    swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            mPresenter.getHotData();
        }
    });
    mAdapter.setOnItemClickListener(new HotAdapter.OnItemClickListener() {
        @Override
        public void onItemClick(int position, View shareView) {
            mPresenter.insertReadToDB(mList.get(position).getNews_id());
            mAdapter.setReadState(position,true);
            mAdapter.notifyItemChanged(position);
            Intent intent = new Intent();
            intent.setClass(mContext, ZhihuDetailActivity.class);
            intent.putExtra(Constants.IT_ZHIHU_DETAIL_ID, mList.get(position).getNews_id());
            ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(mActivity, shareView, "shareView");
            mContext.startActivity(intent,options.toBundle());
        }
    });
}
项目:SunmiUI    文件:TransitionHomeActivity.java   
public void simpleSharedElementTransition(View view) {
    Intent intent = new Intent(this, SimpleSharedTransitionActivity.class);
    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, findViewById(R.id.simple_shared), "test");
    startActivity(intent, options.toBundle());

}