当前位置: 首页>>代码示例>>Java>>正文


Java CheckDirection类代码示例

本文整理汇总了Java中com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection的典型用法代码示例。如果您正苦于以下问题:Java CheckDirection类的具体用法?Java CheckDirection怎么用?Java CheckDirection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CheckDirection类属于com.fsck.k9.activity.setup.AccountSetupCheckSettings包,在下文中一共展示了CheckDirection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteCertificate

import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; //导入依赖的package包/类
/**
 * Examine the existing settings for an account.  If the old host/port is different from the
 * new host/port, then try and delete any (possibly non-existent) certificate stored for the
 * old host/port.
 */
public void deleteCertificate(String newHost, int newPort, CheckDirection direction) {
    Uri uri;
    if (direction == CheckDirection.INCOMING) {
        uri = Uri.parse(getStoreUri());
    } else {
        uri = Uri.parse(getTransportUri());
    }
    String oldHost = uri.getHost();
    int oldPort = uri.getPort();
    if (oldPort == -1) {
        // This occurs when a new account is created
        return;
    }
    if (!newHost.equals(oldHost) || newPort != oldPort) {
        LocalKeyStore localKeyStore = LocalKeyStore.getInstance();
        localKeyStore.deleteCertificate(oldHost, oldPort);
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:24,代码来源:Account.java

示例2: onActivityResult

import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
        if (!mCheckedIncoming) {
            //We've successfully checked incoming.  Now check outgoing.
            mCheckedIncoming = true;
            AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.OUTGOING);
        } else {
            //We've successfully checked outgoing as well.
            mAccount.setDescription(mAccount.getEmail());
            mAccount.save(Preferences.getPreferences(this));
            QMail.setServicesEnabled(this);
            AccountSetupNames.actionSetNames(this, mAccount);
            finish();
        }
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:18,代码来源:AccountSetupBasics.java

示例3: onNext

import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; //导入依赖的package包/类
protected void onNext() {
    ConnectionSecurity securityType = getSelectedSecurity();
    String uri;
    String username = null;
    String password = null;
    String clientCertificateAlias = null;
    AuthType authType = null;
    if (mRequireLoginView.isChecked()) {
        username = mUsernameView.getText().toString();

        authType = getSelectedAuthType();
        if (AuthType.EXTERNAL == authType) {
            clientCertificateAlias = mClientCertificateSpinner.getAlias();
        } else {
            password = mPasswordView.getText().toString();
        }
    }

    String newHost = mServerView.getText().toString();
    int newPort = Integer.parseInt(mPortView.getText().toString());
    ServerSettings server = new ServerSettings(Type.SMTP, newHost, newPort, securityType, authType, username, password, clientCertificateAlias);
    uri = TransportUris.createTransportUri(server);
    mAccount.deleteCertificate(newHost, newPort, CheckDirection.OUTGOING);
    mAccount.setTransportUri(uri);
    AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.OUTGOING);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:27,代码来源:AccountSetupOutgoing.java

示例4: onActivityResult

import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
        if (!mCheckedIncoming) {
            //We've successfully checked incoming.  Now check outgoing.
            mCheckedIncoming = true;
            AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.OUTGOING);
        } else {
            //We've successfully checked outgoing as well.
            mAccount.setDescription(mAccount.getEmail());
            mAccount.save(Preferences.getPreferences(this));
            K9.setServicesEnabled(this);
            AccountSetupNames.actionSetNames(this, mAccount);
            finish();
        }
    }
}
 
开发者ID:scoute-dich,项目名称:K9-MailClient,代码行数:18,代码来源:AccountSetupBasics.java

示例5: onNext

import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; //导入依赖的package包/类
protected void onNext() {
    ConnectionSecurity securityType = getSelectedSecurity();
    String uri;
    String username = null;
    String password = null;
    String clientCertificateAlias = null;
    AuthType authType = null;
    if (mRequireLoginView.isChecked()) {
        username = mUsernameView.getText().toString();

        authType = getSelectedAuthType();
        if (AuthType.EXTERNAL == authType) {
            clientCertificateAlias = mClientCertificateSpinner.getAlias();
        } else {
            password = mPasswordView.getText().toString();
        }
    }

    String newHost = mServerView.getText().toString();
    int newPort = Integer.parseInt(mPortView.getText().toString());
    ServerSettings server = new ServerSettings(Type.SMTP, newHost, newPort, securityType, authType, username, password, clientCertificateAlias);
    uri = Transport.createTransportUri(server);
    mAccount.deleteCertificate(newHost, newPort, CheckDirection.OUTGOING);
    mAccount.setTransportUri(uri);
    AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.OUTGOING);
}
 
