正在查看: 自健身 v3.3.4 应用的 InviteActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 自健身 v3.3.4 应用的 InviteActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.mu.gymtrain.Activity;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import com.blankj.utilcode.util.LogUtils;
import com.mu.gymtrain.Adapter.InviteListAdapter;
import com.mu.gymtrain.Base.BaseActivity;
import com.mu.gymtrain.Bean.InviteADEntity;
import com.mu.gymtrain.Bean.InviteListEntity;
import com.mu.gymtrain.Bean.SucessBean;
import com.mu.gymtrain.Http.HttpCallBack;
import com.mu.gymtrain.Http.HttpHelper;
import com.mu.gymtrain.R;
import com.mu.gymtrain.Utils.FinalTools;
import com.mu.gymtrain.Utils.InputUtils;
import com.mu.gymtrain.view.DialogUtils;
import com.tencent.open.SocialConstants;
public class InviteActivity extends BaseActivity {
private InviteListAdapter adapter;
@BindView(R.id.etPhone)
EditText etPhone;
@BindView(R.id.title_left)
ImageView imgLeft;
@BindView(R.id.title_right)
ImageView imgRight;
private DialogUtils mDialog;
@BindView(2131297022)
RecyclerView recyclerView;
private TextView text;
@BindView(R.id.title1)
TextView text1;
@BindView(2131297193)
TextView text2;
@BindView(R.id.text3)
TextView text3;
@BindView(R.id.title_middle)
TextView title;
@BindView(R.id.tvInvite)
TextView tvInvite;
public int getContentLayout() {
return R.layout.activity_invite_layout;
}
public void initView() {
this.title.setText("邀请好友");
this.imgLeft.setOnClickListener(this);
this.imgRight.setOnClickListener(this);
this.tvInvite.setOnClickListener(this);
}
public void initData() {
this.recyclerView.setLayoutManager(new LinearLayoutManager(this));
InviteListAdapter inviteListAdapter = new InviteListAdapter();
this.adapter = inviteListAdapter;
this.recyclerView.setAdapter(inviteListAdapter);
View inflate = LayoutInflater.from(this).inflate(R.layout.dialog_invite_layout, (ViewGroup) null, false);
this.mDialog = new DialogUtils.Builder(this).setGravity(17).setOutCancelEnable(false).setContentView(inflate).create();
inflate.findViewById(R.id.tvOk).setOnClickListener(this);
this.text = (TextView) inflate.findViewById(2131297190);
this.text1.setText("邀请好友加入自健身");
this.text2.setText("得100元充值");
this.text3.setText("邀请好友注册APP并扫码进门即可");
requestList();
}
private void requestADText() {
showProgress();
HttpHelper.getInstance().getRetrofitService(this).getADText(getToken()).enqueue(new HttpCallBack<InviteADEntity>() {
@Override
public void onSuccess(InviteADEntity entity, String json) {
InviteActivity.this.dismissProgress();
if (entity.getData() == null) {
return;
}
InviteActivity.this.text1.setText(entity.getData().getL1());
InviteActivity.this.text2.setText(entity.getData().getL2());
InviteActivity.this.text3.setText(entity.getData().getL3());
}
@Override
public void onFail(String str) {
InviteActivity.this.dismissProgress();
}
});
}
private void requestList() {
HttpHelper.getInstance().getRetrofitService(this).getADList(getToken()).enqueue(new HttpCallBack<InviteListEntity>() {
@Override
public void onSuccess(InviteListEntity entity, String json) {
InviteActivity.this.dismissProgress();
LogUtils.i(new Object[]{json});
InviteActivity.this.adapter.setNewData(entity.getData());
}
@Override
public void onFail(String str) {
InviteActivity.this.dismissProgress();
LogUtils.i(new Object[]{str});
}
});
}
public void onClick(View v) {
super.onClick(v);
switch (v.getId()) {
case R.id.title_left:
finish();
break;
case R.id.title_right:
Intent intent = new Intent((Context) this, (Class<?>) WebViewActivity.class);
intent.putExtra(SocialConstants.PARAM_URL, "https://www.zijianshen.com/public/invite_toknow.php");
intent.putExtra(FinalTools.INTENT_COMMON, "邀请规则");
startActivity(intent);
break;
case R.id.tvInvite:
InputUtils.hideInput(this);
submit();
break;
case R.id.tvOk:
this.mDialog.dismiss();
break;
}
}
private void submit() {
String obj = this.etPhone.getText().toString();
if (TextUtils.isEmpty(obj) || obj.length() != 11) {
showToast("请填写正确的手机号");
} else {
showProgress();
HttpHelper.getInstance().getRetrofitService(this).inviteFriend(getToken(), obj).enqueue(new HttpCallBack<SucessBean>() {
@Override
public void onSuccess(SucessBean sucessBean, String json) {
InviteActivity.this.dismissProgress();
InviteActivity.this.etPhone.setText("");
if (sucessBean.code == 30201) {
InviteActivity.this.text.setText("该用户已经注册App\n不能再次邀请");
} else if (sucessBean.code == 10000) {
InviteActivity.this.text.setText("邀请成功\n告知好友下载App");
} else {
InviteActivity.this.text.setText(sucessBean.message);
}
InviteActivity.this.mDialog.show();
}
@Override
public void onFail(String str) {
InviteActivity.this.dismissProgress();
}
});
}
}
}