use of cn.cerc.summer.android.basis.ListViewAdapter in project summer-android by cn-cerc.
the class FrmScanProduct method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_frm_scan_product);
instance = this;
Intent intent = getIntent();
imgBack = (ImageView) findViewById(R.id.imgBack);
imgBack.setOnClickListener(this);
lblTitle = (TextView) findViewById(R.id.lblTitle);
lblTitle.setText(intent.getStringExtra("title"));
this.homeUrl = intent.getStringExtra("homeUrl");
this.returnUrl = intent.getStringExtra("returnUrl");
this.appendUrl = intent.getStringExtra("appendUrl");
this.modifyUrl = intent.getStringExtra("modifyUrl");
this.deleteUrl = intent.getStringExtra("deleteUrl");
this.viewUrl = intent.getStringExtra("viewUrl");
chkIsSpare = (CheckBox) findViewById(R.id.chkIsSpare);
edtBarcode = (EditText) findViewById(R.id.edtBarcode);
btnSave = (Button) findViewById(R.id.btnSave);
btnSave.setOnClickListener(this);
adapter = new ListViewAdapter(this, R.layout.activity_list_scan_product, dataSet, this);
lstView = (ListView) findViewById(R.id.lstView);
lstView.setAdapter(adapter);
webView = (WebView) findViewById(R.id.webView);
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
// 返回值是true的时候控制去WebView打开,为false调用系统浏览器或第三方浏览器
view.loadUrl(url);
return true;
}
});
// 启用支持javascript
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
// 打开指定的网页
webView.loadUrl(MyApp.getFormUrl(homeUrl));
// 关闭软键盘
edtBarcode.setInputType(InputType.TYPE_NULL);
edtBarcode.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE || event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
saveBarcode();
}
return false;
}
});
// 自动归位焦点
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
Message msg = new Message();
msg.what = MSG_TIMER;
handler.sendMessage(msg);
}
}, 1000, 200);
}
Aggregations