Git Product home page Git Product logo

Comments (12)

lingesh10 avatar lingesh10 commented on August 16, 2024 1

I modified MeowBottomNavigation.kt file like adding interface and that is worked in java project.
Here how i did,

declare at top level

private var mOnBottomNavigationItemClickListener: IBottomNavigationItemClickListener? = null
 interface IBottomNavigationItemClickListener {
         fun mOnBottomNavigationItemClickedListener(model: Model)
 }

replace add method

 fun add(model: Model) {
         val cell = MeowBottomNavigationCell(context)
         cell.apply {
             val params = LinearLayout.LayoutParams(0, heightCell, 1f)
             layoutParams = params
             icon = model.icon
             count = model.count
             circleColor = [email protected]
             countTextColor = [email protected]
             countBackgroundColor = [email protected]
             countTypeface = [email protected]
             rippleColor = [email protected]
             defaultIconColor = [email protected]
             selectedIconColor = [email protected]
             onClickListener = {
                 if (!cell.isEnabledCell && !isAnimating) {
                     show(model.id)
                     mOnClickedListener(model)
                     mOnBottomNavigationItemClickListener?.mOnBottomNavigationItemClickedListener (model)
                 } else {
                     if (callListenerWhenIsSelected) {
                         mOnClickedListener(model)
                         mOnBottomNavigationItemClickListener?.mOnBottomNavigationItemClickedListener (model)
                     }
                 }
             }
             disableCell()
             ll_cells.addView(this)
         }
 
         cells.add(cell)
         models.add(model)
     }

//add this method to set listener in java

 fun setOnBottomNavigationItemClickListener(listener: IBottomNavigationItemClickListener) {
         mOnBottomNavigationItemClickListener = listener
}

//In java

 bottomNavigation.setOnBottomNavigationItemClickListener(new MeowBottomNavigation.IBottomNavigationItemClickListener() {
             @Override
             public void mOnBottomNavigationItemClickedListener(@NonNull MeowBottomNavigation.Model model) {
                 switch (model.getId()) {
                     case 1:
                         Toast.makeText(MainActivity.this, "1", Toast.LENGTH_SHORT).show();
                         break;
                     case 2:
                         Toast.makeText(MainActivity.this, "2", Toast.LENGTH_SHORT).show();
                         break;
                     case 3:
                         Toast.makeText(MainActivity.this, "3", Toast.LENGTH_SHORT).show();
                         break;
                     default:
                         Toast.makeText(MainActivity.this, "default", Toast.LENGTH_SHORT).show();
                         break;
                 }
             }
         });

from meowbottomnavigation.

lingesh10 avatar lingesh10 commented on August 16, 2024 1

from meowbottomnavigation.

darpal1707 avatar darpal1707 commented on August 16, 2024

I modified MeowBottomNavigation.kt file like adding interface and that is worked in java project.
Here how i did,
//declare at top level

private var mOnBottomNavigationItemClickListener: IBottomNavigationItemClickListener? = null
interface IBottomNavigationItemClickListener {
fun mOnBottomNavigationItemClickedListener(model: Model)
}

//replace add method

fun add(model: Model) {
val cell = MeowBottomNavigationCell(context)
cell.apply {
val params = LinearLayout.LayoutParams(0, heightCell, 1f)
layoutParams = params
icon = model.icon
count = model.count
circleColor = [email protected]
countTextColor = [email protected]
countBackgroundColor = [email protected]
countTypeface = [email protected]
rippleColor = [email protected]
defaultIconColor = [email protected]
selectedIconColor = [email protected]
onClickListener = {
if (!cell.isEnabledCell && !isAnimating) {
show(model.id)
mOnClickedListener(model)
mOnBottomNavigationItemClickListener?.mOnBottomNavigationItemClickedListener (model)
} else {
if (callListenerWhenIsSelected) {
mOnClickedListener(model)
mOnBottomNavigationItemClickListener?.mOnBottomNavigationItemClickedListener (model)
}
}
}
disableCell()
ll_cells.addView(this)
}

    cells.add(cell)
    models.add(model)
}

//add this method to set listener in java

fun setOnBottomNavigationItemClickListener(listener: IBottomNavigationItemClickListener) {
mOnBottomNavigationItemClickListener = listener
}

//In java

bottomNavigation.setOnBottomNavigationItemClickListener(new MeowBottomNavigation.IBottomNavigationItemClickListener() {
@OverRide
public void mOnBottomNavigationItemClickedListener(@nonnull MeowBottomNavigation.Model model) {
switch (model.getId()) {
case 1:
Toast.makeText(MainActivity.this, "1", Toast.LENGTH_SHORT).show();
break;
case 2:
Toast.makeText(MainActivity.this, "2", Toast.LENGTH_SHORT).show();
break;
case 3:
Toast.makeText(MainActivity.this, "3", Toast.LENGTH_SHORT).show();
break;
default:
Toast.makeText(MainActivity.this, "default", Toast.LENGTH_SHORT).show();
break;
}
}
});

Hi I saw your issue and even was looking for the same implementation. Thanks for posting an issue on this.
Yet I am facing issues.

We have below code initialized in MeowBottomNavigation.kt

private var mOnClickedListener: IBottomNavigationListener = {}
private var mOnShowListener: IBottomNavigationListener = {}

which is creating issues and giving errors
What did you pass instead of IBottomNavigationListener in both variable above?

Thanks for the headsup on that
Been looking at this repo for a while

from meowbottomnavigation.

darpal1707 avatar darpal1707 commented on August 16, 2024

Nevermind figured out. Thanks for the solution

from meowbottomnavigation.

Meglali20 avatar Meglali20 commented on August 16, 2024

@lingesh10 Can you provide the final dependency please ? I did as you mentioned by edditing MeowBottomNavigation.kt but i get an this error "Unable to start activity ComponentInfo{com.example.medifind/com.example.medifind.liste_pharmacie}: android.view.InflateException: Binary XML file line #198: Error inflating class com.etebarian.meowbottomnavigation.MeowBottomNavigation"

from meowbottomnavigation.

ahmedkabut avatar ahmedkabut commented on August 16, 2024

hi pro ,please if you dont mind . iam trying for 2 week in this library .

i want when click open view in the same screen
notes:- and i dont how to do fragment

plesssssssssss

from meowbottomnavigation.

lingesh10 avatar lingesh10 commented on August 16, 2024

Can you post some sample to what you trying to achieve, then only we can help

from meowbottomnavigation.

lingesh10 avatar lingesh10 commented on August 16, 2024

from meowbottomnavigation.

Meglali20 avatar Meglali20 commented on August 16, 2024

Can you post some sample to what you trying to achieve, then only we can help

Can you just post the dependency after you edited it because I did same as you did and I hade to assemble the dependency and it's like I did nothing !
And after your edit is it possible to use it between activities ?

from meowbottomnavigation.

lingesh10 avatar lingesh10 commented on August 16, 2024

check this like using this project i created a sample porject with fragment implementaion. https://github.com/lingesh10/Android/tree/master/hotelmenus/

from meowbottomnavigation.

ahmedkabut avatar ahmedkabut commented on August 16, 2024

ok i will chek after 7 hour becouse know iam in plane
i hope its help me and tank tank you very much
if you want any thing from libya dont be shy pro iam libyan thankss

from meowbottomnavigation.

oneHamidreza avatar oneHamidreza commented on August 16, 2024

I updated ReadMe.md file. Just check it.

from meowbottomnavigation.

Related Issues (20)

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.