正在查看: 新暖心缘 v8.1.1 应用的 ActiveCommentActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 新暖心缘 v8.1.1 应用的 ActiveCommentActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.luanxingyuan.app.activity;
import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.OnClick;
import com.luanxingyuan.app.base.BaseActivity;
import com.luanxingyuan.app.base.BaseResponse;
import com.luanxingyuan.app.bean.ActiveCommentBean;
import com.luanxingyuan.app.bean.PageBean;
import com.luanxingyuan.app.util.ParamUtil;
import com.luanxingyuan.app.util.ToastUtil;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import k6.b;
public class ActiveCommentActivity extends BaseActivity {
private int mActorId;
private k6.b mAdapter;
private int mCommentCount;
@BindView
EditText mCommentEt;
@BindView
RecyclerView mContentRv;
private int mDynamicId;
@BindView
TextView mNumberTv;
@BindView
SmartRefreshLayout mRefreshLayout;
private int mCurrentPage = 1;
private List<ActiveCommentBean> mFocusBeans = new ArrayList();
class a extends r6.a<BaseResponse<PageBean<ActiveCommentBean>>> {
final boolean f6038a;
final m7.i f6039b;
a(boolean z7, m7.i iVar) {
this.f6038a = z7;
this.f6039b = iVar;
}
@Override
public void onError(x8.e eVar, Exception exc, int i8) {
super.onError(eVar, exc, i8);
ToastUtil.showToast(ActiveCommentActivity.this.getApplicationContext(), 2131821363);
if (this.f6038a) {
this.f6039b.d();
} else {
this.f6039b.a();
}
}
public void onResponse(BaseResponse<PageBean<ActiveCommentBean>> baseResponse, int i8) {
List<ActiveCommentBean> list;
if (baseResponse == null || baseResponse.m_istatus != 1) {
ToastUtil.showToast(ActiveCommentActivity.this.getApplicationContext(), 2131821363);
if (this.f6038a) {
this.f6039b.d();
return;
} else {
this.f6039b.a();
return;
}
}
PageBean<ActiveCommentBean> pageBean = baseResponse.m_object;
if (pageBean == null || (list = pageBean.data) == null) {
return;
}
int size = list.size();
if (this.f6038a) {
ActiveCommentActivity.this.mCurrentPage = 1;
ActiveCommentActivity.this.mFocusBeans.clear();
ActiveCommentActivity.this.mFocusBeans.addAll(list);
ActiveCommentActivity.this.mAdapter.b(ActiveCommentActivity.this.mFocusBeans);
this.f6039b.d();
if (size >= 10) {
this.f6039b.f(true);
}
} else {
ActiveCommentActivity.access$008(ActiveCommentActivity.this);
ActiveCommentActivity.this.mFocusBeans.addAll(list);
ActiveCommentActivity.this.mAdapter.b(ActiveCommentActivity.this.mFocusBeans);
if (size >= 10) {
this.f6039b.a();
}
}
if (size < 10) {
this.f6039b.c();
}
}
}
class b implements s7.d {
b() {
}
@Override
public void d(m7.i iVar) {
ActiveCommentActivity.this.getCommentList(iVar, true, 1);
}
}
class c implements s7.b {
c() {
}
@Override
public void c(m7.i iVar) {
ActiveCommentActivity activeCommentActivity = ActiveCommentActivity.this;
activeCommentActivity.getCommentList(iVar, false, activeCommentActivity.mCurrentPage + 1);
}
}
class d implements b.c {
d() {
}
@Override
public void a(String str) {
ActiveCommentActivity.this.deleteComment(str);
}
}
class e extends r6.a<BaseResponse> {
e() {
}
public void onResponse(BaseResponse baseResponse, int i8) {
if (baseResponse == null || baseResponse.m_istatus != 1) {
ToastUtil.showToast(ActiveCommentActivity.this.getApplicationContext(), 2131820812);
return;
}
ToastUtil.showToast(ActiveCommentActivity.this.getApplicationContext(), 2131820813);
if (ActiveCommentActivity.this.mCommentCount > 0) {
ActiveCommentActivity.access$510(ActiveCommentActivity.this);
ActiveCommentActivity.this.mNumberTv.setText(ActiveCommentActivity.this.getResources().getString(2131820772) + ActiveCommentActivity.this.mCommentCount);
}
ActiveCommentActivity activeCommentActivity = ActiveCommentActivity.this;
activeCommentActivity.getCommentList(activeCommentActivity.mRefreshLayout, true, 1);
}
}
class f extends r6.a<BaseResponse> {
f() {
}
@Override
public void onError(x8.e eVar, Exception exc, int i8) {
super.onError(eVar, exc, i8);
ToastUtil.showToast(ActiveCommentActivity.this.getApplicationContext(), 2131820771);
}
public void onResponse(BaseResponse baseResponse, int i8) {
if (baseResponse == null || baseResponse.m_istatus != 1) {
ToastUtil.showToast(ActiveCommentActivity.this.getApplicationContext(), 2131820771);
return;
}
ToastUtil.showToast(ActiveCommentActivity.this.getApplicationContext(), 2131820775);
ActiveCommentActivity activeCommentActivity = ActiveCommentActivity.this;
activeCommentActivity.closeSoft(activeCommentActivity.mCommentEt);
ActiveCommentActivity.this.finish();
}
}
static int access$008(ActiveCommentActivity activeCommentActivity) {
int i8 = activeCommentActivity.mCurrentPage;
activeCommentActivity.mCurrentPage = i8 + 1;
return i8;
}
static int access$510(ActiveCommentActivity activeCommentActivity) {
int i8 = activeCommentActivity.mCommentCount;
activeCommentActivity.mCommentCount = i8 - 1;
return i8;
}
public void closeSoft(EditText editText) {
InputMethodManager inputMethodManager;
if (editText != null) {
try {
if (editText.hasFocus() && (inputMethodManager = (InputMethodManager) getApplicationContext().getSystemService("input_method")) != null && inputMethodManager.isActive()) {
inputMethodManager.hideSoftInputFromWindow(editText.getWindowToken(), 0);
}
} catch (Exception e8) {
e8.printStackTrace();
}
}
}
public void deleteComment(String str) {
HashMap hashMap = new HashMap();
hashMap.put("userId", getUserId());
hashMap.put("commentId", str);
x7.a.h().c(m6.a.j()).e("param", ParamUtil.getParam(hashMap)).f().c(new e());
}
public void getCommentList(m7.i iVar, boolean z7, int i8) {
HashMap hashMap = new HashMap();
hashMap.put("userId", getUserId());
hashMap.put("dynamicId", String.valueOf(this.mDynamicId));
hashMap.put("page", String.valueOf(i8));
x7.a.h().c(m6.a.B()).e("param", ParamUtil.getParam(hashMap)).f().c(new a(z7, iVar));
}
private void initRecycler() {
this.mRefreshLayout.T(new b());
this.mRefreshLayout.S(new c());
this.mContentRv.setLayoutManager(new LinearLayoutManager(this));
k6.b bVar = new k6.b(this);
this.mAdapter = bVar;
this.mContentRv.setAdapter(bVar);
this.mAdapter.c(new d());
}
private void initStart() {
this.mDynamicId = getIntent().getIntExtra("active_id", 0);
this.mActorId = getIntent().getIntExtra("actor_id", 0);
this.mCommentCount = getIntent().getIntExtra("comment_number", 0);
this.mNumberTv.setText(getResources().getString(2131820772) + this.mCommentCount);
if (this.mDynamicId > 0) {
getCommentList(this.mRefreshLayout, true, 1);
}
}
private void postComment() {
String trim = this.mCommentEt.getText().toString().trim();
if (TextUtils.isEmpty(trim)) {
ToastUtil.showToast(getApplicationContext(), 2131821175);
return;
}
HashMap hashMap = new HashMap();
hashMap.put("userId", getUserId());
hashMap.put("coverUserId", String.valueOf(this.mActorId));
hashMap.put("comment", trim);
hashMap.put("dynamicId", String.valueOf(this.mDynamicId));
x7.a.h().c(m6.a.o()).e("param", ParamUtil.getParam(hashMap)).f().c(new f());
}
@Override
protected View getContentView() {
return inflate(2131492893);
}
@OnClick
public void onClick(View view) {
int id = view.getId();
if (id == 2131297225) {
postComment();
} else {
if (id != 2131297349) {
return;
}
finish();
}
}
@Override
protected void onContentAdded() {
needHeader(false);
initStart();
initRecycler();
}
}