开发者ID:scoute-dich,项目名称:K9-MailClient,代码行数:27,代码来源:AccountSetupOutgoing.java

示例6: deleteCertificate

import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; //导入依赖的package包/类
/**
 * Examine the existing settings for an account.  If the old host/port is different from the
 * new host/port, then try and delete any (possibly non-existent) certificate stored for the
 * old host/port.
 */
public void deleteCertificate(String newHost, int newPort,
        CheckDirection direction) {
    Uri uri;
    if (direction.equals(CheckDirection.INCOMING)) {
        uri = Uri.parse(getStoreUri());
    } else {
        uri = Uri.parse(getTransportUri());
    }
    String oldHost = uri.getHost();
    int oldPort = uri.getPort();
    if (oldPort == -1) {
        // This occurs when a new account is created
        return;
    }
    if (!newHost.equals(oldHost) || newPort != oldPort) {
        LocalKeyStore localKeyStore = LocalKeyStore.getInstance();
        localKeyStore.deleteCertificate(oldHost, oldPort);
    }
}
 
开发者ID:thialfihar,项目名称:k-9,代码行数:25,代码来源:Account.java

示例7: onNext

import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; //导入依赖的package包/类
protected void onNext() {
    ConnectionSecurity securityType = (ConnectionSecurity) mSecurityTypeView.getSelectedItem();
    String uri;
    String username = null;
    String password = null;
    AuthType authType = null;
    if (mRequireLoginView.isChecked()) {
        username = mUsernameView.getText().toString();
        password = mPasswordView.getText().toString();
        authType = (AuthType) mAuthTypeView.getSelectedItem();
    }

    String newHost = mServerView.getText().toString();
    int newPort = Integer.parseInt(mPortView.getText().toString());
    String type = SmtpTransport.TRANSPORT_TYPE;
    ServerSettings server = new ServerSettings(type, newHost, newPort, securityType, authType, username, password);
    uri = Transport.createTransportUri(server);
    mAccount.deleteCertificate(newHost, newPort, CheckDirection.OUTGOING);
    mAccount.setTransportUri(uri);
    AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.OUTGOING);
}
 
开发者ID:thialfihar,项目名称:k-9,代码行数:22,代码来源:AccountSetupOutgoing.java

示例8: addCertificate

import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; //导入依赖的package包/类
/**
 * Add a new certificate for the incoming or outgoing server to the local key store.
 */
