use of lib.net.ListHttpAdapter in project LibTest by liudao01.
the class NetHoverMenuScreen method initView.
// // private View createScreenView() {
// // TextView wholeScreen = new TextView(mContext);
// // wholeScreen.setText("Screen: " + mPageTitle);
// // wholeScreen.setGravity(Gravity.CENTER);
// // return wholeScreen;
// // } @NonNull
private View initView() {
view = LayoutInflater.from(mContext).inflate(R.layout.result_list, null);
httpResult = (LinearLayout) view.findViewById(R.id.http_result);
httpResultList = (LinearLayout) view.findViewById(R.id.http_result_list);
btCopy = (Button) view.findViewById(R.id.bt_copy);
btClear = (Button) view.findViewById(R.id.bt_clear);
listview = (ListView) view.findViewById(R.id.listview);
listview.setOnItemClickListener(this);
listview.setOnItemLongClickListener(this);
httpTransactionList = TestLibUtil.httpMoudleList;
if (httpTransactionList != null && httpTransactionList.size() > 0) {
// 倒序刚发的在最前面
Collections.reverse(httpTransactionList);
}
listHttpAdapter = new ListHttpAdapter(mContext, httpTransactionList);
listview.setAdapter(listHttpAdapter);
btClear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
TestLibUtil.httpMoudleList.clear();
httpTransactionList.clear();
listHttpAdapter.setList(httpTransactionList);
}
});
// 拷贝返回的数据
btCopy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
HttpTransaction httpTransaction = httpTransactionList.get(clickPosition);
Utils.copy(mContext, "返回数据: " + httpTransaction.getFormattedResponseBody());
}
});
return view;
}
Aggregations