1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-06-25 21:14:52 +02:00

Fixed layout bug and disabled refreshing on new post

This commit is contained in:
vanitasvitae 2016-10-09 11:39:05 +02:00
parent 5b73f99213
commit ff7f0eb86b
Signed by: vanitasvitae
GPG key ID: DCCFB3302C9E4615
3 changed files with 7 additions and 4 deletions

View file

@ -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);
}

View file

@ -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);

View file

@ -14,7 +14,7 @@
<com.github.dfa.diaspora_android.ui.ContextMenuWebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="wrap_content" />
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>