Search in sources :

Example 1 with ListHttpAdapter

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;
}
Also used : HttpTransaction(lib.data.HttpTransaction) ListHttpAdapter(lib.net.ListHttpAdapter) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Aggregations

View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 HttpTransaction (lib.data.HttpTransaction)1 ListHttpAdapter (lib.net.ListHttpAdapter)1