Giter Site home page Giter Site logo

bufferapp / adaptablebottomnavigation Goto Github PK

View Code? Open in Web Editor NEW
830.0 21.0 73.0 13.85 MB

A simpler way for implementing the Bottom Navigation View on Android

Java 100.00%
android android-library bottomnavigationview bottombar bottom-navigation bottom-nav bottom-navigation-view android-ui view viewpager

adaptablebottomnavigation's People

Contributors

hitherejoe avatar passsy avatar snajdan0525 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adaptablebottomnavigation's Issues

Crash in low memory conditions

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)ย 

Xml Example wrong declaration AdaptableBottomNavigationView

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

Set initially selected item index/id in BottomNavigationView

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

How to alter the save the fragment state like Orginal FragmentStateAdapter !

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?

Crash when not overriding `clearItem()` inside `FragmentAdapter`

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);
}

Question: Disable Swiping Possible in Viewpager?

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.

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.