柬埔寨通 v6.1.5版本的 MD5 值为:9b68581ac30883219d6a25858a099d6b
以下内容为反编译后的 CircleListFragment.java 源代码,内容仅作参考
package net.duohuo.magappx.circle.circle;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
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.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.ioc.Ioc;
import net.duohuo.core.net.Net;
import net.duohuo.core.net.Result;
import net.duohuo.core.net.Task;
import net.duohuo.magappx.API;
import net.duohuo.magappx.SiteConfig;
import net.duohuo.magappx.circle.circle.model.CircleListItem;
import net.duohuo.magappx.common.dataview.DataViewUtil;
import net.duohuo.magappx.common.util.FilterUtil;
import net.duohuo.magappx.common.view.CircleTabHeadView;
import net.duohuo.magappx.common.view.MagListView;
import net.duohuo.magappx.main.indextab.TabFragment;
public class CircleListFragment extends TabFragment implements CircleTabHeadView.OnStringTabChangeListener {
DataPageAdapter adapter;
String catId;
@BindColor(R.color.grey_bg)
int grey_bg;
List<CircleListItem> listItem;
@BindView(R.id.listview)
MagListView listView;
@BindView(R.id.navi_action)
View naviActionV;
@BindView(R.id.navi_tabs)
LinearLayout naviTabs;
@BindView(R.id.navi_title)
TextView naviTitle;
private CircleTabHeadView tabs;
@BindView(R.id.tabs_box)
ViewGroup tabsLayout;
LinearLayout topLayout;
private JSONArray totalArray;
int siez = 0;
int refreshSize = 0;
boolean isSize = false;
Handler handler = new Handler() {
@Override
public void handleMessage(Message message) {
super.handleMessage(message);
CircleListFragment circleListFragment = CircleListFragment.this;
circleListFragment.updateCatId(circleListFragment.catId, true);
CircleListFragment.this.isSize = true;
CircleListFragment.this.listView.setSelection(CircleListFragment.this.listView.getHeaderViewsCount() - 1);
}
};
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View inflate = layoutInflater.inflate(R.layout.circle_frament_list, (ViewGroup) null);
ButterKnife.bind(this, inflate);
return inflate;
}
@Override
public void onActivityCreated(Bundle bundle) {
super.onActivityCreated(bundle);
this.naviTitle.setText(getResources().getString(R.string.tab_circle));
LinearLayout linearLayout = new LinearLayout(getActivity());
this.topLayout = linearLayout;
linearLayout.setOrientation(1);
View inflate = View.inflate(getActivity(), R.layout.listv_item_line, null);
CircleTabHeadView circleTabHeadView = new CircleTabHeadView(getActivity());
this.tabs = circleTabHeadView;
circleTabHeadView.setOnStringTabChangeListener(this);
this.listView.addHeaderView(this.topLayout);
this.listView.addHeaderView(inflate);
this.listView.setBackgroundResource(R.color.white);
Net url = Net.url(API.Circle.circleRecommend);
url.showProgress(false);
url.get(new Task<Result>() {
@Override
public void onResult(Result result) {
JSONArray jSONArray = result.json().getJSONArray("tops");
if (jSONArray == null || jSONArray.size() == 0) {
return;
}
DataViewUtil.addView(CircleListFragment.this.topLayout, jSONArray);
CircleListFragment.this.listItem = JSON.parseArray(result.json().getJSONArray("cats_config").toJSONString(), CircleListItem.class);
CircleListFragment circleListFragment = CircleListFragment.this;
circleListFragment.siez = circleListFragment.listItem.size();
CircleListFragment circleListFragment2 = CircleListFragment.this;
circleListFragment2.updateCatId(circleListFragment2.listItem.get(0).getCatId(), false);
if (CircleListFragment.this.listItem.size() > 1) {
CircleListFragment.this.listView.addHeaderView(CircleListFragment.this.tabs.getRootView());
CircleListFragment.this.tabs.setTabs(CircleListFragment.this.listItem);
} else {
CircleListFragment.this.tabs.setTabs(null);
}
}
});
DataPageAdapter dataPageAdapter = new DataPageAdapter(getActivity(), "https://app.jpztong.com/mag/info/v3/info/infoListByCatId", "info_item") {
@Override
public void refresh() {
super.refresh();
CircleListFragment.this.refreshNetData();
}
};
this.adapter = dataPageAdapter;
this.listView.setAdapter((ListAdapter) dataPageAdapter);
this.adapter.param("is_app_first", 1);
this.adapter.addOnLoadSuccessCallBack(new DataPage.OnLoadSuccessCallBack() {
@Override
public void onLoadSuccess(Task task, int i) {
if (task.getResult().success()) {
if (i == 1) {
CircleListFragment.this.totalArray = (JSONArray) task.getResult().get("totalList");
}
if (!task.getResult().isCache()) {
CircleListFragment.this.adapter.param("is_app_first", -1);
}
if (CircleListFragment.this.listItem.size() > 1) {
CircleListFragment.this.listView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView absListView, int i2) {
}
@Override
public void onScroll(AbsListView absListView, int i2, int i3, int i4) {
if (CircleListFragment.this.tabs.isOutParent(0) || i2 + 1 > CircleListFragment.this.listView.getHeaderViewsCount() - 1) {
CircleListFragment.this.tabs.tabsAddTo(CircleListFragment.this.tabsLayout);
} else {
CircleListFragment.this.tabs.resetTabs();
}
}
});
}
}
}
});
this.adapter.setOnLoadPageListener(new DataPage.OnLoadPageListener() {
@Override
public void onLoadPageListener(int i) {
if (i != 1) {
CircleListFragment.this.adapter.param("content_id", FilterUtil.filterVideoIds(i, CircleListFragment.this.totalArray));
}
}
});
}
public void refreshNetData() {
Net url = Net.url(API.Circle.circleRecommend);
url.showProgress(false);
url.get(new Task<Result>() {
@Override
public void onResult(Result result) {
CircleListFragment.this.listItem = JSON.parseArray(result.json().getJSONArray("cats_config").toJSONString(), CircleListItem.class);
CircleListFragment circleListFragment = CircleListFragment.this;
circleListFragment.refreshSize = circleListFragment.listItem.size();
CircleListFragment.this.listView.removeHeaderView(CircleListFragment.this.tabs.getRootView());
if (CircleListFragment.this.listItem.size() > 1) {
CircleListFragment.this.listView.addHeaderView(CircleListFragment.this.tabs.getRootView());
CircleListFragment.this.tabs.setTabs(CircleListFragment.this.listItem);
} else {
CircleListFragment.this.tabs.setTabs(null);
}
if (CircleListFragment.this.isSize) {
if (CircleListFragment.this.refreshSize < CircleListFragment.this.siez) {
CircleListFragment.this.tabs.TabSize(CircleListFragment.this.siez);
CircleListFragment circleListFragment2 = CircleListFragment.this;
circleListFragment2.siez = circleListFragment2.refreshSize;
CircleListFragment.this.isSize = false;
return;
}
CircleListFragment circleListFragment3 = CircleListFragment.this;
circleListFragment3.updateCatId(circleListFragment3.catId, false);
}
}
});
}
public void updateCatId(String str, boolean z) {
this.adapter.param("cat_id", str);
if (z) {
this.adapter.refresh();
} else {
this.adapter.next();
}
}
@OnClick({R.id.navi_action})
public void onNavActionClick(View view) {
SiteConfig siteConfig = (SiteConfig) Ioc.get(SiteConfig.class);
if (TextUtils.isEmpty(siteConfig.seekUrl)) {
return;
}
UrlSchemeProxy.search(getActivity()).url(siteConfig.seekUrl).go();
}
@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);
}
}