Java Code Examples for com.nextgis.maplib.api.IGISApplication#getAccount()

The following examples show how to use com.nextgis.maplib.api.IGISApplication#getAccount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AccountUtil.java    From android_maplib with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static AccountData getAccountData(Context context, String accountName) throws IllegalStateException {
    IGISApplication app = (IGISApplication) context.getApplicationContext();
    Account account = app.getAccount(accountName);

    if (null == account) {
        throw new IllegalStateException("Account is null");
    }

    AccountData accountData = new AccountData();

    accountData.url = app.getAccountUrl(account);
    accountData.login = app.getAccountLogin(account);
    accountData.password = app.getAccountPassword(account);

    return accountData;
}
 
Example 2
Source File: NGWLoginFragment.java    From android_maplibui with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void onTokenReceived(
        String accountName,
        String token)
{
    IGISApplication app = (IGISApplication) getActivity().getApplication();
    String login = mLoginText;
    String password = mPasswordText;
    if (token.equals(Constants.NGW_ACCOUNT_GUEST)) {
        login = Constants.NGW_ACCOUNT_GUEST;
        password = null;
    }

    if (mForNewAccount) {
        boolean accountAdded = app.addAccount(accountName, mUrlText.toLowerCase(), login, password, token);

        if (null != mOnAddAccountListener) {
            Account account = null;
            if (accountAdded)
                account = app.getAccount(accountName);

            mOnAddAccountListener.onAddAccount(account, token, accountAdded);
        }
    } else {
        if (mChangeAccountUrl)
            app.setUserData(accountName, "url", mUrlText.toLowerCase());

        if (mChangeAccountLogin)
            app.setUserData(accountName, "login", login);

        app.setPassword(accountName, password);
        NGWSettingsFragment.updateAccountLayersCacheData(app, app.getAccount(accountName));

        getActivity().finish();
    }
}
 
Example 3
Source File: NGWLookupTable.java    From android_maplib with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void setAccountCacheData()
{
    IGISApplication app = (IGISApplication) mContext.getApplicationContext();
    Account account = app.getAccount(mAccountName);

    if (null != account) {
        mCacheUrl = app.getAccountUrl(account);
        mCacheLogin = app.getAccountLogin(account);
        mCachePassword = app.getAccountPassword(account);
    }
}
 
Example 4
Source File: NGWRasterLayer.java    From android_maplib with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void setAccountCacheData() {
    IGISApplication app = (IGISApplication) mContext.getApplicationContext();
    Account account = app.getAccount(mAccountName);

    if (null != account) {
        mCacheLogin = app.getAccountLogin(account);
        mCachePassword = app.getAccountPassword(account);
        if (Constants.DEBUG_MODE)
            Log.d(Constants.TAG, "Get account. User: " + mCacheLogin);
    } else if (Constants.DEBUG_MODE) {
        Log.d(Constants.TAG, "Failed to get account for name: " + mAccountName);
    }
}