pgreze / android-reactions

Facebook like reaction picker for Android
Apache License 2.0
158 stars 46 forks source link

OnLongPress open dialog #7

Closed ShwetaChauhan18 closed 4 years ago

ShwetaChauhan18 commented 4 years ago

Can we do like onLongPress dialog will open and default like and dislike work?

pgreze commented 4 years ago

I'm not sure if it's solving your issue but library is only providing the dialog, and you're owning the callee onTouchListener.

Also sample app provided in this repository is showcasing the reaction pattern originally from Facebook app, but another way to interact the dialog should be possible (it may requires forking the library).

ShwetaChauhan18 commented 4 years ago

@pgreze : Actually, I solved this issue.

peddiraju26 commented 4 years ago

@pgreze : Actually, I solved this issue.

@ShwetaChauhan18 Can you share the working code?

ShwetaChauhan18 commented 4 years ago

@pgreze : Actually, I solved this issue.

@ShwetaChauhan18 Can you share the working code?

@pgreze : I have created PR for that before. And long press code is working on below like button. Please review code and merge that branch so everyone get that functionality.

Let me generate PR here

peddiraju26 commented 4 years ago

@ShwetaChauhan18 @pgreze have tried below code for Single click and Long click for a view But I need to release my hold so I can navigate through the popup window for reaction selection. AND If I use //((ImageViewHolder1) viewHolder).moment_reaction.setOnTouchListener(popup); the It will popup will stick to view only

    ((ImageViewHolder1) viewHolder).moment_reaction_lay.setOnTouchListener(new OnSwipeListener(context) {

        public void onClick() {

            Log.i("@@@@@@@@@@@@", "Short press!");

                }
            }
        }

        public void onLongClick(View view, MotionEvent motionEvent) {

            Log.i("@@@@@@@@@@@@", "Long press!");

            parent11.requestDisallowInterceptTouchEvent(true);

            //((ImageViewHolder1) viewHolder).moment_reaction.setOnTouchListener(popup);
            popup.onTouch(view, motionEvent);

        }

    });
ShwetaChauhan18 commented 4 years ago

@ShwetaChauhan18 @pgreze have tried below code for Single click and Long click for a view But I need to release my hold so I can navigate through the popup window for reaction selection. AND If I use //((ImageViewHolder1) viewHolder).moment_reaction.setOnTouchListener(popup); the It will popup will stick to view only

    ((ImageViewHolder1) viewHolder).moment_reaction_lay.setOnTouchListener(new OnSwipeListener(context) {

        public void onClick() {

            Log.i("@@@@@@@@@@@@", "Short press!");

                }
            }
        }

        public void onLongClick(View view, MotionEvent motionEvent) {

            Log.i("@@@@@@@@@@@@", "Long press!");

            parent11.requestDisallowInterceptTouchEvent(true);

            //((ImageViewHolder1) viewHolder).moment_reaction.setOnTouchListener(popup);
            popup.onTouch(view, motionEvent);

        }

    });

@peddiraju26 : Check I have created PR for that

peddiraju26 commented 4 years ago

@ShwetaChauhan18 Thanks for PR!

For a Long click, I need to release my hold so I can navigate through the reaction popup window for like, love, etc reactions. Can we solve this?

ShwetaChauhan18 commented 4 years ago

@ShwetaChauhan18 Thanks for PR!

For a Long click, I need to release my hold so I can navigate through the reaction popup window for like, love, etc reactions. Can we solve this?

yes. long_press

ghost commented 2 years ago

I solved this issue in a simple way... you can follow this...


Button react = findViewById(R.id.react);

ReactionsConfig config = new ReactionsConfigBuilder(context)
                    .withReactions(new int[]{
                            R.drawable.ic_thumb,
                            R.drawable.ic_love,
                            R.drawable.ic_laugh,
                            R.drawable.ic_wow,
                            R.drawable.ic_sad,
                            R.drawable.ic_angry
                    })
                    .withPopupAlpha(1)
                    .build();
            ReactionPopup reactionPopup = new ReactionPopup(context, config, pos ->{
                return true;
            });

react.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {

                    react.setOnLongClickListener(v1 -> {

                        reactionPopup.onTouch(v, event);
                        return false;
                    });

                    return false;
                }
            });