예제 #1
0
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    view_main = getLayoutInflater().from(this).inflate(R.layout.login_layout, null);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    // view_main.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
    // view_main.setOnClickListener(this);
    setContentView(view_main);

    BaseHelp.enterLightsOutMode(getWindow());
    parameterApplication = (ParameterApplication) getApplication();

    userAccount = (EditText) findViewById(R.id.login_user);
    userPassword = (EditText) findViewById(R.id.login_pw);
    login_type = (Switch) findViewById(R.id.type_open);
    login_btn = (ButtonRectangle) findViewById(R.id.login_ok_bt);
    login_btn.setOnClickListener(this);
    login_type.setOncheckListener(
        new Switch.OnCheckListener() {
          @Override
          public void onCheck(boolean check) {
            if (check) {
              login_card = true;
            } else {
              login_card = false;
            }
          }
        });

    initNfc();
  }
예제 #2
0
 private void initNfc() {
   nfcAdapter = NfcAdapter.getDefaultAdapter(this);
   if (nfcAdapter == null) {
     BaseHelp.ShowDialog(this, "您的设备不支持NFC,是否退出!", 0);
     // return;
   }
   if (!nfcAdapter.isEnabled()) {
     BaseHelp.ShowDialog(this, "您的设备没有打开NFC功能!", 1);
     // return;
   }
   pendingIntent =
       PendingIntent.getActivity(
           this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
   IntentFilter intentFilter = new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED);
   intentFilter.addCategory("*//*");
   intentFilters = new IntentFilter[] {intentFilter}; // 过滤器
   techList =
       new String[][] {
         new String[] {MifareClassic.class.getName()}, new String[] {NfcA.class.getName()}
       }; // 允许扫描的标签类型
 }
예제 #3
0
 @Override
 public void onClick(View v) {
   // view_main.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
   switch (v.getId()) {
     case R.id.login_ok_bt:
       if (login_card) {
         BaseHelp.ShowDialog(this, "请刷卡登录!", 1);
         return;
       }
       Logining();
       // new Thread(runnable).start();
       break;
   }
 }