com.tencent.connect.common.Constants Java Examples

The following examples show how to use com.tencent.connect.common.Constants. 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: ImageActivity.java    From letv with Apache License 2.0 6 votes vote down vote up
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    requestWindowFeature(1);
    setRequestedOrientation(1);
    setContentView(a());
    this.d = new Handler();
    Bundle bundleExtra = getIntent().getBundleExtra(Constants.KEY_PARAMS);
    this.r = bundleExtra.getString(SocialConstants.PARAM_AVATAR_URI);
    this.c = bundleExtra.getString("return_activity");
    String string = bundleExtra.getString("appid");
    String string2 = bundleExtra.getString("access_token");
    long j = bundleExtra.getLong("expires_in");
    String string3 = bundleExtra.getString("openid");
    this.n = bundleExtra.getInt("exitAnim");
    this.b = new QQToken(string);
    this.b.setAccessToken(string2, ((j - System.currentTimeMillis()) / 1000) + "");
    this.b.setOpenId(string3);
    b();
    e();
    this.m = System.currentTimeMillis();
    a("10653", 0);
}
 
Example #2
Source File: LoginActivity.java    From QiQuYing with Apache License 2.0 6 votes vote down vote up
public void initOpenidAndToken(JSONObject jsonObject) {
    try {
        String token = jsonObject.getString(Constants.PARAM_ACCESS_TOKEN);
        String expires = jsonObject.getString(Constants.PARAM_EXPIRES_IN);
        mOpenId = jsonObject.getString(Constants.PARAM_OPEN_ID);
        if (!TextUtils.isEmpty(token) && !TextUtils.isEmpty(expires)
                && !TextUtils.isEmpty(mOpenId)) {
            mTencent.setAccessToken(token, expires);
            mTencent.setOpenId(mOpenId);
            App.mTencent = mTencent;
            //存储OpenidAndToken值
            spUtil.putString(Constants.PARAM_OPEN_ID, mOpenId);
            spUtil.putString(Constants.PARAM_ACCESS_TOKEN, token);
            spUtil.putLong(Constants.PARAM_EXPIRES_IN, System.currentTimeMillis() + Long.parseLong(expires) * 1000);
        }
    } catch(Exception e) {
    	Log.e(TAG, "initOpenidAndToken exception", e);
    }
}
 
Example #3
Source File: CoinDetailsActivity.java    From PocketEOS-Android with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        hideProgress();
//        Tencent.onActivityResultData(requestCode, resultCode, data, new BaseUIListener(CoinDetailsActivity.this, true));
        if (requestCode == Constants.REQUEST_QQ_SHARE || requestCode == Constants.REQUEST_QZONE_SHARE || requestCode == Constants.REQUEST_OLD_SHARE) {
            Tencent.handleResultData(data, new BaseUIListener(CoinDetailsActivity.this, true));
        }
        if (requestCode == 100 && resultCode == 300) {
            if (data.getExtras().getString("coin_type").equals(accountWithCoinBean.getCoinName())) {
                mDataBeanList.clear();
                page = 0;
                mPostChainHistoryBean.setPage(page);
                presenter.getTransferHistoryData(mPostChainHistoryBean);
                BigDecimal oldcoinforcny = new BigDecimal(accountWithCoinBean.getCoinForCny());
                BigDecimal oldcoin = new BigDecimal(accountWithCoinBean.getCoinNumber());
                BigDecimal minuscny = new BigDecimal(data.getExtras().getString("coin_cny"));
                BigDecimal minuscoin = new BigDecimal(data.getExtras().getString("coin_number"));
                mIconTotalNumber.setText(StringUtils.addComma(BigDecimalUtil.minus(oldcoinforcny, minuscny, 4) + "") + " CNY");
                mIconNumber.setText(StringUtils.addComma(BigDecimalUtil.minus(oldcoin, minuscoin, 4) + "") + " " + accountWithCoinBean.getCoinName());
                mIconRmbNumber.setText("≈" + StringUtils.addComma(BigDecimalUtil.minus(oldcoinforcny, minuscny, 4) + "") + " CNY");
            }
        }
    }
 
