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


Java Token类代码示例

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


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

示例1: setToken

import com.alwaysallthetime.adnlib.data.Token; //导入依赖的package包/类
public static void setToken(Token token) {
    final SharedPreferences.Editor editor = sPrefs.edit();
    if(token != null) {
        editor.putString(TOKEN_OBJECT, gson.toJson(token));
    } else {
        editor.remove(TOKEN_OBJECT);
    }
    editor.commit();
}
 
开发者ID:rrbrambley,项目名称:MessageBeast-Android,代码行数:10,代码来源:ADNSharedPreferences.java

示例2: saveCredentials

import com.alwaysallthetime.adnlib.data.Token; //导入依赖的package包/类
public static void saveCredentials(String accessToken, Token token) {
    final SharedPreferences.Editor editor = sPrefs.edit();
    final String tokenJson = gson.toJson(token);
    editor.putString(TOKEN_OBJECT, tokenJson);
    editor.putString(ACCESS_TOKEN, accessToken);
    editor.commit();
}
 
开发者ID:rrbrambley,项目名称:MessageBeast-Android,代码行数:8,代码来源:ADNSharedPreferences.java

示例3: attemptLogin

import com.alwaysallthetime.adnlib.data.Token; //导入依赖的package包/类
/**
     * Attempts to sign in or register the account specified by the login form.
     * If there are form errors (invalid email, missing fields, etc.), the
     * errors are presented and no actual login attempt is made.
     */
    public void attemptLogin() {
        String clientID = AccessKeys.CLIENT_ID;
        String pwGrantSecret = AccessKeys.PASSWORD_GRANT_SECRET;
        AppDotNetClient client = new AppDotNetClient(clientID, pwGrantSecret);
        final LoginActivity closure = this;

        mUser = mUserView.getText().toString();
        mPassword = mPasswordView.getText().toString();
        showProgress(true); // Switch!

        client.authenticateWithPassword(mUser, mPassword, SCOPE, new LoginResponseHandler() {
                @Override
                public void onSuccess(String accessToken, Token token) {
                    // The access token has already been set on the client; you don't need to call setToken() here.
                    // This also happens on the main thread.

                    Log.d("onSuccess", "got token?");
                    Log.d("onSuccess", accessToken);
                    SettingsDAO dao = new SettingsDAO(closure);
                    dao.open();
//                    Settings settings = dao.getSettings();
                    Settings settings = new Settings();
                    settings.setClientID( accessToken );
                    dao.save( settings );
                    dao.close();
                    // the settings object should now have an id!
                    Log.d("Settings ID", settings.getColumnId().toString());
                    // Let's redirect to the main thing now.
                    Intent mainActivity = new Intent(getApplicationContext(), MainActivity.class);
                    // Could set some things up here to pass it forwards.
                    startActivity(mainActivity);
                    finish();
                }
//                @Override
//                public void onError() {
//                    Log.d("error!", "error");
//                }
            });


    }
 
开发者ID:aurynn,项目名称:fantail,代码行数:47,代码来源:LoginActivity.java

示例4: getToken

import com.alwaysallthetime.adnlib.data.Token; //导入依赖的package包/类
public static Token getToken() {
    final String tokenJson = sPrefs.getString(TOKEN_OBJECT, null);
    return gson.fromJson(tokenJson, Token.class);
}
 
开发者ID:rrbrambley,项目名称:MessageBeast-Android,代码行数:5,代码来源:ADNSharedPreferences.java

示例5: TokenResponseHandler

import com.alwaysallthetime.adnlib.data.Token; //导入依赖的package包/类
protected TokenResponseHandler() {
    super(new TypeToken<ResponseEnvelope<Token>>(){});
}
 
开发者ID:alwaysallthetime,项目名称:ADNLib,代码行数:4,代码来源:TokenResponseHandler.java

示例6: onSuccess

import com.alwaysallthetime.adnlib.data.Token; //导入依赖的package包/类
public abstract void onSuccess(String accessToken, Token token); 
开发者ID:alwaysallthetime,项目名称:ADNLib,代码行数:2,代码来源:LoginResponseHandler.java


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