예제 #1
0
 public void getRegistrationNumbers() {
   allRegistrationNumbers = DBOps.getAllTruckRegNo(this);
 }
예제 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_issue_truck_tag);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    //
    libInstance = NxpNfcLibLite.getInstance();
    // intent filter directly picked from manifest
    libInstance.registerActivity(this);
    //        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    //            // Registering the activity for the NFC tag detection mode.
    //
    //            final Handler mLibhandler = new Handler(mLibhandlercb);
    //
    //            try {
    //                libInstance.setNfcControllerMode(1000, new NfcAdapter.ReaderCallback() {
    //
    //                    @Override
    //                    public void onTagDiscovered(final Tag tagObject) {
    //                        NxpLogUtils.d(TAG,
    //                                "TAG is Discovered from ReaderCallBack...");
    //
    //                        tag = tagObject;
    //                        mLibhandler.sendEmptyMessage(0);
    //
    //                    }
    //                }, NfcAdapter.FLAG_READER_NFC_A | NfcAdapter.FLAG_READER_NFC_V |
    // NfcAdapter.FLAG_READER_NFC_B | NfcAdapter.FLAG_READER_NFC_F );
    //            } catch (SmartCardException e) {
    //
    //            }
    //        }
    //
    if (DBOps.getAllTruckRegNo(this).size() == 0) {
      DBOps.insertNewTruck(
          this,
          new Truck(
              "TC1",
              "GA04J4008",
              "TCC1",
              "DC1",
              "GC1",
              "CARDID1000",
              "CAT1",
              new Date(),
              7000,
              3000));
      DBOps.insertNewTruck(
          this,
          new Truck(
              "TC2",
              "GA09J4567",
              "TCC2",
              "DC2",
              "GC2",
              "CARDID2001",
              "CAT2",
              new Date(),
              7000,
              4000));
      DBOps.insertNewTruck(
          this,
          new Truck(
              "TC3",
              "GA04J4444",
              "TCC3",
              "DC3",
              "GC3",
              "CARDID3002",
              "CAT3",
              new Date(),
              7000,
              5000));
    }
    initializeViews();
    getRegistrationNumbers();
    bindDataToAutoCompleteTextView();
  }