Example #4
Source File: BlackBoxCoinDetailsActivity.java    From PocketEOS-Android with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    hideProgress();
    if (requestCode == Constants.REQUEST_QQ_SHARE || requestCode == Constants.REQUEST_QZONE_SHARE || requestCode == Constants.REQUEST_OLD_SHARE) {
        Tencent.handleResultData(data, new BaseUIListener(BlackBoxCoinDetailsActivity.this, true));
    }
    if (requestCode == 100 && resultCode == 300) {
        if (data.getExtras().getString("coin_type").equals(accountWithCoinBean.getCoinName())) {
            mDataBeanList.clear();
            page = 0;
            mPostChainHistoryBean.setPage(0);
            presenter.getTransferHistoryData(mPostChainHistoryBean);
        }
    }
}
 
Example #5
Source File: QQHelper.java    From android-common-utils with Apache License 2.0 6 votes vote down vote up
public void onActivityResultByShare(Activity activity,int requestCode, int resultCode, Intent data){
    Tencent.onActivityResultData(requestCode, resultCode, data, mShareListener);
    if (requestCode == Constants.REQUEST_QQ_SHARE) {
        if (resultCode == Constants.ACTIVITY_OK) {
            Tencent.handleResultData(data, mShareListener);
        }
    }else{
        String path = null;
        if (resultCode == Activity.RESULT_OK && requestCode == 0) {
            if (data != null && data.getData() != null) {
                // 根据返回的URI获取对应的SQLite信息
                Uri uri = data.getData();
                path = QQUtil.getPath(activity, uri);
            }
        }
        Log.d(TAG," user selected path =  " + path );
        //path may be null;
    }
}
 
Example #6
Source File: LoginActivity.java    From Social with Apache License 2.0 6 votes vote down vote up
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == Constants.REQUEST_LOGIN ||
            requestCode == Constants.REQUEST_APPBAR) {
        Tencent.onActivityResultData(requestCode, resultCode, data, loginListener);
    }
    if (requestCode==REQUEST_CODE_SET_ACCOUNT && resultCode==RESULT_OK){
        //登录
        loginWithQQopenid();
    }

    if (requestCode == REQUEST_CODE_REGIST && resultCode ==RESULT_OK){
        SocialMainActivity.startSelf(this);
        finish();
    }

    super.onActivityResult(requestCode, resultCode, data);
}
 
Example #7
Source File: QQShare.java    From letv with Apache License 2.0 6 votes vote down vote up
private StringBuffer a(StringBuffer stringBuffer, Bundle bundle) {
    f.c(f.d, "fillShareToQQParams() --start");
    String str = "...";
    bundle.putString("action", SystemUtils.QQ_SHARE_CALLBACK_ACTION);
    bundle.putString("appId", this.mToken.getAppId());
    bundle.putString("sdkp", "a");
    bundle.putString("sdkv", Constants.SDK_VERSION);
    bundle.putString("status_os", VERSION.RELEASE);
    bundle.putString("status_machine", Build.MODEL);
    String str2 = WidgetRequestParam.REQ_PARAM_COMMENT_CONTENT;
    if (bundle.containsKey(str2) && bundle.getString(str2).length() > 40) {
        bundle.putString(str2, bundle.getString(str2).substring(0, 40) + str);
    }
    str2 = "summary";
    if (bundle.containsKey(str2) && bundle.getString(str2).length() > 80) {
        bundle.putString(str2, bundle.getString(str2).substring(0, 80) + str);
    }
    stringBuffer.append("&" + Util.encodeUrl(bundle).replaceAll("\\+", "%20"));
    f.c(f.d, "fillShareToQQParams() --end");
    return stringBuffer;
}
 
Example #8
Source File: FileManager.java    From letv with Apache License 2.0 6 votes vote down vote up
public void onComplete(Object obj) {
    JSONObject jSONObject = (JSONObject) obj;
    try {
        List arrayList = new ArrayList();
        JSONObject jSONObject2 = jSONObject.getJSONObject(ShareRequestParam.RESP_UPLOAD_PIC_PARAM_DATA);
        if (!jSONObject2.isNull(WidgetRequestParam.REQ_PARAM_COMMENT_CONTENT)) {
            JSONArray jSONArray = jSONObject2.getJSONArray(WidgetRequestParam.REQ_PARAM_COMMENT_CONTENT);
            for (int i = 0; i < jSONArray.length(); i++) {
                JSONObject jSONObject3 = jSONArray.getJSONObject(i);
                arrayList.add(new WeiyunFile(jSONObject3.getString("file_id"), jSONObject3.getString("file_name"), jSONObject3.getString("file_ctime"), (long) jSONObject3.getInt("file_size")));
            }
        }
        this.mListener.onComplete(arrayList);
    } catch (JSONException e) {
        this.mListener.onError(new UiError(-4, Constants.MSG_JSON_ERROR, jSONObject.toString()));
    }
}
 
