private void solveData() { mButler.clear(); final boolean ready = isDataSetReady(); if (ready) { final LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation(this, R.anim.layout_animation_from_bottom); mRecyclerView.setLayoutAnimation(controller); mRecyclerView.scheduleLayoutAnimation(); dataSetReady(); } else { dataSetUnready(); } }
public void loadFolder(String folder) { clear(); mProjectFolder = folder; mListProjects = PhonkScriptHelper.listProjects(mProjectFolder, mOrderByName); mProjectAdapter.setArray(mListProjects); mGrid.setAdapter(mProjectAdapter); // mGrid.clearAnimation(); // mGrid.startAnimation(mAnim); notifyAddedProject(); final Context context = mGrid.getContext(); final LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation(context, R.anim.fav_grid_anim); mGrid.setLayoutAnimation(controller); mGrid.getAdapter().notifyDataSetChanged(); mGrid.scheduleLayoutAnimation(); MLog.d(TAG, "loading " + mProjectFolder); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_grid); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mRecyclerView = (StaggeredGridRecyclerView) findViewById(R.id.recycler_view); mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)); mStaggeredGridAdapter = new StaggeredGridAdapter(); mStaggeredGridAdapter.setDataSet(mockData()); mRecyclerView.setAdapter(mStaggeredGridAdapter); LayoutAnimationController controller = MyLayoutAnimationHelper.makeLayoutAnimationController(); ViewGroup viewGroup = (ViewGroup) findViewById(R.id.root_view); viewGroup.setLayoutAnimation(controller); viewGroup.scheduleLayoutAnimation(); }
@Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); if (itemList.size() == 0) Toast.makeText(MyRank.this, "发生未知错误",Toast.LENGTH_SHORT).show(); RecyclerView rankList = findViewById(R.id.rank_list); ReleaseRankItemAdapter adapter = new ReleaseRankItemAdapter(itemList); GridLayoutManager layoutManager = new GridLayoutManager(MyRank.this, 1); rankList.setLayoutManager(layoutManager); rankList.setAdapter(adapter); TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 2f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0); animation.setInterpolator(new DecelerateInterpolator()); animation.setDuration(550); lac = new LayoutAnimationController(animation, 0.12f); lac.setInterpolator(new DecelerateInterpolator()); rankList.setLayoutAnimation(lac); RecyclerView ranklist1 = findViewById(R.id.rank_list1); ReleaseRankItemAdapter adapter1 = new ReleaseRankItemAdapter(itemListOthers); GridLayoutManager layoutManager1 = new GridLayoutManager(MyRank.this,1); ranklist1.setLayoutManager(layoutManager1); ranklist1.setAdapter(adapter1); ranklist1.setLayoutAnimation(lac); }
@Override protected void onInitView() { mSwipeRefreshLayout.setColorSchemeResources( R.color.username1, R.color.username2, R.color.username3, R.color.username4, R.color.username5, R.color.username6); mSwipeRefreshLayout.setOnRefreshListener(this); mAdapter = new CategoryAdapter(getContext(),R.layout.category_item,mDatas); mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); mRecyclerView.addItemDecoration(new RecycleViewDivider(getActivity(), LinearLayoutManager.HORIZONTAL)); mRecyclerView.setAdapter(mAdapter); mRecyclerView.setOnLoadMoreListener(this); mRecyclerView.setEmpty(); LayoutAnimationController lac = new LayoutAnimationController(AnimationUtils.loadAnimation(getContext(),R.anim.fade_in)); lac.setOrder(LayoutAnimationController.ORDER_NORMAL); mRecyclerView.setLayoutAnimation(lac); mRecyclerView.startLayoutAnimation(); getData(true); }
/** * ListView节点出现动画 * * @return */ protected LayoutAnimationController getAnimationController() { int duration = 300; AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(duration); set.addAnimation(animation); animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(duration); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f); controller.setOrder(LayoutAnimationController.ORDER_NORMAL); return controller; }
/** * 加载动画. */ @SuppressWarnings("ResourceType") public static LayoutAnimationController loadAnimation(Context context) { /* * 创建动画的集合 */ AnimationSet set = new AnimationSet(false); Animation animation; /* * 创建旋转动画 */ animation = new RotateAnimation(180, 10); animation.setDuration(1000); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 1); controller.setInterpolator(context, android.R.anim.accelerate_interpolator); controller.setAnimation(set); return controller; }
/** * 加载动画2. */ public static LayoutAnimationController loadAnimation2() { int duration = 300; AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(duration); set.addAnimation(animation); animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(duration); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f); controller.setOrder(LayoutAnimationController.ORDER_NORMAL); return controller; }
private void applyAnimationToListView() { AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(50); set.addAnimation(animation); animation = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0.0f,Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f ); animation.setDuration(100); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f); ListView listView = getListView(); listView.setLayoutAnimation(controller); }
/** * Set the list loading animation. */ private void setAnimation() { AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(75); set.addAnimation(animation); animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(50); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController( set, 0.5f); mListView.setLayoutAnimation(controller); }
/** * Set the list loading animation. */ private void setAnimation() { AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(100); set.addAnimation(animation); animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(100); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f); mList.setLayoutAnimation(controller); }
/** * Set the view loading animation. */ private void setAnimation() { AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(100); set.addAnimation(animation); animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(100); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController( set, 0.5f); ListView listView = getListView(); listView.setLayoutAnimation(controller); }
public LayoutAnimationController getLayoutAnimation(ResourceDesc resourceDesc, XMLInflaterContext xmlInflaterContext) { if (resourceDesc instanceof ResourceDescDynamic) { ResourceDescDynamic resourceDescDyn = (ResourceDescDynamic)resourceDesc; if (resourceDescDyn.getValuesResourceName() != null) { ElementValuesResources elementResources = getElementValuesResources(resourceDescDyn, xmlInflaterContext); return elementResources.getLayoutAnimation(resourceDescDyn.getValuesResourceName(), xmlInflaterContext); } else { return getLayoutAnimationDynamicFromXML(resourceDescDyn,xmlInflaterContext); } } else if (resourceDesc instanceof ResourceDescCompiled) { Context ctx = xmlInflaterContext.getContext(); String resourceDescValue = resourceDesc.getResourceDescValue(); return getLayoutAnimationCompiled(resourceDescValue, ctx); } else throw MiscUtil.internalError(); }
private LayoutAnimationController getLayoutAnimationDynamicFromXML(ResourceDescDynamic resourceDescDyn, XMLInflaterContext xmlInflaterContext) { if (resourceDescDyn.getValuesResourceName() != null) throw MiscUtil.internalError(); Context ctx = xmlInflaterContext.getContext(); int bitmapDensityReference = xmlInflaterContext.getBitmapDensityReference(); AttrResourceInflaterListener attrResourceInflaterListener = xmlInflaterContext.getAttrResourceInflaterListener(); // Esperamos un LayoutAnimationController PageImpl page = xmlInflaterContext.getPageImpl(); // Puede ser null if (resourceDescDyn instanceof ResourceDescRemote && page == null) throw MiscUtil.internalError(); // Si es remote hay page por medio ParsedResourceXMLDOM resource = (ParsedResourceXMLDOM) resourceDescDyn.getParsedResource(); if (resource == null) throw new ItsNatDroidException("Resource is still not loaded, if remote resource maybe you should use an attribute with namespace " + NamespaceUtil.XMLNS_ITSNATDROID_RESOURCE + " for manual load declaration"); XMLDOMLayoutAnimation xmlDOMLayoutAnimation = (XMLDOMLayoutAnimation) resource.getXMLDOM(); InflatedXMLLayoutAnimation inflatedLayoutAnimation = InflatedXMLLayoutAnimation.createInflatedLayoutAnimation(itsNatDroid, xmlDOMLayoutAnimation, ctx, page); XMLInflaterLayoutAnimation xmlInflaterLayoutAnimation = XMLInflaterLayoutAnimation.createXMLInflaterLayoutAnimation(inflatedLayoutAnimation, bitmapDensityReference, attrResourceInflaterListener); return xmlInflaterLayoutAnimation.inflateLayoutAnimation(); }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); AnimationSet set = new AnimationSet(true); Animation fadeIn = new AlphaAnimation(0.0f, 1.0f); fadeIn.setDuration(350); set.addAnimation(fadeIn); Animation dropDown = new TranslateAnimation( Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f ); dropDown.setDuration(400); set.addAnimation(dropDown); LayoutAnimationController controller = new LayoutAnimationController(set, 0.2f); mRecyclerView.setLayoutAnimation(controller); mFab.attachToRecyclerView(mRecyclerView); mFab.setVisibility(View.INVISIBLE); mEmptyStartView.setVisibility(View.GONE); mEmptyWorkingView.setVisibility(View.GONE); mListContainer.addView(mEmptyStartView); mListContainer.addView(mEmptyWorkingView); mRecyclerView.setEmptyView(mEmptyStartView); mRecyclerView.setItemAnimator(new DefaultItemAnimator()); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mStrings)); AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(50); set.addAnimation(animation); animation = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0.0f,Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f,Animation.RELATIVE_TO_SELF, 0.0f ); animation.setDuration(100); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f); ListView listView = getListView(); listView.setLayoutAnimation(controller); }
/** * Set the list loading animation. */ private void setAnimation() { AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(75); set.addAnimation(animation); animation = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f ); animation.setDuration(50); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f); mListView.setLayoutAnimation(controller); }
/** * Set the list loading animation. */ private void setAnimation() { AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(100); set.addAnimation(animation); animation = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f ); animation.setDuration(100); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f); mList.setLayoutAnimation(controller); }
/** * Set the view loading animation. */ private void setAnimation() { AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(100); set.addAnimation(animation); animation = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f ); animation.setDuration(100); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f); ListView listView = getListView(); listView.setLayoutAnimation(controller); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.property_animation_layout); propertyNormalTextView.setOnClickListener(this); { propertyFlakes.setOnClickListener(this); layoutAnimBtn.setOnClickListener(this); secretTextView.setOnClickListener(this); clickImageView.setOnClickListener(this); autoScrollView.setOnClickListener(this); } Animation animation = AnimationUtils.loadAnimation(this, R.anim.shake); LayoutAnimationController mAnimationControll = new LayoutAnimationController( animation); container.setLayoutAnimation(mAnimationControll); }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { ListView listView = (ListView) view.findViewById(R.id.schedule_lv); //Animation for the list-view. AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(500); set.addAnimation(animation); animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(100); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f); listView.setLayoutAnimation(controller); setListViewWidget(listView); setAdapter(new ScheduleListViewListAdapter()); ((MarginLayoutParams)listView.getLayoutParams()).bottomMargin = getActionBarHeight(); super.onViewCreated(view, savedInstanceState); }
private void intLayoutAnim() { Animation slideIn = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_SELF, -1, TranslateAnimation.ABSOLUTE, 0, TranslateAnimation.ABSOLUTE, 0, TranslateAnimation.ABSOLUTE, 0); slideIn.setDuration(KAnimTimeShort); mAnimIn = new LayoutAnimationController(slideIn, LayoutAnimDelay); Animation slideOut = new TranslateAnimation(TranslateAnimation.ABSOLUTE, 0, TranslateAnimation.RELATIVE_TO_SELF, -1, TranslateAnimation.ABSOLUTE, 0, TranslateAnimation.ABSOLUTE, 0); slideOut.setDuration(KAnimTimeShort); slideOut.setFillAfter(true); mAnimOut = new LayoutAnimationController(slideOut, LayoutAnimDelay); mAnimOut.setOrder(LayoutAnimationController.ORDER_REVERSE); mainMenu.setLayoutAnimation(mAnimIn); mHideShowListener = new HideShowListener(); mainMenu.setLayoutAnimationListener(mHideShowListener); mReady.autoSetVal(true, AnimationBlockTimer); }
/** * Set the list loading animation. */ private void setAnimation() { AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(100); set.addAnimation(animation); animation = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELR, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f ); animation.setDuration(100); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set,0.5f); mList.setLayoutAnimation(controller); }