Exemple #1
0
 /**
  * Returns the Client with the given email.
  *
  * @param email the email of this Client
  * @return the Client with the given email
  */
 public static String getClient(String email) {
   ArrayList<Client> clients = Client.getClients();
   for (Client client : clients) {
     if (client.getEmail().equals(email)) {
       return client.toString();
     }
   }
   return "";
 }
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_client, parent, false);

    mNameDisplay = (EditText) v.findViewById(R.id.client_name);

    mNameDisplay.setText(mClient.getName());

    mNameDisplay.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {
            mClient.setName(s.toString());
          }

          @Override
          public void afterTextChanged(Editable s) {}
        });

    mEmailDisplay = (EditText) v.findViewById(R.id.client_email);

    mEmailDisplay.setText(mClient.getEmail());

    mEmailDisplay.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {
            mClient.setEmail(s.toString());
          }

          @Override
          public void afterTextChanged(Editable s) {}
        });
    return v;
  }
 public void sendMessage(Client client, Template template) {
   String msgContent = templateEngine.prepareMessage(template, client);
   mailServer.send(client.getEmail(), msgContent);
 }