Example #9
Source File: QQHelper.java    From android-common-utils with Apache License 2.0 6 votes vote down vote up
/** return is success */
private boolean  initOpenIdAndToken(JSONObject jsonResponse) {
    try {
        String token = jsonResponse.getString(Constants.PARAM_ACCESS_TOKEN);
        String expires = jsonResponse.getString(Constants.PARAM_EXPIRES_IN);
        String openId = jsonResponse.getString(Constants.PARAM_OPEN_ID);
        if (!TextUtils.isEmpty(token) && !TextUtils.isEmpty(expires)
                && !TextUtils.isEmpty(openId)) {
            mTencent.setAccessToken(token, expires);
            mTencent.setOpenId(openId);
            return true;
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    return false;
}
 
Example #10
Source File: QQAvatar.java    From letv with Apache License 2.0 6 votes vote down vote up
public void setAvatar(Activity activity, Uri uri, IUiListener iUiListener, int i) {
    if (this.a != null) {
        this.a.onCancel();
    }
    this.a = iUiListener;
    Bundle bundle = new Bundle();
    bundle.putString(SocialConstants.PARAM_AVATAR_URI, uri.toString());
    bundle.putInt("exitAnim", i);
    bundle.putString("appid", this.mToken.getAppId());
    bundle.putString("access_token", this.mToken.getAccessToken());
    bundle.putLong("expires_in", this.mToken.getExpireTimeInSecond());
    bundle.putString("openid", this.mToken.getOpenId());
    this.mActivityIntent = a(activity);
    if (hasActivityForIntent()) {
        a(activity, bundle);
        d.a().a(this.mToken.getOpenId(), this.mToken.getAppId(), Constants.VIA_SET_AVATAR, "12", "18", "0");
        return;
    }
    d.a().a(this.mToken.getOpenId(), this.mToken.getAppId(), Constants.VIA_SET_AVATAR, "12", "18", "1");
}
 
Example #11
Source File: SocialApiIml.java    From letv with Apache License 2.0 6 votes vote down vote up
protected Intent getTargetActivityIntent(String str) {
    Intent intent = new Intent();
    intent.setClassName(Constants.PACKAGE_QZONE, str);
    Intent intent2 = new Intent();
    intent2.setClassName("com.tencent.mobileqq", str);
    if (SystemUtils.isActivityExist(Global.getContext(), intent2) && SystemUtils.compareQQVersion(Global.getContext(), "4.7") >= 0) {
        return intent2;
    }
    if (!SystemUtils.isActivityExist(Global.getContext(), intent) || SystemUtils.compareVersion(SystemUtils.getAppVersionName(Global.getContext(), Constants.PACKAGE_QZONE), "4.2") < 0) {
        return null;
    }
    if (SystemUtils.isAppSignatureValid(Global.getContext(), intent.getComponent().getPackageName(), Constants.SIGNATRUE_QZONE)) {
        return intent;
    }
    return null;
}
 
Example #12
Source File: QQAvatar.java    From letv with Apache License 2.0 6 votes vote down vote up
private void a(Bundle bundle) {
    if (this.mToken != null) {
        bundle.putString("appid", this.mToken.getAppId());
        if (this.mToken.isSessionValid()) {
            bundle.putString(Constants.PARAM_KEY_STR, this.mToken.getAccessToken());
            bundle.putString(Constants.PARAM_KEY_TYPE, "0x80");
        }
        String openId = this.mToken.getOpenId();
        if (openId != null) {
            bundle.putString("hopenid", openId);
        }
        bundle.putString(Constants.PARAM_PLATFORM, "androidqz");
        try {
            bundle.putString(Constants.PARAM_PLATFORM_ID, Global.getContext().getSharedPreferences(Constants.PREFERENCE_PF, 0).getString(Constants.PARAM_PLATFORM_ID, Constants.DEFAULT_PF));
        } catch (Exception e) {
            e.printStackTrace();
            bundle.putString(Constants.PARAM_PLATFORM_ID, Constants.DEFAULT_PF);
        }
    }
    bundle.putString("sdkv", Constants.SDK_VERSION);
    bundle.putString("sdkp", "a");
}
 
Example #13
Source File: QQAvatar.java    From letv with Apache License 2.0 6 votes vote down vote up
public void onActivityResult(Activity activity, int i, int i2, Intent intent) {
    if (i2 == -1) {
        int intExtra = intent.getIntExtra(Constants.KEY_ERROR_CODE, 0);
        if (intExtra == 0) {
            String stringExtra = intent.getStringExtra(Constants.KEY_RESPONSE);
            if (stringExtra != null) {
                try {
                    this.a.onComplete(Util.parseJson(stringExtra));
                    return;
                } catch (JSONException e) {
                    this.a.onError(new UiError(-4, Constants.MSG_JSON_ERROR, stringExtra));
                    return;
                }
            }
            this.a.onComplete(new JSONObject());
            return;
        }
        this.a.onError(new UiError(intExtra, intent.getStringExtra(Constants.KEY_ERROR_MSG), intent.getStringExtra(Constants.KEY_ERROR_DETAIL)));
        return;
    }
    this.a.onCancel();
}
 
Example #14
Source File: SocialApiIml.java    From letv with Apache License 2.0 6 votes vote down vote up
private void a(Activity activity, String str, Bundle bundle, String str2, IUiListener iUiListener) {
    f.b(f.d, "-->handleIntentWithH5 " + str + " params=" + bundle);
    Intent targetActivityIntent = getTargetActivityIntent("com.tencent.open.agent.AgentActivity");
    Object cVar = new c(this, activity, iUiListener, str, str2, bundle);
    Intent targetActivityIntent2 = getTargetActivityIntent("com.tencent.open.agent.EncryTokenActivity");
    if (targetActivityIntent2 == null || targetActivityIntent == null || targetActivityIntent.getComponent() == null || targetActivityIntent2.getComponent() == null || !targetActivityIntent.getComponent().getPackageName().equals(targetActivityIntent2.getComponent().getPackageName())) {
        String encrypt = Util.encrypt("tencent&sdk&qazxc***14969%%" + this.mToken.getAccessToken() + this.mToken.getAppId() + this.mToken.getOpenId() + "qzone3.4");
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put(SocialConstants.PARAM_ENCRY_EOKEN, encrypt);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        cVar.onComplete(jSONObject);
        return;
    }
    targetActivityIntent2.putExtra("oauth_consumer_key", this.mToken.getAppId());
    targetActivityIntent2.putExtra("openid", this.mToken.getOpenId());
    targetActivityIntent2.putExtra("access_token", this.mToken.getAccessToken());
    targetActivityIntent2.putExtra(Constants.KEY_ACTION, SocialConstants.ACTION_CHECK_TOKEN);
    this.mActivityIntent = targetActivityIntent2;
    if (hasActivityForIntent()) {
        startAssitActivity(activity, (IUiListener) cVar);
    }
}
 
Example #15
Source File: Util.java    From letv with Apache License 2.0 6 votes vote down vote up
public static void reportBernoulli(final Context context, String str, long j, String str2) {
    final Bundle bundle = new Bundle();
    bundle.putString("appid_for_getting_config", str2);
    bundle.putString("strValue", str2);
    bundle.putString("nValue", str);
    bundle.putString("qver", Constants.SDK_VERSION);
    if (j != 0) {
        bundle.putLong("elt", j);
    }
    new Thread() {
        public void run() {
            try {
                HttpUtils.openUrl2(context, "http://cgi.qplus.com/report/report", "GET", bundle);
            } catch (Exception e) {
                f.e(Util.a, "reportBernoulli has exception: " + e.getMessage());
            }
        }
    }.start();
}
 
Example #16
Source File: Util.java    From letv with Apache License 2.0 6 votes vote down vote up
public static Bundle composeHaboCgiReportParams(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9) {
    Bundle bundle = new Bundle();
    bundle.putString(Constants.PARAM_PLATFORM, "1");
    bundle.putString("result", str);
    bundle.putString("code", str2);
    bundle.putString("tmcost", str3);
    bundle.putString("rate", str4);
    bundle.putString("cmd", str5);
    bundle.putString("uin", str6);
    bundle.putString("appid", str7);
    bundle.putString("share_type", str8);
    bundle.putString("detail", str9);
    bundle.putString("os_ver", VERSION.RELEASE);
    bundle.putString("network", a.a(Global.getContext()));
    bundle.putString("apn", a.b(Global.getContext()));
    bundle.putString("model_name", Build.MODEL);
    bundle.putString("sdk_ver", Constants.SDK_VERSION);
    bundle.putString(ShareRequestParam.REQ_PARAM_PACKAGENAME, Global.getPackageName());
    bundle.putString("app_ver", getAppVersionName(Global.getContext(), Global.getPackageName()));
    return bundle;
}
 
Example #17
Source File: AppbarAgent.java    From letv with Apache License 2.0 6 votes vote down vote up
private void a(Activity activity, String str) {
    if (this.mToken != null) {
        Intent intent = new Intent(activity, AppbarActivity.class);
        intent.putExtra("appid", this.mToken.getAppId());
        if (!(this.mToken.getAccessToken() == null || this.mToken.getOpenId() == null)) {
            a aVar = new a();
            aVar.b = this.mToken.getAccessToken();
            aVar.c = Long.parseLong(this.mToken.getAppId());
            aVar.a = this.mToken.getOpenId();
            a.a(activity, str, this.mToken.getOpenId(), this.mToken.getAccessToken(), this.mToken.getAppId());
        }
        intent.putExtra("url", str);
        f.b("AppbarAgent", "-->(AppbarAgent)startAppbar H5 : url = " + str);
        try {
            activity.startActivityForResult(intent, Constants.REQUEST_APPBAR);
        } catch (Exception e) {
            f.b("AppbarAgent", "-->(AppbarAgent)startAppbar : activity not found, start H5");
        }
    }
}
 
Example #18
Source File: AppbarAgent.java    From letv with Apache License 2.0 6 votes vote down vote up
public void startAppbar(Activity activity, String str) {
    if (a(str)) {
        String c = c(str);
        Object b = b();
        if (TextUtils.isEmpty(b) || SystemUtils.compareVersion(b, "4.2") < 0) {
            a(activity, c);
            return;
        }
        String str2 = c + a();
        f.b("AppbarAgent", "-->(AppbarAgent)startAppbar : yybUrl = " + str2);
        try {
            Intent intent = new Intent();
            intent.setClassName("com.tencent.android.qqdownloader", "com.tencent.assistant.activity.ExportBrowserActivity");
            intent.putExtra("com.tencent.assistant.BROWSER_URL", str2);
            activity.startActivity(intent);
            activity.overridePendingTransition(17432576, 17432577);
            return;
        } catch (Exception e) {
            f.b("AppbarAgent", "-->(AppbarAgent)startAppbar : ExportBrowserActivity not found, start H5");
            a(activity, c);
            return;
        }
    }
    Toast.makeText(activity, Constants.MSG_PARAM_ERROR, 0).show();
}
 
Example #19
Source File: LoginActivity.java    From MyHearts with Apache License 2.0 5 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.d("ruolan", "-->onActivityResult " + requestCode + " resultCode=" + resultCode);
    if (requestCode == Constants.REQUEST_LOGIN ||
            requestCode == Constants.REQUEST_APPBAR) {
        Tencent.onActivityResultData(requestCode, resultCode, data, loginListener);
    }

    super.onActivityResult(requestCode, resultCode, data);
}
 
Example #20
Source File: QQAuthManager.java    From sharesdk with Apache License 2.0 5 votes vote down vote up
private void initOpenidAndToken(JSONObject jsonObject) {
    try {
        String token = jsonObject.getString(Constants.PARAM_ACCESS_TOKEN);
        String expires = jsonObject.getString(Constants.PARAM_EXPIRES_IN);
        String openId = jsonObject.getString(Constants.PARAM_OPEN_ID);
        if (!TextUtils.isEmpty(token) && !TextUtils.isEmpty(expires)
                && !TextUtils.isEmpty(openId)) {
            mTencent.setAccessToken(token, expires);
            mTencent.setOpenId(openId);
        }
    } catch (Exception e) {
    }
}
 
Example #21
Source File: SocialApiIml.java    From letv with Apache License 2.0 5 votes vote down vote up
protected void a(Activity activity, String str, IUiListener iUiListener) {
    Intent intent = new Intent();
    intent.setClassName(Constants.PACKAGE_QZONE, "com.tencent.open.agent.AgentActivity");
    intent.putExtra(Constants.KEY_ACTION, "action_check");
    Bundle bundle = new Bundle();
    bundle.putString("apiName", str);
    intent.putExtra(Constants.KEY_PARAMS, bundle);
    this.mActivityIntent = intent;
    startAssitActivity(activity, iUiListener);
}
 
Example #22
Source File: SocialApiIml.java    From letv with Apache License 2.0 5 votes vote down vote up
private void a(Context context, String str, Bundle bundle, String str2, IUiListener iUiListener) {
    f.a(f.d, "OpenUi, showDialog --start");
    CookieSyncManager.createInstance(context);
    bundle.putString("oauth_consumer_key", this.mToken.getAppId());
    if (this.mToken.isSessionValid()) {
        bundle.putString("access_token", this.mToken.getAccessToken());
    }
    String openId = this.mToken.getOpenId();
    if (openId != null) {
        bundle.putString("openid", openId);
    }
    try {
        bundle.putString(Constants.PARAM_PLATFORM_ID, Global.getContext().getSharedPreferences(Constants.PREFERENCE_PF, 0).getString(Constants.PARAM_PLATFORM_ID, Constants.DEFAULT_PF));
    } catch (Exception e) {
        e.printStackTrace();
        bundle.putString(Constants.PARAM_PLATFORM_ID, Constants.DEFAULT_PF);
    }
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append(str2);
    stringBuilder.append(Util.encodeUrl(bundle));
    String stringBuilder2 = stringBuilder.toString();
    f.b(f.d, "OpenUi, showDialog TDialog");
    if (SocialConstants.ACTION_CHALLENGE.equals(str) || SocialConstants.ACTION_BRAG.equals(str)) {
        f.b(f.d, "OpenUi, showDialog PKDialog");
        new PKDialog(this.b, str, stringBuilder2, iUiListener, this.mToken).show();
        return;
    }
    new TDialog(this.b, str, stringBuilder2, iUiListener, this.mToken).show();
}
 
Example #23
Source File: SocialApiIml.java    From letv with Apache License 2.0 5 votes vote down vote up
private void a(Activity activity, Intent intent, String str, Bundle bundle, IUiListener iUiListener) {
    f.b(f.d, "-->handleIntentWithAgent " + str + " params=" + bundle + " activityIntent=" + intent);
    intent.putExtra(Constants.KEY_ACTION, str);
    intent.putExtra(Constants.KEY_PARAMS, bundle);
    this.mActivityIntent = intent;
    startAssitActivity(activity, iUiListener);
}
 
Example #24
Source File: SocialShareActivity.java    From ESSocialSDK with Apache License 2.0 5 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == Constants.REQUEST_QZONE_SHARE || requestCode == Constants.REQUEST_QQ_SHARE) {
        SocialSDK.shareToQCallback(requestCode, resultCode, data);
        finish();
    }

}
 
