柬埔寨通 v6.1.5版本的 MD5 值为:9b68581ac30883219d6a25858a099d6b
以下内容为反编译后的 CircleFragmentList.java 源代码,内容仅作参考
package net.duohuo.magappx.circle.circle;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.TextView;
import butterknife.BindColor;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jianpuzhaitong.forum.R;
import java.util.List;
import net.duohuo.core.adapter.DataPage;
import net.duohuo.core.adapter.DataPageAdapter;
import net.duohuo.core.build.UrlSchemeProxy;
import net.duohuo.core.dataview.TypeBean;
import net.duohuo.core.ioc.Ioc;
import net.duohuo.core.net.Net;
import net.duohuo.core.net.Result;
import net.duohuo.core.net.Task;
import net.duohuo.core.net.cache.CachePolicy;
import net.duohuo.core.util.SafeJsonUtil;
import net.duohuo.magappx.API;
import net.duohuo.magappx.DataViewType;
import net.duohuo.magappx.SiteConfig;
import net.duohuo.magappx.UrlScheme;
import net.duohuo.magappx.circle.circle.model.CircleListItem;
import net.duohuo.magappx.circle.show.model.ShowItem;
import net.duohuo.magappx.common.dataview.DataViewUtil;
import net.duohuo.magappx.common.util.Constants;
import net.duohuo.magappx.common.util.FilterUtil;
import net.duohuo.magappx.common.util.ReadRecordUtil;
import net.duohuo.magappx.common.view.MagListView;
import net.duohuo.magappx.common.view.NavibarView;
import net.duohuo.magappx.common.view.NetTabHeadView;
import net.duohuo.magappx.info.model.InfoItem;
import net.duohuo.magappx.main.indextab.TabFragment;
import net.duohuo.magappx.main.login.UserApi;
public class CircleFragmentList extends TabFragment implements NetTabHeadView.OnStringTabChangeListener {
DataPageAdapter adapter;
String catId;
SiteConfig config;
@BindColor(R.color.grey_bg)
int grey_bg;
Handler handler = new Handler() {
@Override
public void handleMessage(Message message) {
super.handleMessage(message);
CircleFragmentList circleFragmentList = CircleFragmentList.this;
circleFragmentList.updateCatId(circleFragmentList.catId);
CircleFragmentList.this.listView.setSelection(CircleFragmentList.this.listView.getHeaderViewsCount() - 1);
}
};
List<CircleListItem> listItem;
@BindView(R.id.listview)
MagListView listView;
@BindView(R.id.navi_action)
ImageView naviActionV;
@BindView(R.id.navi_tabs)
LinearLayout naviTabs;
@BindView(R.id.navi_title)
TextView naviTitle;
@BindView(R.id.navibar)
NavibarView navibarView;
@BindView(R.id.navigator_bar)
View normalNaviV;
private NetTabHeadView tabs;
@BindView(R.id.tabs_box)
ViewGroup tabsLayout;
LinearLayout topLayout;
private JSONArray totalArray;
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View inflate = layoutInflater.inflate(R.layout.circle_index_style_three, (ViewGroup) null);
ButterKnife.bind(this, inflate);
return inflate;
}
@Override
public void onActivityCreated(Bundle bundle) {
super.onActivityCreated(bundle);
int i = getArguments().getInt(Constants.HOME_POSITION, -1);
if (i >= 0) {
this.navibarView.setData(i);
this.navibarView.setVisibility(0);
this.normalNaviV.setVisibility(8);
} else {
this.navibarView.setVisibility(8);
this.normalNaviV.setVisibility(0);
}
this.naviTitle.setText(getResources().getString(R.string.tab_circle));
this.config = (SiteConfig) Ioc.get(SiteConfig.class);
this.naviActionV.setImageResource("FFFFFF".equals(getResources().getString(R.string.navigator_bg)) ? R.drawable.fb_f : R.drawable.fb_n);
LinearLayout linearLayout = new LinearLayout(getActivity());
this.topLayout = linearLayout;
linearLayout.setOrientation(1);
NetTabHeadView netTabHeadView = new NetTabHeadView(getActivity());
this.tabs = netTabHeadView;
netTabHeadView.setOnStringTabChangeListener(this);
this.tabs.setTopLineBackgroundResource(R.color.white);
this.listView.addHeaderView(this.topLayout);
final View inflate = LayoutInflater.from(getActivity()).inflate(R.layout.dataview_wrap_layout_q, (ViewGroup) null);
this.listView.setBackgroundResource(R.color.white);
DataPageAdapter dataPageAdapter = new DataPageAdapter(getActivity(), "https://app.jpztong.com/mag/info/v3/info/infoListByCatId", "info_item", this);
this.adapter = dataPageAdapter;
dataPageAdapter.param("is_app_first", 1);
this.adapter.setDataBuilder(new DataPage.DataBuilder() {
@Override
public List buildList(Result result, int i2) {
if (!result.success()) {
return null;
}
JSONArray jSONArray = result.json().getJSONArray("list");
String string = result.json().getString("style");
if (jSONArray == null) {
jSONArray = new JSONArray();
}
int i3 = 0;
if (Constants.KAPIAN_STYLE.equals(string)) {
JSONArray jSONArray2 = new JSONArray();
if (i2 > 1) {
try {
if (CircleFragmentList.this.adapter.getValues().size() > 0 && (((TypeBean) CircleFragmentList.this.adapter.getTItem(CircleFragmentList.this.adapter.getCount() - 1)).getData() instanceof ShowItem) && ((ShowItem) ((TypeBean) CircleFragmentList.this.adapter.getTItem(CircleFragmentList.this.adapter.getCount() - 1)).getData()).getWetherFallyItems().size() == 1) {
((ShowItem) ((TypeBean) CircleFragmentList.this.adapter.getTItem(CircleFragmentList.this.adapter.getCount() - 1)).getData()).getWetherFallyItems().add((ShowItem.WetherFallyItem) JSON.parseObject(jSONArray.getJSONObject(0).toJSONString(), ShowItem.WetherFallyItem.class));
jSONArray.remove(0);
}
} catch (Exception unused) {
}
}
int size = jSONArray.size();
while (i3 < jSONArray.size() + ((jSONArray.size() - size) % 2)) {
JSONObject jSONObject = new JSONObject();
JSONArray jSONArray3 = new JSONArray();
jSONArray2.add(jSONObject);
jSONObject.put(DataViewType.show_item, (Object) jSONArray3);
jSONObject.put("_type", (Object) "show_waterfally");
jSONArray3.add(jSONArray.getJSONObject(i3));
int i4 = i3 + 1;
if (i4 < jSONArray.size()) {
jSONArray3.add(jSONArray.getJSONObject(i4));
}
i3 += 2;
}
jSONArray = jSONArray2;
} else {
if (i2 == 1) {
if ("weibo".equals(string) || "pintu".equals(string) || Constants.WEIBO_DES.equals(string)) {
CircleFragmentList.this.adapter.setWrapLayout(R.layout.dataview_wrap_layout_q, R.id.container);
} else {
CircleFragmentList.this.adapter.setWrapLayout(0, 0);
}
}
while (i3 < jSONArray.size()) {
JSONObject jSONObject2 = jSONArray.getJSONObject(i3);
if ("pintu".equals(jSONObject2.getString("style_type"))) {
jSONObject2.put("_type", "pintu");
} else if (Constants.NORMAL_FRIEND.equals(jSONObject2.getString("style_type"))) {
jSONObject2.put("_type", DataViewType.show_item);
} else if ("weibo".equals(jSONObject2.getString("style_type")) || Constants.WEIBO_DES.equals(jSONObject2.getString("style_type")) || "weibo".equals(jSONObject2.getString("style")) || Constants.WEIBO_DES.equals(jSONObject2.getString("style"))) {
jSONObject2.put("_type", DataViewType.weibo_from_circle_forum);
} else if (!result.isCache()) {
jSONObject2.put("isReadContent", Boolean.valueOf(ReadRecordUtil.isReadRecord(jSONObject2.getString("id"), "info_item")));
}
i3++;
}
}
return TypeBean.parseList(jSONArray.toJSONString(), InfoItem.class);
}
});
this.adapter.cache();
this.listView.setAdapter((ListAdapter) this.adapter);
this.adapter.addOnLoadSuccessCallBack(new DataPage.OnLoadSuccessCallBack() {
@Override
public void onLoadSuccess(Task task, int i2) {
if (task.getResult().success()) {
if (i2 == 1) {
CircleFragmentList.this.totalArray = (JSONArray) task.getResult().get("totalList");
}
if (!task.getResult().isCache()) {
CircleFragmentList.this.adapter.param("is_app_first", -1);
}
if (CircleFragmentList.this.listItem.size() > 1) {
CircleFragmentList.this.listView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView absListView, int i3) {
}
@Override
public void onScroll(AbsListView absListView, int i3, int i4, int i5) {
if (CircleFragmentList.this.tabs.isOutParent(0) || i3 + 1 > CircleFragmentList.this.listView.getHeaderViewsCount() - 1) {
CircleFragmentList.this.tabs.tabsAddTo(CircleFragmentList.this.tabsLayout);
} else {
CircleFragmentList.this.tabs.resetTabs();
}
}
});
}
}
}
});
this.adapter.setOnLoadPageListener(new DataPage.OnLoadPageListener() {
@Override
public void onLoadPageListener(int i2) {
if (i2 != 1) {
CircleFragmentList.this.adapter.param("content_id", FilterUtil.filterVideoIds(i2, CircleFragmentList.this.totalArray));
}
}
});
Net url = Net.url(API.Circle.circleRecommend);
url.showProgress(false);
url.cache(CachePolicy.POLICY_BEFORE_AND_AFTER_NET);
url.get(new Task<Result>() {
@Override
public void onResult(Result result) {
JSONArray jSONArray = result.json().getJSONArray("tops");
CircleFragmentList.this.topLayout.removeAllViews();
if (jSONArray != null || jSONArray.size() > 0) {
DataViewUtil.addView(CircleFragmentList.this.topLayout, jSONArray);
}
CircleFragmentList.this.listItem = JSON.parseArray(result.json().getJSONArray("cats_config").toJSONString(), CircleListItem.class);
CircleFragmentList.this.listView.removeHeaderView(inflate);
CircleFragmentList.this.listView.addHeaderView(inflate);
CircleFragmentList.this.listView.removeHeaderView(CircleFragmentList.this.tabs.getRootView());
if (CircleFragmentList.this.listItem.size() > 1) {
CircleFragmentList.this.listView.addHeaderView(CircleFragmentList.this.tabs.getRootView());
}
CircleFragmentList circleFragmentList = CircleFragmentList.this;
circleFragmentList.updateCatId(circleFragmentList.listItem.get(0).getCatId());
CircleFragmentList.this.tabs.setTabs(CircleFragmentList.this.listItem);
}
});
this.listView.setAutoLoad();
}
public void updateCatId(String str) {
this.adapter.param("cat_id", str);
this.adapter.refresh();
}
@OnClick({R.id.navi_action})
public void onNavActionClick(View view) {
UserApi.afterLogin(getActivity(), new UserApi.LoginCallBack() {
@Override
public void onLogin() {
JSONObject parseJSONObject = SafeJsonUtil.parseJSONObject(CircleFragmentList.this.config.jump_to_forum);
if (parseJSONObject == null || parseJSONObject.isEmpty()) {
UrlScheme.toUrl(CircleFragmentList.this.getActivity(), UrlScheme.appcode + "://groupTree?type=1");
return;
}
try {
UrlSchemeProxy.threadPost(CircleFragmentList.this.getContext()).circleId(parseJSONObject.getString("id")).fid(parseJSONObject.getString("fid")).name(parseJSONObject.getString("name")).go();
} catch (Exception e) {
e.getMessage();
}
}
});
}
@Override
public void onTabStringChange(int i, String str) {
this.catId = str;
if (this.listItem.size() > 1) {
this.handler.sendEmptyMessageAtTime(i, 100L);
}
}
@Override
public void onDestroy() {
super.onDestroy();
this.handler.removeCallbacksAndMessages(null);
}
}