com.tencent.tauth.UiError Java Examples

The following examples show how to use com.tencent.tauth.UiError. 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: j.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public void onComplete(Object obj)
{
    JSONObject jsonobject = (JSONObject)obj;
    if (jsonobject.getInt("ret") == 0)
    {
        a.onComplete("");
        return;
    }
    try
    {
        a.onError(new UiError(-4, jsonobject.toString(), null));
        return;
    }
    catch (JSONException jsonexception)
    {
        a.onError(new UiError(-4, jsonexception.getMessage(), null));
    }
    return;
}
 
Example #2
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 #3
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 #4
Source File: TaskGuide.java    From letv with Apache License 2.0 6 votes vote down vote up
protected void a(final Exception exception) {
    if (exception != null) {
        exception.printStackTrace();
    }
    this.c.c.onError(new UiError(101, "error ", "金券领取时出现异常"));
    if (this.c.g != null) {
        this.c.g.post(new Runnable(this) {
            final /* synthetic */ d b;

            public void run() {
                k kVar = k.INIT;
                if (this.b.b == 0) {
                    kVar = this.b.c.i;
                } else {
                    kVar = this.b.c.j;
                }
                if (kVar == k.WAITTING_BACK_REWARD) {
                    this.b.c.a(this.b.b, k.NORAML);
                    this.b.c.a("领取失败 :" + exception.getClass().getName());
                }
                this.b.c.b(this.b.b);
                this.b.c.d(2000);
            }
        });
    }
}
 
Example #5
Source File: m.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public void onError(UiError uierror)
{
    String s;
    if (uierror.errorMessage != null)
    {
        s = (new StringBuilder()).append(uierror.errorMessage).append(a).toString();
    } else
    {
        s = a;
    }
    com.tencent.open.a.b.a().a((Context)AuthDialog.a().get(), (new StringBuilder()).append(d).append("_H5").toString(), SystemClock.elapsedRealtime(), 0L, 0L, uierror.errorCode, b, s, "1000067");
    if (e != null)
    {
        e.onError(uierror);
        e = null;
    }
}
 
Example #6
Source File: l.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public void onComplete(Object obj)
{
    JSONObject jsonobject = (JSONObject)obj;
    if (jsonobject.getInt("ret") == 0)
    {
        String s = jsonobject.getJSONObject("data").getString("value");
        a.onComplete(Util.hexToString(s));
        return;
    }
    try
    {
        a.onError(new UiError(-4, jsonobject.toString(), null));
        return;
    }
    catch (JSONException jsonexception)
    {
        a.onError(new UiError(-4, jsonexception.getMessage(), null));
    }
    return;
}
 
Example #7
Source File: TaskGuide.java    From letv with Apache License 2.0 5 votes vote down vote up
protected void a(Exception exception) {
    if (exception != null) {
        exception.printStackTrace();
    }
    if (exception == null) {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("result", "暂无任务");
        } catch (JSONException e) {
            e.printStackTrace();
        }
        this.b.c.onComplete(jSONObject);
    } else {
        this.b.c.onError(new UiError(100, "error ", "获取任务失败"));
    }
    this.b.g.post(new Runnable(this) {
        final /* synthetic */ j a;

        {
            this.a = r1;
        }

        public void run() {
            this.a.b.a(2, k.INIT);
        }
    });
}
 
Example #8
Source File: TDialog.java    From letv with Apache License 2.0 5 votes vote down vote up
public void onReceivedError(WebView webView, int i, String str, String str2) {
    super.onReceivedError(webView, i, str, str2);
    TDialog.this.f.onError(new UiError(i, str, str2));
    if (!(TDialog.this.c == null || TDialog.this.c.get() == null)) {
        Toast.makeText((Context) TDialog.this.c.get(), "网络连接异常或系统错误", 0).show();
    }
    TDialog.this.dismiss();
}
 