public void addCertificate(CheckDirection direction, X509Certificate certificate) throws CertificateException {
    Uri uri;
    if (direction == CheckDirection.INCOMING) {
        uri = Uri.parse(getStoreUri());
    } else {
        uri = Uri.parse(getTransportUri());
    }
    LocalKeyStore localKeyStore = LocalKeyStore.getInstance();
    localKeyStore.addCertificate(uri.getHost(), uri.getPort(), certificate);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:14,代码来源:Account.java

示例9: clearCertificateErrorNotifications

import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; //导入依赖的package包/类
public void clearCertificateErrorNotifications(Context context,
        final Account account, CheckDirection direction) {
    final NotificationManager nm = (NotificationManager)
            context.getSystemService(Context.NOTIFICATION_SERVICE);

    if (direction.equals(CheckDirection.INCOMING)) {
        nm.cancel(null, K9.CERTIFICATE_EXCEPTION_NOTIFICATION_INCOMING + account.getAccountNumber());
    } else {
        nm.cancel(null, K9.CERTIFICATE_EXCEPTION_NOTIFICATION_OUTGOING + account.getAccountNumber());
    }
}
 
开发者ID:thialfihar,项目名称:k-9,代码行数:12,代码来源:MessagingController.java

示例10: addCertificate

import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; //导入依赖的package包/类
/**
 * Add a new certificate for the incoming or outgoing server to the local key store.
 */
public void addCertificate(CheckDirection direction,
        X509Certificate certificate) throws CertificateException {
    Uri uri;
    if (direction.equals(CheckDirection.INCOMING)) {
        uri = Uri.parse(getStoreUri());
    } else {
        uri = Uri.parse(getTransportUri());
    }
    LocalKeyStore localKeyStore = LocalKeyStore.getInstance();
    localKeyStore.addCertificate(uri.getHost(), uri.getPort(), certificate);
}
 
开发者ID:thialfihar,项目名称:k-9,代码行数:15,代码来源:Account.java

示例11: clearCertificateErrorNotifications

import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; //导入依赖的package包/类
public void clearCertificateErrorNotifications(Account account, CheckDirection direction) {
    boolean incoming = (direction == CheckDirection.INCOMING);
    notificationController.clearCertificateErrorNotifications(account, incoming);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:5,代码来源:MessagingController.java

示例12: onNext

import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; //导入依赖的package包/类
protected void onNext() {
    try {
        ConnectionSecurity connectionSecurity = getSelectedSecurity();

        String username = mUsernameView.getText().toString();
        String password = null;
        String clientCertificateAlias = null;

        AuthType authType = getSelectedAuthType();
        if (authType == AuthType.EXTERNAL) {
            clientCertificateAlias = mClientCertificateSpinner.getAlias();
        } else {
            password = mPasswordView.getText().toString();
        }
        String host = mServerView.getText().toString();
        int port = Integer.parseInt(mPortView.getText().toString());

        Map<String, String> extra = null;
        if (Type.IMAP == mStoreType) {
            extra = new HashMap<String, String>();
            extra.put(ImapStoreSettings.AUTODETECT_NAMESPACE_KEY,
                    Boolean.toString(mImapAutoDetectNamespaceView.isChecked()));
            extra.put(ImapStoreSettings.PATH_PREFIX_KEY,
                    mImapPathPrefixView.getText().toString());
        } else if (Type.WebDAV == mStoreType) {
            extra = new HashMap<String, String>();
            extra.put(WebDavStoreSettings.PATH_KEY,
                    mWebdavPathPrefixView.getText().toString());
            extra.put(WebDavStoreSettings.AUTH_PATH_KEY,
                    mWebdavAuthPathView.getText().toString());
            extra.put(WebDavStoreSettings.MAILBOX_PATH_KEY,
                    mWebdavMailboxPathView.getText().toString());
        } else if (Type.EWS == mStoreType) {
            extra = new HashMap<>();
            extra.put(EwsStoreSettings.EXCHANGE_VERSION_KEY, getSelectedExchangeVersion().name());
            extra.put(EwsStoreSettings.PATH_KEY, mExchangePathView.getText().toString());
        }

        mAccount.deleteCertificate(host, port, CheckDirection.INCOMING);
        ServerSettings settings = new ServerSettings(mStoreType, host, port,
                connectionSecurity, authType, username, password, clientCertificateAlias, extra);

        mAccount.setStoreUri(RemoteStore.createStoreUri(settings));

        mAccount.setCompression(NetworkType.MOBILE, mCompressionMobile.isChecked());
        mAccount.setCompression(NetworkType.WIFI, mCompressionWifi.isChecked());
        mAccount.setCompression(NetworkType.OTHER, mCompressionOther.isChecked());
        mAccount.setSubscribedFoldersOnly(mSubscribedFoldersOnly.isChecked());

        AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.INCOMING);
    } catch (Exception e) {
        failure(e);
    }

}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:56,代码来源:AccountSetupIncoming.java

示例13: finishAutoSetup

import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; //导入依赖的package包/类
private void finishAutoSetup() {
    String email = mEmailView.getText().toString();
    String password = mPasswordView.getText().toString();
    String[] emailParts = splitEmail(email);
    String user = emailParts[0];
    String domain = emailParts[1];
    try {
        String userEnc = UrlEncodingHelper.encodeUtf8(user);
        String passwordEnc = UrlEncodingHelper.encodeUtf8(password);

        String incomingUsername = mProvider.incomingUsernameTemplate;
        incomingUsername = incomingUsername.replaceAll("\\$email", email);
        incomingUsername = incomingUsername.replaceAll("\\$user", userEnc);
        incomingUsername = incomingUsername.replaceAll("\\$domain", domain);

        URI incomingUriTemplate = mProvider.incomingUriTemplate;
        URI incomingUri = new URI(incomingUriTemplate.getScheme(), incomingUsername + ":" + passwordEnc,
                incomingUriTemplate.getHost(), incomingUriTemplate.getPort(), null, null, null);

        String outgoingUsername = mProvider.outgoingUsernameTemplate;

        URI outgoingUriTemplate = mProvider.outgoingUriTemplate;


        URI outgoingUri;
        if (outgoingUsername != null) {
            outgoingUsername = outgoingUsername.replaceAll("\\$email", email);
            outgoingUsername = outgoingUsername.replaceAll("\\$user", userEnc);
            outgoingUsername = outgoingUsername.replaceAll("\\$domain", domain);
            outgoingUri = new URI(outgoingUriTemplate.getScheme(), outgoingUsername + ":"
                                  + passwordEnc, outgoingUriTemplate.getHost(), outgoingUriTemplate.getPort(), null,
                                  null, null);

        } else {
            outgoingUri = new URI(outgoingUriTemplate.getScheme(),
                                  null, outgoingUriTemplate.getHost(), outgoingUriTemplate.getPort(), null,
                                  null, null);


        }
        if (mAccount == null) {
            mAccount = Preferences.getPreferences(this).newAccount();
        }
        mAccount.setName(getOwnerName());
        mAccount.setEmail(email);
        mAccount.setStoreUri(incomingUri.toString());
        mAccount.setTransportUri(outgoingUri.toString());

        setupFolderNames(incomingUriTemplate.getHost().toLowerCase(Locale.US));

        ServerSettings incomingSettings = RemoteStore.decodeStoreUri(incomingUri.toString());
        mAccount.setDeletePolicy(AccountCreator.getDefaultDeletePolicy(incomingSettings.type));

        // Check incoming here.  Then check outgoing in onActivityResult()
        AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.INCOMING);
    } catch (URISyntaxException use) {
        /*
         * If there is some problem with the URI we give up and go on to
         * manual setup.
         */
        onManualSetup();
    }
}
 
