Esempio n. 1
0
        @Override
        public void onComplete(SHARE_MEDIA platform, int action, Map<String, String> data) {
          Toast.makeText(getApplicationContext(), "授权成功", Toast.LENGTH_SHORT).show();
          mShareAPI.getPlatformInfo(
              LoginActivity.this,
              SHARE_MEDIA.WEIXIN,
              new UMAuthListener() {
                @Override
                public void onComplete(SHARE_MEDIA share_media, int i, Map<String, String> map) {
                  if (map != null) {
                    String openid = map.get("openid").toString();
                    String nickname = map.get("nickname").toString();
                    String headimgurl = map.get("headimgurl").toString();
                    WXloading(openid, nickname, headimgurl);
                  } else {
                    Toast.makeText(getApplicationContext(), "没有授权", Toast.LENGTH_SHORT).show();
                  }
                }

                @Override
                public void onError(SHARE_MEDIA share_media, int i, Throwable throwable) {}

                @Override
                public void onCancel(SHARE_MEDIA share_media, int i) {}
              });
        }
Esempio n. 2
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentViewWithActionBar(R.layout.activity_login, "登录 | 注册");
   // setContentView(R.layout.activity_login);
   mShareAPI = UMShareAPI.get(this); // 初始化友盟分享
   initView();
   // 删除授权接口
   // mShareAPI.deleteOauth(AuthActivity.this, platform, umdelAuthListener);
 }
Esempio n. 3
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.bt_login:
       // 登陆请求.
       confirmLogin();
       //                    lOGON();
       if (i == 0) {
         i++;
         llCode.setVisibility(View.VISIBLE);
       } else {
         i = 0;
         llCode.setVisibility(View.GONE);
       }
       break;
     case R.id.imageView_weixin:
       // 授权微信
       mShareAPI.doOauthVerify(LoginActivity.this, SHARE_MEDIA.WEIXIN, umAuthListeners);
       //                    mShareAPI.getPlatformInfo(LoginActivity.this,
       // SHARE_MEDIA.WEIXIN,
       //                            umAuthListener);
       break;
     case R.id.imageView_qq:
       // 授权腾讯
       mShareAPI.doOauthVerify(LoginActivity.this, SHARE_MEDIA.QQ, umAuthListener);
       break;
     case R.id.imageView_weibo:
       // 授权微博
       mShareAPI.doOauthVerify(LoginActivity.this, SHARE_MEDIA.SINA, umAuthListener);
       break;
     case R.id.login_but:
       //                    new AsnyckLogin().execute();
       mShareAPI.getPlatformInfo(LoginActivity.this, SHARE_MEDIA.WEIXIN, umAuthListener);
       break;
     case R.id.login_but1:
       //                    lOGON();
       break;
     default:
       break;
   }
 }
Esempio n. 4
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   mShareAPI.onActivityResult(requestCode, resultCode, data); // 分享需要
 }