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


Java ChangeBounds類代碼示例

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


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

示例1: onClick

import android.transition.ChangeBounds; //導入依賴的package包/類
@OnClick(R.id.square2)
public void onClick() {

    FragmentSharedElementTransitionTarget targetFragment = new FragmentSharedElementTransitionTarget();
    // FIXME: 08/02/2017 the shared element transitions to the next fragment below other views while it should be on top as in Activity transitions
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        TransitionSet transitionSet = new TransitionSet();
        transitionSet.addTransition(new ChangeBounds());
        transitionSet.setPathMotion(new ArcMotion());
        targetFragment.setSharedElementEnterTransition(transitionSet);
        targetFragment.setSharedElementReturnTransition(transitionSet);
        targetFragment.setEnterTransition(TransitionInflater.from(getActivity()).inflateTransition(R.transition.slide_bottom));
        targetFragment.setExitTransition(TransitionInflater.from(getActivity()).inflateTransition(R.transition.slide_top_and_fade));
        setExitTransition(new Explode());
        setReenterTransition(new Explode());
        setAllowReturnTransitionOverlap(false);
    }
    getActivity().getSupportFragmentManager()
            .beginTransaction()
            .addSharedElement(square2, getString(R.string.custom_element_transition_name))
            .replace(R.id.fragmentContainer, targetFragment)
            .addToBackStack(null)
            .commit();
}
 
開發者ID:zawadz88,項目名稱:AnimationShowcase,代碼行數:25,代碼來源:FragmentSharedElementTransitionSource.java

示例2: handleTransitions

import android.transition.ChangeBounds; //導入依賴的package包/類
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
private void handleTransitions() {
    useSysTransition = getIntent().getBooleanExtra(KEY_USE_SYS_TRANSITION, false);
    if(useSysTransition) {
        ivDetail.setVisibility(View.VISIBLE);
        Fade fade = new Fade();
        fade.setDuration(500);
        getWindow().setEnterTransition(fade);
        getWindow().setExitTransition(fade);
        ChangeBounds changeBounds = new ChangeBounds();
        getWindow().setSharedElementEnterTransition(changeBounds);
    }
    entity = (TransitionsEntity) getIntent().getSerializableExtra(KEY_ENTITY);
    KLog.d(entity);
    GlideUtils.displayImage(this, ivDetail, entity.getUrl(), R.drawable.def_placeholder);
}
 
開發者ID:Sherchen,項目名稱:AnimationsDemo,代碼行數:17,代碼來源:DetailActivity.java

示例3: addNextFragment

import android.transition.ChangeBounds; //導入依賴的package包/類
private void addNextFragment(Sample sample, ImageView squareBlue, boolean overlap) {
    SharedElementFragment2 sharedElementFragment2 = SharedElementFragment2.newInstance(sample);

    Slide slideTransition = new Slide(Gravity.RIGHT);
    slideTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium));

    ChangeBounds changeBoundsTransition = new ChangeBounds();
    changeBoundsTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium));

    sharedElementFragment2.setEnterTransition(slideTransition);
    sharedElementFragment2.setAllowEnterTransitionOverlap(overlap);
    sharedElementFragment2.setAllowReturnTransitionOverlap(overlap);
    sharedElementFragment2.setSharedElementEnterTransition(changeBoundsTransition);

    getFragmentManager().beginTransaction()
            .replace(R.id.sample2_content, sharedElementFragment2)
            .addToBackStack(null)
            .addSharedElement(squareBlue, getString(R.string.square_blue_name))
            .commit();
}
 
開發者ID:shenhuanet,項目名稱:AndroidOpen,代碼行數:21,代碼來源:SharedElementFragment1.java

示例4: getNextButtonTransition

import android.transition.ChangeBounds; //導入依賴的package包/類
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private ChangeBounds getNextButtonTransition() {
    ChangeBounds arcMoveTransition = new ChangeBounds();
    //create "zorro" like path
    arcMoveTransition.setPathMotion(new PathMotion() {
        @Override
        public Path getPath(float startX, float startY, float endX, float endY) {
            Path p = new Path();
            p.moveTo(startX, startY);
            p.lineTo(endX, startY);
            p.lineTo(startX, endY);
            p.lineTo(endX, endY);
            return p;
        }
    });
    arcMoveTransition.setDuration(500);
    arcMoveTransition.setInterpolator(new AccelerateDecelerateInterpolator());
    return arcMoveTransition;
}
 
開發者ID:fzymek,項目名稱:FunWithAndroid,代碼行數:20,代碼來源:WelcomeFragmentStep1.java

示例5: startTransition

