Java Code Examples for android.view.animation.AnimationUtils#loadLayoutAnimation()
The following examples show how to use
android.view.animation.AnimationUtils#loadLayoutAnimation() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProjectListFragment.java From PHONK with GNU General Public License v3.0 | 6 votes |
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); }
Example 2
Source File: AnimatedRecyclerView.java From AnimatedRecyclerView with MIT License | 6 votes |
@SuppressLint({"Recycle", "WrongConstant"}) private void init(Context context, @Nullable AttributeSet attrs) { TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.AnimatedRecyclerView, 0, 0); orientation = typedArray.getInt(R.styleable.AnimatedRecyclerView_layoutManagerOrientation, orientation); reverse = typedArray.getBoolean(R.styleable.AnimatedRecyclerView_layoutManagerReverse, reverse); animationDuration = typedArray.getInt(R.styleable.AnimatedRecyclerView_animationDuration, animationDuration); layoutManagerType = typedArray.getInt(R.styleable.AnimatedRecyclerView_layoutManagerType, layoutManagerType); columns = typedArray.getInt(R.styleable.AnimatedRecyclerView_gridLayoutManagerColumns, columns); animation = typedArray.getResourceId(R.styleable.AnimatedRecyclerView_layoutAnimation, -1); if (animationController == null) animationController = animation != -1 ? AnimationUtils.loadLayoutAnimation(getContext(), animation) : AnimationUtils.loadLayoutAnimation(getContext(), R.anim.layout_animation_from_bottom); animationController.getAnimation().setDuration(animationDuration); setLayoutAnimation(animationController); if (layoutManagerType == LayoutManagerType.LINEAR) setLayoutManager(new LinearLayoutManager(context, orientation, reverse)); else if (layoutManagerType == LayoutManagerType.GRID) setLayoutManager(new GridLayoutManager(context, columns, orientation, reverse)); }
Example 3
Source File: EventsFragment.java From Deadline with GNU General Public License v3.0 | 6 votes |
private void setupEventList() { RecyclerView recyclerView = mBinding.listEvents; mEventsAdapter = new EventsAdapter(getContext(), mViewModel); recyclerView.setAdapter(mEventsAdapter); ItemTouchHelper touchHelper = new ItemTouchHelper(new EventTouchHelperCallback(mEventsAdapter)); touchHelper.attachToRecyclerView(recyclerView); LayoutAnimationController animationController = AnimationUtils.loadLayoutAnimation(getActivity(), R.anim.layout_fall_down); recyclerView.setLayoutAnimation(animationController); mEventsAdapter.setEventItemActionListener(new EventItemActionListener() { @Override public void onItemClicked(String eventId) { Bundle bundle = new Bundle(); bundle.putString(EditFragment.ARG_EDIT_EVENT_ID, eventId); Navigation.findNavController(getView()).navigate(R.id.action_events_to_edit, bundle); } }); }
Example 4
Source File: HomeFragment.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 5 votes |
public void generateListTechnology(List<Tenant> tenantList){ try{ int resId = R.anim.layout_animation_from_down; LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), resId); tenantAdapter = new TenantAdapter(getContext(), tenantList); RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(getContext(), 2); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setLayoutAnimation(animation); recyclerView.setAdapter(tenantAdapter); }catch (Exception e){ } }
Example 5
Source File: GradeBookOfEachCourseFragment.java From PKUCourses with GNU General Public License v3.0 | 5 votes |
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.fragment_grade_book_list, container, false); // 查找xml文件中的对象并保存进Java变量 mRecyclerView = linearLayout.findViewById(R.id.recycler_grades); mGradeBookSwipeContainer = linearLayout.findViewById(R.id.grade_book_list_swipe_container); // 设置动画 LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), R.anim.layout_animation_fall_down); mGradeBookSwipeContainer.setLayoutAnimation(animation); // 设置刷新的监听类为此类(监听函数onRefresh) mGradeBookSwipeContainer.setOnRefreshListener(this); mGradeBookSwipeContainer.setColorSchemeColors(getResources().getColor(R.color.colorPrimary), getResources().getColor(R.color.colorAccent)); FragmentActivity fa = getActivity(); // 为了消除编译器Warning,需要判断一下是不是null,其实这基本上不可能出现null if (fa == null) { return linearLayout; } adapter = new GradeBookListRecyclerViewAdapter(new ArrayList<GradeInfo>()); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setAdapter(adapter); courseId = getActivity().getIntent().getStringExtra("CourseId"); // 显示Loading的小动画,并在后台读取课程列表 showLoading(true); mLoadingTask = new LoadingTask(); mLoadingTask.execute((Void) null); return linearLayout; }
Example 6
Source File: CourseActionFragment.java From PKUCourses with GNU General Public License v3.0 | 5 votes |
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.fragment_course_action, container, false); // 查找xml文件中的对象并保存进Java变量 mRecyclerView = linearLayout.findViewById(R.id.recycler_actions); mCourseActionSwipeContainer = linearLayout.findViewById(R.id.course_action_swipe_container); // 设置动画 LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), R.anim.layout_animation_fall_down); mCourseActionSwipeContainer.setLayoutAnimation(animation); // 设置刷新的监听类为此类(监听函数onRefresh) mCourseActionSwipeContainer.setEnabled(false); adapter = new CourseActionsAdapter(new ArrayList<String>(), this); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setAdapter(adapter); FragmentActivity fa = getActivity(); if (fa == null) { courseId = ""; } else { String xmlStr = getActivity().getIntent().getStringExtra("CourseActionsXML"); if (xmlStr == null) { courseId = getActivity().getIntent().getStringExtra("CourseId"); // 显示Loading的小动画,并在后台读取课程列表 showLoading(true); mLoadingTask = new CourseActionFragment.ActionsLoadingTask(); mLoadingTask.execute((Void) null); } else { attachXmlToView(Utils.stringToNode(xmlStr)); } } return linearLayout; }
Example 7
Source File: ConferenceListFragment.java From conference-central-android-app with GNU General Public License v2.0 | 5 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); getListView().setFastScrollEnabled(true); LayoutAnimationController controller = AnimationUtils .loadLayoutAnimation(getActivity(), R.anim.list_layout_controller); getListView().setLayoutAnimation(controller); mAdapter = new ConferenceDataAdapter(getActivity()); setEmptyText(getString(R.string.no_conferences)); setListAdapter(mAdapter); setListShown(false); }
Example 8
Source File: ProdukActivity.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 5 votes |
public void generateListTechnology(List<Produk> produkList){ try{ int resId = R.anim.layout_animation_from_down; LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(this, resId); produkAdapter = new ProdukAdapter(this, produkList); RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 2); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setLayoutAnimation(animation); recyclerView.setAdapter(produkAdapter); }catch (Exception e){ } }
Example 9
Source File: EntryListView.java From Aegis with GNU General Public License v3.0 | 5 votes |
public void runEntriesAnimation() { final Context context = _recyclerView.getContext(); final LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation(context, R.anim.layout_animation_fall_down); _recyclerView.setLayoutAnimation(controller); _recyclerView.scheduleLayoutAnimation(); }
Example 10
Source File: PengaduanActivity.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 5 votes |
public void generateListPengaduan(List<Pengaduan> pengaduanList){ try{ int resId = R.anim.layout_animation_from_down; LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(this, resId); pengaduanAdapter = new PengaduanAdapter(this, pengaduanList); RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 1); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setLayoutAnimation(animation); recyclerView.setAdapter(pengaduanAdapter); }catch (Exception e){ } }
Example 11
Source File: ReviewActivity.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 5 votes |
public void generateListReview(List<Review> reviewList){ try{ int resId = R.anim.layout_animation_from_down; LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(this, resId); reviewAdapter = new ReviewAdapter(this, reviewList); RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 1); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setLayoutAnimation(animation); recyclerView.setAdapter(reviewAdapter); }catch (Exception e){ } }
Example 12
Source File: GalleryTenantActivity.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 5 votes |
public void generateListTechnology(List<Gallery> tenantList){ try{ int resId = R.anim.layout_animation_from_down; LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(this, resId); galleryAdapter = new GalleryAdapter(this, tenantList); RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 3); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setLayoutAnimation(animation); recyclerView.setAdapter(galleryAdapter); }catch (Exception e){ } }
Example 13
Source File: EventTenantActivity.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 5 votes |
public void generateListTechnology(List<Event> eventList){ try{ int resId = R.anim.layout_animation_from_down; LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(this, resId); RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(EventTenantActivity.this, 1); eventAdapter = new EventAdapter(this, eventList); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setLayoutAnimation(animation); recyclerView.setAdapter(eventAdapter); }catch (Exception e){ } }
Example 14
Source File: PengaduanTenantActivity.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 5 votes |
public void generateListPengaduan(List<Pengaduan> pengaduanList){ try{ int resId = R.anim.layout_animation_from_down; LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(this, resId); pengaduanAdapter = new PengaduanAdapter(this, pengaduanList); RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 1); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setLayoutAnimation(animation); recyclerView.setAdapter(pengaduanAdapter); }catch (Exception e){ } }
Example 15
Source File: EventFragment.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 5 votes |
public void generateListTechnology(List<Event> eventList){ try{ int resId = R.anim.layout_animation_from_down; LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), resId); eventAdapter = new EventAdapter(getContext(), eventList); RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(getContext(), 1); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setLayoutAnimation(animation); recyclerView.setAdapter(eventAdapter); }catch (Exception e){ } }
Example 16
Source File: NewsFragment.java From NewsApp with GNU General Public License v3.0 | 5 votes |
@Override public void onNewsItemClicked(Article article) { Timber.d("Recieved article"); Intent intent = new Intent(getContext(), DetailActivity.class); intent.putExtra(DetailActivity.PARAM_ARTICLE, article); final LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation(getContext(), R.anim.layout_animation_fall_down); binding.rvNewsPosts.setLayoutAnimation(controller); binding.rvNewsPosts.scheduleLayoutAnimation(); startActivity(intent); if (getActivity() != null) { getActivity().overridePendingTransition(R.anim.slide_up_animation, R.anim.fade_exit_transition); } }
Example 17
Source File: AnnouncementListFragment.java From PKUCourses with GNU General Public License v3.0 | 4 votes |
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.fragment_announcement_list, container, false); // 查找xml文件中的对象并保存进Java变量 mRecyclerView = linearLayout.findViewById(R.id.recycler_announcement_list); mAnnouncementListSwipeContainer = linearLayout.findViewById(R.id.announcement_swipe_container); // 设置动画 LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), R.anim.layout_animation_fall_down); mAnnouncementListSwipeContainer.setLayoutAnimation(animation); // 设置刷新的监听类为此类(监听函数onRefresh) mAnnouncementListSwipeContainer.setOnRefreshListener(this); mAnnouncementListSwipeContainer.setColorSchemeColors(getResources().getColor(R.color.colorPrimary), getResources().getColor(R.color.colorAccent)); FragmentActivity fa = getActivity(); // 为了消除编译器Warning,需要判断一下是不是null,其实这基本上不可能出现null if (fa == null) { return linearLayout; } // 将读取已置顶课程列表的SharedPreferences传递给CourseListRecyclerViewAdapter // SharedPreferences sharedPreferences = fa.getSharedPreferences("pinnedAnnouncementList", Context.MODE_PRIVATE); adapter = new AnnouncementListRecyclerViewAdapter(new ArrayList<AnnouncementInfo>(), this); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setAdapter(adapter); try { String cachedList = getCachedAnnouncementsList(); if (cachedList == null) throw new Exception(); updateAdapter(cachedList, false); } catch (Exception e) { e.printStackTrace(); } // 显示Loading的小动画,并在后台读取课程列表 showLoading(true); mLoadingTask = new AnnouncementLoadingTask(); mLoadingTask.execute((Void) null); return linearLayout; }
Example 18
Source File: CourseListFragment.java From PKUCourses with GNU General Public License v3.0 | 4 votes |
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.fragment_course_list, container, false); // 查找xml文件中的对象并保存进Java变量 mRecyclerView = linearLayout.findViewById(R.id.recycler_courses); mCourseListSwipeContainer = linearLayout.findViewById(R.id.course_list_swipe_container); // 设置动画 LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), R.anim.layout_animation_fall_down); mCourseListSwipeContainer.setLayoutAnimation(animation); // 设置刷新的监听类为此类(监听函数onRefresh) mCourseListSwipeContainer.setOnRefreshListener(this); mCourseListSwipeContainer.setColorSchemeColors(getResources().getColor(R.color.colorPrimary), getResources().getColor(R.color.colorAccent)); FragmentActivity fa = getActivity(); // 为了消除编译器Warning,需要判断一下是不是null,其实这基本上不可能出现null if (fa == null) { return linearLayout; } // 将读取已置顶课程列表的SharedPreferences传递给CourseListRecyclerViewAdapter SharedPreferences sharedPreferences = fa.getSharedPreferences("pinnedCourseList", Context.MODE_PRIVATE); adapter = new CourseListRecyclerViewAdapter(new ArrayList<CourseInfo>(), sharedPreferences, this); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setAdapter(adapter); try { String cachedCourseList = getCachedCourseList(); if (cachedCourseList == null) throw new Exception(); updateAdapter(cachedCourseList, false); } catch (Exception e) { // 显示Loading的小动画,并在后台读取课程列表 showLoading(true); mLoadingTask = new CoursesLoadingTask(); mLoadingTask.execute((Void) null); } return linearLayout; }
Example 19
Source File: EntryListView.java From Aegis with GNU General Public License v3.0 | 4 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_entry_list_view, container, false); _progressBar = view.findViewById(R.id.progressBar); // set up the recycler view _recyclerView = view.findViewById(R.id.rvKeyProfiles); _recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); _listener.onScroll(dx, dy); } }); // set up icon preloading _preloadSizeProvider = new ViewPreloadSizeProvider<>(); IconPreloadProvider modelProvider = new IconPreloadProvider(); RecyclerViewPreloader<VaultEntry> preloader = new RecyclerViewPreloader<>(Glide.with(this), modelProvider, _preloadSizeProvider, 10); _recyclerView.addOnScrollListener(preloader); LinearLayoutManager layoutManager = new LinearLayoutManager(view.getContext()); _recyclerView.setLayoutManager(layoutManager); _touchCallback = new SimpleItemTouchHelperCallback(_adapter); ItemTouchHelper touchHelper = new ItemTouchHelper(_touchCallback); touchHelper.attachToRecyclerView(_recyclerView); _recyclerView.setAdapter(_adapter); int resId = R.anim.layout_animation_fall_down; LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), resId); _recyclerView.setLayoutAnimation(animation); _refresher = new UiRefresher(new UiRefresher.Listener() { @Override public void onRefresh() { refresh(false); } @Override public long getMillisTillNextRefresh() { return TotpInfo.getMillisTillNextRotation(_adapter.getMostFrequentPeriod()); } }); _emptyStateView = view.findViewById(R.id.vEmptyList); return view; }
Example 20
Source File: MainActivity.java From journaldev with MIT License | 3 votes |
private void runAnimationAgain() { final LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation(this, animationList[i]); recyclerView.setLayoutAnimation(controller); recyclerViewAdapter.notifyDataSetChanged(); recyclerView.scheduleLayoutAnimation(); }