本文整理汇总了Java中com.tencent.tauth.IUiListener.onError方法的典型用法代码示例。如果您正苦于以下问题:Java IUiListener.onError方法的具体用法?Java IUiListener.onError怎么用?Java IUiListener.onError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tencent.tauth.IUiListener
的用法示例。
在下文中一共展示了IUiListener.onError方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openBrowser
import com.tencent.tauth.IUiListener; //导入方法依赖的package包/类
private void openBrowser(Bundle bundle) {
String string = bundle.getString("viaShareType");
String string2 = bundle.getString("callbackAction");
String string3 = bundle.getString("url");
String string4 = bundle.getString("openId");
String string5 = bundle.getString("appId");
String str = "";
String str2 = "";
if (SystemUtils.QQ_SHARE_CALLBACK_ACTION.equals(string2)) {
str = Constants.VIA_SHARE_TO_QQ;
str2 = "10";
} else if (SystemUtils.QZONE_SHARE_CALLBACK_ACTION.equals(string2)) {
str = Constants.VIA_SHARE_TO_QZONE;
str2 = "11";
}
if (Util.openBrowser(this, string3)) {
d.a().a(string4, string5, str, str2, "3", "0", string, "0", "2", "0");
} else {
IUiListener iUiListener = (IUiListener) TemporaryStorage.get(string2);
if (iUiListener != null) {
iUiListener.onError(new UiError(-6, Constants.MSG_OPEN_BROWSER_ERROR, null));
}
d.a().a(string4, string5, str, str2, "3", "1", string, "0", "2", "0");
finish();
}
getIntent().removeExtra("shareH5");
}
示例2: getWPAUserOnlineState
import com.tencent.tauth.IUiListener; //导入方法依赖的package包/类
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");
}
}
示例3: deleteRecord
import com.tencent.tauth.IUiListener; //导入方法依赖的package包/类
public void deleteRecord(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("");
} else {
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/delete_record", composeCGIParams, "GET", tempRequestListener);
}
示例4: getRecord
import com.tencent.tauth.IUiListener; //导入方法依赖的package包/类
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);
}
示例5: checkRecord
import com.tencent.tauth.IUiListener; //导入方法依赖的package包/类
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);
}
示例6: openBrowser
import com.tencent.tauth.IUiListener; //导入方法依赖的package包/类
private void openBrowser(Bundle bundle) {
String string = bundle.getString("viaShareType");
String string2 = bundle.getString("callbackAction");
String string3 = bundle.getString("url");
String string4 = bundle.getString("openId");
String string5 = bundle.getString("appId");
String str = "";
String str2 = "";
if (SystemUtils.QQ_SHARE_CALLBACK_ACTION.equals(string2)) {
str = Constants.VIA_SHARE_TO_QQ;
str2 = Constants.VIA_REPORT_TYPE_SHARE_TO_QQ;
} else if (SystemUtils.QZONE_SHARE_CALLBACK_ACTION.equals(string2)) {
str = Constants.VIA_SHARE_TO_QZONE;
str2 = Constants.VIA_REPORT_TYPE_SHARE_TO_QZONE;
}
if (Util.openBrowser(this, string3)) {
d.a().a(string4, string5, str, str2, "3", "0", string, "0", "2", "0");
} else {
IUiListener iUiListener = (IUiListener) TemporaryStorage.get(string2);
if (iUiListener != null) {
iUiListener.onError(new UiError(-6, Constants.MSG_OPEN_BROWSER_ERROR, null));
}
d.a().a(string4, string5, str, str2, "3", "1", string, "0", "2", "0");
finish();
}
getIntent().removeExtra("shareH5");
}
示例7: handleDataToListener
import com.tencent.tauth.IUiListener; //导入方法依赖的package包/类
public static void handleDataToListener(Intent intent, IUiListener iUiListener) {
if (intent == null) {
iUiListener.onCancel();
return;
}
String stringExtra = intent.getStringExtra(Constants.KEY_ACTION);
String stringExtra2;
if (SystemUtils.ACTION_LOGIN.equals(stringExtra)) {
int intExtra = intent.getIntExtra(Constants.KEY_ERROR_CODE, 0);
if (intExtra == 0) {
stringExtra2 = intent.getStringExtra(Constants.KEY_RESPONSE);
if (stringExtra2 != null) {
try {
iUiListener.onComplete(Util.parseJson(stringExtra2));
return;
} catch (Throwable e) {
iUiListener.onError(new UiError(-4, Constants.MSG_JSON_ERROR, stringExtra2));
f.b(f.d, "OpenUi, onActivityResult, json error", e);
return;
}
}
f.b(f.d, "OpenUi, onActivityResult, onComplete");
iUiListener.onComplete(new JSONObject());
return;
}
f.e(f.d, "OpenUi, onActivityResult, onError = " + intExtra + "");
iUiListener.onError(new UiError(intExtra, intent.getStringExtra(Constants.KEY_ERROR_MSG), intent.getStringExtra(Constants.KEY_ERROR_DETAIL)));
} else if (SystemUtils.ACTION_SHARE.equals(stringExtra)) {
stringExtra = intent.getStringExtra("result");
stringExtra2 = intent.getStringExtra("response");
if ("cancel".equals(stringExtra)) {
iUiListener.onCancel();
} else if (NativeProtocol.BRIDGE_ARG_ERROR_BUNDLE.equals(stringExtra)) {
iUiListener.onError(new UiError(-6, "unknown error", stringExtra2 + ""));
} else if ("complete".equals(stringExtra)) {
try {
if (stringExtra2 == null) {
stringExtra = "{\"ret\": 0}";
} else {
stringExtra = stringExtra2;
}
iUiListener.onComplete(new JSONObject(stringExtra));
} catch (JSONException e2) {
e2.printStackTrace();
iUiListener.onError(new UiError(-4, "json error", stringExtra2 + ""));
}
}
}
}
示例8: handleDataToListener
import com.tencent.tauth.IUiListener; //导入方法依赖的package包/类
public static void handleDataToListener(Intent intent, IUiListener iUiListener) {
String stringExtra;
if (intent == null) {
iUiListener.onCancel();
return;
}
String stringExtra2 = intent.getStringExtra(Constants.KEY_ACTION);
if (SystemUtils.ACTION_LOGIN.equals(stringExtra2)) {
int intExtra = intent.getIntExtra(Constants.KEY_ERROR_CODE, 0);
if (intExtra == 0) {
stringExtra = intent.getStringExtra(Constants.KEY_RESPONSE);
if (stringExtra != null) {
try {
iUiListener.onComplete(Util.parseJson(stringExtra));
return;
} catch (Throwable e) {
iUiListener.onError(new UiError(-4, Constants.MSG_JSON_ERROR, stringExtra));
f.b(f.d, "OpenUi, onActivityResult, json error", e);
return;
}
}
f.b(f.d, "OpenUi, onActivityResult, onComplete");
iUiListener.onComplete(new JSONObject());
return;
}
f.e(f.d, "OpenUi, onActivityResult, onError = " + intExtra + "");
iUiListener.onError(new UiError(intExtra, intent.getStringExtra(Constants
.KEY_ERROR_MSG), intent.getStringExtra(Constants.KEY_ERROR_DETAIL)));
} else if (SystemUtils.ACTION_SHARE.equals(stringExtra2)) {
stringExtra2 = intent.getStringExtra("result");
stringExtra = intent.getStringExtra("response");
if ("cancel".equals(stringExtra2)) {
iUiListener.onCancel();
} else if ("error".equals(stringExtra2)) {
iUiListener.onError(new UiError(-6, "unknown error", stringExtra + ""));
} else if ("complete".equals(stringExtra2)) {
try {
if (stringExtra == null) {
stringExtra2 = "{\"ret\": 0}";
} else {
stringExtra2 = stringExtra;
}
iUiListener.onComplete(new JSONObject(stringExtra2));
} catch (JSONException e2) {
e2.printStackTrace();
iUiListener.onError(new UiError(-4, "json error", stringExtra + ""));
}
}
}
}