Skip to content

Commit

Permalink
Merge pull request #16583 from brave/open_new_tab_brave_news_android
Browse files Browse the repository at this point in the history
[Android] open in a new tab from brave news in background tab
  • Loading branch information
tapanmodh authored Jan 13, 2023
2 parents 42075db + 30c3e19 commit 0537d39
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
newTab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TabUtils.openUrlInNewTab(false, mUrl);
TabUtils.openUrlInNewTabInBackground(false, mUrl);
dismiss();
}
});
Expand Down
10 changes: 10 additions & 0 deletions android/java/org/chromium/chrome/browser/util/TabUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@ public static void openUrlInNewTab(boolean isIncognito, String url) {
}
}

public static void openUrlInNewTabInBackground(boolean isIncognito, String url) {
BraveActivity braveActivity = BraveActivity.getBraveActivity();
if (braveActivity != null && braveActivity.getTabModelSelector() != null
&& braveActivity.getActivityTab() != null) {
braveActivity.getTabModelSelector().openNewTab(new LoadUrlParams(url),
TabLaunchType.FROM_LONGPRESS_BACKGROUND_IN_GROUP,
braveActivity.getActivityTab(), isIncognito);
}
}

public static void openUrlInSameTab(String url) {
BraveActivity braveActivity = BraveActivity.getBraveActivity();
if (braveActivity != null && braveActivity.getActivityTab() != null) {
Expand Down

0 comments on commit 0537d39

Please sign in to comment.