Example #9
Source File: l.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public void onReceivedError(WebView webview, int i, String s, String s1)
{
    super.onReceivedError(webview, i, s, s1);
    AuthDialog.e(a).onError(new UiError(i, s, s1));
    if (AuthDialog.a() != null && AuthDialog.a().get() != null)
    {
        Toast.makeText((Context)AuthDialog.a().get(), "\u7F51\u7EDC\u8FDE\u63A5\u5F02\u5E38\u6216\u7CFB\u7EDF\u9519\u8BEF", 0).show();
    }
    a.dismiss();
}
 
Example #10
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 #11
Source File: AppbarActivity.java    From letv with Apache License 2.0 5 votes vote down vote up
public void shareToQzone() {
    final QQToken token = getToken();
    if (token != null) {
        QzoneShare qzoneShare = new QzoneShare(this, token);
        Bundle bundle = new Bundle();
        bundle.putInt("req_type", 1);
        bundle.putString("title", this.model.a);
        bundle.putString("summary", this.model.b);
        bundle.putString("targetUrl", this.model.d);
        ArrayList arrayList = new ArrayList();
        f.b(f.d, "-->shareToQzone : mIconUrl = " + this.model.c);
        arrayList.add(this.model.c);
        bundle.putStringArrayList("imageUrl", arrayList);
        qzoneShare.shareToQzone(this, bundle, new IUiListener(this) {
            final /* synthetic */ AppbarActivity b;

            public void onError(UiError uiError) {
                f.b(f.d, "-->(AppbarActivity)shareToQzone onError");
                this.b.jsBridge.responseShareFail(2);
            }

            public void onComplete(Object obj) {
                f.b(f.d, "-->(AppbarActivity)shareToQzone onComplete");
                this.b.jsBridge.responseShare(2);
                a.a(token.getAppId(), PLAYER.PLAY, "SDK.APPBAR.HOME.SHARE.QZ");
            }

            public void onCancel() {
                f.b(f.d, "-->(AppbarActivity)shareToQzone onCancel");
                this.b.jsBridge.responseShareFail(2);
            }
        });
        a.a(token.getAppId(), "200", "SDK.APPBAR.HOME.SHARE.QZ");
    }
}
 
Example #12
Source File: a.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public void handleMessage(Message message)
{
    if (message.what == 0)
    {
        BaseApi.TempRequestListener.a(b).onComplete((JSONObject)message.obj);
        return;
    } else
    {
        BaseApi.TempRequestListener.a(b).onError(new UiError(message.what, (String)message.obj, null));
        return;
    }
}
 
Example #13
Source File: PKDialog.java    From letv with Apache License 2.0 5 votes vote down vote up
public void onError(UiError uiError) {
    g.a().a(this.mAction + "_H5", SystemClock.elapsedRealtime(), 0, 0, uiError.errorCode, uiError.errorMessage != null ? uiError.errorMessage + this.mUrl : this.mUrl, false);
    if (this.mWeakL != null) {
        this.mWeakL.onError(uiError);
        this.mWeakL = null;
    }
}
 
Example #14
Source File: PKDialog.java    From letv with Apache License 2.0 5 votes vote down vote up
private void onComplete(String str) {
    try {
        onComplete(Util.parseJson(str));
    } catch (JSONException e) {
        e.printStackTrace();
        onError(new UiError(-4, Constants.MSG_JSON_ERROR, str));
    }
}
 
Example #15
Source File: PKDialog.java    From letv with Apache License 2.0 5 votes vote down vote up
public void onReceivedError(WebView webView, int i, String str, String str2) {
    super.onReceivedError(webView, i, str, str2);
    PKDialog.this.mListener.onError(new UiError(i, str, str2));
    if (!(PKDialog.this.mWeakContext == null || PKDialog.this.mWeakContext.get() == null)) {
        Toast.makeText((Context) PKDialog.this.mWeakContext.get(), "网络连接异常或系统错误", 0).show();
    }
    PKDialog.this.dismiss();
}
 
