1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-16 17:32:08 +01: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.activity.MainActivity;
import com.github.dfa.diaspora_android.data.AppSettings; import com.github.dfa.diaspora_android.data.AppSettings;
import com.github.dfa.diaspora_android.ui.ContextMenuWebView; 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.CustomWebViewClient;
import com.github.dfa.diaspora_android.webview.ProgressBarWebChromeClient; import com.github.dfa.diaspora_android.webview.ProgressBarWebChromeClient;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
@ -62,6 +63,7 @@ public class BrowserFragment extends CustomFragment {
protected AppSettings appSettings; protected AppSettings appSettings;
protected CustomWebViewClient webViewClient; protected CustomWebViewClient webViewClient;
protected WebSettings webSettings; protected WebSettings webSettings;
protected DiasporaUrlHelper urls;
protected String pendingUrl; protected String pendingUrl;
@ -81,6 +83,7 @@ public class BrowserFragment extends CustomFragment {
if(this.appSettings == null) { if(this.appSettings == null) {
this.appSettings = ((App) getActivity().getApplication()).getSettings(); this.appSettings = ((App) getActivity().getApplication()).getSettings();
this.urls = new DiasporaUrlHelper(appSettings);
} }
if(this.webView == null) { if(this.webView == null) {
@ -97,7 +100,9 @@ public class BrowserFragment extends CustomFragment {
this.swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { this.swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override @Override
public void onRefresh() { public void onRefresh() {
webView.reload(); if(webView.getUrl() != null && !webView.getUrl().equals(urls.getNewPostUrl())) {
webView.reload();
}
BrowserFragment.this.swipeRefreshLayout.setRefreshing(false); BrowserFragment.this.swipeRefreshLayout.setRefreshing(false);
} }
}); });
@ -118,7 +123,6 @@ public class BrowserFragment extends CustomFragment {
} }
webView.setParentActivity(getActivity()); webView.setParentActivity(getActivity());
this.setRetainInstance(true); this.setRetainInstance(true);
} }

View file

@ -226,7 +226,6 @@ public class ContextMenuWebView extends WebView {
@Override @Override
public void loadUrl(String url) { public void loadUrl(String url) {
super.loadUrl(url); super.loadUrl(url);
// Don't spam intents ;) // Don't spam intents ;)
if (!lasLoadUrl.equals(url)) { if (!lasLoadUrl.equals(url)) {
Intent updateActivityTitleIntent = new Intent(MainActivity.ACTION_UPDATE_TITLE_FROM_URL); Intent updateActivityTitleIntent = new Intent(MainActivity.ACTION_UPDATE_TITLE_FROM_URL);

View file

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