|
@@ -32,6 +32,7 @@ import com.common.config.BaseConfig;
|
|
|
import com.common.data.JSONUtil;
|
|
import com.common.data.JSONUtil;
|
|
|
import com.common.data.ListUtils;
|
|
import com.common.data.ListUtils;
|
|
|
import com.common.data.StringUtil;
|
|
import com.common.data.StringUtil;
|
|
|
|
|
+import com.common.data.TextUtil;
|
|
|
import com.common.system.PermissionUtil;
|
|
import com.common.system.PermissionUtil;
|
|
|
import com.core.app.MyApplication;
|
|
import com.core.app.MyApplication;
|
|
|
import com.core.base.OABaseActivity;
|
|
import com.core.base.OABaseActivity;
|
|
@@ -53,6 +54,8 @@ import com.modular.apputils.R;
|
|
|
import com.uuzuche.lib_zxing.activity.CaptureActivity;
|
|
import com.uuzuche.lib_zxing.activity.CaptureActivity;
|
|
|
import com.uuzuche.lib_zxing.activity.CodeUtils;
|
|
import com.uuzuche.lib_zxing.activity.CodeUtils;
|
|
|
|
|
|
|
|
|
|
+import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
|
|
|
|
+
|
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
@@ -75,6 +78,7 @@ public class SelectNetAcitivty extends OABaseActivity {
|
|
|
private String gCaller;//传进来的附表caller,当是明细表时候存在
|
|
private String gCaller;//传进来的附表caller,当是明细表时候存在
|
|
|
private String fieldKey;
|
|
private String fieldKey;
|
|
|
private String corekey;
|
|
private String corekey;
|
|
|
|
|
+ private boolean dataForm;
|
|
|
|
|
|
|
|
|
|
|
|
|
private PullToRefreshListView refreshListView;
|
|
private PullToRefreshListView refreshListView;
|
|
@@ -139,6 +143,18 @@ public class SelectNetAcitivty extends OABaseActivity {
|
|
|
private boolean isDevice;
|
|
private boolean isDevice;
|
|
|
|
|
|
|
|
private void initView() {
|
|
private void initView() {
|
|
|
|
|
+
|
|
|
|
|
+ Intent intent = getIntent();
|
|
|
|
|
+ if (intent != null) {
|
|
|
|
|
+ fieldKey = intent.getStringExtra("fieldKey");
|
|
|
|
|
+ caller = intent.getStringExtra("caller");
|
|
|
|
|
+ gCaller = intent.getStringExtra("gCaller");
|
|
|
|
|
+ dataForm = intent.getBooleanExtra("dataForm", false);
|
|
|
|
|
+ corekey = intent.getStringExtra("corekey");
|
|
|
|
|
+ isDevice = intent.getBooleanExtra("isDevice", false);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
VoiceSearchView voiceSearchView = (VoiceSearchView) findViewById(R.id.voiceSearchView);
|
|
VoiceSearchView voiceSearchView = (VoiceSearchView) findViewById(R.id.voiceSearchView);
|
|
|
refreshListView = (PullToRefreshListView) findViewById(R.id.refreshListView);
|
|
refreshListView = (PullToRefreshListView) findViewById(R.id.refreshListView);
|
|
|
refreshListView.setMode(PullToRefreshBase.Mode.BOTH);
|
|
refreshListView.setMode(PullToRefreshBase.Mode.BOTH);
|
|
@@ -151,7 +167,9 @@ public class SelectNetAcitivty extends OABaseActivity {
|
|
|
@Override
|
|
@Override
|
|
|
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
|
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
|
|
lastKey = StringUtil.getText(v);
|
|
lastKey = StringUtil.getText(v);
|
|
|
- if (isDevice && !TextUtils.isEmpty(lastKey)) {
|
|
|
|
|
|
|
+ if (dataForm) {
|
|
|
|
|
+ findByLocal();
|
|
|
|
|
+ } else if (isDevice && !TextUtils.isEmpty(lastKey)) {
|
|
|
loadSearchDevice(lastKey);
|
|
loadSearchDevice(lastKey);
|
|
|
} else {
|
|
} else {
|
|
|
loadSearch(page = 1, lastKey);
|
|
loadSearch(page = 1, lastKey);
|
|
@@ -159,26 +177,24 @@ public class SelectNetAcitivty extends OABaseActivity {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- refreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
|
|
|
|
|
- loadSearch(page = 1, lastKey);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
|
|
|
|
|
- loadSearch(++page, lastKey);
|
|
|
|
|
|
|
+ if (dataForm) {
|
|
|
|
|
+ refreshListView.setMode(PullToRefreshBase.Mode.DISABLED);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ refreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
|
|
|
|
|
+ loadSearch(page = 1, lastKey);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- Intent intent = getIntent();
|
|
|
|
|
- if (intent != null) {
|
|
|
|
|
- fieldKey = intent.getStringExtra("fieldKey");
|
|
|
|
|
- caller = intent.getStringExtra("caller");
|
|
|
|
|
- gCaller = intent.getStringExtra("gCaller");
|
|
|
|
|
- corekey = intent.getStringExtra("corekey");
|
|
|
|
|
- isDevice = intent.getBooleanExtra("isDevice", false);
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
|
|
|
|
|
+ loadSearch(++page, lastKey);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
String baseUrl = CommonUtil.getAppBaseUrl(this);
|
|
String baseUrl = CommonUtil.getAppBaseUrl(this);
|
|
|
String sessionId = CommonUtil.getSharedPreferences(this, "sessionId");
|
|
String sessionId = CommonUtil.getSharedPreferences(this, "sessionId");
|
|
|
httpClient = new HttpClient.Builder(baseUrl)
|
|
httpClient = new HttpClient.Builder(baseUrl)
|
|
@@ -193,6 +209,23 @@ public class SelectNetAcitivty extends OABaseActivity {
|
|
|
showLoading();
|
|
showLoading();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void findByLocal() {
|
|
|
|
|
+ List<Bean> showModels = null;
|
|
|
|
|
+ if (ListUtils.getSize(allModels) > 0) {
|
|
|
|
|
+ if (TextUtils.isEmpty(lastKey)) {
|
|
|
|
|
+ showModels = allModels;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ showModels = new ArrayList<>();
|
|
|
|
|
+ for (Bean e : allModels) {
|
|
|
|
|
+ if (e != null && !TextUtils.isEmpty(e.showName) && e.showName.toUpperCase().contains(lastKey)) {
|
|
|
|
|
+ showModels.add(e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ showByAdapter(showModels);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private void loadSearchDevice(final String keyWork) {
|
|
private void loadSearchDevice(final String keyWork) {
|
|
|
refreshListView.setMode(PullToRefreshBase.Mode.DISABLED);
|
|
refreshListView.setMode(PullToRefreshBase.Mode.DISABLED);
|
|
|
HttpClient.Builder builder = new HttpClient.Builder();
|
|
HttpClient.Builder builder = new HttpClient.Builder();
|
|
@@ -241,7 +274,7 @@ public class SelectNetAcitivty extends OABaseActivity {
|
|
|
.add("ob", "")
|
|
.add("ob", "")
|
|
|
.add("_config", "")
|
|
.add("_config", "")
|
|
|
.add("page", page)
|
|
.add("page", page)
|
|
|
- .add("pageSize", 20)
|
|
|
|
|
|
|
+ .add("pageSize", dataForm ? 10000 : 20)
|
|
|
.method(Method.GET);
|
|
.method(Method.GET);
|
|
|
if (!isForm) {
|
|
if (!isForm) {
|
|
|
builder.add("gridField", fieldKey)
|
|
builder.add("gridField", fieldKey)
|
|
@@ -267,22 +300,6 @@ public class SelectNetAcitivty extends OABaseActivity {
|
|
|
|
|
|
|
|
private ListAdapter mAdapter = null;
|
|
private ListAdapter mAdapter = null;
|
|
|
|
|
|
|
|
- private void handleDataDevice(String messgae) throws Exception {
|
|
|
|
|
- JSONObject object = JSON.parseObject(messgae);
|
|
|
|
|
- String dataStr = JSONUtil.getText(object, "data");
|
|
|
|
|
- JSONArray data = JSON.parseArray(dataStr);
|
|
|
|
|
- List<Bean> models = new ArrayList<>();
|
|
|
|
|
- Bean b = null;
|
|
|
|
|
- for (int i = 0; i < data.size(); i++) {
|
|
|
|
|
- JSONObject o = data.getJSONObject(i);
|
|
|
|
|
- b = new Bean();
|
|
|
|
|
- b.name = JSONUtil.getText(o, fieldKey);
|
|
|
|
|
- b.json = o.toJSONString();
|
|
|
|
|
- b.showName = getShowName(o);
|
|
|
|
|
- models.add(b);
|
|
|
|
|
- }
|
|
|
|
|
- showByAdapter(models);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
private void handleData(String messgae) throws Exception {
|
|
private void handleData(String messgae) throws Exception {
|
|
|
JSONObject object = JSON.parseObject(messgae);
|
|
JSONObject object = JSON.parseObject(messgae);
|
|
@@ -330,9 +347,14 @@ public class SelectNetAcitivty extends OABaseActivity {
|
|
|
if (!StringUtil.isEmpty(b.name))
|
|
if (!StringUtil.isEmpty(b.name))
|
|
|
models.add(b);
|
|
models.add(b);
|
|
|
}
|
|
}
|
|
|
|
|
+ if (TextUtils.isEmpty(lastKey) && dataForm) {
|
|
|
|
|
+ allModels = models;
|
|
|
|
|
+ }
|
|
|
showByAdapter(models);
|
|
showByAdapter(models);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private List<Bean> allModels = null;
|
|
|
|
|
+
|
|
|
private void showByAdapter(List<Bean> models) {
|
|
private void showByAdapter(List<Bean> models) {
|
|
|
if (mAdapter == null) {
|
|
if (mAdapter == null) {
|
|
|
mAdapter = new ListAdapter(models);
|
|
mAdapter = new ListAdapter(models);
|