本文整理汇总了Java中com.weibo.sdk.android.sso.SsoHandler类的典型用法代码示例。如果您正苦于以下问题:Java SsoHandler类的具体用法?Java SsoHandler怎么用?Java SsoHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SsoHandler类属于com.weibo.sdk.android.sso包,在下文中一共展示了SsoHandler类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleMessage
import com.weibo.sdk.android.sso.SsoHandler; //导入依赖的package包/类
public void handleMessage(final Message msg) {
Log.d("emop", "message id:" + msg.what +", msg:" + msg.obj);
String message = null;
if(msg.obj != null){
message = msg.obj.toString();
if(message != null){
Toast.makeText(SettingActivity.this, message, Toast.LENGTH_LONG).show();
}
}
if(msg.what == GetSinaUserInfoTask.LOGIN_DONE){
loading.dismiss();
showSinaInfo();
}else if(msg.what == SsoHandler.START_WEB_LOGIN || msg.what == SsoHandler.SSO_LOGIN_ERROR){
loading.dismiss();
}
}
示例2: onClick
import com.weibo.sdk.android.sso.SsoHandler; //导入依赖的package包/类
@Override
public void onClick(View v) {
int id = v.getId();
switch(id) {
case R.id.weibo_login: {
mSsoHandler = new SsoHandler(this, mWeibo);
mSsoHandler.authorize(new AuthDialogListener(),null);
break;
}
default: {
KLog.w(TAG, "Unknow id onClick : %d", id);
break;
}
}
}
示例3: onResume
import com.weibo.sdk.android.sso.SsoHandler; //导入依赖的package包/类
public void onResume(){
super.onResume();
if(loginTimes < 3 && weibo.getAccessToken() == null && !loading.isShowing()){
loginTimes++;
sinaSSO = new SsoHandler(this, sinaHandler);
loading.show();
sinaSSO.authorize();
}
}
示例4: handleMessage
import com.weibo.sdk.android.sso.SsoHandler; //导入依赖的package包/类
public void handleMessage(final Message msg) {
Log.d("emop", "message id:" + msg.what +", msg:" + msg.obj);
String message = null;
if(msg.obj != null){
message = msg.obj.toString();
if(message != null){
Toast.makeText(ShareToWeiboActivity.this, message, Toast.LENGTH_LONG).show();
}
}
if(msg.what == GetSinaUserInfoTask.LOGIN_DONE){
loading.dismiss();
}else if(msg.what == SsoHandler.START_WEB_LOGIN || msg.what == SsoHandler.SSO_LOGIN_ERROR){
loading.dismiss();
}
}
示例5: doLoginFromSina
import com.weibo.sdk.android.sso.SsoHandler; //导入依赖的package包/类
public void doLoginFromSina(View v){
Log.d("tag", "doLoginFrom sina");
if(this.isLoginSina){
logoutRef(Constants.AUTH_REF_SINA);
Weibo.getInstance().setAccessToken(null);
}else {
sinaSSO = new SsoHandler(this, sinaHandler);
loading.show();
sinaSSO.authorize();
}
}
示例6: doLoginFromSina
import com.weibo.sdk.android.sso.SsoHandler; //导入依赖的package包/类
public void doLoginFromSina(View v){
Log.d("tag", "doLoginFromsina");
/*
Intent intent = new Intent();
intent.setClass(this, WebLoginActivity.class);
startActivity(intent);
*/
sinaSSO = new SsoHandler(this, handler);
loading.show();
sinaSSO.authorize();
}
示例7: handleMessage
import com.weibo.sdk.android.sso.SsoHandler; //导入依赖的package包/类
public void handleMessage(final Message msg) {
String message = null;
if(msg.obj != null){
message = msg.obj.toString();
if(message != null){
Toast.makeText(LoginActivity.this, message, Toast.LENGTH_LONG).show();
}
}
if(msg.what == GetSinaUserInfoTask.LOGIN_DONE){
finish();
}else if(msg.what == SsoHandler.START_WEB_LOGIN || msg.what == SsoHandler.SSO_LOGIN_ERROR){
loading.dismiss();
}
}
示例8: onCreate
import com.weibo.sdk.android.sso.SsoHandler; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.timeline_activity);
shared = this.getSharedPreferences("user_info", 0);
editor = shared.edit();
mWeibo = Weibo.getInstance(AppConst.SINA_KEY,
"http://open.weibo.com/apps/" + AppConst.SINA_KEY
+ "/info/advanced", SCOPE);
IWeiboAPI weiboAPI = WeiboSDK.createWeiboAPI(this, AppConst.SINA_KEY);
mSsoHandler = new SsoHandler(this, mWeibo);
String pkName = this.getPackageName();
mSsoHandler.authorize(new AuthDialogListener(), pkName);
dataModel = new TimelineModel(this);
dataModel.addResponseListener(this);
feedListView = (XListView) findViewById(R.id.feed_list);
feedListView.setPullLoadEnable(true);
feedListView.setRefreshTime();
feedListView.setXListViewListener(this, 1);
listAdapter = new TimelineAdapter(this, dataModel.searchResult);
feedListView.setAdapter(listAdapter);
Drawable drawable = ResourcesFactory.getDrawable(getResources(),
R.drawable.splash_background);
ImageView header = (ImageView) findViewById(R.id.listImage);
header.setImageDrawable(drawable);
header.setBackgroundColor(Color.RED);
}
示例9: auth
import com.weibo.sdk.android.sso.SsoHandler; //导入依赖的package包/类
/**
* @param activity
* @param handler
* @return
*/
public SsoHandler auth(final Activity activity, final ReqHandler handler) {
SsoHandler ssoHandler = new SsoHandler(activity, weibo);
ssoHandler.authorize(new WeiboAuthListener() {
@Override
public void onComplete(Bundle data) {
AccessTokenKeeper.clear(activity);
Oauth2AccessToken token = new Oauth2AccessToken(data.getString("access_token"),
data.getString("expires_in"));
AccessTokenKeeper.keepAccessToken(activity, token);
handler.onSucceed();
}
@Override
public void onCancel() {
handler.onFail(activity.getString(R.string.weibo_auth_cancel));
}
@Override
public void onError(WeiboDialogError error) {
handler.onFail(error.getMessage());
}
@Override
public void onWeiboException(WeiboException exception) {
handler.onFail(exception.getMessage());
}
});
return ssoHandler;
}
示例10: getSsoHandler
import com.weibo.sdk.android.sso.SsoHandler; //导入依赖的package包/类
public SsoHandler getSsoHandler() {
return mSsoHandler;
}
示例11: initSsoHandler
import com.weibo.sdk.android.sso.SsoHandler; //导入依赖的package包/类
private void initSsoHandler(Activity context){
mSsoHandler = new SsoHandler(context, weibo);
}
示例12: onActivityResult
import com.weibo.sdk.android.sso.SsoHandler; //导入依赖的package包/类
/**
* @param handler
* @param requestCode
* @param resultCode
* @param data
*/
public void onActivityResult(SsoHandler handler, int requestCode, int resultCode, Intent data) {
if (handler != null) {
handler.authorizeCallBack(requestCode, resultCode, data);
}
}