Example #16
Source File: AuthDialog.java    From letv with Apache License 2.0 5 votes vote down vote up
private void a(String str) {
    try {
        onComplete(Util.parseJson(str));
    } catch (JSONException e) {
        e.printStackTrace();
        onError(new UiError(-4, Constants.MSG_JSON_ERROR, str));
    }
}
 
Example #17
Source File: QQLoginInstance.java    From ShareLoginPayUtil with Apache License 2.0 5 votes vote down vote up
public QQLoginInstance(Activity activity, final LoginListener listener,
                       final boolean fetchUserInfo) {
    super(activity, listener, fetchUserInfo);
    mTencent = Tencent.createInstance(ShareManager.CONFIG.getQqId(), activity);
    mIUiListener = new IUiListener() {
        @Override
        public void onComplete(Object o) {
            ShareLogger.i(ShareLogger.INFO.QQ_AUTH_SUCCESS);
            try {
                QQToken token = new QQToken((JSONObject) o);
                if (fetchUserInfo) {
                    listener.beforeFetchUserInfo(token);
                    fetchUserInfo(token);
                } else {
                    listener.loginSuccess(new LoginResultData(LoginPlatform.QQ, token));
                    LoginUtil.recycle();
                }
            } catch (JSONException e) {
                ShareLogger.i(ShareLogger.INFO.ILLEGAL_TOKEN);
                mLoginListener.loginFailure(e, ShareLogger.INFO.ERR_GET_TOKEN_CODE);
                LoginUtil.recycle();
            }
        }

        @Override
        public void onError(UiError uiError) {
            ShareLogger.i(ShareLogger.INFO.LOGIN_ERROR);
            listener.loginFailure(new Exception(uiError.errorDetail), uiError.errorCode);
            LoginUtil.recycle();
        }

        @Override
        public void onCancel() {
            ShareLogger.i(ShareLogger.INFO.AUTH_CANCEL);
            listener.loginCancel();
            LoginUtil.recycle();
        }
    };
}
 
Example #18
Source File: TDialog.java    From letv with Apache License 2.0 5 votes vote down vote up
private void onComplete(String str) {
    try {
        onComplete(Util.parseJson(str));
    } catch (JSONException e) {
        e.printStackTrace();
        onError(new UiError(-4, Constants.MSG_JSON_ERROR, str));
    }
}
 
Example #19
Source File: u.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
protected void a(Exception exception)
{
    if (exception != null)
    {
        exception.printStackTrace();
    }
    b.c.onError(new UiError(101, "error ", "\u91D1\u5238\u9886\u53D6\u65F6\u51FA\u73B0\u5F02\u5E38"));
    if (TaskGuide.x(b) != null)
    {
        TaskGuide.x(b).post(new v(this, exception));
    }
}
 
Example #20
Source File: FileManager.java    From letv with Apache License 2.0 5 votes vote down vote up
public UploadFileImp(Context context, WeiyunFileType weiyunFileType, String str, IUploadFileCallBack iUploadFileCallBack) {
    this.mContext = context;
    this.mFileType = weiyunFileType;
    this.mFilePath = str;
    this.mCallback = iUploadFileCallBack;
    this.mHandler = new Handler(this.mContext.getMainLooper(), FileManager.this) {
        public void handleMessage(Message message) {
            switch (message.what) {
                case 0:
                    JSONObject jSONObject = (JSONObject) message.obj;
                    try {
                        int i = jSONObject.getInt("ret");
                        if (i != 0) {
                            UploadFileImp.this.mCallback.onError(new UiError(i, jSONObject.toString(), null));
                            return;
                        }
                        jSONObject = jSONObject.getJSONObject(ShareRequestParam.RESP_UPLOAD_PIC_PARAM_DATA);
                        UploadFileImp.this.mUKey = DataConvert.string2bytes(jSONObject.getString("csum"));
                        UploadFileImp.this.mHost = jSONObject.getString("host");
                        UploadFileImp.this.mCallback.onUploadStart();
                        UploadFileImp.this.doUpload();
                        return;
                    } catch (Exception e) {
                        UploadFileImp.this.mCallback.onError(new UiError(-4, e.getMessage(), null));
                        return;
                    }
                case 1:
                    UploadFileImp.this.mCallback.onUploadProgress(Integer.parseInt((String) message.obj));
                    return;
                case 2:
                    UploadFileImp.this.mCallback.onUploadSuccess();
                    return;
                default:
                    UploadFileImp.this.mCallback.onError(new UiError(message.what, (String) message.obj, null));
                    return;
            }
        }
    };
}
 
