本文整理了Java中android.transition.Transition.addTarget()
方法的一些代码示例,展示了Transition.addTarget()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transition.addTarget()
方法的具体详情如下:
包路径:android.transition.Transition
类名称:Transition
方法名:addTarget
暂无
代码示例来源:origin: bluelinelabs/Conductor
void configureTransition(@NonNull final ViewGroup container, @Nullable View from, @Nullable View to, @NonNull final Transition transition, boolean isPush) {
final View nonExistentView = new View(container.getContext());
List<View> fromSharedElements = new ArrayList<>();
List<View> toSharedElements = new ArrayList<>();
configureSharedElements(container, nonExistentView, to, from, isPush, fromSharedElements, toSharedElements);
List<View> exitingViews = exitTransition != null ? configureEnteringExitingViews(exitTransition, from, fromSharedElements, nonExistentView) : null;
if (exitingViews == null || exitingViews.isEmpty()) {
exitTransition = null;
}
if (enterTransition != null) {
enterTransition.addTarget(nonExistentView);
}
final List<View> enteringViews = new ArrayList<>();
scheduleRemoveTargets(transition, enterTransition, enteringViews, exitTransition, exitingViews, sharedElementTransition, toSharedElements);
scheduleTargetChange(container, to, nonExistentView, toSharedElements, enteringViews, exitingViews);
setNameOverrides(container, toSharedElements);
scheduleNameReset(container, toSharedElements);
}
代码示例来源:origin: bluelinelabs/Conductor
@Override @NonNull
protected Transition getTransition(@NonNull final ViewGroup container, @Nullable final View from, @Nullable final View to, boolean isPush) {
Transition backgroundFade = new Fade();
backgroundFade.addTarget(R.id.dialog_background);
Transition fabTransform = new FabTransform(ContextCompat.getColor(container.getContext(), R.color.colorAccent), R.drawable.ic_github_face);
TransitionSet set = new TransitionSet();
set.addTransition(backgroundFade);
set.addTransition(fabTransform);
return set;
}
代码示例来源:origin: bluelinelabs/Conductor
public static void replaceTargets(@NonNull Transition transition, @NonNull List<View> oldTargets, @Nullable List<View> newTargets) {
if (transition instanceof TransitionSet) {
TransitionSet set = (TransitionSet) transition;
int numTransitions = set.getTransitionCount();
for (int i = 0; i < numTransitions; i++) {
Transition child = set.getTransitionAt(i);
replaceTargets(child, oldTargets, newTargets);
}
} else if (!TransitionUtils.hasSimpleTarget(transition)) {
List<View> targets = transition.getTargets();
if (targets != null && targets.size() == oldTargets.size() && targets.containsAll(oldTargets)) {
final int targetCount = newTargets == null ? 0 : newTargets.size();
for (int i = 0; i < targetCount; i++) {
transition.addTarget(newTargets.get(i));
}
for (int i = oldTargets.size() - 1; i >= 0; i--) {
transition.removeTarget(oldTargets.get(i));
}
}
}
}
代码示例来源:origin: bluelinelabs/Conductor
public static void addTargets(@Nullable Transition transition, @NonNull List<View> views) {
if (transition == null) {
return;
}
if (transition instanceof TransitionSet) {
TransitionSet set = (TransitionSet) transition;
int numTransitions = set.getTransitionCount();
for (int i = 0; i < numTransitions; i++) {
Transition child = set.getTransitionAt(i);
addTargets(child, views);
}
} else if (!hasSimpleTarget(transition)) {
List<View> targets = transition.getTargets();
if (isNullOrEmpty(targets)) {
int numViews = views.size();
for (int i = 0; i < numViews; i++) {
transition.addTarget(views.get(i));
}
}
}
}
代码示例来源:origin: DroidsOnRoids/Workcation
public TransitionBuilder target(String target) {
transition.addTarget(target);
return this;
}
代码示例来源:origin: DroidsOnRoids/Workcation
public TransitionBuilder target(View view) {
transition.addTarget(view);
return this;
}
代码示例来源:origin: DroidsOnRoids/Workcation
public TransitionBuilder target(Class clazz) {
transition.addTarget(clazz);
return this;
}
代码示例来源:origin: DroidsOnRoids/Workcation
public TransitionBuilder target(int targetId) {
transition.addTarget(targetId);
return this;
}
代码示例来源:origin: kingargyle/adt-leanback-support
public static void addTargets(Object transitionObject, ArrayList<View> views) {
Transition transition = (Transition) transitionObject;
int numViews = views.size();
for (int i = 0; i < numViews; i++) {
transition.addTarget(views.get(i));
}
}
代码示例来源:origin: stackoverflow.com
Transition fadeOut = new FadeTransition(1f, 0f, new LinearInterpolator());
fadeOut.addTarget(transitionName);
代码示例来源:origin: DroidsOnRoids/Workcation
public TransitionBuilder pair(Pair<View, String> pair) {
pair.first.setTransitionName(pair.second);
transition.addTarget(pair.second);
return this;
}
代码示例来源:origin: stackoverflow.com
TransitionSet set = new TransitionSet();
Transition slideUp = new Slide(Gravity.UP);
slideUp.addTarget(view1);
set.addTransition(slideUp);
Transition slideDown = new Slide(Gravity.DOWN);
slideDown.addTarget(view2);
set.addTransition(slideDown);
代码示例来源:origin: tyrex-team/senslogs
public void addTextView(TextView tv, int sizeBegin, int sizeEnd) {
Transition textSize = new TextSizeTransition();
textSize.addTarget(tv.getId());
textSize.addTarget(tv.getText().toString());
mTransitionSet.addTransition(textSize);
textViewList.put(tv, new Pair<>(sizeBegin, sizeEnd));
}
代码示例来源:origin: DroidsOnRoids/Workcation
public TransitionBuilder link(final View from, final View to, final String transitionName) {
from.setTransitionName(transitionName);
to.setTransitionName(transitionName);
transition.addTarget(transitionName);
return this;
}
代码示例来源:origin: stackoverflow.com
// above I've gotten the sharedElements (Views)...
newSharedElement.setTransitionName("sharedProperty");
oldSharedElement.setTransitionName("sharedProperty");
// having android:transitionName in the xml can be easier
// This transition handles the shared element move based on the shared tansition name
Transition shared = TransitionInflater.from(context).inflateTransition(android.R.transition.move);
shared.addTarget(newSharedElement);
// create a scene container is a parentView (FrameLayout) of both children
Scene scene = new Scene(container, newChild);
// everything else is set to Fade, shared element is excluded
Transition fade = TransitionInflater.from(context).inflateTransition(android.R.transition.fade);
fade.excludeTarget(newSharedElement, true);
// combine the translations
TransitionSet set = new TransitionSet();
set.addTransition(shared).addTransition(fade);
// translationize
TransitionManager.go(scene, set);
代码示例来源:origin: andremion/Music-Cover-View
mRectToCircleTransition.addTarget(this);
mRectToCircleTransition.addListener(new TransitionAdapter() {
@Override
mCircleToRectTransition.addTarget(this);
mCircleToRectTransition.addListener(new TransitionAdapter() {
@Override
代码示例来源:origin: kingargyle/adt-leanback-support
final Transition enterTransition = (Transition) enterTransitionObject;
if (enterTransition != null) {
enterTransition.addTarget(nonExistentView);
代码示例来源:origin: jonasbleyl/recurrence
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);
}
}
代码示例来源:origin: stackoverflow.com
textSize.addTarget(tv.getId());
textSize.addTarget(tv.getText().toString());
mTransitionSet.addTransition(textSize);
代码示例来源:origin: codeka/wwmmo
if (sharedView.getViewId() != 0) {
fadeTransition.excludeTarget(sharedView.getViewId(), true);
transformTransition.addTarget(sharedView.getViewId());
} else {
String name = "shared-" + Long.toString(RANDOM.nextLong());
transformTransition.addTarget(name);
内容来源于网络,如有侵权,请联系作者删除!