open() shows only 1 (second) button
lidialibelle opened this issue · 4 comments
lidialibelle commented
When I open menu programmatically by calling open(true/false) menu opens, but only 1 button is present out of 3. Version I use : 0.3.1 .
dvg4000 commented
Can't reproduce your issue. Can you provide your xml layout and buttons plus colors arrays?
lidialibelle commented
Hi Dmitry,
Yes sure. Please find attached.
I debugged the issue and looks like the reason is that the values below are
zero
final float centerX = mMenuButton.getX();
final float centerY = mMenuButton.getY();
Note, I invoke menu.open() before the menu default icon is displayed
(basically to display the menu option buttons immediately). Pls see the
video https://www.dropbox.com/s/ljljrscdak4nie0/IMG-6413.MOV?dl=0
the code snippet is
rateButton = itemView.findViewWithTag("rating");
the rateButton (which is in layout attached is then handled by
RateButtonOnClickListener below)
public class RateButtonOnClickListener implements View.OnClickListener {
...
@OverRide
public void onClick(View v) {
holder.recycleRatingMenu();
if (randoListAdapter.isRateMenuOpened()) {
holder.ratingMenu.close(true);
}
if (holder.ratingMenu != null) {
return;
}
LayoutInflater.from(v.getContext()).inflate(R.layout.rate_menu,
holder.randoItemLayout, true);
holder.ratingMenu = holder.randoItemLayout.findViewById(R.id.rate_menu);
holder.ratingMenu.open(true);
....
…On 7 February 2018 at 07:38, Dmitriy ***@***.***> wrote:
Can't reproduce your issue. Can you provide your xml layout and buttons
plus colors arrays?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#19 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AE1tE-53m_oPF73XICwFbhJALYZpnmKPks5tSUTUgaJpZM4R7xL0>
.
--
Kind regards,
Lidia Chistik
dvg4000 commented
Hi, @lidialibelle. Try this code, to open menu immediately:
final CircleMenuView menu = view.findViewById(R.id.circle_menu);
menu.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
menu.getViewTreeObserver().removeOnGlobalLayoutListener(this);
menu.open(true);
}
});
lidialibelle commented
Hi Dmitry,
Yes, this is a big help. Thanks! Now this works as intended:
https://www.dropbox.com/s/mbrzikgyo3qnbv1/IMG-6417.MOV?dl=0
…On 8 February 2018 at 07:16, Dmitriy ***@***.***> wrote:
Hi, @lidialibelle <https://github.com/lidialibelle>. Try this code, to
open menu immediately:
final CircleMenuView menu = view.findViewById(R.id.circle_menu);
menu.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@OverRide
public void onGlobalLayout() {
menu.getViewTreeObserver().removeOnGlobalLayoutListener(this);
menu.open(true);
}
});
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AE1tE3wO_q19_Q7SwiYsO0c3SyY9KEd4ks5tSpE2gaJpZM4R7xL0>
.
--
Kind regards,
Lidia Chistik