Пример #1
0
  @Override
  public void onFragmentInteraction(TestInfo testInfo) {
    MainApp mainApp = (MainApp) getApplicationContext();
    mainApp.setSwatches(testInfo.getCode());

    if (testInfo.getType() == 0) {
      if (!MainApp.hasCameraFlash) {
        AlertUtils.showError(
            this,
            R.string.error,
            getString(R.string.errorCameraFlashRequired),
            null,
            R.string.ok,
            null,
            null);
      } else {
        final Intent intent = new Intent(this, CalibrateListActivity.class);
        startActivity(intent);
      }
    } else {

      boolean hasOtg = this.getPackageManager().hasSystemFeature(PackageManager.FEATURE_USB_HOST);
      if (hasOtg) {
        final Intent intent = new Intent(this, CalibrateSensorActivity.class);
        startActivity(intent);
      } else {
        AlertUtils.showMessage(this, R.string.notSupported, R.string.phoneDoesNotSupport);
      }
    }
  }