當前位置: 首頁>>代碼示例>>Java>>正文


Java TransitionInflater.inflateTransition方法代碼示例

本文整理匯總了Java中android.transition.TransitionInflater.inflateTransition方法的典型用法代碼示例。如果您正苦於以下問題:Java TransitionInflater.inflateTransition方法的具體用法?Java TransitionInflater.inflateTransition怎麽用?Java TransitionInflater.inflateTransition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.transition.TransitionInflater的用法示例。


在下文中一共展示了TransitionInflater.inflateTransition方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: displayDetails

import android.transition.TransitionInflater; //導入方法依賴的package包/類
@Override
public void displayDetails(AnnouncementItem announcementItem) {
    FullAnnouncement announcement = announcementItem.getAnnouncement();

    FragmentManager fm = getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();

    AnnouncementDetailsFragment announcementDetailsFragment = AnnouncementDetailsFragment.newInstance(announcement);

    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        TransitionInflater transitionInflater = null;
        transitionInflater = TransitionInflater.from(getContext());
        Transition details_enter = transitionInflater.inflateTransition(R.transition.details_enter);
        Transition details_exit = transitionInflater.inflateTransition(R.transition.details_exit);
        setSharedElementEnterTransition(details_enter);
        setSharedElementReturnTransition(details_exit);
        setExitTransition(new Fade());
        announcementDetailsFragment.setSharedElementEnterTransition(details_enter);
        announcementDetailsFragment.setSharedElementReturnTransition(details_exit);
        ft.addSharedElement(announcementItem.getBackgroundView(), announcementItem.getBackgroundView().getTransitionName());
    }

    ft.replace(R.id.content_main, announcementDetailsFragment, "Announcement details transition");
    ft.addToBackStack(null);
    ft.commitAllowingStateLoss();
}
 
開發者ID:shymmq,項目名稱:librus-client,代碼行數:27,代碼來源:AnnouncementsFragment.java

示例2: initPushInAnim

import android.transition.TransitionInflater; //導入方法依賴的package包/類
private void initPushInAnim() {

        Window window = getWindow();
        window.requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);

        TransitionInflater inflater = TransitionInflater.from(mContext);
        Transition pushDownIn = inflater.inflateTransition(R.transition.explode_in);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            window.setEnterTransition(pushDownIn); // 第一次進入時使用
            window.setReenterTransition(pushDownIn); // 再次進入時使用
            window.setExitTransition(pushDownIn);
        }

    }
 
開發者ID:ifadai,項目名稱:SuperNote,代碼行數:16,代碼來源:LockActivity.java

示例3: onCreate

import android.transition.TransitionInflater; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= 21) {

        TransitionInflater inflater = TransitionInflater.from(this);
        Transition transition = inflater.inflateTransition(R.transition.details_window_return_transition);
        getWindow().setExitTransition(transition);
    }
    // setUpWindowAnimations();
    setContentView(R.layout.activity_article_detail);
    if (savedInstanceState == null) {
        // Create the detail fragment and add it to the activity
        // using a fragment transaction.

        Bundle extras = getIntent().getExtras();

        DetailsFragment fragment = new DetailsFragment();
         extras.putBoolean(DetailsFragment.DETAIL_TRANSITION_ANIMATION, true);

        fragment.setArguments(extras);
        getSupportFragmentManager().beginTransaction()
                .add(R.id.container, fragment)
                .commit();


        // Being here means we are in animation mode
        supportPostponeEnterTransition();
    }
}
 
開發者ID:vikasdesale,項目名稱:News24x7-news-from-every-part-of-the-world,代碼行數:31,代碼來源:DetailsActivity.java

示例4: onCheckedChanged

