Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
fix problems with pull to refresh #155
Browse files Browse the repository at this point in the history
  • Loading branch information
indywidualny committed Apr 30, 2016
1 parent 0eba557 commit d1a4461
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,8 @@ public void onRefresh() {
if (!Connectivity.isConnected(getApplicationContext()) && !preferences.getBoolean("offline_mode", false))
Toast.makeText(getApplicationContext(), getString(R.string.no_network), Toast.LENGTH_SHORT).show();

webView.stopLoading();

// reloading page (if offline try to load a live version first)
if (preferences.getBoolean("offline_mode", false) && MyWebViewClient.wasOffline)
webView.loadUrl(MyWebViewClient.currentlyLoadedPage);
Expand Down Expand Up @@ -1129,4 +1131,8 @@ public static Activity getMainActivity() {
return mainActivity;
}

public SwipeRefreshLayout getSwipeRefreshLayout() {
return swipeRefreshLayout;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ public void onReceivedError(WebView view, WebResourceRequest req, WebResourceErr

@Override
public void onPageFinished(WebView view, String url) {
if (url.contains("messenger.com"))
((MainActivity) MainActivity.getMainActivity()).getSwipeRefreshLayout().setEnabled(false);
else
((MainActivity) MainActivity.getMainActivity()).getSwipeRefreshLayout().setEnabled(true);

// when Zero is activated and there is a mobile network connection ignore extra customizations
if (!preferences.getBoolean("facebook_zero", false) || !Connectivity.isConnectedMobile(context)) {

Expand Down

0 comments on commit d1a4461

Please sign in to comment.