Example #21
Source File: RecordManager.java    From letv with Apache License 2.0 5 votes vote down vote up
public void getRecord(String str, final IUiListener iUiListener) {
    Bundle composeCGIParams = composeCGIParams();
    IRequestListener tempRequestListener = new TempRequestListener(new IUiListener(this) {
        final /* synthetic */ RecordManager b;

        public void onError(UiError uiError) {
            iUiListener.onError(uiError);
        }

        public void onComplete(Object obj) {
            JSONObject jSONObject = (JSONObject) obj;
            try {
                if (jSONObject.getInt("ret") == 0) {
                    iUiListener.onComplete(Util.hexToString(jSONObject.getJSONObject(ShareRequestParam.RESP_UPLOAD_PIC_PARAM_DATA).getString(Constants.VALUE_ID)));
                    return;
                }
                iUiListener.onError(new UiError(-4, jSONObject.toString(), null));
            } catch (JSONException e) {
                iUiListener.onError(new UiError(-4, e.getMessage(), null));
            }
        }

        public void onCancel() {
            iUiListener.onCancel();
        }
    });
    composeCGIParams.putString("key", Util.toHexString(str));
    HttpUtils.requestAsync(this.mToken, Global.getContext(), "https://graph.qq.com/weiyun/get_record", composeCGIParams, "GET", tempRequestListener);
}
 
Example #22
Source File: RecordManager.java    From letv with Apache License 2.0 5 votes vote down vote up
public void queryAllRecord(final IUiListener iUiListener) {
    HttpUtils.requestAsync(this.mToken, Global.getContext(), "https://graph.qq.com/weiyun/query_all_record", composeCGIParams(), "GET", new TempRequestListener(new IUiListener(this) {
        final /* synthetic */ RecordManager b;

        public void onError(UiError uiError) {
            iUiListener.onError(uiError);
        }

        public void onComplete(Object obj) {
            JSONObject jSONObject = (JSONObject) obj;
            try {
                if (jSONObject.getInt("ret") == 0) {
                    List arrayList = new ArrayList();
                    JSONObject jSONObject2 = jSONObject.getJSONObject(ShareRequestParam.RESP_UPLOAD_PIC_PARAM_DATA);
                    if (!jSONObject2.isNull("keys")) {
                        JSONArray jSONArray = jSONObject2.getJSONArray("keys");
                        for (int i = 0; i < jSONArray.length(); i++) {
                            arrayList.add(Util.hexToString(jSONArray.getJSONObject(i).getString("key")));
                        }
                    }
                    iUiListener.onComplete(arrayList);
                    return;
                }
                iUiListener.onError(new UiError(-4, jSONObject.toString(), null));
            } catch (JSONException e) {
                iUiListener.onError(new UiError(-4, e.getMessage(), null));
            }
        }

        public void onCancel() {
            iUiListener.onCancel();
        }
    }));
}
 
Example #23
Source File: RecordManager.java    From letv with Apache License 2.0 5 votes vote down vote up
public void checkRecord(String str, final IUiListener iUiListener) {
    Bundle composeCGIParams = composeCGIParams();
    IRequestListener tempRequestListener = new TempRequestListener(new IUiListener(this) {
        final /* synthetic */ RecordManager b;

        public void onError(UiError uiError) {
            iUiListener.onError(uiError);
        }

        public void onComplete(Object obj) {
            try {
                if (((JSONObject) obj).getInt("ret") == 0) {
                    iUiListener.onComplete(Boolean.TRUE);
                } else {
                    iUiListener.onComplete(Boolean.FALSE);
                }
            } catch (JSONException e) {
                iUiListener.onError(new UiError(-4, e.getMessage(), null));
            }
        }

        public void onCancel() {
            iUiListener.onCancel();
        }
    });
    composeCGIParams.putString("key", Util.toHexString(str));
    HttpUtils.requestAsync(this.mToken, Global.getContext(), "https://graph.qq.com/weiyun/check_record", composeCGIParams, "GET", tempRequestListener);
}
 
