当前位置: 首页>>代码示例>>Java>>正文


Java Scene.setExitAction方法代码示例

本文整理汇总了Java中android.transition.Scene.setExitAction方法的典型用法代码示例。如果您正苦于以下问题:Java Scene.setExitAction方法的具体用法?Java Scene.setExitAction怎么用?Java Scene.setExitAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.transition.Scene的用法示例。


在下文中一共展示了Scene.setExitAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildScene

import android.transition.Scene; //导入方法依赖的package包/类
private Scene buildScene(ViewGroup sceneRoot, final TransitionLayout layout) {
    final Scene scene = new Scene(sceneRoot, (View) layout);
    scene.setEnterAction(new Runnable() {
        @Override
        public void run() {
            boolean wasEmptyScene = (mCurrentScene == mEmptyScene);
            setCurrentScene(scene, (ViewGroup) layout);
            layout.onEnterAction(wasEmptyScene);
        }
    });
    scene.setExitAction(new Runnable() {
        @Override
        public void run() {
            removeAllViewsFromOverlay();
            layout.onExitAction();
        }
    });
    return scene;
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:20,代码来源:TvTransitionManager.java

示例2: initIfNeeded

import android.transition.Scene; //导入方法依赖的package包/类
public void initIfNeeded() {
    if (mInitialized) {
        return;
    }
    mEnterAnimator = AnimatorInflater.loadAnimator(mMainActivity,
            R.animator.channel_banner_enter);
    mExitAnimator = AnimatorInflater.loadAnimator(mMainActivity,
            R.animator.channel_banner_exit);

    mEmptyScene = new Scene(mSceneContainer, (View) mEmptyView);
    mEmptyScene.setEnterAction(new Runnable() {
        @Override
        public void run() {
            FrameLayout.LayoutParams emptySceneLayoutParams =
                    (FrameLayout.LayoutParams) mEmptyView.getLayoutParams();
            ViewGroup.MarginLayoutParams lp =
                    (ViewGroup.MarginLayoutParams) mCurrentSceneView.getLayoutParams();
            emptySceneLayoutParams.topMargin = mCurrentSceneView.getTop();
            emptySceneLayoutParams.setMarginStart(lp.getMarginStart());
            emptySceneLayoutParams.height = mCurrentSceneView.getHeight();
            emptySceneLayoutParams.width = mCurrentSceneView.getWidth();
            mEmptyView.setLayoutParams(emptySceneLayoutParams);
            setCurrentScene(mEmptyScene, mEmptyView);
        }
    });
    mEmptyScene.setExitAction(new Runnable() {
        @Override
        public void run() {
            removeAllViewsFromOverlay();
        }
    });

    mChannelBannerScene = buildScene(mSceneContainer, mChannelBannerView);
    mInputBannerScene = buildScene(mSceneContainer, mInputBannerView);
    mKeypadChannelSwitchScene = buildScene(mSceneContainer, mKeypadChannelSwitchView);
    mSelectInputScene = buildScene(mSceneContainer, mSelectInputView);
    mCurrentScene = mEmptyScene;

    // Enter transitions
    TransitionSet enter = new TransitionSet()
            .addTransition(new SceneTransition(SceneTransition.ENTER))
            .addTransition(new Fade(Fade.IN));
    setTransition(mEmptyScene, mChannelBannerScene, enter);
    setTransition(mEmptyScene, mInputBannerScene, enter);
    setTransition(mEmptyScene, mKeypadChannelSwitchScene, enter);
    setTransition(mEmptyScene, mSelectInputScene, enter);

    // Exit transitions
    TransitionSet exit = new TransitionSet()
            .addTransition(new SceneTransition(SceneTransition.EXIT))
            .addTransition(new Fade(Fade.OUT));
    setTransition(mChannelBannerScene, mEmptyScene, exit);
    setTransition(mInputBannerScene, mEmptyScene, exit);
    setTransition(mKeypadChannelSwitchScene, mEmptyScene, exit);
    setTransition(mSelectInputScene, mEmptyScene, exit);

    // All other possible transitions between scenes
    TransitionInflater ti = TransitionInflater.from(mMainActivity);
    Transition transition = ti.inflateTransition(R.transition.transition_between_scenes);
    setTransition(mChannelBannerScene, mKeypadChannelSwitchScene, transition);
    setTransition(mChannelBannerScene, mSelectInputScene, transition);
    setTransition(mInputBannerScene, mSelectInputScene, transition);
    setTransition(mKeypadChannelSwitchScene, mChannelBannerScene, transition);
    setTransition(mKeypadChannelSwitchScene, mSelectInputScene, transition);
    setTransition(mSelectInputScene, mChannelBannerScene, transition);
    setTransition(mSelectInputScene, mInputBannerScene, transition);

    mInitialized = true;
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:70,代码来源:TvTransitionManager.java


注:本文中的android.transition.Scene.setExitAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。