淘歌音乐 v2.0.49版本的 MD5 值为:49b2dab2d28afd9ea0c9c8648d644406
以下内容为反编译后的 WXEntryActivity.java 源代码,内容仅作参考
package com.apicloud;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import com.alipay.sdk.packet.d;
import com.apicloud.wxcardpackage.utils.HttpUtils;
import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.modelbiz.ChooseCardFromWXCardPackage;
import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram;
import com.tencent.mm.opensdk.modelmsg.SendAuth;
import com.tencent.mm.opensdk.modelmsg.SendMessageToWX;
import com.tencent.mm.opensdk.modelmsg.ShowMessageFromWX;
import com.tencent.mm.opensdk.modelmsg.WXAppExtendObject;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.uzmap.pkg.EntranceActivity;
import com.uzmap.pkg.uzkit.UZOpenApi;
import com.uzmap.pkg.uzmodules.uzWx.UzWx;
import com.uzmap.pkg.uzmodules.uzWx.utils.Util;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
private static final String TAG = "WXEntryActivity";
private IWXAPI api;
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
Log.e("Tim", "=========onCreate============");
String appId = Util.getAppId(getApplicationContext());
Log.e("Tim", "=========appId============" + appId);
IWXAPI createWXAPI = WXAPIFactory.createWXAPI(this, appId, false);
this.api = createWXAPI;
createWXAPI.handleIntent(getIntent(), this);
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Log.e("Tim", "=========onNewIntent============");
setIntent(intent);
this.api.handleIntent(intent, this);
}
@Override
public void onReq(BaseReq baseReq) {
Log.e("Tim", "========= onReq ==========");
if (baseReq != null) {
try {
if (baseReq.getType() == 3) {
goToGetMsg();
return;
}
Log.e("Tim", "=========== req is not null ===========");
ShowMessageFromWX.Req req = (ShowMessageFromWX.Req) baseReq;
if (req != null) {
Log.e("Tim", "=========== showReq is not null ===========");
String str = ((WXAppExtendObject) req.message.mediaObject).extInfo;
JSONObject jSONObject = new JSONObject();
jSONObject.put("app_params", str);
if (UzWx.miniToApp != null) {
UzWx.miniToApp.success(jSONObject, false);
}
startMyActivity(jSONObject);
finish();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
private void goToGetMsg() {
Intent intent = new Intent(this, (Class<?>) EntranceActivity.class);
intent.putExtras(getIntent());
intent.setFlags(805306368);
startActivity(intent);
finish();
}
private void startMyActivity(JSONObject jSONObject) {
Intent intent = new Intent(this, (Class<?>) EntranceActivity.class);
intent.setFlags(805306368);
intent.putExtra("wx_arguments", jSONObject.toString());
startActivity(intent);
}
@Override
public void onResp(BaseResp baseResp) {
Log.e("Tim", "========= onResp ============");
Intent intent = new Intent();
intent.putExtra("errCode", baseResp.errCode);
intent.putExtra(d.p, baseResp.getType());
intent.putExtra("msg", baseResp.errStr);
if (baseResp.getType() == 16) {
getChooseCardResult((ChooseCardFromWXCardPackage.Resp) baseResp);
return;
}
if (baseResp.getType() == 1) {
SendAuth.Resp resp = (SendAuth.Resp) baseResp;
intent.putExtra("code", resp.code);
intent.putExtra("state", resp.state);
intent.putExtra("lang", resp.lang);
intent.putExtra("country", resp.country);
} else if (baseResp.getType() == 19) {
intent.putExtra("extMsg", ((WXLaunchMiniProgram.Resp) baseResp).extMsg);
} else if (baseResp.getType() == 2) {
System.out.println(((SendMessageToWX.Resp) baseResp).errCode);
}
intent.setAction(getPackageName() + ".weixinshare");
sendBroadcast(intent);
int i = baseResp.errCode;
if (i == -4) {
Log.v(TAG, "发送被拒绝");
} else if (i == -2) {
Log.v(TAG, "发送取消");
} else if (i == 0) {
Log.v(TAG, "发送成功");
} else {
Log.v(TAG, "发送返回");
}
finish();
}
private void getChooseCardResult(ChooseCardFromWXCardPackage.Resp resp) {
Log.i("xDebug", "getChooseCardResult entered");
String str = resp.cardItemList;
if (TextUtils.isEmpty(str)) {
Log.i("xDebug", "getChooseCardResult finish");
finish();
} else {
Log.i("xDebug", "getChooseCardResult -> getinvoicebatch");
getinvoicebatch(str);
}
}
private void getinvoicebatch(String str) {
Log.i("xDebug", "getinvoicebatch entered " + str);
String str2 = "https://api.weixin.qq.com/card/invoice/reimburse/getinvoicebatch?access_token=" + UzWx.access_token;
try {
JSONArray jSONArray = new JSONArray();
JSONArray jSONArray2 = new JSONArray(str);
for (int i = 0; i < jSONArray2.length(); i++) {
JSONObject jSONObject = jSONArray2.getJSONObject(i);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("card_id", jSONObject.getString("card_id"));
jSONObject2.put("encrypt_code", jSONObject.getString("encrypt_code"));
jSONArray.put(jSONObject2);
}
JSONObject jSONObject3 = new JSONObject();
jSONObject3.put("item_list", jSONArray);
String jSONObject4 = jSONObject3.toString();
Log.i("xDebug", "will do doPostJsonAsync");
HttpUtils.doPostJsonAsync(str2, jSONObject4, new HttpUtils.CallBack() {
@Override
public void onRequestComplete(String str3) {
WXEntryActivity.this.finish();
Log.i("xDebug", "getinvoicebatch -> doPostJsonAsync -> onRequestComplete : " + str3);
Intent intent = new Intent();
intent.putExtra(UZOpenApi.RESULT, str3);
intent.setAction(WXEntryActivity.this.getPackageName() + ".CBReceiver");
WXEntryActivity.this.sendBroadcast(intent);
}
@Override
public void onError() {
Log.i("xDebug", "getinvoicebatch -> doPostJsonAsync -> onError");
WXEntryActivity.this.finish();
}
});
} catch (JSONException e) {
e.printStackTrace();
}
}
}