use of com.dante.adapter.ProxyAdapter in project 91Pop by DanteAndroid.
the class ProxySettingActivity method init.
private void init() {
testAlertDialog = DialogUtils.initLodingDialog(this, "测试中,请稍候...");
String proxyHost = dataManager.getProxyIpAddress();
int port = dataManager.getProxyPort();
etDialogProxySettingIpAddress.setIpAddressStr(proxyHost);
etDialogProxySettingPort.setText(port == 0 ? "" : String.valueOf(port));
List<ProxyModel> data = new ArrayList<>();
proxyAdapter = new ProxyAdapter(R.layout.item_proxy, data);
recyclerViewProxySetting.setLayoutManager(new LinearLayoutManager(this));
recyclerViewProxySetting.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
View view = getLayoutInflater().inflate(R.layout.item_proxy, recyclerViewProxySetting, false);
proxyAdapter.setHeaderView(view);
proxyAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
presenter.parseXiCiDaiLi(false);
}
}, recyclerViewProxySetting);
proxyAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
ProxyModel proxyModel = (ProxyModel) adapter.getItem(position);
if (proxyModel == null) {
showMessage("数据出错了", TastyToast.WARNING);
return;
}
proxyAdapter.setClickPosition(position);
if (proxyModel.getType() != ProxyModel.TYPE_SOCKS) {
etDialogProxySettingIpAddress.setIpAddressStr(proxyModel.getProxyIp());
etDialogProxySettingPort.setText(proxyModel.getProxyPort());
} else {
showMessage("暂不支持socket代理", TastyToast.INFO);
}
}
});
recyclerViewProxySetting.setAdapter(proxyAdapter);
helper = new LoadViewHelper(recyclerViewProxySetting);
helper.setListener(new OnLoadViewListener() {
@Override
public void onRetryClick() {
presenter.parseXiCiDaiLi(false);
}
});
presenter.parseXiCiDaiLi(false);
}
Aggregations