-/* ownCloud Android client application
- * Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ * ownCloud Android client application
+ *
+ * @author Maria Asensio
+ * @author David A. Velasco
+ * Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
+import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.webkit.WebView;
import android.widget.RelativeLayout;
-import com.actionbarsherlock.app.SherlockDialogFragment;
+import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.SsoWebViewClient;
import com.owncloud.android.authentication.SsoWebViewClient.SsoWebViewClientListener;
-import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.utils.Log_OC;
/**
* Dialog to show the WebView for SAML Authentication
- *
- * @author Maria Asensio
- * @author David A. Velasco
*/
-public class SamlWebViewDialog extends SherlockDialogFragment {
+public class SamlWebViewDialog extends DialogFragment {
public final String SAML_DIALOG_TAG = "SamlWebViewDialog";
/**
* Public factory method to get dialog instances.
- *
- * @param handler
- * @param Url Url to open at WebView
- * @param targetURL mBaseUrl + AccountUtils.getWebdavPath(mDiscoveredVersion, mCurrentAuthTokenType)
+ *
+ * @param url Url to open at WebView
+ * @param targetUrl mBaseUrl + AccountUtils.getWebdavPath(mDiscoveredVersion, m
+ * CurrentAuthTokenType)
* @return New dialog instance, ready to show.
*/
public static SamlWebViewDialog newInstance(String url, String targetUrl) {
mWebViewClient = new SsoWebViewClient(activity, mHandler, mSsoWebViewClientListener);
} catch (ClassCastException e) {
- throw new ClassCastException(activity.toString() + " must implement " + SsoWebViewClientListener.class.getSimpleName());
+ throw new ClassCastException(activity.toString() + " must implement " +
+ SsoWebViewClientListener.class.getSimpleName());
}
}
setRetainInstance(true);
- CookieSyncManager.createInstance(getSherlockActivity().getApplicationContext());
+ CookieSyncManager.createInstance(getActivity().getApplicationContext());
if (savedInstanceState == null) {
mInitialUrl = getArguments().getString(ARG_INITIAL_URL);
mTargetUrl = savedInstanceState.getString(ARG_TARGET_URL);
}
- setStyle(SherlockDialogFragment.STYLE_NO_TITLE, R.style.Theme_ownCloud_Dialog);
+ setStyle(DialogFragment.STYLE_NO_TITLE, R.style.Theme_ownCloud_Dialog);
}
@SuppressWarnings("deprecation")
@SuppressLint("SetJavaScriptEnabled")
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
Log_OC.v(TAG, "onCreateView, savedInsanceState is " + savedInstanceState);
// Inflate layout of the dialog
- RelativeLayout ssoRootView = (RelativeLayout) inflater.inflate(R.layout.sso_dialog, container, false); // null parent view because it will go in the dialog layout
+ RelativeLayout ssoRootView = (RelativeLayout) inflater.inflate(R.layout.sso_dialog,
+ container, false); // null parent view because it will go in the dialog layout
if (mSsoWebView == null) {
// initialize the WebView
- mSsoWebView = new SsoWebView(getSherlockActivity().getApplicationContext());
+ mSsoWebView = new SsoWebView(getActivity().getApplicationContext());
mSsoWebView.setFocusable(true);
mSsoWebView.setFocusableInTouchMode(true);
mSsoWebView.setClickable(true);
webSettings.setBuiltInZoomControls(false);
webSettings.setLoadWithOverviewMode(false);
webSettings.setSavePassword(false);
- webSettings.setUserAgentString(OwnCloudClient.USER_AGENT);
+ webSettings.setUserAgentString(MainApp.getUserAgent());
webSettings.setSaveFormData(false);
CookieManager cookieManager = CookieManager.getInstance();