import android.transition.ChangeBounds; //導入依賴的package包/類
private void startTransition(){
    lifeGridFragment = LifeGridFragment.newInstance();
    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    if(Build.VERSION.SDK_INT >= 21) {
        TransitionSet gridTransition = new TransitionSet();
        gridTransition.setDuration(600);
        gridTransition.addTransition(new ChangeBounds());
        gridTransition.addTransition((new ChangeTransform()));
        lifeGridFragment.setSharedElementEnterTransition(gridTransition);
    }


    fragmentTransaction.addSharedElement(findViewById(R.id.intro_card_view), getString(R.string.card_view_transition_name));
    fragmentTransaction.replace(R.id.container, lifeGridFragment);
    fragmentTransaction.addToBackStack(null);
    fragmentTransaction.commit();
    appBarLayout.setExpanded(false, true);
}
 
開發者ID:lewismcgeary,項目名稱:AndroidGameofLife,代碼行數:20,代碼來源:MainActivity.java

示例6: startToolbarAnimation

import android.transition.ChangeBounds; //導入依賴的package包/類
public static void startToolbarAnimation(
    Context context,
    ViewGroup v
) {
    if (new UpdaterOptions(context).disableAnimations()) {
        return;
    }

    if (Build.VERSION.SDK_INT >= 21) {
        TransitionManager.beginDelayedTransition(v, new TransitionSet()
            .addTransition(new Fade(Fade.IN))
            .addTransition(new Slide(Gravity.LEFT))
            .addTransition(new ChangeBounds())
        );

    } else if (Build.VERSION.SDK_INT >= 14){
        android.support.transition.TransitionManager.beginDelayedTransition(v, new AutoTransition().setDuration(250));
    } {
        // No animation
    }
}
 
開發者ID:rumboalla,項目名稱:apkupdater,代碼行數:22,代碼來源:AnimationUtil.java

示例7: createTransition

import android.transition.ChangeBounds; //導入依賴的package包/類
@NonNull
@Override
protected Transition createTransition(@NonNull ViewGroup container, @NonNull View entering, @Nullable View leaving, boolean push) {
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
    return new TransitionSet()
        .setOrdering(ORDERING_TOGETHER)
        .addTransition(new Fade(Fade.OUT))
        .addTransition(new Fade(Fade.IN));
  }
  final TransitionSet transition = new TransitionSet()
      .addTransition(new ChangeBounds())
      .addTransition(new ChangeClipBounds())
      .addTransition(new ChangeTransform());

  transition.setPathMotion(new ArcMotion());

  return transition;
}
 
開發者ID:SiimKinks,項目名稱:unicorn,代碼行數:19,代碼來源:ArcMoveTransitionHandler.java

示例8: onCreate

import android.transition.ChangeBounds; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    mSceneRoot = (ViewGroup) findViewById(R.id.scene_root);

    mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene1, this);
    mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene2, this);

    mTransition = new ChangeBounds();
    mTransition.setDuration(DateUtils.SECOND_IN_MILLIS);
    mTransition.setInterpolator(new AccelerateDecelerateInterpolator());
    TransitionManager.go(mScene1);
    mCurrentScene = mScene1;

    findViewById(R.id.button).setOnClickListener(this);
}
 
開發者ID:IanGClifton,項目名稱:auid2,代碼行數:22,代碼來源:MainActivity.java

示例9: onCheckedChanged

import android.transition.ChangeBounds; //導入依賴的package包/類
@Override public void onCheckedChanged(final RadioGroup group, int checkedId) {
    switch (checkedId) {
        case R.id.select_scene_1: {
            // You can start an automatic transition with TransitionManager.go().
            TransitionManager.go(mScene1);
            break;
        }
        case R.id.select_scene_2: {
            TransitionSet set = new TransitionSet();
            Slide slide = new Slide(Gravity.LEFT);
            slide.addTarget(R.id.transition_title);
            set.addTransition(slide);
            set.addTransition(new ChangeBounds());
            set.setOrdering(TransitionSet.ORDERING_TOGETHER);
            set.setDuration(350);
            TransitionManager.go(mScene2, set);
            break;
        }
        case R.id.select_scene_3: {
            // You can also start a transition with a custom TransitionManager.
            mTransitionManagerForScene3.transitionTo(mScene3);
            break;
        }
    }
}
 
開發者ID:xu6148152,項目名稱:binea_project_for_android,代碼行數:26,代碼來源:ScenesSample.java

示例10: makeSharedElementEnterTransition

