diff --git a/app/src/main/java/com/github/dfa/diaspora_android/fragment/BrowserFragment.java b/app/src/main/java/com/github/dfa/diaspora_android/fragment/BrowserFragment.java index 1bc7195f..a87b8841 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/fragment/BrowserFragment.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/fragment/BrowserFragment.java @@ -30,6 +30,7 @@ import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.activity.MainActivity; import com.github.dfa.diaspora_android.data.AppSettings; import com.github.dfa.diaspora_android.ui.ContextMenuWebView; +import com.github.dfa.diaspora_android.util.DiasporaUrlHelper; import com.github.dfa.diaspora_android.webview.CustomWebViewClient; import com.github.dfa.diaspora_android.webview.ProgressBarWebChromeClient; import com.github.dfa.diaspora_android.util.AppLog; @@ -62,6 +63,7 @@ public class BrowserFragment extends CustomFragment { protected AppSettings appSettings; protected CustomWebViewClient webViewClient; protected WebSettings webSettings; + protected DiasporaUrlHelper urls; protected String pendingUrl; @@ -81,6 +83,7 @@ public class BrowserFragment extends CustomFragment { if(this.appSettings == null) { this.appSettings = ((App) getActivity().getApplication()).getSettings(); + this.urls = new DiasporaUrlHelper(appSettings); } if(this.webView == null) { @@ -97,7 +100,9 @@ public class BrowserFragment extends CustomFragment { this.swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { - webView.reload(); + if(webView.getUrl() != null && !webView.getUrl().equals(urls.getNewPostUrl())) { + webView.reload(); + } BrowserFragment.this.swipeRefreshLayout.setRefreshing(false); } }); @@ -118,7 +123,6 @@ public class BrowserFragment extends CustomFragment { } webView.setParentActivity(getActivity()); - this.setRetainInstance(true); } diff --git a/app/src/main/java/com/github/dfa/diaspora_android/ui/ContextMenuWebView.java b/app/src/main/java/com/github/dfa/diaspora_android/ui/ContextMenuWebView.java index 02ac27f2..7e0fe46d 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/ui/ContextMenuWebView.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/ui/ContextMenuWebView.java @@ -226,7 +226,6 @@ public class ContextMenuWebView extends WebView { @Override public void loadUrl(String url) { super.loadUrl(url); - // Don't spam intents ;) if (!lasLoadUrl.equals(url)) { Intent updateActivityTitleIntent = new Intent(MainActivity.ACTION_UPDATE_TITLE_FROM_URL); diff --git a/app/src/main/res/layout/browser__fragment.xml b/app/src/main/res/layout/browser__fragment.xml index 15875642..2e7adc33 100644 --- a/app/src/main/res/layout/browser__fragment.xml +++ b/app/src/main/res/layout/browser__fragment.xml @@ -14,7 +14,7 @@ + android:layout_height="wrap_content" />