• 大小: 120KB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-06-07
  • 语言: Java
  • 标签: Android  

资源简介

Android 单线程获取局域网在线设备,极速刷新arp文件并读取内容 从4分30s 优化到 0.150s

资源截图

代码片段和文件信息

package com.area.device.activity;

import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.area.device.R;
import com.area.device.adapter.AreaDeviceAdapter;
import com.area.device.base.baseActivity;
import com.area.device.bean.AreaDeviceBean;
import com.area.device.iview.IAreaDeviceView;
import com.area.device.present.AreaDevicePresent;


/**
 * Created by user on 2017/5/9.
 */

public class AreaNetDeviceActivity extends baseActivity implements IAreaDeviceView {
    private TextView mNumTv;
    private ImageView mLocalIv;
    private TextView mLocalNameTv;
    private TextView mLocalIpTv;
    private TextView mLocalMacTv;
    private ListView mListView;
    private AreaDeviceAdapter mAdapter;
    private AreaDevicePresent mPresent;

    @Override
    public void setContentView() {
        setContentView(R.layout.activity_area_device);
    }

    @Override
    public void findView() {
        mNumTv = (TextView) findViewById(R.id.activity_area_device_conn_num);

        mLocalIv = (ImageView) findViewById(R.id.item_area_device_iv);
        mLocalNameTv = (TextView) findViewById(R.id.item_area_device_name);
        mLocalIpTv = (TextView) findViewById(R.id.item_area_device_ip);
        mLocalMacTv = (TextView) findViewById(R.id.item_area_device_mac);

        mListView = (ListView) findViewById(R.id.activity_area_device_list);
    }

    @Override
    public void initView() {

    }


    @Override
    public void initData() {
        mPresent = new AreaDevicePresent(this mContext);
        mAdapter = new AreaDeviceAdapter(mContext mPresent.getData());
        mListView.setAdapter(mAdapter);
    }

    @Override
    public void initListener() {

    }

    @Override
    public void upLocalData(AreaDeviceBean localBean) {
        mLocalIv.setImageResource(localBean.getResId());
        mLocalNameTv.setText(localBean.getName());
        mLocalIpTv.setText(localBean.getIp());
        mLocalMacTv.setText(localBean.getMac());
    }

    @Override
    public void upListData(boolean isChange int numDevice) {
        mNumTv.setText(String.valueOf(numDevice));
        if (isChange && mAdapter != null) {//避免异常
            mAdapter.notifyDataSetChanged();
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mPresent.onDestroy();
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-05-11 12:12  areaDevice\
     文件         127  2017-05-11 08:58  areaDevice\.gitignore
     目录           0  2017-05-11 08:58  areaDevice\.gradle\
     目录           0  2017-05-11 09:24  areaDevice\.gradle\2.14.1\
     目录           0  2017-05-11 08:58  areaDevice\.gradle\2.14.1\taskArtifacts\
     文件          31  2017-05-11 08:58  areaDevice\.gradle\2.14.1\taskArtifacts\cache.properties
     文件          17  2017-05-11 09:31  areaDevice\.gradle\2.14.1\taskArtifacts\cache.properties.lock
     文件       25744  2017-05-11 09:31  areaDevice\.gradle\2.14.1\taskArtifacts\fileHashes.bin
     文件      121544  2017-05-11 09:31  areaDevice\.gradle\2.14.1\taskArtifacts\fileSnapshots.bin
     文件       23894  2017-05-11 09:31  areaDevice\.gradle\2.14.1\taskArtifacts\fileSnapshotsToTreeSnapshotsIndex.bin
     文件       89884  2017-05-11 09:31  areaDevice\.gradle\2.14.1\taskArtifacts\taskArtifacts.bin
     目录           0  2017-05-11 09:24  areaDevice\.gradle\2.14.1\tasks\
     目录           0  2017-05-11 09:24  areaDevice\.gradle\2.14.1\tasks\_app_compileDebugJavaWithJavac\
     目录           0  2017-05-11 09:24  areaDevice\.gradle\2.14.1\tasks\_app_compileDebugJavaWithJavac\localClassSetAnalysis\
     文件       26292  2017-05-11 09:29  areaDevice\.gradle\2.14.1\tasks\_app_compileDebugJavaWithJavac\localClassSetAnalysis\localClassSetAnalysis.bin
     文件          17  2017-05-11 09:29  areaDevice\.gradle\2.14.1\tasks\_app_compileDebugJavaWithJavac\localClassSetAnalysis\localClassSetAnalysis.lock
     目录           0  2017-05-11 09:24  areaDevice\.gradle\2.14.1\tasks\_app_compileDebugJavaWithJavac\localJarClasspathSnapshot\
     文件       18820  2017-05-11 09:29  areaDevice\.gradle\2.14.1\tasks\_app_compileDebugJavaWithJavac\localJarClasspathSnapshot\localJarClasspathSnapshot.bin
     文件          17  2017-05-11 09:29  areaDevice\.gradle\2.14.1\tasks\_app_compileDebugJavaWithJavac\localJarClasspathSnapshot\localJarClasspathSnapshot.lock
     目录           0  2017-05-11 09:37  areaDevice\.idea\
     文件         686  2017-05-11 08:58  areaDevice\.idea\compiler.xml
     目录           0  2017-05-11 08:58  areaDevice\.idea\copyright\
     文件          76  2017-05-11 08:58  areaDevice\.idea\copyright\profiles_settings.xml
     目录           0  2017-05-11 08:59  areaDevice\.idea\dictionaries\
     文件          85  2017-05-11 08:59  areaDevice\.idea\dictionaries\user.xml
     文件         159  2017-05-11 08:58  areaDevice\.idea\encodings.xml
     文件         626  2017-05-11 08:58  areaDevice\.idea\gradle.xml
     目录           0  2017-05-11 09:22  areaDevice\.idea\libraries\
     文件         589  2017-05-11 09:22  areaDevice\.idea\libraries\rxandroid_1_2_1.xml
     文件         501  2017-05-11 09:22  areaDevice\.idea\libraries\rxjava_1_1_6.xml
     文件        4801  2017-05-11 09:22  areaDevice\.idea\misc.xml
............此处省略52个文件信息

评论

共有 条评论