开发者ID:scoute-dich,项目名称:K9-MailClient,代码行数:64,代码来源:AccountSetupBasics.java

示例14: onNext

import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; //导入依赖的package包/类
protected void onNext() {
    try {
        ConnectionSecurity connectionSecurity = getSelectedSecurity();

        String username = mUsernameView.getText().toString();
        String password = null;
        String clientCertificateAlias = null;

        AuthType authType = getSelectedAuthType();
        if (authType == AuthType.EXTERNAL) {
            clientCertificateAlias = mClientCertificateSpinner.getAlias();
        } else {
            password = mPasswordView.getText().toString();
        }
        String host = mServerView.getText().toString();
        int port = Integer.parseInt(mPortView.getText().toString());

        Map<String, String> extra = null;
        if (Type.IMAP == mStoreType) {
            extra = new HashMap<String, String>();
            extra.put(ImapStoreSettings.AUTODETECT_NAMESPACE_KEY,
                    Boolean.toString(mImapAutoDetectNamespaceView.isChecked()));
            extra.put(ImapStoreSettings.PATH_PREFIX_KEY,
                    mImapPathPrefixView.getText().toString());
        } else if (Type.WebDAV == mStoreType) {
            extra = new HashMap<String, String>();
            extra.put(WebDavStoreSettings.PATH_KEY,
                    mWebdavPathPrefixView.getText().toString());
            extra.put(WebDavStoreSettings.AUTH_PATH_KEY,
                    mWebdavAuthPathView.getText().toString());
            extra.put(WebDavStoreSettings.MAILBOX_PATH_KEY,
                    mWebdavMailboxPathView.getText().toString());
        }

        mAccount.deleteCertificate(host, port, CheckDirection.INCOMING);
        ServerSettings settings = new ServerSettings(mStoreType, host, port,
                connectionSecurity, authType, username, password, clientCertificateAlias, extra);

        mAccount.setStoreUri(RemoteStore.createStoreUri(settings));

        mAccount.setCompression(NetworkType.MOBILE, mCompressionMobile.isChecked());
        mAccount.setCompression(NetworkType.WIFI, mCompressionWifi.isChecked());
        mAccount.setCompression(NetworkType.OTHER, mCompressionOther.isChecked());
        mAccount.setSubscribedFoldersOnly(mSubscribedFoldersOnly.isChecked());

        AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.INCOMING);
    } catch (Exception e) {
        failure(e);
    }

}
 