Example #24
Source File: Login.java    From LoginSharePay with Apache License 2.0 5 votes vote down vote up
@Override
public void onError(UiError uiError) {
    if (listener == null) return;
    if (isQQLogin) listener.onLoginError(Type.QQ, uiError.errorCode);
    else
        listener.onShareError(Type.QQ, uiError.errorCode);
}
 
Example #25
Source File: BaseQQShareHandler.java    From BiliShare with Apache License 2.0 5 votes vote down vote up
@Override
public void onError(UiError e) {
    Log.d(TAG, "share failed");
    if (getShareListener() != null) {
        getShareListener().onError(getShareMedia(), BiliShareStatusCode.ST_CODE_SHARE_ERROR_EXCEPTION, new ShareException(e.errorMessage));
    }
}
 
Example #26
Source File: QQLoginInstance.java    From ShareUtil with Apache License 2.0 5 votes vote down vote up
public QQLoginInstance(Activity activity, final LoginListener listener,
        final boolean fetchUserInfo) {
    super(activity, listener, fetchUserInfo);
    mTencent = Tencent.createInstance(ShareManager.CONFIG.getQqId(),
            activity.getApplicationContext());
    mLoginListener = listener;
    mIUiListener = new IUiListener() {
        @Override
        public void onComplete(Object o) {
            ShareLogger.i(INFO.QQ_AUTH_SUCCESS);
            try {
                QQToken token = QQToken.parse((JSONObject) o);
                if (fetchUserInfo) {
                    listener.beforeFetchUserInfo(token);
                    fetchUserInfo(token);
                } else {
                    listener.loginSuccess(new LoginResult(LoginPlatform.QQ, token));
                }
            } catch (JSONException e) {
                ShareLogger.i(INFO.ILLEGAL_TOKEN);
                mLoginListener.loginFailure(e);
            }
        }

        @Override
        public void onError(UiError uiError) {
            ShareLogger.i(INFO.QQ_LOGIN_ERROR);
            listener.loginFailure(
                    new Exception("QQError: " + uiError.errorCode + uiError.errorDetail));
        }

        @Override
        public void onCancel() {
            ShareLogger.i(INFO.AUTH_CANCEL);
            listener.loginCancel();
        }
    };
}
 
Example #27
Source File: QQLoginInstance.java    From smart-farmer-android with Apache License 2.0 5 votes vote down vote up
public QQLoginInstance(Activity activity, final LoginListener listener,
        final boolean fetchUserInfo) {
    super(activity, listener, fetchUserInfo);
    mTencent = Tencent.createInstance(ShareManager.CONFIG.getQqId(),
            activity.getApplicationContext());
    mLoginListener = listener;
    mIUiListener = new IUiListener() {
        @Override
        public void onComplete(Object o) {
            ShareLogger.i(INFO.QQ_AUTH_SUCCESS);
            try {
                QQToken token = QQToken.parse((JSONObject) o);
                if (fetchUserInfo) {
                    listener.beforeFetchUserInfo(token);
                    fetchUserInfo(token);
                } else {
                    listener.loginSuccess(new LoginResult(LoginPlatform.QQ, token));
                }
            } catch (JSONException e) {
                ShareLogger.i(INFO.ILLEGAL_TOKEN);
                mLoginListener.loginFailure(e);
            }
        }

        @Override
        public void onError(UiError uiError) {
            ShareLogger.i(INFO.QQ_LOGIN_ERROR);
            listener.loginFailure(
                    new Exception("QQError: " + uiError.errorCode + uiError.errorDetail));
        }

        @Override
        public void onCancel() {
            ShareLogger.i(INFO.AUTH_CANCEL);
            listener.loginCancel();
        }
    };
}
 
