コード例 #1
0
  private void layoutCustomer() {
    if (getView() == null || customer == null) {
      return;
    }

    ((TextView) getView().findViewById(R.id.textViewCustomerId)).setText(customer.getId());
    ((TextView) getView().findViewById(R.id.textViewCustomerName)).setText(customer.getName());
    ((TextView) getView().findViewById(R.id.textViewCustomerAddress))
        .setText(customer.getAddress());
  }
コード例 #2
0
  /** Lays out the list of customers */
  private void layoutCustomer() {
    if (!started || getView() == null) {
      return;
    }

    LinearLayout panelCustomerInfo =
        (LinearLayout) getView().findViewById(R.id.linearLayoutCustomerInfo);

    panelCustomerInfo.removeAllViews();

    final FragmentTransaction ft = getFragmentManager().beginTransaction();

    if (customer != null) {
      CustomerThumbnailFragment customerThumbnail = new CustomerThumbnailFragment();
      customerThumbnail.setCustomer(customer);
      ft.add(R.id.linearLayoutCustomerInfo, customerThumbnail);

      List<Reading> readings = customer.getReadings();

      if (readings.size() > 0) {
        ReadingThumbnailFragment readingThumbnail = new ReadingThumbnailFragment();
        readingThumbnail.setReading(readings.get(readings.size() - 1));
        readingThumbnail.setHideCustomer(true);
        ft.add(R.id.linearLayoutCustomerInfo, readingThumbnail);
      }

      getView().findViewById(R.id.buttonScan).setEnabled(true);
    } else {
      getView().findViewById(R.id.buttonScan).setEnabled(false);
    }

    ft.commit();
  }
コード例 #3
0
  @Override
  public void onSaveInstanceState(Bundle outState) {
    if (customer != null) {
      outState.putString("customer.id", customer.getId());
    }

    super.onSaveInstanceState(outState);
  }
コード例 #4
0
  @Override
  public void onSaveInstanceState(Bundle outState) {
    outState.putBoolean("hideControls", hideControls);

    if (customer != null) {
      outState.putString("customer.id", customer.getId());
    }

    super.onSaveInstanceState(outState);
  }