android.transition.Transition.addListener()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(10.7k)|赞(0)|评价(0)|浏览(250)

本文整理了Java中android.transition.Transition.addListener()方法的一些代码示例,展示了Transition.addListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transition.addListener()方法的具体详情如下:
包路径:android.transition.Transition
类名称:Transition
方法名:addListener

Transition.addListener介绍

暂无

代码示例

代码示例来源:origin: bluelinelabs/Conductor

private void scheduleRemoveTargets(@NonNull final Transition overallTransition,
                  @Nullable final Transition enterTransition, @Nullable final List<View> enteringViews,
                  @Nullable final Transition exitTransition, @Nullable final List<View> exitingViews,
                  @Nullable final Transition sharedElementTransition, @Nullable final List<View> toSharedElements) {
  overallTransition.addListener(new TransitionListener() {
    @Override
    public void onTransitionStart(Transition transition) {
      if (enterTransition != null && enteringViews != null) {
        TransitionUtils.replaceTargets(enterTransition, enteringViews, null);
      }
      if (exitTransition != null && exitingViews != null) {
        TransitionUtils.replaceTargets(exitTransition, exitingViews, null);
      }
      if (sharedElementTransition != null && toSharedElements != null) {
        TransitionUtils.replaceTargets(sharedElementTransition, toSharedElements, null);
      }
    }
    @Override
    public void onTransitionEnd(Transition transition) { }
    @Override
    public void onTransitionCancel(Transition transition) { }
    @Override
    public void onTransitionPause(Transition transition) { }
    @Override
    public void onTransitionResume(Transition transition) { }
  });
}

代码示例来源:origin: CarGuo/GSYVideoPlayer

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private boolean addTransitionListener() {
  transition = getWindow().getSharedElementEnterTransition();
  if (transition != null) {
    transition.addListener(new OnTransitionListener(){
      @Override
      public void onTransitionEnd(Transition transition) {
        super.onTransitionEnd(transition);
        videoPlayer.startPlayLogic();
        transition.removeListener(this);
      }
    });
    return true;
  }
  return false;
}

代码示例来源:origin: CarGuo/GSYVideoPlayer

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private boolean addTransitionListener() {
  transition = getWindow().getSharedElementEnterTransition();
  if (transition != null) {
    transition.addListener(new OnTransitionListener(){
      @Override
      public void onTransitionEnd(Transition transition) {
        super.onTransitionEnd(transition);
        videoPlayer.startPlayLogic();
        transition.removeListener(this);
      }
    });
    return true;
  }
  return false;
}

代码示例来源:origin: CarGuo/GSYVideoPlayer

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private boolean addTransitionListener() {
  transition = getWindow().getSharedElementEnterTransition();
  if (transition != null) {
    transition.addListener(new OnTransitionListener(){
      @Override
      public void onTransitionEnd(Transition transition) {
        super.onTransitionEnd(transition);
        videoPlayer.startPlayLogic();
        transition.removeListener(this);
      }
    });
    return true;
  }
  return false;
}

代码示例来源:origin: bluelinelabs/Conductor