import android.transition.TransitionInflater; //導入方法依賴的package包/類
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
    View square = sceneRoot.findViewById(R.id.transition_square);
    switch (checkedId) {
        case R.id.select_scene_1: {
            square.setVisibility(View.VISIBLE);

            // You can start an automatic transition with TransitionManager.go().
            TransitionManager.go(mScene1);

            break;
        }
        case R.id.select_scene_2: {
            square.setVisibility(View.VISIBLE);
            TransitionManager.go(mScene2);
            break;
        }
        case R.id.select_scene_3: {
            square.setVisibility(View.VISIBLE);

            // You can also start a transition with a custom TransitionManager.
            mTransitionManagerForScene3.transitionTo(mScene3);

            break;
        }
        case R.id.select_scene_4: {

            // Alternatively, transition can be invoked dynamically without a Scene.
            // For this, we first call TransitionManager.beginDelayedTransition().
            TransitionManager.beginDelayedTransition(sceneRoot);
            // Then, we can just change view properties as usual.
            square.setVisibility(View.VISIBLE);
            ViewGroup.LayoutParams params = square.getLayoutParams();
            int newSize = getResources().getDimensionPixelSize(R.dimen.square_size_expanded);
            params.width = newSize;
            params.height = newSize;
            square.setLayoutParams(params);

            break;
        }
        case R.id.select_scene_5: {
            TransitionInflater transitionInflater = TransitionInflater.from(this);
            Transition transition = transitionInflater.inflateTransition(R.transition.changebounds_fadeout_sequential);
            TransitionManager.beginDelayedTransition(sceneRoot, transition);

            square.setVisibility(View.GONE);
            break;
        }
    }
}
 
開發者ID:zawadz88,項目名稱:AnimationShowcase,代碼行數:52,代碼來源:TransitionActivity.java

示例5: getTransition

import android.transition.TransitionInflater; //導入方法依賴的package包/類
private Transition getTransition(@TransitionRes int transitionId) {
    TransitionInflater inflater=TransitionInflater.from(this);
    return inflater.inflateTransition(transitionId);
}
 
開發者ID:vpaliyX,項目名稱:Melophile,代碼行數:5,代碼來源:SearchActivity.java

示例6: onCreate

import android.transition.TransitionInflater; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //  Declare a new thread to do a preference check. Library to invoke Intro slides
    Thread t = new Thread(new Runnable() {
        @Override
        public void run() {
            //  Initialize SharedPreferences
            SharedPreferences getPrefs = PreferenceManager
                    .getDefaultSharedPreferences(getBaseContext());

            //  Create a new boolean and preference and set it to true
            boolean isFirstStart = getPrefs.getBoolean("firstStart", true);

            //  If the activity has never started before...
            if (isFirstStart) {

                //  Launch app intro
                Intent i = new Intent(HomeActivity.this, IntroActivity.class);
                startActivity(i);

                //  Make a new preferences editor
                SharedPreferences.Editor e = getPrefs.edit();

                //  Edit preference to make it false because we don't want this to run again
                e.putBoolean("firstStart", false);

                //  Apply changes
                e.apply();
            }
            else {
                //  Launch Mainactivity
            //    Intent intent = new Intent(getApplicationContext(), MainActivity.class);
              //  intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
               // startActivity(intent);
                // mActivity=true;

            }
        }
    });
    // Start the thread
    t.start();
    if (Build.VERSION.SDK_INT >= 21) {

        TransitionInflater inflater = TransitionInflater.from(this);
        Transition transition = inflater.inflateTransition(R.transition.details_window_enter_transition);
        getWindow().setExitTransition(transition);
    }
    // setUpWindowAnimations();
    setContentView(R.layout.activity_home);
    ButterKnife.bind(this);
    setupFind();

    // Obtain the FirebaseAnalytics instance.
    mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);

    //Sets whether analytics collection is enabled for this app on this device.
    mFirebaseAnalytics.setAnalyticsCollectionEnabled(true);

    if (savedInstanceState == null) {

        NewsFragment fragment = new NewsFragment();
        fragment.setArguments(null);

        getSupportFragmentManager().beginTransaction()
                .replace(R.id.container, fragment, "")
                .commit();
    }
    NewsSyncUtils.initialize(this);

}
 
開發者ID:vikasdesale,項目名稱:News24x7-news-from-every-part-of-the-world,代碼行數:72,代碼來源:HomeActivity.java

示例7: initIfNeeded

import android.transition.TransitionInflater; //導入方法依賴的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.TransitionInflater.inflateTransition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。