import android.transition.ChangeBounds; //導入依賴的package包/類
public static Transition makeSharedElementEnterTransition(List<String> textTransitionNames) {
    TransitionSet set = new TransitionSet();
    set.setOrdering(TransitionSet.ORDERING_TOGETHER);

    Transition recolor = new Recolor();
    Transition changeBounds = new ChangeBounds();
    Transition textSize = new TextSizeTransition();

    for (String textTName : textTransitionNames) {
        changeBounds.addTarget(textTName);
        textSize.addTarget(textTName);
        recolor.addTarget(textTName);
    }

    set.addTransition(recolor);
    set.addTransition(changeBounds);
    set.addTransition(textSize);

    ///set.setDuration(3000);
    return set;
}
 
開發者ID:ndorigatti,項目名稱:RevealPathMotion,代碼行數:22,代碼來源:TransitionUtils.java

示例11: setPitchBarPosition

import android.transition.ChangeBounds; //導入依賴的package包/類
private void setPitchBarPosition(double frequency) {
    View pitchBar = (View)findViewById(R.id.tune_view_current_pitch);
    int margin = 20;
    double leftDP = NoteCalculator.getPitchBarPosition(frequency, 560);

    Transition moveTransition = new ChangeBounds();
    moveTransition.setDuration(300);
    moveTransition.setInterpolator(new LinearInterpolator());

    TransitionManager.beginDelayedTransition((ViewGroup) pitchBar.getRootView(), moveTransition);

    ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams)(pitchBar.getLayoutParams());
    Log.d(TAG, String.format("Current: %d New: %f", params.leftMargin, leftDP));
    params.setMargins((int)leftDP,0,0,0);
    pitchBar.setLayoutParams(params);
}
 
開發者ID:GlassTune,項目名稱:GlassTune,代碼行數:17,代碼來源:TuneGuitarActivity.java

示例12: onTextClick

import android.transition.ChangeBounds; //導入依賴的package包/類
@OnClick({ R.id.text1 })
public void onTextClick() {

    // Create a TransitionSet that will animated ChangeBounds and Fade
    TransitionSet transitionSet = new TransitionSet();
    transitionSet.addTransition(new ChangeBounds());
    transitionSet.addTransition(new Fade());

    TransitionManager.beginDelayedTransition(mLayout, transitionSet);

    // Remove text1 from the Layout
    mLayout.removeView(mText1);

    // Increase the height of Text1 and set a top margin
    LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mText1.getLayoutParams();
    params.height *= 2;
    params.topMargin = 100;
    mText1.setLayoutParams(params);

    // Add text1 back to the layout
    // TransitionManager will automagically apply animations
    mLayout.addView(mText1, 1);


}
 
開發者ID:RealAndyLawton,項目名稱:BreakMeOffKitKat,代碼行數:26,代碼來源:TransitionsDelayedFragment.java

示例13: createTransitionSet

import android.transition.ChangeBounds; //導入依賴的package包/類
public static TransitionSet createTransitionSet(
    ScalingUtils.ScaleType fromScale,
    ScalingUtils.ScaleType toScale) {
  TransitionSet transitionSet = new TransitionSet();
  transitionSet.addTransition(new ChangeBounds());
  transitionSet.addTransition(new DraweeTransition(fromScale, toScale));
  return transitionSet;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:DraweeTransition.java

示例14: prepare

import android.transition.ChangeBounds; //導入依賴的package包/類
public void prepare(Fragment toFragment) {
    final Bundle transitionBundle = TransitionBundleFactory.createTransitionBundle(context, fromView, bitmap);
    if (Build.VERSION.SDK_INT >= 21) {
        toFragment.setSharedElementEnterTransition(new ChangeBounds());
        toFragment.setSharedElementReturnTransition(new ChangeBounds());
    }
    toFragment.setArguments(transitionBundle);
}
 
開發者ID:MSay2,項目名稱:Mire,代碼行數:9,代碼來源:FragmentTransitionLauncher.java

示例15: getTransition

import android.transition.ChangeBounds; //導入依賴的package包/類
@Override
@NonNull
protected Transition getTransition(@NonNull ViewGroup container, View from, View to, boolean isPush) {
    TransitionSet transition = new TransitionSet()
            .setOrdering(TransitionSet.ORDERING_SEQUENTIAL)
            .addTransition(new Fade(Fade.OUT))
            .addTransition(new TransitionSet().addTransition(new ChangeBounds()).addTransition(new ChangeClipBounds()).addTransition(new ChangeTransform()))
            .addTransition(new Fade(Fade.IN));

    transition.setPathMotion(new ArcMotion());

    return transition;
}
 
開發者ID:zawadz88,項目名稱:Conductor-TransitionsEverywhere,代碼行數:14,代碼來源:ArcFadeMoveChangeHandler.java


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