transition.addListener(endListener);
} else {
  endListener.onTransitionCompleted(null);
  transition.addListener(endListener);
} else {
  endListener.onTransitionCompleted(null);

代码示例来源:origin: nickbutcher/plaid

/**
 * The shared element transition to dribbble shots & dn stories can intersect with the FAB.
 * This can cause a strange layers-passing-through-each-other effect. On return hide the FAB
 * and animate it back in after the transition.
 */
private void setGridItemContentTransitions(View gridItem) {
  final View fab = host.findViewById(R.id.fab);
  if (!ViewUtils.viewsIntersect(gridItem, fab)) return;
  Transition reenter = TransitionInflater.from(host)
      .inflateTransition(R.transition.grid_overlap_fab_reenter);
  reenter.addListener(new TransitionUtils.TransitionListenerAdapter() {
    @Override
    public void onTransitionEnd(Transition transition) {
      // we only want these content transitions in certain cases so clear out when done.
      host.getWindow().setReenterTransition(null);
    }
  });
  host.getWindow().setReenterTransition(reenter);
}

代码示例来源:origin: bluelinelabs/Conductor

transition.addListener(new TransitionListener() {
  @Override
  public void onTransitionStart(Transition transition) { }

代码示例来源:origin: naman14/Timber

@TargetApi(21)
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_playlist_detail);
  action = getIntent().getAction();
  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  getSupportActionBar().setTitle("");
  playlistsMap.put(Constants.NAVIGATE_PLAYLIST_LASTADDED, playlistLastAdded);
  playlistsMap.put(Constants.NAVIGATE_PLAYLIST_RECENT, playlistRecents);
  playlistsMap.put(Constants.NAVIGATE_PLAYLIST_TOPTRACKS, playlistToptracks);
  playlistsMap.put(Constants.NAVIGATE_PLAYLIST_USERCREATED, playlistUsercreated);
  recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
  blurFrame = (ImageView) findViewById(R.id.blurFrame);
  playlistname = (TextView) findViewById(R.id.name);
  foreground = findViewById(R.id.foreground);
  recyclerView.setLayoutManager(new LinearLayoutManager(this));
  setAlbumart();
  animate = getIntent().getBooleanExtra(Constants.ACTIVITY_TRANSITION, false);
  if (animate && TimberUtils.isLollipop()) {
    getWindow().getEnterTransition().addListener(new EnterTransitionListener());
  } else {
    setUpSongs();
  }
}

代码示例来源:origin: xinghongfei/LookLook

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.topnews_describe);
  ButterKnife.bind(this);
  setSupportActionBar(mToolbar);
  mDeviceInfo = DensityUtil.getDeviceInfo(this);
  width = mDeviceInfo[0];
  heigh = width * 3 / 4;
  initData();
  initView();
  getData();
  enterAnimation();
  chromeFader = new ElasticDragDismissFrameLayout.SystemChromeFader(this);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    getWindow().getSharedElementReturnTransition().addListener(mReturnHomeListener);
    getWindow().getSharedElementEnterTransition().addListener(mEnterTrasitionListener);
  }
}

代码示例来源:origin: xinghongfei/LookLook

getWindow().getSharedElementEnterTransition().addListener(mListener);
getWindow().setSharedElementEnterTransition(new ChangeBounds());

代码示例来源:origin: bluelinelabs/Conductor

@Nullable
@Override
public Transition getSharedElementTransition(@NonNull ViewGroup container, @Nullable final View from, @Nullable View to, boolean isPush) {
  Transition transition = new TransitionSet().addTransition(new ChangeBounds()).addTransition(new ChangeClipBounds()).addTransition(new ChangeTransform());
  transition.setPathMotion(new ArcMotion());
  // The framework doesn't totally fade out the "from" shared element, so we'll hide it manually once it's safe.
  transition.addListener(new TransitionListener() {
    @Override
    public void onTransitionStart(Transition transition) {
      if (from != null) {
        for (String name : sharedElementNames) {
          View namedView = TransitionUtils.findNamedView(from, name);
          if (namedView != null) {
            namedView.setVisibility(View.INVISIBLE);
          }
        }
      }
    }
    @Override
    public void onTransitionEnd(Transition transition) { }
    @Override
    public void onTransitionCancel(Transition transition) { }
    @Override
    public void onTransitionPause(Transition transition) { }
    @Override
    public void onTransitionResume(Transition transition) { }
  });
  return transition;
}

代码示例来源:origin: Ramotion/cardslider-android