开发者ID:scoute-dich,项目名称:K9-MailClient,代码行数:52,代码来源:AccountSetupIncoming.java

示例15: finishAutoSetup

import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; //导入依赖的package包/类
private void finishAutoSetup() {
    String email = mEmailView.getText().toString();
    String password = mPasswordView.getText().toString();
    String[] emailParts = splitEmail(email);
    String user = emailParts[0];
    String domain = emailParts[1];
    URI incomingUri = null;
    URI outgoingUri = null;
    try {
        String userEnc = URLEncoder.encode(user, "UTF-8");
        String passwordEnc = URLEncoder.encode(password, "UTF-8");

        String incomingUsername = mProvider.incomingUsernameTemplate;
        incomingUsername = incomingUsername.replaceAll("\\$email", email);
        incomingUsername = incomingUsername.replaceAll("\\$user", userEnc);
        incomingUsername = incomingUsername.replaceAll("\\$domain", domain);

        URI incomingUriTemplate = mProvider.incomingUriTemplate;
        incomingUri = new URI(incomingUriTemplate.getScheme(), incomingUsername + ":"
                              + passwordEnc, incomingUriTemplate.getHost(), incomingUriTemplate.getPort(), null,
                              null, null);

        String outgoingUsername = mProvider.outgoingUsernameTemplate;

        URI outgoingUriTemplate = mProvider.outgoingUriTemplate;


        if (outgoingUsername != null) {
            outgoingUsername = outgoingUsername.replaceAll("\\$email", email);
            outgoingUsername = outgoingUsername.replaceAll("\\$user", userEnc);
            outgoingUsername = outgoingUsername.replaceAll("\\$domain", domain);
            outgoingUri = new URI(outgoingUriTemplate.getScheme(), outgoingUsername + ":"
                                  + passwordEnc, outgoingUriTemplate.getHost(), outgoingUriTemplate.getPort(), null,
                                  null, null);

        } else {
            outgoingUri = new URI(outgoingUriTemplate.getScheme(),
                                  null, outgoingUriTemplate.getHost(), outgoingUriTemplate.getPort(), null,
                                  null, null);


        }
        if (mAccount == null) {
            mAccount = Preferences.getPreferences(this).newAccount();
        }
        mAccount.setName(getOwnerName());
        mAccount.setEmail(email);
        mAccount.setStoreUri(incomingUri.toString());
        mAccount.setTransportUri(outgoingUri.toString());
        mAccount.setDraftsFolderName(getString(R.string.special_mailbox_name_drafts));
        mAccount.setTrashFolderName(getString(R.string.special_mailbox_name_trash));
        mAccount.setArchiveFolderName(getString(R.string.special_mailbox_name_archive));
        // Yahoo! has a special folder for Spam, called "Bulk Mail".
        if (incomingUriTemplate.getHost().toLowerCase(Locale.US).endsWith(".yahoo.com")) {
            mAccount.setSpamFolderName("Bulk Mail");
        } else {
            mAccount.setSpamFolderName(getString(R.string.special_mailbox_name_spam));
        }
        mAccount.setSentFolderName(getString(R.string.special_mailbox_name_sent));
        if (incomingUri.toString().startsWith("imap")) {
            mAccount.setDeletePolicy(Account.DELETE_POLICY_ON_DELETE);
        } else if (incomingUri.toString().startsWith("pop3")) {
            mAccount.setDeletePolicy(Account.DELETE_POLICY_NEVER);
        }
        // Check incoming here.  Then check outgoing in onActivityResult()
        AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.INCOMING);
    } catch (UnsupportedEncodingException enc) {
        // This really shouldn't happen since the encoding is hardcoded to UTF-8
        Log.e(K9.LOG_TAG, "Couldn't urlencode username or password.", enc);
    } catch (URISyntaxException use) {
        /*
         * If there is some problem with the URI we give up and go on to
         * manual setup.
         */
        onManualSetup();
    }
}
 
开发者ID:thialfihar,项目名称:k-9,代码行数:78,代码来源:AccountSetupBasics.java


注:本文中的com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。