中建乐购 v3.2.3版本的 MD5 值为:3856d0da11f056931d64951d23a4b3b8
以下内容为反编译后的 ShareInviteFragment.java 源代码,内容仅作参考
package com.thirdbureau.fragment;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.pm.PackageInfo;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import cn.sharesdk.framework.Platform;
import cn.sharesdk.framework.PlatformActionListener;
import cn.sharesdk.framework.ShareSDK;
import cn.sharesdk.tencent.qq.QQ;
import cn.sharesdk.wechat.friends.Wechat;
import com.google.gson.Gson;
import com.shopex.westore.AgentApplication;
import com.shopex.westore.activity.AgentActivity;
import com.shopex.westore.b;
import com.shopex.westore.h;
import com.shopex.westore.k;
import com.thirdbureau.homepage.InviteModel;
import com.zjsjtz.ecstore.R;
import dc.r;
import du.c;
import fu.d;
import fu.e;
import gi.b;
import go.f;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import org.json.JSONObject;
public class ShareInviteFragment extends b implements PlatformActionListener {
private TextView mCopyBut;
private TextView mCreateInviteBut;
private DownTimer mDownTimer;
private TextView mShareNumber;
private LinearLayout mShareQQBut;
private LinearLayout mShareWeixinBut;
private TextView mSurplusText;
private EditText mUserNameEdit;
private final Long mTimerTime = Long.valueOf((long) c.f15364c);
private final String shareContent = "有机生活,健康自然!快来和我一起体验“中建三局生态”。";
private final String shareUrl = "/download-invite.html?inviteCode=";
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
this.mActionBar.setTitle(getString(R.string.share_invite_title));
}
@Override
public void init(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
super.init(layoutInflater, viewGroup, bundle);
this.rootView = layoutInflater.inflate(R.layout.fragment_new_share_invite, (ViewGroup) null);
this.mShareNumber = (TextView) findViewById(R.id.fragment_share_number);
this.mCopyBut = (TextView) findViewById(R.id.fragment_copy_number);
this.mSurplusText = (TextView) findViewById(R.id.fragment_surplus_number);
this.mCreateInviteBut = (TextView) findViewById(R.id.fragment_create_number);
this.mUserNameEdit = (EditText) findViewById(R.id.fragment_user_name_edit);
this.mShareQQBut = (LinearLayout) findViewById(R.id.share_to_qq);
this.mShareWeixinBut = (LinearLayout) findViewById(R.id.share_to_weixin);
this.mCreateInviteBut.setOnClickListener(this);
this.mShareQQBut.setOnClickListener(this);
this.mShareWeixinBut.setOnClickListener(this);
}
@Override
public void onResume() {
super.onResume();
h c2 = AgentApplication.c(this.mActivity);
if (c2.h() == null) {
startActivity(AgentActivity.a(this.mActivity, (int) AgentActivity.f8626j));
} else {
this.mShareNumber.setText(c2.h());
}
}
@Override
public void onClick(View view) {
super.onClick(view);
String charSequence = this.mShareNumber.getText().toString();
String trim = this.mUserNameEdit.getText().toString().trim();
switch (view.getId()) {
case R.id.fragment_create_number:
k.a(new d(), new CreateInviteTask());
return;
case R.id.fragment_share_number:
case R.id.fragment_surplus_number:
default:
return;
case R.id.fragment_copy_number:
if (!charSequence.equals("")) {
copyInvite(charSequence);
r.a("已复制到粘贴板");
return;
}
r.a("请先生成推荐码");
return;
case R.id.share_to_qq:
if (!charSequence.equals("")) {
if (isQQClientAvailable()) {
shareToCode(true, trim, charSequence);
return;
} else {
r.a("还未安装QQ");
return;
}
}
r.a("请先生成推荐码");
return;
case R.id.share_to_weixin:
if (!charSequence.equals("")) {
if (isWeixinAvilible()) {
shareToCode(false, trim, charSequence);
return;
} else {
r.a("还未安装微信");
return;
}
}
r.a("请先生成推荐码");
return;
}
}
private void copyInvite(String str) {
((ClipboardManager) getActivity().getSystemService("clipboard")).setPrimaryClip(ClipData.newPlainText(com.google.android.exoplayer.util.k.f7274c, str));
}
class DownTimer extends CountDownTimer {
public DownTimer(long j2, long j3) {
super(j2, j3);
}
@Override
public void onTick(long j2) {
TextView textView = ShareInviteFragment.this.mCreateInviteBut;
textView.setText((j2 / 1000) + "秒");
}
@Override
public void onFinish() {
ShareInviteFragment.this.mCreateInviteBut.setBackgroundResource(R.drawable.icon_share_red_but);
ShareInviteFragment.this.mCreateInviteBut.setClickable(true);
ShareInviteFragment.this.mCreateInviteBut.setText("生成推荐码");
}
}
private void shareToCode(boolean z2, String str, String str2) {
if (TextUtils.isEmpty(str)) {
r.a("请输入您的姓名");
} else if (!z2) {
Platform platform = ShareSDK.getPlatform(getActivity(), Wechat.NAME);
Wechat.ShareParams shareParams = new Wechat.ShareParams();
shareParams.setShareType(4);
shareParams.setImageData(BitmapFactory.decodeResource(getResources(), R.drawable.icon_launcher));
shareParams.setTitle(str + "的推荐函");
shareParams.setText("有机生活,健康自然!快来和我一起体验“中建三局生态”。");
shareParams.setTitleUrl("https://www.zjsjtz.com/download-invite.html?inviteCode=" + str2 + "&inviteName=" + str);
shareParams.setImageUrl("https://www.zjsjtz.com/public/app/cscec3b/statics/images/shop_log.jpg");
try {
shareParams.setUrl("https://www.zjsjtz.com/download-invite.html?inviteCode=" + str2 + "&inviteName=" + URLEncoder.encode(str, "utf-8"));
} catch (UnsupportedEncodingException e2) {
e2.printStackTrace();
}
platform.setPlatformActionListener(this);
platform.share(shareParams);
} else {
Platform platform2 = ShareSDK.getPlatform(getActivity(), QQ.NAME);
QQ.ShareParams shareParams2 = new QQ.ShareParams();
shareParams2.setTitle(str + "的推荐函");
shareParams2.setText("有机生活,健康自然!快来和我一起体验“中建三局生态”。");
shareParams2.setTitleUrl("https://www.zjsjtz.com/download-invite.html?inviteCode=" + str2 + "&inviteName=" + str);
shareParams2.setSiteUrl("https://www.zjsjtz.com/download-invite.html?inviteCode=" + str2 + "&inviteName=" + str);
shareParams2.setImageUrl("https://www.zjsjtz.com/public/app/cscec3b/statics/images/shop_log.jpg");
try {
shareParams2.setUrl("https://www.zjsjtz.com/download-invite.html?inviteCode=" + str2 + "&inviteName=" + URLEncoder.encode(str, "utf-8"));
} catch (UnsupportedEncodingException e3) {
e3.printStackTrace();
}
platform2.setPlatformActionListener(this);
platform2.share(shareParams2);
}
}
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
public void onComplete(Platform platform, int i2, HashMap<String, Object> hashMap) {
r.a("分享成功");
f.a().a(f.f19144a, "");
this.mShareNumber.setText("");
}
@Override
public void onError(Platform platform, int i2, Throwable th) {
r.a("分享错误");
}
@Override
public void onCancel(Platform platform, int i2) {
r.a("分享取消");
}
public boolean isWeixinAvilible() {
List<PackageInfo> installedPackages = getActivity().getPackageManager().getInstalledPackages(0);
if (installedPackages != null) {
for (int i2 = 0; i2 < installedPackages.size(); i2++) {
if (installedPackages.get(i2).packageName.equals(b.C0119b.f18926a)) {
return true;
}
}
}
return false;
}
public boolean isQQClientAvailable() {
List<PackageInfo> installedPackages = getActivity().getApplicationContext().getPackageManager().getInstalledPackages(0);
if (installedPackages != null) {
for (int i2 = 0; i2 < installedPackages.size(); i2++) {
if (installedPackages.get(i2).packageName.equals("com.tencent.mobileqq")) {
return true;
}
}
}
return false;
}
private class CreateInviteTask implements e {
private CreateInviteTask() {
}
@Override
public void task_response(String str) {
Log.i("aInvite====>", str);
try {
JSONObject jSONObject = new JSONObject(str);
if (TextUtils.equals(jSONObject.optString("rsp"), "succ")) {
ShareInviteFragment.this.mShareNumber.setText(((InviteModel) new Gson().fromJson(jSONObject.optString("data"), (Class<Object>) InviteModel.class)).getCode());
} else {
r.a(ShareInviteFragment.this.getActivity(), jSONObject.optString("data"));
}
} catch (Exception e2) {
e2.printStackTrace();
r.a(ShareInviteFragment.this.getActivity(), "获取数据异常");
}
ShareInviteFragment.this.hideLoadingDialog_mt();
}
@Override
public fu.c task_request() {
ShareInviteFragment.this.showCancelableLoadingDialog();
return new fu.c(k.T);
}
}
}