bufferapp / adaptablebottomnavigation Goto Github PK
View Code? Open in Web Editor NEWA simpler way for implementing the Bottom Navigation View on Android
A simpler way for implementing the Bottom Navigation View on Android
In the xml example in the readme the AdaptebleBottomNavigationView is declared as:
<org.buffer.adaptablebottomnavigation.AdaptableBottomNavigationView
instead of
<org.buffer.adaptablebottomnavigation.view.AdaptableBottomNavigationView
Shame on me for blindly copy-pasting, but it still cost me some time to debug
Good
I want to alter the viewSwapperAdapter to fragment will not be destroyed and will be reused. Only swipe is disabled!
it will be good if we get the option to don't want to repopulate data!
viewSwapperAdapter.setOffscreenPageLimit( 3);
or
viewSwapperAdapter.enableSavedstate(true|false);
will be good! any help available try this?
If I enable the "don't keep activities" from the Developer Options to test the low memory cases, after getting out and in via HOME button, library is crashing..
java.lang.RuntimeException: Unable to start activity ComponentInfo{net.abc/net.abc.ui.MainActivity}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: android.support.design.widget.BottomNavigationView$SavedState at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: android.support.design.widget.BottomNavigationView$SavedState at android.os.Parcel.readParcelableCreator(Parcel.java:2536) at android.os.Parcel.readParcelable(Parcel.java:2462) at android.view.AbsSavedState.<init>(AbsSavedState.java:67) at android.view.View$BaseSavedState.<init>(View.java:22746) at android.view.View$BaseSavedState.<init>(View.java:22735) at org.buffer.adaptablebottomnavigation.view.ViewSwapper$SavedState.<init>(ViewSwapper.java:179) at org.buffer.adaptablebottomnavigation.view.AdaptableBottomNavigationView$SavedState$1.createFromParcel(AdaptableBottomNavigationView.java:151) at org.buffer.adaptablebottomnavigation.view.AdaptableBottomNavigationView$SavedState$1.createFromParcel(AdaptableBottomNavigationView.java:148) at android.support.v4.os.ParcelableCompatCreatorHoneycombMR2.createFromParcel(ParcelableCompatHoneycombMR2.java:43)ย
since Android Support Library v25.3.0 new method was added:
bottomNavigationView.setSelectedItemId(R.id.item_id);
In ViewSwapper exist an method:
public void showItemAt(int position) {}
both return NullPointerException :(
Log:
Caused by: java.lang.NullPointerException: Attempt to read from field 'int android.support.v4.app.Fragment.mIndex' on a null object reference
I found a crash which occurs when using a custom adapter that extends from FragmentAdapter
.
Whenever the ViewSwapper
makes a call to clearItem()
it throws a custom UnsupportedOperationException
inside ViewSwapperAdapter
since clearItem()
is not overrided by default.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example, PID: 12089
java.lang.UnsupportedOperationException: Required method destroyItem was not overridden
at org.buffer.adaptablebottomnavigation.adapter.ViewSwapperAdapter.destroyItem(ViewSwapperAdapter.java:196)
at org.buffer.adaptablebottomnavigation.adapter.ViewSwapperAdapter.clearItem(ViewSwapperAdapter.java:126)
at org.buffer.adaptablebottomnavigation.view.ViewSwapper.showItemAt(ViewSwapper.java:122)
at org.buffer.adaptablebottomnavigation.view.AdaptableBottomNavigationView$ViewSwapperOnItemSelectedListener.onNavigationItemSelected(AdaptableBottomNavigationView.java:83)
at android.support.design.widget.BottomNavigationView$1.onMenuItemSelected(BottomNavigationView.java:182)
at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:822)
at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:171)
at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:973)
at android.support.design.internal.BottomNavigationMenuView$1.onClick(BottomNavigationMenuView.java:95)
at android.view.View.performClick(View.java:6256)
at android.view.View$PerformClick.run(View.java:24697)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
I temporary fixed it by overriding clearItem()
with a call to destroyItem()
inside my custom FragmentAdapter
.
@Override
public void clearItem(ViewGroup container, int position, Object object) {
super.destroyItem(container, position, object);
}
This library points out a lot of the issues with using a ViewPager and a Bottom Tab Layout. My current understanding of the ViewPager is that it draws some of the views that are not yet visible and allows swiping between pages. Is it possible using the ViewPager to disable swiping between pages and drawing pages that are not yet visible? If not, then this library will be very useful!
As it stands, I am not certain whether this library improves upon the ViewPager's performance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.