From: masensio Date: Tue, 18 Mar 2014 14:13:50 +0000 (+0100) Subject: OC-3390: Message is shown in the login screen instead of an alert message: Change... X-Git-Tag: oc-android-1.5.5~5^2~1^2~14 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/705bee08fa4e77f399049afc1e2ffe81ce481d6f?ds=inline OC-3390: Message is shown in the login screen instead of an alert message: Change the alert dialog by an error message under server address --- diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index 72b65945..16ce7558 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -35,7 +35,6 @@ import android.net.http.SslError; import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; -import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; @@ -74,8 +73,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode; import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation; import com.owncloud.android.lib.resources.users.GetRemoteUserNameOperation; - -import com.owncloud.android.ui.dialog.AlertMessageDialog; + import com.owncloud.android.ui.dialog.SamlWebViewDialog; import com.owncloud.android.ui.dialog.SslUntrustedCertDialog; import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertListener; @@ -130,7 +128,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity public static final byte ACTION_UPDATE_TOKEN = 1; private static final String TAG_SAML_DIALOG = "samlWebViewDialog"; - private static final String TAG_ALERT_MESSAGE_DIALOG = "alertMessagewDialog"; private String mHostBaseUrl; private OwnCloudVersion mDiscoveredVersion; @@ -1147,6 +1144,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity mAuthStatusText = R.string.auth_fail_get_user_name; } + private void updateServerStatusIconNoRegularAuth(){ + mServerStatusIcon = android.R.drawable.ic_secure; + mServerStatusText = R.string.auth_unsupported_auth_method; + } + /** * Processes the result of the request for and access token send * to an OAuth authorization server. @@ -1204,8 +1206,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity mOkButton.setEnabled(false); mTryEmptyAuthorization = false; mServerIsValid = false; - //show an alert message - showAlertMessageDialog(R.string.common_alert_title, R.string.auth_unsupported_auth_method); + //show an alert message + updateServerStatusIconNoRegularAuth(); + showServerStatus(); } else { Log_OC.d(TAG, "Successful access - time to save the account"); @@ -1778,10 +1781,5 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity } } - - private void showAlertMessageDialog(int tittle, int message) { - DialogFragment newAlertMessage = AlertMessageDialog.newInstance(tittle, message); - newAlertMessage.show(getSupportFragmentManager(), TAG_ALERT_MESSAGE_DIALOG); - } } diff --git a/src/com/owncloud/android/ui/dialog/AlertMessageDialog.java b/src/com/owncloud/android/ui/dialog/AlertMessageDialog.java deleted file mode 100644 index 82164c33..00000000 --- a/src/com/owncloud/android/ui/dialog/AlertMessageDialog.java +++ /dev/null @@ -1,63 +0,0 @@ -/* ownCloud Android client application - * Copyright (C) 2012-2014 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, - * as published by the Free Software Foundation. - * - * This program 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 this program. If not, see . - * - */ - -package com.owncloud.android.ui.dialog; - -import android.app.AlertDialog; -import android.app.Dialog; -import android.content.DialogInterface; -import android.os.Bundle; - -import com.actionbarsherlock.app.SherlockDialogFragment; -import com.owncloud.android.R; - -public class AlertMessageDialog extends SherlockDialogFragment { - - private static final String ARG_TITLE_ID = AlertMessageDialog.class.getCanonicalName() + ".ARG_TITLE_ID"; - private static final String ARG_MESSAGE_ID = AlertMessageDialog.class.getCanonicalName() + ".ARG_MESSAGE_ID"; - - - public static AlertMessageDialog newInstance(int title, int message) { - AlertMessageDialog frag = new AlertMessageDialog(); - Bundle args = new Bundle(); - args.putInt(ARG_TITLE_ID, title); - args.putInt(ARG_MESSAGE_ID, message); - frag.setArguments(args); - return frag; - } - - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getSherlockActivity()); - - int title = getArguments().getInt(ARG_TITLE_ID); - int message = getArguments().getInt(ARG_MESSAGE_ID); - - dialogBuilder.setIcon(R.drawable.common_error) - .setTitle(title) - .setMessage(message) - .setCancelable(true) - .setPositiveButton(R.string.common_ok, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int whichButton) { - dialog.dismiss(); - } - }); - return dialogBuilder.create(); - } - -}