Example #1
0
 public void onClickPositiveBtn(DialogFragment dialogFragment, String id) {
   if ("add_fir".equals(dialogFragment.getTag())) {
     //  OnAddFIR(5000, id);
   } else if ("remove".equals(dialogFragment.getTag())) {
     //  OnRemoveUser(id);
   }
 }
 @Override
 public void onDialogPositiveClick(DialogFragment dialog) {
   if (dialog instanceof PurchaseDialog) {
     if (dialog.getTag().equals("ADD")) {
       // Позиционирование на новом списке
       mNextPage = ((PurchaseDialog) dialog).getPurchaseId();
     }
     onDataSetChanged();
   } else if (dialog instanceof DeleteDialog) {
     if (((DeleteDialog) dialog).getMainActivityOnDataSetChanged()) {
       // Перестроить всё
       onDataSetChanged();
     } else {
       // Обновить все виджеты на странице
       int i = mViewPager.getCurrentItem();
       if (mAdapter.getCount() > 0) {
         PageFragment page = (PageFragment) mAdapter.getItem(i);
         page.onDataSetChanged(null);
       }
     }
   } else if (dialog instanceof GoodsDialog) {
     // Обновить виджет списка
     int i = mViewPager.getCurrentItem();
     if (mAdapter.getCount() > 0) {
       PageFragment page = (PageFragment) mAdapter.getItem(i);
       List list = (List) page.getWidget(List.WIDGET_NUM);
       list.onDataSetChanged();
     }
   }
 }
Example #3
0
  /**
   * Capture Function
   *
   * @param captured_data
   * @return
   */
  public int OnCaptured(NBioBSPJNI.CAPTURED_DATA captured_data) {
    //  tvDevice.setText("IMAGE Quality: "+capturedData.getImageQuality());

    if (captured_data.getImage() != null) {
      if (bCapturedFirst) {
        iv_VerifyFinger.setImageBitmap(captured_data.getImage());
      }
    }

    // quality : 40~100
    if (captured_data.getImageQuality() >= EConstants.QUALITY_LIMIT) {
      if (sampleDialogFragment != null
          && "DIALOG_TYPE_PROGRESS".equals(sampleDialogFragment.getTag()))
        sampleDialogFragment.dismiss();
      return NBioBSPJNI.ERROR.NBioAPIERROR_USER_CANCEL;
    } else if (captured_data.getDeviceError() != NBioBSPJNI.ERROR.NBioAPIERROR_NONE) {
      if (sampleDialogFragment != null
          && "DIALOG_TYPE_PROGRESS".equals(sampleDialogFragment.getTag()))
        sampleDialogFragment.dismiss();
      return captured_data.getDeviceError();
    } else {
      return NBioBSPJNI.ERROR.NBioAPIERROR_NONE;
    }
  }
Example #4
0
  public synchronized void OnCapture1(int timeout) {

    NBioBSPJNI.FIR_HANDLE hCapturedFIR, hAuditFIR;
    NBioBSPJNI.CAPTURED_DATA capturedData;

    hCapturedFIR = bsp.new FIR_HANDLE();
    hAuditFIR = bsp.new FIR_HANDLE();
    capturedData = bsp.new CAPTURED_DATA();

    bCapturedFirst = true;

    bsp.Capture(
        NBioBSPJNI.FIR_PURPOSE.ENROLL,
        hCapturedFIR,
        timeout,
        hAuditFIR,
        capturedData,
        MainActivity.this,
        0,
        null);

    if (sampleDialogFragment != null
        && "DIALOG_TYPE_PROGRESS".equals(sampleDialogFragment.getTag()))
      sampleDialogFragment.dismiss();

    if (bsp.IsErrorOccured()) {
      msg = "NBioBSP Capture Error: " + bsp.GetErrorCode();
    } else {
      NBioBSPJNI.INPUT_FIR inputFIR;

      inputFIR = bsp.new INPUT_FIR();

      // Make ISO 19794-2 data
      {
        NBioBSPJNI.Export.DATA exportData;

        inputFIR.SetFIRHandle(hCapturedFIR);

        exportData = exportEngine.new DATA();

        exportEngine.ExportFIR(inputFIR, exportData, NBioBSPJNI.EXPORT_MINCONV_TYPE.OLD_FDA);

        if (bsp.IsErrorOccured()) {
          runOnUiThread(
              new Runnable() {

                public void run() {
                  msg = "NBioBSP ExportFIR Error: " + bsp.GetErrorCode();
                }
              });
          return;
        }

        if (byTemplate1 != null) byTemplate1 = null;

        byTemplate1 = new byte[exportData.FingerData[0].Template[0].Data.length];
        byTemplate1 = exportData.FingerData[0].Template[0].Data;

        Base64_templateVerify = Base64.encodeToString(byTemplate1, Base64.DEFAULT);

        // Base64_templateVerify is the fingure that is placed on the machine
        // Start ASYNC TASK
        if (Base64_templateVerify != null) {
          VerifyFinger VF = new VerifyFinger();
          VF.execute(Base64_templateVerify);
        } else {
          msg = "String Empty";
        }
      }

      // Make Raw Image data
      {
        NBioBSPJNI.Export.AUDIT exportAudit;

        inputFIR.SetFIRHandle(hAuditFIR);

        exportAudit = exportEngine.new AUDIT();

        exportEngine.ExportAudit(inputFIR, exportAudit);

        if (bsp.IsErrorOccured()) {

          runOnUiThread(
              new Runnable() {

                public void run() {
                  msg = "NBioBSP ExportAudit Error: " + bsp.GetErrorCode();
                }
              });

          return;
        }

        if (byCapturedRaw1 != null) byCapturedRaw1 = null;

        byCapturedRaw1 = new byte[exportAudit.FingerData[0].Template[0].Data.length];
        byCapturedRaw1 = exportAudit.FingerData[0].Template[0].Data;

        nCapturedRawWidth1 = exportAudit.ImageWidth;
        nCapturedRawHeight1 = exportAudit.ImageHeight;

        msg = "First Capture Success";
      }
    }

    runOnUiThread(
        new Runnable() {

          public void run() {

            if (byTemplate1 != null && byTemplate1 != null) {
            } else {
            }
          }
        });
  }