ibrahimsn98 / SmoothBottomBar

A lightweight Android material bottom navigation bar library
MIT License
1.95k stars 253 forks source link

Java version #19

Open KeulTomi opened 4 years ago

KeulTomi commented 4 years ago

Hy, It is a great library, but i can not code in kotlin. So my question is: Is there perhaps a java version of this library? If so, than could you please link it for me? Thank you for your answer!

AbedQa commented 4 years ago

bottomBar.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelect(int i) { Log.d("",i + ""); } });

SlackerState commented 4 years ago

bottomBar.setOnItemSelectedListener(new OnItemSelectedListener() { @override public void onItemSelect(int i) { Log.d("",i + ""); } });

it couldn't work

brookmg commented 4 years ago
smoothBottomBar.setOnItemSelectedListener(i -> {
    // i = the currently selected index
});

smoothBottomBar.setOnItemReselectedListener(i -> {
    // i = the currently reselected index
});

The above code can be used for setting the item selected and item reselected listeners. But to have this kind of simple expression you need to enable Java1.8 compile option.

go to your app.gradle file and add the following snippet inside the android object

android {
   ...

   compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
}