Giter Site home page Giter Site logo

recyclerview-absolutelayoutmanager's Introduction

ypresto πŸ’»πŸ‘ΆπŸ§‘β€πŸ³πŸŒˆ

I'm full stack software engineer and designer with 10+ years experience, especially focused on frontend development.

  • 🌏 Web Frontend: 10+ years (React, Vue 1.x)
  • πŸ“± Android/iOS: 4+ years
  • βš™οΈ Backend: 7+ years
  • 🎨 UX Design: 3+ years
  • 🏠 Remote Work: 5+ years

Works

Notable OSS Contributions

recyclerview-absolutelayoutmanager's People

Contributors

hiroyukimizukami avatar ypresto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

recyclerview-absolutelayoutmanager's Issues

Occasionally crashes on onSaveInstanceState()

Currently onSaveInstanceState() returns empty state if getItemCount() == 0.
But we face crashes caused by out-of-sync state of LayoutProvider: LayoutProvider.mState.mItemCount == 0 while getItemCount() > 0.

Fatal Exception: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
       at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
       at java.util.ArrayList.get(ArrayList.java:308)
       at us.mitene.app.album.ui.AlbumThumbnailLayoutProvider.getLayoutAttributeForItemAtPosition(Unknown Source:144)
       at net.ypresto.recyclerview.absolutelayoutmanager.AbsoluteLayoutManager.net.ypresto.recyclerview.absolutelayoutmanager.AnchorHelper.calculateAnchorItemInRect(Unknown Source:17041)
       at us.mitene.app.album.ui.MonthlyAlbumFragment.onSaveInstanceState(Unknown Source:205)

onItemsChanged() or its family methods are lazy fired inside of dispatchLayout(). This can cause out-of-sync with following step:

  1. Change adapter content and call notifyDataSetChanged() or etc.
  2. Call prepareLayoutProvider() from onSaveInstanceState() but no update is performed.
  3. onItemsChanged() is called from dispatchLayout() and mIsLayoutProviderDirty is set to true.
  4. prepareLayoutProvider() is called from onLayoutChildren() and provider state is updated at last.

scrollToPositionWithAlignment() does not call awakenScrollBars()

So scroll bars are not shown when it is called, while they are shown when scrollToPosition() is called.
This is because awakenScrollBars() is protected and creating subclass of RecyclerView (or reflection) is required.
If you need this feature vote by reaction.

Check if current impl does handle item change

Currently relying on state.didStructureChange(), not using RecyclerView.AdapterDataObserver.
I'm not sure whether this value is true or not when item is ONLY changed, not added or removed.

Also didStructureChange() defined as "changed since last onLayoutChidlren() call", so checking it from smoothScrollToPostion() might not be good.

Add document for supporting auto inflate

In RecyclerView documentation:

If the LayoutManager specifies a default constructor or one with the signature (Context, AttributeSet, int, int), RecyclerView will instantiate and set the LayoutManager when being inflated.

Creating subclass of AbsoluteLayoutManager and implement LayoutProvider, then super(this) (is it possible!?) enables this.

Keep scroll position by anchoring view

This library does not keep current visible cell after layout change.
Currently it scrolls to absolute x and y position of previous layout instead.
To reproduce: change screen orientation on example app.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.