X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Factivities%2FMainWebViewActivity.java;h=91c3a71ebbaa125590debe2d2bbf99ead47a0e2f;hp=f2bf75366c0288d993e970a2615f7b623e54d990;hb=31cabbff2facf185d9037588fca46b8a6e5737bc;hpb=5186b668274b09e37b371c0a134e53255c98ad98 diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index f2bf7536..91c3a71e 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -759,8 +759,18 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook } } } else { // The app has been restarted. - // Set the saved tab position to be the size of the saved state array list. The tab position is 0 based, meaning the at the new tab will be the tab position that is restored. - savedTabPosition = savedStateArrayList.size(); + // Get the information from the intent. + String intentAction = intent.getAction(); + Uri intentUriData = intent.getData(); + String intentStringExtra = intent.getStringExtra(Intent.EXTRA_TEXT); + + // Determine if this is a web search. + boolean isWebSearch = ((intentAction != null) && intentAction.equals(Intent.ACTION_WEB_SEARCH)); + + // If the new intent will open a new tab, set the saved tab position to be the size of the saved state array list. + // The tab position is 0 based, meaning the at the new tab will be the tab position that is restored. + if (intentUriData != null || intentStringExtra != null || isWebSearch) + savedTabPosition = savedStateArrayList.size(); // Replace the intent that started the app with this one. This will load the tab after the others have been restored. setIntent(intent);