@Override public void setAttribute(View view, DOMAttr attr, AttrLayoutContext attrCtx) { ObjectAnimator animator = (ObjectAnimator) getAnimator(attr.getResourceDesc(), attrCtx.getXMLInflaterContext()); AdapterViewAnimator adapterViewAnimator = (AdapterViewAnimator)view; String value = attr.getName(); if ("inAnimation".equals(value)) { if (animator == null) animator = getDefaultInAnimation(); adapterViewAnimator.setInAnimation(animator); } else if ("outAnimation".equals(value)) { if (animator == null) animator = getDefaultOutAnimation(); adapterViewAnimator.setOutAnimation(animator); } else throw MiscUtil.internalError(); }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { mQuizView = (AdapterViewAnimator) view.findViewById(R.id.quiz_view); decideOnViewToDisplay(); setQuizViewAnimations(); final AvatarView avatar = (AvatarView) view.findViewById(R.id.avatar); setAvatarDrawable(avatar); initProgressToolbar(view); super.onViewCreated(view, savedInstanceState); }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { mQuizView = (AdapterViewAnimator) view.findViewById(R.id.quiz_view); decideOnViewToDisplay(); mQuizView.setInAnimation(getActivity(), R.animator.slide_in_bottom); mQuizView.setOutAnimation(getActivity(), R.animator.slide_out_top); final AvatarView avatar = (AvatarView) view.findViewById(R.id.avatar); setAvatarDrawable(avatar); initProgressToolbar(view); super.onViewCreated(view, savedInstanceState); }
@Override public void makeDataRenderedWithinAdapterView( AdapterView<? extends Adapter> adapterView, AdaptedData data) { checkArgument(data.opaqueToken instanceof Integer, "Not my data: %s", data); int position = ((Integer) data.opaqueToken).intValue(); boolean moved = false; // set selection should always work, we can give a little better experience if per subtype // though. if (Build.VERSION.SDK_INT > 7) { if (adapterView instanceof AbsListView) { if (Build.VERSION.SDK_INT > 10) { ((AbsListView) adapterView).smoothScrollToPositionFromTop(position, adapterView.getPaddingTop(), 0); } else { ((AbsListView) adapterView).smoothScrollToPosition(position); } moved = true; } if (Build.VERSION.SDK_INT > 10) { if (adapterView instanceof AdapterViewAnimator) { if (adapterView instanceof AdapterViewFlipper) { ((AdapterViewFlipper) adapterView).stopFlipping(); } ((AdapterViewAnimator) adapterView).setDisplayedChild(position); moved = true; } } } if (!moved) { adapterView.setSelection(position); } }