From 218e6dd88550abcd6ab360d61094a57850f1c5dc Mon Sep 17 00:00:00 2001 From: Alex Facciorusso Date: Tue, 27 Jan 2015 11:25:39 +0100 Subject: [PATCH 1/2] Some methods! Added some methods to set normal and pressed color to all childs of a FloatingActionsMenu. --- .../FloatingActionsMenu.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/library/src/main/java/com/getbase/floatingactionbutton/FloatingActionsMenu.java b/library/src/main/java/com/getbase/floatingactionbutton/FloatingActionsMenu.java index cd47adb2..ec9f1e79 100644 --- a/library/src/main/java/com/getbase/floatingactionbutton/FloatingActionsMenu.java +++ b/library/src/main/java/com/getbase/floatingactionbutton/FloatingActionsMenu.java @@ -130,6 +130,55 @@ public void draw(Canvas canvas) { } } + + public void setColorNormalToAll(int normalColor) { + mAddButtonColorNormal = normalColor; + mAddButton.setColorNormal(normalColor); + + for (int i = 0; i < getChildCount(); i++) { + View child = getChildAt(i); + if (child instanceof FloatingActionButton) { + ((FloatingActionButton) child).setColorNormal(normalColor); + } + } + } + + public void setColorPressedToAll(int pressedColor) { + mAddButtonColorPressed = pressedColor; + mAddButton.setColorPressed(pressedColor); + + for (int i = 0; i < getChildCount(); i++) { + View child = getChildAt(i); + if (child instanceof FloatingActionButton) { + ((FloatingActionButton) child).setColorPressed(pressedColor); + } + } + } + + public void setColorNormalResIdToAll(@ColorRes int normalColor) { + mAddButtonColorNormal = getColor(normalColor); + mAddButton.setColorNormalResId(normalColor); + + for (int i = 0; i < getChildCount(); i++) { + View child = getChildAt(i); + if (child instanceof FloatingActionButton) { + ((FloatingActionButton) child).setColorNormalResId(normalColor); + } + } + } + + public void setColorPressedResIdToAll(@ColorRes int pressedColor) { + mAddButtonColorPressed = getColor(pressedColor); + mAddButton.setColorPressedResId(pressedColor); + + for (int i = 0; i < getChildCount(); i++) { + View child = getChildAt(i); + if (child instanceof FloatingActionButton) { + ((FloatingActionButton) child).setColorPressedResId(pressedColor); + } + } + } + private void createAddButton(Context context) { mAddButton = new AddFloatingActionButton(context) { @Override From 9dfdee64d8ba2e5d8f030ff515b2a663e41f58ca Mon Sep 17 00:00:00 2001 From: Alex Facciorusso Date: Tue, 27 Jan 2015 11:34:40 +0100 Subject: [PATCH 2/2] Added javadoc to new methods. --- .../FloatingActionsMenu.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/getbase/floatingactionbutton/FloatingActionsMenu.java b/library/src/main/java/com/getbase/floatingactionbutton/FloatingActionsMenu.java index ec9f1e79..0e4ae45d 100644 --- a/library/src/main/java/com/getbase/floatingactionbutton/FloatingActionsMenu.java +++ b/library/src/main/java/com/getbase/floatingactionbutton/FloatingActionsMenu.java @@ -130,7 +130,11 @@ public void draw(Canvas canvas) { } } - + /** + * Set normal color to the plus button and to all children of this menu. + * + * @param normalColor The normal color + */ public void setColorNormalToAll(int normalColor) { mAddButtonColorNormal = normalColor; mAddButton.setColorNormal(normalColor); @@ -143,6 +147,11 @@ public void setColorNormalToAll(int normalColor) { } } + /** + * Set pressed color to the plus button and to all children of this menu. + * + * @param pressedColor The pressed color + */ public void setColorPressedToAll(int pressedColor) { mAddButtonColorPressed = pressedColor; mAddButton.setColorPressed(pressedColor); @@ -154,7 +163,12 @@ public void setColorPressedToAll(int pressedColor) { } } } - + + /** + * Set normal color id to the plus button and to all children of this menu. + * + * @param normalColor The normal color res id + */ public void setColorNormalResIdToAll(@ColorRes int normalColor) { mAddButtonColorNormal = getColor(normalColor); mAddButton.setColorNormalResId(normalColor); @@ -167,6 +181,11 @@ public void setColorNormalResIdToAll(@ColorRes int normalColor) { } } + /** + * Set pressed color id to the plus button and to all children of this menu. + * + * @param pressedColor The pressed color res id + */ public void setColorPressedResIdToAll(@ColorRes int pressedColor) { mAddButtonColorPressed = getColor(pressedColor); mAddButton.setColorPressedResId(pressedColor);