Java 类似、注释和共享按钮的静态方法或类?

Java 类似、注释和共享按钮的静态方法或类?,java,android,android-studio,Java,Android,Android Studio,我正在创建一个包含多个片段的应用程序,每个片段都显示一个带有卡片的垂直回收视图,每个卡片分别有like、comment和share按钮。因为每张卡都有这些按钮,所以我用静态方法来处理这3个按钮中的onClickListner,它们工作得很好。我的困惑是,在这种情况下静态方法会更好,还是为每个按钮创建单独的类会更好 下面是这些静态方法之一的示例 public static void likeLongClick(Context context, ToggleButton likeButton, St

我正在创建一个包含多个片段的应用程序,每个片段都显示一个带有卡片的垂直回收视图,每个卡片分别有like、comment和share按钮。因为每张卡都有这些按钮,所以我用静态方法来处理这3个按钮中的onClickListner,它们工作得很好。我的困惑是,在这种情况下静态方法会更好,还是为每个按钮创建单独的类会更好

下面是这些静态方法之一的示例

public static void likeLongClick(Context context, ToggleButton likeButton, String articleID, String likesCount, TextView likesTextView
        , String[] reactions, ImageView reaction2, ImageView reaction3, String postId, int likeTime, String title, MyApplication application) {
    //reset unlike image if no reaction clicked
    AppUtils.updateReactionOnClick(context, likeButton, articleID, likesCount, likesTextView, reactions, reaction2
            , reaction3, postId, likeTime, 0, application);

    // inflate the layout of the popup window
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE);
    final View popupView = inflater.inflate(R.layout.like_popup, null);
    // create the popup window
    int width = RecyclerView.LayoutParams.WRAP_CONTENT;
    final int height = RecyclerView.LayoutParams.WRAP_CONTENT;
    boolean focusable = true; // lets taps outside the popup also dismiss it
    final PopupWindow popupWindow = new PopupWindow(popupView, width, height, focusable);
    // show the popup window
    popupWindow.setOutsideTouchable(true);
    popupWindow.showAsDropDown(likeButton, 30, -250);
    popupWindow.setContentView(likeButton);

    ImageView likeImage = popupView.findViewById(R.id.likeImage);
    Glide.with(context).load(R.drawable.likegif)
            .apply(new RequestOptions().placeholder(R.drawable.likereaction))
            .into(likeImage);
    ImageView loveImage = popupView.findViewById(R.id.loveImage);
    Glide.with(context).load(R.drawable.lovegif)
            .apply(new RequestOptions().placeholder(R.drawable.love))
            .into(loveImage);
    ImageView laughImage = popupView.findViewById(R.id.laughImage);
    Glide.with(context).load(R.drawable.laughgif)
            .apply(new RequestOptions().placeholder(R.drawable.laugh))
            .into(laughImage);
    ImageView wowImage = popupView.findViewById(R.id.wowImage);
    Glide.with(context).load(R.drawable.wowgif)
            .apply(new RequestOptions().placeholder(R.drawable.wow))
            .into(wowImage);
    ImageView sadImage = popupView.findViewById(R.id.sadImage);
    Glide.with(context).load(R.drawable.crygif)
            .apply(new RequestOptions().placeholder(R.drawable.sad))
            .into(sadImage);
    ImageView angryImage = popupView.findViewById(R.id.angryImage);
    Glide.with(context).load(R.drawable.angrygif)
            .apply(new RequestOptions().placeholder(R.drawable.angry))
            .into(angryImage);

    likeImage.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            AppUtils.updateReactionOnClick(context, likeButton, articleID, likesCount, likesTextView, reactions, reaction2
                    , reaction3, postId, likeTime, 1, application);
            popupWindow.dismiss();
        }
    });
    loveImage.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            AppUtils.updateReactionOnClick(context, likeButton, articleID, likesCount, likesTextView, reactions, reaction2
                    , reaction3, postId, likeTime, 2, application);
            popupWindow.dismiss();
        }
    });
    laughImage.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            AppUtils.updateReactionOnClick(context, likeButton, articleID, likesCount, likesTextView, reactions, reaction2
                    , reaction3, postId, likeTime, 3, application);
            popupWindow.dismiss();
        }
    });
    wowImage.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            AppUtils.updateReactionOnClick(context, likeButton, articleID, likesCount, likesTextView, reactions, reaction2
                    , reaction3, postId, likeTime, 4, application);
            popupWindow.dismiss();
        }
    });
    sadImage.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            AppUtils.updateReactionOnClick(context, likeButton, articleID, likesCount, likesTextView, reactions, reaction2
                    , reaction3, postId, likeTime, 6, application);
            popupWindow.dismiss();
        }
    });
    angryImage.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            AppUtils.updateReactionOnClick(context, likeButton, articleID, likesCount, likesTextView, reactions, reaction2
                    , reaction3, postId, likeTime, 5, application);
            popupWindow.dismiss();
        }
    });

    //fire a log event
    //AppUtils.logScreen(mFirebaseAnalytics, "Reaction - " + title);
}
非常感谢各位的帮助