loadFullSizeBitmap(smallResId);
} else {
  getWindow().getSharedElementEnterTransition().addListener(new Transition.TransitionListener() {

代码示例来源:origin: fanrunqi/MaterialLogin

private void ShowEnterAnimation() {
  Transition transition = TransitionInflater.from(this).inflateTransition(R.transition.fabtransition);
  getWindow().setSharedElementEnterTransition(transition);
  transition.addListener(new Transition.TransitionListener() {
    @Override
    public void onTransitionStart(Transition transition) {
      cvAdd.setVisibility(View.GONE);
    }
    @Override
    public void onTransitionEnd(Transition transition) {
      transition.removeListener(this);
      animateRevealShow();
    }
    @Override
    public void onTransitionCancel(Transition transition) {
    }
    @Override
    public void onTransitionPause(Transition transition) {
    }
    @Override
    public void onTransitionResume(Transition transition) {
    }
  });
}

代码示例来源:origin: Ramotion/garland-view-android

getWindow().getSharedElementEnterTransition().addListener(new Transition.TransitionListener() {

代码示例来源:origin: xinghongfei/LookLook

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.zhihudescribe);
  setDragEdge(SwipeBackLayout.DragEdge.LEFT);
  ButterKnife.bind(this);
  mDeviceInfo = DensityUtil.getDeviceInfo(this);
  width = mDeviceInfo[0];
  heigh = width * 3 / 4;
  setSupportActionBar(mToolbar);
  initlistenr();
  initData();
  initView();
  getData();
  chromeFader = new ElasticDragDismissFrameLayout.SystemChromeFader(this);
  if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP){
    getWindow().getSharedElementReturnTransition().addListener(zhihuReturnHomeListener);
    getWindow().setSharedElementEnterTransition(new ChangeBounds());
  }
  enterAnimation();
}

代码示例来源:origin: kaku2015/ColorfulNews

private void initLazyLoadView() {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    getWindow().getEnterTransition().addListener(new Transition.TransitionListener() {
      @Override
      public void onTransitionStart(Transition transition) {
      }
      @Override
      public void onTransitionEnd(Transition transition) {
        showToolBarAndPhotoTouchView();
      }
      @Override
      public void onTransitionCancel(Transition transition) {
      }
      @Override
      public void onTransitionPause(Transition transition) {
      }
      @Override
      public void onTransitionResume(Transition transition) {
      }
    });
  } else {
    showToolBarAndPhotoTouchView();
  }
}

代码示例来源:origin: blundell/QuickSand

public void addListener(Transition.TransitionListener listener) {
    transition.addListener(listener);
  }
}

代码示例来源:origin: luhaoaimama1/LollipopTransition

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_transition);
  ButterKnife.bind(this);
  btFade.performClick();
  scenesMethod();
  nowTransition.addListener(this);
}

代码示例来源:origin: contentful/gallery-app-android

private void initializeViews() {
 viewPager.setCurrentItem(gallery.images().indexOf(image));
 viewPager.setOffscreenPageLimit(getResources().getInteger(
   R.integer.gallery_pager_offscreen_limit));
 repositionStar();
 ViewUtils.setViewHeight(infoContainer, Const.IMAGE_HEIGHT, true);
 if (Const.HAS_L && Utils.isPortrait(this)) {
  ViewUtils.setViewHeight(photo, Const.IMAGE_HEIGHT, false);
  photo.setImageDrawable(Holder.get());
  getWindow().getSharedElementEnterTransition().addListener(new TransitionListenerAdapter() {
   @Override public void onTransitionEnd(Transition transition) {
    getWindow().getSharedElementEnterTransition().removeListener(this);
    photo.setVisibility(View.GONE);
   }
  });
 }
}

代码示例来源:origin: googlesamples/android-unsplash

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  postponeEnterTransition();
  // Listener to reset shared element exit transition callbacks.
  getWindow().getSharedElementExitTransition().addListener(sharedExitListener);
  grid = (RecyclerView) findViewById(R.id.image_grid);
  empty = (ProgressBar) findViewById(android.R.id.empty);
  setupRecyclerView();
  if (savedInstanceState != null) {
    relevantPhotos = savedInstanceState.getParcelableArrayList(IntentUtil.RELEVANT_PHOTOS);
  }
  displayData();
}

相关文章