Example #28
Source File: QQShareImpl.java    From ChinaShare with MIT License 5 votes vote down vote up
public void shareToQzeon(String title, String content, String shareUrl,
                         String imgUrl) {
    final Bundle params = new Bundle();
    params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT);
    params.putString(QzoneShare.SHARE_TO_QQ_TITLE, title);
    params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, shareUrl);
    params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, content);
    params.putString(QzoneShare.SHARE_TO_QQ_APP_NAME, ShareManager.getAppName());
    ArrayList<String> list = new ArrayList<String>();
    if (!TextUtils.isEmpty(imgUrl)) {
        list.add(imgUrl);
    } else {
        if(!TextUtils.isEmpty(ShareManager.getDefShareImageUrl())){
            list.add(ShareManager.getDefShareImageUrl());
        }
    }
    params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, list);
    mTencent.shareToQzone(mActivity, params, new IUiListener() {

        @Override
        public void onCancel() {
        }

        @Override
        public void onError(UiError e) {
            String message = mActivity.getString(R.string.share_fail) + " " + e.errorMessage;
            Toast.makeText(mActivity, message, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onComplete(Object response) {

        }

    });
}
 
Example #29
Source File: QQHandler.java    From SocialSDKAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void authorize(Activity activity, AuthListener authListener) {
    this.mActivity = activity;
    this.mAuthListener = authListener;

    this.mTencent.login(this.mActivity, "all", new IUiListener() {
        @Override
        public void onComplete(Object o) {
            if (null == o || ((JSONObject)o) == null) {
                LogUtils.e("onComplete response=null");
                mAuthListener.onError(mConfig.getName(), "onComplete response=null");
                return;
            }

            JSONObject response = (JSONObject) o;

            initOpenidAndToken(response);

            mAuthListener.onComplete(mConfig.getName(), Utils.jsonToMap(response));

            mTencent.logout(mActivity);
        }

        @Override
        public void onError(UiError uiError) {
            String errmsg = "errcode=" + uiError.errorCode + " errmsg=" + uiError.errorMessage + " errdetail=" + uiError.errorDetail;
            LogUtils.e(errmsg);
            mAuthListener.onError(mConfig.getName(), errmsg);
        }

        @Override
        public void onCancel() {
            mAuthListener.onCancel(mConfig.getName());
        }
    });
}
 
Example #30
Source File: MainActivity.java    From Jide-Note with MIT License 5 votes vote down vote up
private void checkQQLogState() {

        mUser = application.getUser();
        // 获取QQ登录授权有限期,没有则是-1
        long expireTime = mUser.getExpireTime(this.getApplicationContext());
        LogUtils.e("checkQQLogState ==","ExpireTime="+expireTime);
        if(System.currentTimeMillis() > expireTime) {   // 如果已经过期,或者没有登录
            mUser.removeAllAuth(getApplicationContext());   // 清除所有授权信息
            application.setVisitor(true);       // 游客状态

            removeUserNote();
        }else{
            // TODO 从云端获取该账号的NOTE SET
            String token = mUser.getAccess_token(getApplicationContext());
            String expires = mUser.getExpires_in(getApplicationContext());
            String openId = mUser.getOpenid(getApplicationContext());

            tencentSDKHelper.getTencent().setAccessToken(token,expires);
            tencentSDKHelper.getTencent().setOpenId(openId);

            tencentSDKHelper.login(this, new IUiListener() {
                @Override
                public void onComplete(Object o) {}
                @Override
                public void onError(UiError uiError) {
                    mUser.removeAllAuth(getApplicationContext());
                    NoteApplication.getNoteApplication(MainActivity.this).setVisitor(true);
                }
                @Override
                public void onCancel() {}
            });
        }
    }