diff --git a/app/src/main/java/jahirfiquitiva/apps/fabsmenu/demo/MainActivity.java b/app/src/main/java/jahirfiquitiva/apps/fabsmenu/demo/MainActivity.java index 5dfa2ba..df4eed9 100644 --- a/app/src/main/java/jahirfiquitiva/apps/fabsmenu/demo/MainActivity.java +++ b/app/src/main/java/jahirfiquitiva/apps/fabsmenu/demo/MainActivity.java @@ -48,7 +48,7 @@ public void onClick(View view) { }); final FABsMenu menu = findViewById(R.id.fabs_menu); - menu.setMenuUpdateListener(new FABsMenuListener() { + menu.setMenuListener(new FABsMenuListener() { // You don't need to override all methods. Just the ones you want. @Override diff --git a/library/src/main/java/jahirfiquitiva/libs/fabsmenu/FABsMenu.java b/library/src/main/java/jahirfiquitiva/libs/fabsmenu/FABsMenu.java index 6221aac..dd5635c 100644 --- a/library/src/main/java/jahirfiquitiva/libs/fabsmenu/FABsMenu.java +++ b/library/src/main/java/jahirfiquitiva/libs/fabsmenu/FABsMenu.java @@ -155,8 +155,8 @@ private void init(Context context, AttributeSet attributeSet) { menuButtonRippleColor = attr.getColor(R.styleable.FABsMenu_fab_moreButtonRippleColor, getColor(android.R.color.holo_blue_light)); - menuButtonSize = attr.getInt(R.styleable.FABsMenu_fab_moreButtonSize, TitleFAB - .SIZE_NORMAL); + menuButtonSize = attr.getInt(R.styleable.FABsMenu_fab_moreButtonSize, + TitleFAB.SIZE_NORMAL); expandDirection = attr.getInt(R.styleable.FABsMenu_fab_expandDirection, EXPAND_UP); @@ -165,6 +165,10 @@ private void init(Context context, AttributeSet attributeSet) { attr.recycle(); + if (menuListener == null) { + setMenuListener(new FABsMenuListener() { + }); + } createAddButton(context); } catch (Exception e) { e.printStackTrace(); @@ -823,7 +827,17 @@ public FABsMenuListener getMenuListener() { return menuListener; } + /** + * @param menuListener + * the menu listener + * @deprecated Use {@link #setMenuListener(FABsMenuListener)} instead + */ + @Deprecated public void setMenuUpdateListener(FABsMenuListener menuListener) { + setMenuListener(menuListener); + } + + public void setMenuListener(FABsMenuListener menuListener) { this.menuListener = menuListener; }