@Override
  public void pauseView() {
    try {
      CrashReporter.leaveBreadcrumb("Trip_Stock_Load: pauseView");

      // Pause updating.
      infoview.pause();
    } catch (Exception e) {
      CrashReporter.logHandledException(e);
    }
  }
  @SuppressLint("SetTextI18n")
  @Override
  public void updateUI() {
    try {
      CrashReporter.leaveBreadcrumb("Trip_Stock_Load : updateUI");

      // Update the UI.
      infoview.setDefaultTv1("Load product");

      // Set the Line product in the title bar
      infoview.setDefaultTv2(DbUtils.getInfoviewLineProduct(Active.vehicle.getHosereelProduct()));

      if (product == null) {
        tvProduct.setText("None");
      } else {
        int stockLevel = 0;

        if (stockLevels.containsKey(product.Desc)) {
          stockLevel = stockLevels.get(product.Desc);
        }

        int requiredAmount = 0;

        if (requiredProducts.containsKey(product.Desc)) {
          requiredAmount = requiredProducts.get(product.Desc);
        }

        if (requiredAmount > stockLevel) {
          int toLoad = requiredAmount - stockLevel;

          // Load product.
          tvProduct.setText(String.format(Locale.UK, "%s %d litres", product.Desc, toLoad));
        } else {
          // Load product.
          tvProduct.setText(String.format(Locale.UK, "%s 0 litres", product.Desc));
        }
      }
    } catch (Exception e) {
      CrashReporter.logHandledException(e);
    }
  }
  @SuppressLint("SetTextI18n")
  @Override
  public boolean resumeView() {
    try {
      CrashReporter.leaveBreadcrumb("Trip_Stock_Load: resumeView");

      // Clear product.
      product = null;

      // Load products.
      products = dbProduct.getAllMeteredAndNonMetered();

      // Resume updating.
      infoview.resume();

      // Clear litres & focus.
      etLoaded.setText("");
      etLoaded.requestFocus();

      // Reset buttons.
      btnOK.setEnabled(false);
      btnCancel.setText("Close");
      btnCancel.setEnabled(true);

      // Make sure that the required products Hashtable is populated
      getRequiredProducts();

      // Make sure that the stock levels Hashtable is populated
      getStockLevels();

      return true;
    } catch (Exception e) {
      CrashReporter.logHandledException(e);
      return false;
    }
  }