From 8673b032afaa1c9a30e6b68c4c2141093b1fcb15 Mon Sep 17 00:00:00 2001 From: luvletter2333 Date: Sat, 21 Jan 2023 14:01:58 +0800 Subject: [PATCH] fix more button in ProfileActivity --- .../org/telegram/ui/Cells/AboutLinkCell.java | 11 +++-- .../java/org/telegram/ui/ProfileActivity.java | 41 +------------------ 2 files changed, 9 insertions(+), 43 deletions(-) diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/AboutLinkCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/AboutLinkCell.java index aa31c2e59..64c6921eb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/AboutLinkCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/AboutLinkCell.java @@ -49,6 +49,7 @@ import org.telegram.messenger.LocaleController; import org.telegram.messenger.MessageObject; import org.telegram.messenger.R; import org.telegram.messenger.browser.Browser; +import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.AlertsCreator; @@ -63,6 +64,8 @@ import org.telegram.ui.Components.URLSpanNoUnderline; import java.util.concurrent.atomic.AtomicReference; import kotlin.Unit; +import tw.nekomimi.nekogram.NekoConfig; +import tw.nekomimi.nekogram.parts.DialogTransKt; import tw.nekomimi.nekogram.ui.BottomBuilder; public class AboutLinkCell extends FrameLayout { @@ -385,9 +388,11 @@ public class AboutLinkCell extends FrameLayout { url = pressedLink.getSpan().toString(); } - try { - performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception ignore) {} + if (!NekoConfig.disableVibration.Bool()) { + try { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignore) {} + } ClickableSpan pressedLinkFinal = (ClickableSpan) pressedLink.getSpan(); BottomBuilder builder = new BottomBuilder(parentFragment.getParentActivity()); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index f7cd24fee..a9fe5b687 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -3308,45 +3308,6 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. if (userInfo != null) { presentFragment(new ChangeBioActivity()); } - } else if (position == channelInfoRow || position == userInfoRow || position == locationRow) { - BottomBuilder builder = new BottomBuilder(getParentActivity()); - builder.addItem(LocaleController.getString("Copy", R.string.Copy), R.drawable.baseline_content_copy_24, __ -> { - try { - String about; - if (position == locationRow) { - about = chatInfo != null && chatInfo.location instanceof TLRPC.TL_channelLocation ? ((TLRPC.TL_channelLocation) chatInfo.location).address : null; - } else if (position == channelInfoRow) { - about = chatInfo != null ? chatInfo.about : null; - } else { - about = userInfo != null ? userInfo.about : null; - } - if (!TextUtils.isEmpty(about)) { - AlertUtil.copyAndAlert(about); - } - } catch (Exception e) { - FileLog.e(e); - } - return Unit.INSTANCE; - }); - builder.addItem(LocaleController.getString("Translate", R.string.Translate), R.drawable.ic_translate, __ -> { - try { - String about; - if (position == locationRow) { - about = chatInfo != null && chatInfo.location instanceof TLRPC.TL_channelLocation ? ((TLRPC.TL_channelLocation) chatInfo.location).address : null; - } else if (position == channelInfoRow) { - about = chatInfo != null ? chatInfo.about : null; - } else { - about = userInfo != null ? userInfo.about : null; - } - if (!TextUtils.isEmpty(about)) { - DialogTransKt.startTrans(getParentActivity(), about); - } - } catch (Exception e) { - FileLog.e(e); - } - return Unit.INSTANCE; - }); - builder.show(); } else if (position == numberRow) { TLRPC.User user = UserConfig.getInstance(currentAccount).getCurrentUser(); String number; @@ -8818,7 +8779,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. aboutLinkCell.setTextAndValue(LocaleController.getString("UserBioDetail", R.string.UserBioDetail), LocaleController.getString("UserBio", R.string.UserBio), false); currentBio = null; } -// aboutLinkCell.setMoreButtonDisabled(true); + aboutLinkCell.setMoreButtonDisabled(true); } break; case VIEW_TYPE_PREMIUM_TEXT_CELL: