package com.genlot.ninglottery.module.hardwaretest;

import android.os.Bundle;
import android.view.KeyEvent;
import android.widget.TextView;

import com.genlot.ninglottery.R;
import com.genlot.ninglottery.base.BaseFragment;

import butterknife.BindView;

/**
 * @author ZhuYongKang
 * @description 类描述
 * @date 2019/10/31
 */
public class ScanTestFragment extends BaseFragment {
    @Override
    public int getLayoutResId() {
        return R.layout.fragment_scan_test;
    }

    @Override
    public void onCreateViewFinished(Bundle state) {
        etSacn.requestFocus();
        etSacn.setOnKeyListener((v, keyCode, event) -> {
            if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_UP) {
                String result = etSacn.getText().toString().trim();
                tvContent.setText(result);
                etSacn.setText("");
            }
            return false;
        });
    }

    @BindView(R.id.text1)
    TextView tvContent;
    @BindView(R.id.et_scan)
    TextView etSacn;
}
