Skip to content

Commit

Permalink
feat: support copy fragment username
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Apr 9, 2024
1 parent 673c9b7 commit eebb3bb
Showing 1 changed file with 13 additions and 0 deletions.
Expand Up @@ -45,6 +45,8 @@
import org.telegram.ui.Components.RLottieImageView;
import org.telegram.ui.Stories.recorder.ButtonWithCounterView;

import tw.nekomimi.nekogram.utils.AlertUtil;

public class FragmentUsernameBottomSheet {

public static final int TYPE_USERNAME = 0;
Expand Down Expand Up @@ -168,6 +170,17 @@ public static void open(
sheet.dismiss();
});
layout.addView(button2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48, 6, 6, 6, 0));

// na: copy fragment username
if (type == TYPE_USERNAME) {
ButtonWithCounterView button3 = new ButtonWithCounterView(context, false, resourcesProvider);
button3.setText(getString(R.string.Copy), false);
button3.setOnClickListener(v -> {
AlertUtil.copyAndAlert("@" + name);
sheet.dismiss();
});
layout.addView(button3, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48, 6, 6, 6, 0));
}
}

sheet.setCustomView(layout);
Expand Down

0 comments on commit eebb3bb

Please sign in to comment.