Example #25
Source File: LoginActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
public void handleMessage(Message msg) {
			final LoginActivity activity = mActivityReference.get();
			if (activity != null) {
				switch (msg.what) {
				case com.lling.qiqu.commons.Constants.FAILURE: // QQ登录失败
//					ToastUtils.showMessage(activity, R.string.user_update_fail);
					break;
				case com.lling.qiqu.commons.Constants.SUCCESS: // QQ登录成功
					MobclickAgent.onEvent(activity, "login_qq");
					// 设置本地用户
					User user = (User)msg.getData().getSerializable("user");
					App.currentUser = user;
					activity.spUtil.putObject("user", user);
					activity.finishWithAnimation();
					break;
				case com.lling.qiqu.commons.Constants.FAILURE_2: // 新浪微博登录失败
//					ToastUtils.showMessage(activity, R.string.user_update_fail);
					break;
				case com.lling.qiqu.commons.Constants.SUCCESS_2: // 新浪微博登录成功
					MobclickAgent.onEvent(activity, "login_sina");
					// 设置本地用户
					User user1 = (User)msg.getData().getSerializable("user");
					App.currentUser = user1;
					activity.spUtil.putObject("user", user1);
					activity.finishWithAnimation();
					break;
				case com.lling.qiqu.commons.Constants.FAILURE_1: // 注册失败
//					ToastUtils.showMessage(activity, R.string.user_update_fail);
					break;
				case com.lling.qiqu.commons.Constants.SUCCESS_1: // 注册成功
					// 设置本地用户
					activity.registSuccess((User)msg.getData().getSerializable("user"));
					break;
				}
				ProgressDialogUtils.dismiss();
			}
		}
 
