1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-22 04:12:08 +01:00

Some cleaning up

This commit is contained in:
vanitasvitae 2016-08-10 23:43:00 +02:00
parent be54e65abe
commit 79e8ead9bc
5 changed files with 11 additions and 54 deletions

View file

@ -30,6 +30,7 @@ import android.webkit.WebView;
import com.github.dfa.diaspora_android.data.AppSettings; import com.github.dfa.diaspora_android.data.AppSettings;
import com.github.dfa.diaspora_android.data.PodUserProfile; import com.github.dfa.diaspora_android.data.PodUserProfile;
import com.github.dfa.diaspora_android.util.AvatarImageLoader; import com.github.dfa.diaspora_android.util.AvatarImageLoader;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
public class App extends Application { public class App extends Application {
public static final String TAG = "DIASPORA_"; public static final String TAG = "DIASPORA_";
@ -51,6 +52,7 @@ public class App extends Application {
// Get cookie manager // Get cookie manager
cookieManager = CookieManager.getInstance(); cookieManager = CookieManager.getInstance();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
//noinspection deprecation
CookieSyncManager.createInstance(c); CookieSyncManager.createInstance(c);
} }
cookieManager.setAcceptCookie(true); cookieManager.setAcceptCookie(true);
@ -59,7 +61,7 @@ public class App extends Application {
public void resetPodData(@Nullable WebView webView){ public void resetPodData(@Nullable WebView webView){
if(webView != null){ if(webView != null){
webView.stopLoading(); webView.stopLoading();
webView.loadUrl("about:blank"); webView.loadUrl(DiasporaUrlHelper.URL_BLANK);
webView.clearFormData(); webView.clearFormData();
webView.clearHistory(); webView.clearHistory();
webView.clearCache(true); webView.clearCache(true);
@ -72,6 +74,7 @@ public class App extends Application {
appSettings.clearPodSettings(); appSettings.clearPodSettings();
// Clear cookies // Clear cookies
//noinspection deprecation
cookieManager.removeAllCookie(); cookieManager.removeAllCookie();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cookieManager.removeAllCookies(null); cookieManager.removeAllCookies(null);

View file

@ -20,6 +20,7 @@ package com.github.dfa.diaspora_android.listener;
/** /**
* Created by gsantner (https://gsantner.github.io/) on 26.03.16. * Created by gsantner (https://gsantner.github.io/) on 26.03.16.
* Interface that needs to be implemented by classes that listen for Profile related changes
*/ */
public interface WebUserProfileChangedListener { public interface WebUserProfileChangedListener {
void onUserProfileNameChanged(String name); void onUserProfileNameChanged(String name);

View file

@ -19,12 +19,15 @@ package com.github.dfa.diaspora_android.ui;
import android.content.Context; import android.content.Context;
import android.support.design.widget.AppBarLayout; import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.CoordinatorLayout;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.LinearLayout; import android.widget.LinearLayout;
/**
* Behaviour of the bottom Toolbar
* WARNING: This class is NOT UNUSED
*/
@SuppressWarnings("unused")
public class BottomBarBehavior extends CoordinatorLayout.Behavior<LinearLayout> { public class BottomBarBehavior extends CoordinatorLayout.Behavior<LinearLayout> {
private int defaultDependencyTop = -1; private int defaultDependencyTop = -1;

View file

@ -1,45 +0,0 @@
/*
This file is part of the Diaspora for Android.
Diaspora for Android is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the Diaspora for Android.
If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.dfa.diaspora_android.ui;
import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar.SnackbarLayout;
import android.util.AttributeSet;
import android.view.View;
import com.getbase.floatingactionbutton.FloatingActionsMenu;
public class FloatingActionsMenuBehavior extends CoordinatorLayout.Behavior<FloatingActionsMenu> {
public FloatingActionsMenuBehavior(Context context, AttributeSet attrs) {
}
@Override
public boolean layoutDependsOn(CoordinatorLayout parent, FloatingActionsMenu child, View dependency) {
return dependency instanceof SnackbarLayout;
}
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionsMenu child, View dependency) {
float translationY = Math.min(0, dependency.getTranslationY() - dependency.getHeight());
child.setTranslationY(translationY);
return true;
}
}

View file

@ -19,13 +19,9 @@
package com.github.dfa.diaspora_android.util; package com.github.dfa.diaspora_android.util;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.support.v4.content.ContextCompat;
import android.support.v4.text.TextUtilsCompat;
import android.text.Html; import android.text.Html;
import android.webkit.URLUtil; import android.webkit.URLUtil;
import android.webkit.WebView; import android.webkit.WebView;
@ -36,7 +32,6 @@ import com.github.dfa.diaspora_android.data.AppSettings;
import com.github.dfa.diaspora_android.data.PodAspect; import com.github.dfa.diaspora_android.data.PodAspect;
import com.github.dfa.diaspora_android.data.PodUserProfile; import com.github.dfa.diaspora_android.data.PodUserProfile;
import java.net.URL;
import java.util.Locale; import java.util.Locale;
/** /**
@ -59,7 +54,7 @@ public class WebHelper {
} }
public static String escapeHtmlText(String text){ public static String escapeHtmlText(String text){
text = Html.escapeHtml(text);; text = Html.escapeHtml(text);
text = text.replace("\n", "&#10;"); text = text.replace("\n", "&#10;");
return text; return text;
} }