- // Only enable swipeToRefresh if is mainWebView is scrolled to the top.
- mainWebView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
- @Override
- public void onScrollChanged() {
- if (mainWebView.getScrollY() == 0) {
- swipeToRefresh.setEnabled(true);
- } else {
- swipeToRefresh.setEnabled(false);
- }
- }
- });
+ // Initialize the variables for favoriteIcon, urlTextBox, and progressBar
+ favoriteIcon = (ImageView) actionBar.getCustomView().findViewById(R.id.favoriteIcon);
+ urlTextBox = (EditText) actionBar.getCustomView().findViewById(R.id.urlTextBox);
+ progressBar = (ProgressBar) actionBar.getCustomView().findViewById(R.id.progressBar);
+
+ // Scroll the actionBar.
+ actionBar.setHideOnContentScrollEnabled(true);
+ }