Search in sources :

Example 1 with ListViewAdapter

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);
}
Also used : WebResourceRequest(android.webkit.WebResourceRequest) Message(android.os.Message) Intent(android.content.Intent) KeyEvent(android.view.KeyEvent) Timer(java.util.Timer) TimerTask(java.util.TimerTask) ListViewAdapter(cn.cerc.summer.android.basis.ListViewAdapter) WebSettings(android.webkit.WebSettings) TextView(android.widget.TextView) WebView(android.webkit.WebView) WebViewClient(android.webkit.WebViewClient)

Aggregations

Intent (android.content.Intent)1 Message (android.os.Message)1 KeyEvent (android.view.KeyEvent)1 WebResourceRequest (android.webkit.WebResourceRequest)1 WebSettings (android.webkit.WebSettings)1 WebView (android.webkit.WebView)1 WebViewClient (android.webkit.WebViewClient)1 TextView (android.widget.TextView)1 ListViewAdapter (cn.cerc.summer.android.basis.ListViewAdapter)1 Timer (java.util.Timer)1 TimerTask (java.util.TimerTask)1