Skip to content

Commit

Permalink
feat: show translate button when text selected
Browse files Browse the repository at this point in the history
Signed-off-by: Next Alone <[email protected]>
  • Loading branch information
NextAlone committed Dec 2, 2023
1 parent 002e7a2 commit 00972ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ public boolean onPrepareActionMode(ActionMode mode, Menu menu) {

private String translateFromLanguage = null;
private void updateTranslateButton(Menu menu) {
menu.getItem(3).setVisible(!LanguageDetector.hasSupport() || translateFromLanguage != null && !TranslateHelper.isLanguageRestricted(translateFromLanguage));
menu.getItem(3).setVisible(!LanguageDetector.hasSupport() || translateFromLanguage == null || !TranslateHelper.isLanguageRestricted(translateFromLanguage));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public TranslateAlert(BaseFragment fragment, Context context, int currentAccount
this.onLinkPress = onLinkPress;
this.noforwards = noforwards;
this.fragment = fragment;
this.fromLanguage = /*fromLanguage != null && fromLanguage.equals("und") ? "auto" : */fromLanguage;
this.fromLanguage = fromLanguage == null || fromLanguage.equals("und") ? "auto" : fromLanguage;
this.toLanguage = toLanguage;
this.text = text;
this.textBlocks = new ArrayList<>();
Expand Down

0 comments on commit 00972ee

Please sign in to comment.