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


Java Transition類代碼示例

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


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

示例1: removeTargets

import android.transition.Transition; //導入依賴的package包/類
public static void removeTargets(Object transitionObject, ArrayList<View> views) {
    Transition transition = (Transition) transitionObject;
    int i;
    if (transition instanceof TransitionSet) {
        TransitionSet set = (TransitionSet) transition;
        int numTransitions = set.getTransitionCount();
        for (i = 0; i < numTransitions; i++) {
            removeTargets(set.getTransitionAt(i), views);
        }
    } else if (!hasSimpleTarget(transition)) {
        List<View> targets = transition.getTargets();
        if (targets != null && targets.size() == views.size() && targets.containsAll(views)) {
            for (i = views.size() - 1; i >= 0; i--) {
                transition.removeTarget((View) views.get(i));
            }
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:19,代碼來源:FragmentTransitionCompat21.java

示例2: addTargets

import android.transition.Transition; //導入依賴的package包/類
public static void addTargets(Object transitionObject, ArrayList<View> views) {
    Transition transition = (Transition) transitionObject;
    int i;
    if (transition instanceof TransitionSet) {
        TransitionSet set = (TransitionSet) transition;
        int numTransitions = set.getTransitionCount();
        for (i = 0; i < numTransitions; i++) {
            addTargets(set.getTransitionAt(i), views);
        }
    } else if (!hasSimpleTarget(transition) && isNullOrEmpty(transition.getTargets())) {
        int numViews = views.size();
        for (i = 0; i < numViews; i++) {
            transition.addTarget((View) views.get(i));
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:17,代碼來源:FragmentTransitionCompat21.java

示例3: onCreate

import android.transition.Transition; //導入依賴的package包/類
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (Build.VERSION.SDK_INT >= 21)
            getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
        setContentView(R.layout.activity_window_transitions_second);

        Transition transition = TransitionInflater
                .from(this)
//                .inflateTransition(R.transition.explode); /* 爆炸效果 */
//                .inflateTransition(R.transition.fade);  /* 淡化效果 */
                .inflateTransition(R.transition.slide); /* 滑動效果 */

        /* 退出時使用 */
        getWindow().setExitTransition(transition);
        /* 第一次進入時使用 */
        getWindow().setEnterTransition(transition);
    }
 
開發者ID:InnoFang,項目名稱:Android-Code-Demos,代碼行數:19,代碼來源:WindowTransitionsSecondActivity.java

示例4: onCreate

import android.transition.Transition; //導入依賴的package包/類
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (Build.VERSION.SDK_INT >= 21)
            getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
        setContentView(R.layout.activity_window_transitions);

        Transition transition = TransitionInflater
                .from(this)
                .inflateTransition(R.transition.explode); /* 爆炸效果 */
//                .inflateTransition(R.transition.fade);  /* 淡化效果 */
//                .inflateTransition(R.transition.slide); /* 滑動效果 */

        /* 退出時使用 */
        getWindow().setExitTransition(transition);
        /* 再次進入時使用 */
        getWindow().setReenterTransition(transition);
        /* 第一次進入時使用 */
        getWindow().setEnterTransition(transition);
    }
 
開發者ID:InnoFang,項目名稱:Android-Code-Demos,代碼行數:21,代碼來源:WindowTransitionsActivity.java

示例5: applyTransitionToWindow

import android.transition.Transition; //導入依賴的package包/類
static void applyTransitionToWindow(@NonNull final Window window,
                                    @NonNull final Transition transition,
                                    boolean enter, boolean retun,
                                    boolean reenter, boolean exit,
                                    boolean overlap) {
    window.setAllowEnterTransitionOverlap(overlap);
    window.setAllowReturnTransitionOverlap(overlap);
    if (enter) {
        window.setEnterTransition(transition);
    }
    if (reenter) {
        window.setReenterTransition(transition);
    }
    if (exit) {
        window.setExitTransition(transition);
    }
    if (retun) {
        window.setReturnTransition(transition);
    }
}
 
開發者ID:lekaha,項目名稱:TwitterizedPhotoView,代碼行數:21,代碼來源:TwitterizedImageShowingActivity.java

示例6: navigateToArtist

import android.transition.Transition; //導入依賴的package包/類
@TargetApi(21)
public static void navigateToArtist(Activity context, long artistID, Pair<View, String> transitionViews) {

    FragmentTransaction transaction = ((AppCompatActivity) context).getSupportFragmentManager().beginTransaction();
    Fragment fragment;

    if (TimberUtils.isLollipop() && transitionViews != null && PreferencesUtility.getInstance(context).getAnimations()) {
        Transition changeImage = TransitionInflater.from(context).inflateTransition(R.transition.image_transform);
        transaction.addSharedElement(transitionViews.first, transitionViews.second);
        fragment = ArtistDetailFragment.newInstance(artistID, true, transitionViews.second);
        fragment.setSharedElementEnterTransition(changeImage);
    } else {
        transaction.setCustomAnimations(R.anim.activity_fade_in,
                R.anim.activity_fade_out, R.anim.activity_fade_in, R.anim.activity_fade_out);
        fragment = ArtistDetailFragment.newInstance(artistID, false, null);
    }
    transaction.hide(((AppCompatActivity) context).getSupportFragmentManager().findFragmentById(R.id.fragment_container));
    transaction.add(R.id.fragment_container, fragment);
    transaction.addToBackStack(null).commit();

}
 
開發者ID:Vinetos,項目名稱:Hello-Music-droid,代碼行數:22,代碼來源:NavigationUtils.java

示例7: constructTransitions

import android.transition.Transition; //導入依賴的package包/類
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private TransitionSet constructTransitions() {
	int[] slideTargets = {R.id.ChatRecyclerView, R.id.chat_input, R.id.chat_input_divider};

	Transition slideTransition = new Slide(Gravity.BOTTOM);
	Transition fadeTransition = new Fade();

	for (int slideTarget : slideTargets) {
		slideTransition.addTarget(slideTarget);
		fadeTransition.excludeTarget(slideTarget, true);
	}

	TransitionSet set = new TransitionSet();
	set.addTransition(slideTransition);
	set.addTransition(fadeTransition);
	return set;
}
 
開發者ID:SebastianRask,項目名稱:Pocket-Plays-for-Twitch,代碼行數:18,代碼來源:LiveStreamActivity.java

示例8: createSlideAnimation

import android.transition.Transition; //導入依賴的package包/類
@SuppressLint("RtlHardcoded")
private TransitionAnimation createSlideAnimation(boolean forward, AnimationData animationData) {
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
		Transition enterTransition = forward ? new Slide(Gravity.RIGHT) : new Slide(Gravity.LEFT);
		Transition exitTransition = forward ? new Slide(Gravity.LEFT) : new Slide(Gravity.RIGHT);
		LollipopTransitionAnimation animation = new LollipopTransitionAnimation(enterTransition, exitTransition);
		animation.setAllowEnterTransitionOverlap(false);

		Fragment currentFragment = mActivity.getSupportFragmentManager().findFragmentById(R.id.fragment_container);
		if (currentFragment instanceof SharedElementProvider) {
			SharedElementProvider sharedElementProvider = (SharedElementProvider) currentFragment;
			View sharedElement = sharedElementProvider.getSharedElement(animationData);
			String shareElementName = sharedElementProvider.getSharedElementName(animationData);
			animation.addSharedElement(sharedElement, shareElementName);
			Transition moveTransition = TransitionInflater.from(mActivity).inflateTransition(android.R.transition.move);
			moveTransition.setDuration(600);
			animation.setSharedElementTransition(moveTransition);
		}
		return animation;
	} else {
		int enterAnimRes = forward ? R.anim.slide_in_right : R.anim.slide_in_left;
		int exitAnimRes = forward ? R.anim.slide_out_left : R.anim.slide_out_right;
		return new SimpleTransitionAnimation(enterAnimRes, exitAnimRes);
	}
}
 
開發者ID:aartikov,項目名稱:Alligator,代碼行數:26,代碼來源:SampleTransitionAnimationProvider.java

示例9: windowTransition

import android.transition.Transition; //導入依賴的package包/類
private void windowTransition() {

    getWindow().getEnterTransition().addListener(new TransitionAdapter(){

      @Override
      public void onTransitionEnd(Transition transition) {
        mAddButton.animate().alpha(1.0f);
        getWindow().getEnterTransition().removeListener(this);
      }
    });

  }
 
開發者ID:anwarcse12028,項目名稱:Traveler-List,代碼行數:13,代碼來源:DetailActivity.java

示例10: setupTransitions

import android.transition.Transition; //導入依賴的package包/類
public void setupTransitions() {
    // Add shared element transition animation if on Lollipop or later
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        // Enter transitions
        TransitionSet setEnter = new TransitionSet();

        Transition slideDown = new Explode();
        slideDown.addTarget(headerView);
        slideDown.excludeTarget(scrollView, true);
        slideDown.setDuration(500);
        setEnter.addTransition(slideDown);

        Transition fadeOut = new Slide(Gravity.BOTTOM);
        fadeOut.addTarget(scrollView);
        fadeOut.setDuration(500);
        setEnter.addTransition(fadeOut);

        // Exit transitions
        TransitionSet setExit = new TransitionSet();

        Transition slideDown2 = new Explode();
        slideDown2.addTarget(headerView);
        slideDown2.setDuration(570);
        setExit.addTransition(slideDown2);

        Transition fadeOut2 = new Slide(Gravity.BOTTOM);
        fadeOut2.addTarget(scrollView);
        fadeOut2.setDuration(280);
        setExit.addTransition(fadeOut2);

        getWindow().setEnterTransition(setEnter);
        getWindow().setReturnTransition(setExit);
    }
}
 
開發者ID:adithya321,項目名稱:SOS-The-Healthcare-Companion,代碼行數:35,代碼來源:ViewActivity.java

示例11: updateLinkText

import android.transition.Transition; //導入依賴的package包/類
void updateLinkText(String link) {
    linkTextView.setText(link);

    Transition transition = new AutoTransition()
            .setDuration(500)
            .setStartDelay(300)
            .setInterpolator(new AccelerateDecelerateInterpolator());
    TransitionManager.beginDelayedTransition(rootView, transition);

    linkTextView.setVisibility(View.VISIBLE);
}
 
開發者ID:rumaan,項目名稱:file.io-app,代碼行數:12,代碼來源:MainActivity.java

示例12: setSceneTransitionAnimation

import android.transition.Transition; //導入依賴的package包/類
public void setSceneTransitionAnimation() {
	if (Build.VERSION.SDK_INT < 21) return;
	Transition slide = new Slide(Gravity.RIGHT);
	slide.excludeTarget(android.R.id.statusBarBackground, true);
	slide.excludeTarget(android.R.id.navigationBarBackground, true);
	Window window = getWindow();
	window.requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
	window.setExitTransition(slide);
	window.setEnterTransition(slide);
	window.setTransitionBackgroundFadeDuration(getResources()
			.getInteger(android.R.integer.config_longAnimTime));
	window.setBackgroundDrawableResource(android.R.color.transparent);
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:14,代碼來源:BriarActivity.java

示例13: onTransitionStart

import android.transition.Transition; //導入依賴的package包/類
@Override
public void onTransitionStart(@NonNull Transition transition) {
    //hide toolbar & statusbar
    float toolbar_translationY = -(toolbar.getHeight());
    float bottomBar_translationY = ((View) bottomBar.getParent()).getHeight();
    toolbar.setTranslationY(toolbar_translationY);
    ((View) bottomBar.getParent()).setTranslationY(bottomBar_translationY);
    super.onTransitionStart(transition);
}
 
開發者ID:kollerlukas,項目名稱:Camera-Roll-Android-App,代碼行數:10,代碼來源:ItemActivity.java

示例14: setEnter

import android.transition.Transition; //導入依賴的package包/類
private void setEnter()
{
	enterTransitionListener = new Transition.TransitionListener() 
	{
		@Override
		public void onTransitionStart(Transition transition)
		{ }

		@Override
		public void onTransitionEnd(Transition transition)
		{
			loadWallpaper(image);
		}

		@Override
		public void onTransitionCancel(Transition transition)
		{ }

		@Override
		public void onTransitionPause(Transition transition)
		{ }

		@Override
		public void onTransitionResume(Transition transition)
		{ }
	};
	getWindow().getEnterTransition().addListener(enterTransitionListener);
}
 
開發者ID:MSay2,項目名稱:Mire,代碼行數:29,代碼來源:ActivitySetWallpapers.java

示例15: changeToConfirmScene

import android.transition.Transition; //導入依賴的package包/類
/**
 * 共享元素
 */
private void changeToConfirmScene() {
    final LayoutOrderConfirmationBinding confBinding = prepareConfirmationBinding();

    final Scene scene = new Scene(binding.content,
            ((ViewGroup) confBinding.getRoot()));

    scene.setEnterAction(onEnterConfirmScene(confBinding));

    final Transition transition = TransitionInflater.from(getContext())
            .inflateTransition(R.transition.transition_confirmation_view);

    TransitionManager.go(scene, transition);
}
 
開發者ID:Pingsh,項目名稱:Mix,代碼行數:17,代碼來源:OrderDialogFragment.java


注:本文中的android.transition.Transition類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。