use of lib.data.HttpTransaction in project LibTest by liudao01.
the class ListHttpAdapter method baseGetView.
@Override
public void baseGetView(final int position, View v, ViewHolder vh) {
if (list == null || list.size() <= 0) {
return;
}
HttpTransaction transaction = (HttpTransaction) list.get(position);
// Logger.d(" 每个item 的值 = "+transaction.toString());
TextView code;
TextView path;
TextView host;
TextView start;
TextView duration;
TextView size;
ImageView ssl;
code = (TextView) vh.getTextView(R.id.code);
path = (TextView) vh.getTextView(R.id.path);
host = (TextView) vh.getTextView(R.id.host);
start = (TextView) vh.getTextView(R.id.start);
duration = (TextView) vh.getTextView(R.id.duration);
size = (TextView) vh.getTextView(R.id.size);
ssl = (ImageView) vh.getImageView(R.id.ssl);
Button mBtCopyData;
mBtCopyData = vh.getButton(R.id.bt_copy_data);
path.setText(transaction.getMethod() + " " + transaction.getPath());
host.setText(transaction.getHost());
start.setText(transaction.getRequestStartTimeString());
ssl.setVisibility(transaction.isSsl() ? View.VISIBLE : View.GONE);
if (transaction.getStatus() == HttpTransaction.Status.Complete) {
code.setText(String.valueOf(transaction.getResponseCode()));
duration.setText(transaction.getDurationString());
size.setText(transaction.getTotalSizeString());
} else {
code.setText(null);
duration.setText(null);
size.setText(null);
}
if (transaction.getStatus() == HttpTransaction.Status.Failed) {
code.setText("!!!");
}
mBtCopyData.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
HttpTransaction httpTransaction = (HttpTransaction) TestLibUtil.httpMoudleList.get(position);
Utils.copy(context, "请求方式: " + httpTransaction.getMethod() + "\n" + "请求地址: " + httpTransaction.getUrl() + "\n" + "请求参数: " + httpTransaction.getRequestBody() + "\n请求结果:" + httpTransaction.getFormattedResponseBody());
}
});
setStatusColor(vh, transaction);
}
use of lib.data.HttpTransaction 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;
}
use of lib.data.HttpTransaction in project LibTest by liudao01.
the class HttpNavigatorContent method onItemLongClick.
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
HttpTransaction httpTransaction = getHttpTransactionList().get(position);
Utils.copy(context, "请求方式: " + httpTransaction.getMethod() + "\n" + "请求地址: " + httpTransaction.getUrl() + "\n" + "请求参数: " + httpTransaction.getRequestBody());
return true;
}
use of lib.data.HttpTransaction in project LibTest by liudao01.
the class HttpNavigatorContent method setList.
public static void setList() {
if (TestLibUtil.httpMoudleList != null) {
if (listHttpAdapter != null) {
List<HttpTransaction> httpMoudleList = TestLibUtil.httpMoudleList;
Message message = Message.obtain();
message.obj = httpMoudleList;
handler.sendMessage(message);
}
}
}
Aggregations