private ActionBar actionBar;
private LinearLayout findOnPageLinearLayout;
private LinearLayout tabsLinearLayout;
private ActionBar actionBar;
private LinearLayout findOnPageLinearLayout;
private LinearLayout tabsLinearLayout;
actionBar.setCustomView(R.layout.url_app_bar);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
actionBar.setCustomView(R.layout.url_app_bar);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
// Create the hamburger icon at the start of the AppBar.
actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.open_navigation_drawer, R.string.close_navigation_drawer);
// Create the hamburger icon at the start of the AppBar.
actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.open_navigation_drawer, R.string.close_navigation_drawer);
// Toggle the stored status of swipe to refresh.
currentWebView.setSwipeToRefresh(!currentWebView.getSwipeToRefresh());
// Toggle the stored status of swipe to refresh.
currentWebView.setSwipeToRefresh(!currentWebView.getSwipeToRefresh());
// Update the swipe refresh layout.
if (currentWebView.getSwipeToRefresh()) { // Swipe to refresh is enabled.
// Only enable the swipe refresh layout if the WebView is scrolled to the top. It is updated every time the scroll changes.
// Update the swipe refresh layout.
if (currentWebView.getSwipeToRefresh()) { // Swipe to refresh is enabled.
// Only enable the swipe refresh layout if the WebView is scrolled to the top. It is updated every time the scroll changes.
} else { // Swipe to refresh is disabled.
// Disable the swipe refresh layout.
swipeRefreshLayout.setEnabled(false);
} else { // Swipe to refresh is disabled.
// Disable the swipe refresh layout.
swipeRefreshLayout.setEnabled(false);
// Get the text from urlTextBox and convert it to a string. trim() removes white spaces from the beginning and end of the string.
String unformattedUrlString = urlEditText.getText().toString().trim();
// Get the text from urlTextBox and convert it to a string. trim() removes white spaces from the beginning and end of the string.
String unformattedUrlString = urlEditText.getText().toString().trim();
saveWebpageUrl = originalUrlString;
} else {
// Get the URL from the edit text, which may have been modified.
saveWebpageUrl = originalUrlString;
} else {
// Get the URL from the edit text, which may have been modified.
// Remove the formatting from the URL edit text when the user is editing the text.
urlEditText.setOnFocusChangeListener((View v, boolean hasFocus) -> {
if (hasFocus) { // The user is editing the URL text box.
// Remove the formatting from the URL edit text when the user is editing the text.
urlEditText.setOnFocusChangeListener((View v, boolean hasFocus) -> {
if (hasFocus) { // The user is editing the URL text box.
// Initialize the user agent array adapter and string array.
ArrayAdapter<CharSequence> userAgentNamesArray = ArrayAdapter.createFromResource(this, R.array.user_agent_names, R.layout.spinner_item);
String[] userAgentDataArray = getResources().getStringArray(R.array.user_agent_data);
// Initialize the user agent array adapter and string array.
ArrayAdapter<CharSequence> userAgentNamesArray = ArrayAdapter.createFromResource(this, R.array.user_agent_names, R.layout.spinner_item);
String[] userAgentDataArray = getResources().getStringArray(R.array.user_agent_data);
// Update the swipe refresh layout.
if (defaultSwipeToRefresh) { // Swipe to refresh is enabled.
// Only enable the swipe refresh layout if the WebView is scrolled to the top. It is updated every time the scroll changes.
// Update the swipe refresh layout.
if (defaultSwipeToRefresh) { // Swipe to refresh is enabled.
// Only enable the swipe refresh layout if the WebView is scrolled to the top. It is updated every time the scroll changes.
} else { // Swipe to refresh is disabled.
// Disable the swipe refresh layout.
swipeRefreshLayout.setEnabled(false);
} else { // Swipe to refresh is disabled.
// Disable the swipe refresh layout.
swipeRefreshLayout.setEnabled(false);
nestedScrollWebView.setSwipeToRefresh(true);
// Only enable the swipe refresh layout if the WebView is scrolled to the top. It is updated every time the scroll changes.
nestedScrollWebView.setSwipeToRefresh(true);
// Only enable the swipe refresh layout if the WebView is scrolled to the top. It is updated every time the scroll changes.
// Update the swipe refresh layout.
if (defaultSwipeToRefresh) { // Swipe to refresh is enabled.
// Only enable the swipe refresh layout if the WebView is scrolled to the top. It is updated every time the scroll changes.
// Update the swipe refresh layout.
if (defaultSwipeToRefresh) { // Swipe to refresh is enabled.
// Only enable the swipe refresh layout if the WebView is scrolled to the top. It is updated every time the scroll changes.
} else { // Swipe to refresh is disabled.
// Disable the swipe refresh layout.
swipeRefreshLayout.setEnabled(false);
} else { // Swipe to refresh is disabled.
// Disable the swipe refresh layout.
swipeRefreshLayout.setEnabled(false);
// Set the loading of webpage images.
nestedScrollWebView.getSettings().setLoadsImagesAutomatically(displayWebpageImages);
// Set the loading of webpage images.
nestedScrollWebView.getSettings().setLoadsImagesAutomatically(displayWebpageImages);
urlRelativeLayout.setBackground(ResourcesCompat.getDrawable(getResources(), R.color.transparent, null));
}
urlRelativeLayout.setBackground(ResourcesCompat.getDrawable(getResources(), R.color.transparent, null));
}
- // Get handles for the URL views.
- RelativeLayout urlRelativeLayout = findViewById(R.id.url_relativelayout);
- EditText urlEditText = findViewById(R.id.url_edittext);
- SwipeRefreshLayout swipeRefreshLayout = findViewById(R.id.swiperefreshlayout);
-
WebViewTabFragment webViewTabFragment = webViewPagerAdapter.getPageFragment(pageNumber);
// Get the fragment view.
WebViewTabFragment webViewTabFragment = webViewPagerAdapter.getPageFragment(pageNumber);
// Get the fragment view.
// Update the status of swipe to refresh.
if (currentWebView.getSwipeToRefresh()) { // Swipe to refresh is enabled.
// Enable the swipe refresh layout if the WebView is scrolled all the way to the top. It is updated every time the scroll changes.
// Update the status of swipe to refresh.
if (currentWebView.getSwipeToRefresh()) { // Swipe to refresh is enabled.
// Enable the swipe refresh layout if the WebView is scrolled all the way to the top. It is updated every time the scroll changes.
} else { // Swipe to refresh is disabled.
// Disable the swipe refresh layout.
swipeRefreshLayout.setEnabled(false);
} else { // Swipe to refresh is disabled.
// Disable the swipe refresh layout.
swipeRefreshLayout.setEnabled(false);