Example #26
Source File: SsoActivity.java    From ESSocialSDK with Apache License 2.0 5 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    SocialSDK.oauthWeiboCallback(SsoActivity.this, requestCode, resultCode, data);
    if (requestCode == Constants.REQUEST_LOGIN || requestCode == Constants.REQUEST_APPBAR) {
        SocialSDK.oauthQQCallback(requestCode, resultCode, data);
    }

}
 
Example #27
Source File: WPA.java    From letv with Apache License 2.0 5 votes vote down vote up
public void getWPAUserOnlineState(String str, IUiListener iUiListener) {
    if (str == null) {
        try {
            d.a().a(this.mToken.getOpenId(), this.mToken.getAppId(), Constants.VIA_WAP_STATE, "15", "18", "1");
            throw new Exception("uin null");
        } catch (Exception e) {
            if (iUiListener != null) {
                iUiListener.onError(new UiError(-5, Constants.MSG_PARAM_ERROR, null));
            }
            d.a().a(this.mToken.getOpenId(), this.mToken.getAppId(), Constants.VIA_WAP_STATE, "15", "18", "1");
        }
    } else if (str.length() < 5) {
        d.a().a(this.mToken.getOpenId(), this.mToken.getAppId(), Constants.VIA_WAP_STATE, "15", "18", "1");
        throw new Exception("uin length < 5");
    } else {
        int i = 0;
        while (i < str.length()) {
            if (Character.isDigit(str.charAt(i))) {
                i++;
            } else {
                d.a().a(this.mToken.getOpenId(), this.mToken.getAppId(), Constants.VIA_WAP_STATE, "15", "18", "1");
                throw new Exception("uin not digit");
            }
        }
        Bundle bundle = null;
        HttpUtils.requestAsync(this.mToken, Global.getContext(), "http://webpresence.qq.com/getonline?Type=1&" + str + NetworkUtils.DELIMITER_COLON, bundle, "GET", new TempRequestListener(iUiListener));
        d.a().a(this.mToken.getOpenId(), this.mToken.getAppId(), Constants.VIA_WAP_STATE, "15", "18", "0");
    }
}
 
