Skip to content

Commit

Permalink
[#1] bug fix: only update initial page url when Extras contains "url"
Browse files Browse the repository at this point in the history
  • Loading branch information
warren-bank committed May 22, 2019
1 parent c33d6f6 commit a7ba03e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ public static boolean contains(ArrayList<DrawerListItem> items, String uri) {

// Content: WebView ----------------------------------------------------------------------------

private String default_page_url = "about:blank";
private String current_page_url = default_page_url;
private static final String default_page_url = "about:blank";

private String current_page_url;
private WebView webView;
private BrowserWebViewClient webViewClient;
private BrowserDownloadListener downloadListener;
Expand Down Expand Up @@ -171,8 +172,11 @@ public void onCreate(Bundle savedInstanceState) {

// Content: WebView ------------------------------------------------------------------------

if (getIntent().getExtras() != null) {
current_page_url = getIntent().getStringExtra("url");
current_page_url = default_page_url;

Intent intent = getIntent();
if (intent.hasExtra("url")) {
current_page_url = intent.getStringExtra("url");
}

webView = (WebView)findViewById(R.id.webView);
Expand Down Expand Up @@ -206,8 +210,13 @@ public boolean onQueryTextChange(String newText) {
// Content: UI -----------------------------------------------------------------------------

parentView = (ViewGroup)findViewById(R.id.viewgroup_content);
}

updateCurrentPage(current_page_url, true);
@Override
public void onStart() {
super.onStart();

updateCurrentPage(current_page_url, false);
toggleDrawerBookmarks(); // open
}

Expand Down Expand Up @@ -806,6 +815,11 @@ public void onReceivedError(WebView view, WebResourceRequest request, WebResourc
}

private void updateCurrentPage(String uri, boolean loadUrl) {
if (uri == null) return;

uri = uri.trim();
if (uri == "") return;

current_page_url = uri;
search.setQueryHint(current_page_url);
search.setQuery(current_page_url, false);
Expand Down
4 changes: 2 additions & 2 deletions constants.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project.ext {
releaseVersionCode = 004070116
releaseVersion = '004.07.01-16API'
releaseVersionCode = 004070216
releaseVersion = '004.07.02-16API'
minSdkVersion = 16
targetSdkVersion = 28
compileSdkVersion = 28
Expand Down

0 comments on commit a7ba03e

Please sign in to comment.