Example #28
Source File: QQHelper.java    From android-common-utils with Apache License 2.0 5 votes vote down vote up
public void onActivityResultByLogin(Activity activity,int requestCode, int resultCode, Intent data){
    Tencent.onActivityResultData(requestCode,resultCode,data,mLoginListener);
    if(requestCode == Constants.REQUEST_API) {
        if(resultCode == Constants.RESULT_LOGIN) {
            Tencent.handleResultData(data, mLoginListener);
            Log.i(TAG, "-->onActivityResult handle logindata");
        }
    }
}
 
Example #29
Source File: a.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void a(String str, String str2, String str3) {
    Bundle bundle = new Bundle();
    bundle.putString("uin", Constants.DEFAULT_UIN);
    bundle.putString("action", str2);
    bundle.putString("appid", str);
    bundle.putString("via", str3);
    new b().execute(new Bundle[]{bundle});
}
 
Example #30
Source File: LogOnActivity.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
public static void initOpenidAndToken(JSONObject jsonObject) {
    try {
        String token = jsonObject.getString(Constants.PARAM_ACCESS_TOKEN);
        String expires = jsonObject.getString(Constants.PARAM_EXPIRES_IN);
        String openId = jsonObject.getString(Constants.PARAM_OPEN_ID);
        if (!TextUtils.isEmpty(token) && !TextUtils.isEmpty(expires)
                && !TextUtils.isEmpty(openId)) {
            mTencent.setAccessToken(token, expires);
            mTencent.setOpenId(openId);
        }
    } catch(Exception e) {
    }
}