Пример #1
0
  /**
   * try to remove the given profile
   *
   * @param profile
   */
  public void removeProfile(@NonNull IProfile profile) {
    if (mAccountHeaderBuilder.mProfiles != null) {
      mAccountHeaderBuilder.mProfiles.remove(profile);
    }

    mAccountHeaderBuilder.updateHeaderAndList();
  }
Пример #2
0
  /**
   * Add a new profile at a specific position to the list
   *
   * @param profile
   * @param position
   */
  public void addProfile(@NonNull IProfile profile, int position) {
    if (mAccountHeaderBuilder.mProfiles == null) {
      mAccountHeaderBuilder.mProfiles = new ArrayList<>();
    }
    mAccountHeaderBuilder.mProfiles.add(position, IdDistributor.checkId(profile));

    mAccountHeaderBuilder.updateHeaderAndList();
  }
Пример #3
0
  /**
   * remove a profile from the given position
   *
   * @param position
   */
  public void removeProfile(int position) {
    if (mAccountHeaderBuilder.mProfiles != null
        && mAccountHeaderBuilder.mProfiles.size() > position) {
      mAccountHeaderBuilder.mProfiles.remove(position);
    }

    mAccountHeaderBuilder.updateHeaderAndList();
  }
Пример #4
0
  /**
   * Add new profiles to the existing list of profiles
   *
   * @param profiles
   */
  public void addProfiles(@NonNull IProfile... profiles) {
    if (mAccountHeaderBuilder.mProfiles == null) {
      mAccountHeaderBuilder.mProfiles = new ArrayList<>();
    }

    Collections.addAll(mAccountHeaderBuilder.mProfiles, IdDistributor.checkIds(profiles));

    mAccountHeaderBuilder.updateHeaderAndList();
  }
Пример #5
0
  /**
   * Helper method to update a profile using it's identifier
   *
   * @param newProfile
   */
  @Deprecated
  public void updateProfileByIdentifier(@NonNull IProfile newProfile) {
    if (mAccountHeaderBuilder.mProfiles != null && newProfile.getIdentifier() >= 0) {
      int found = -1;
      for (int i = 0; i < mAccountHeaderBuilder.mProfiles.size(); i++) {
        if (mAccountHeaderBuilder.mProfiles.get(i) instanceof Identifyable) {
          if (mAccountHeaderBuilder.mProfiles.get(i).getIdentifier()
              == newProfile.getIdentifier()) {
            found = i;
            break;
          }
        }
      }

      if (found > -1) {
        mAccountHeaderBuilder.mProfiles.set(found, newProfile);
        mAccountHeaderBuilder.updateHeaderAndList();
      }
    }
  }
Пример #6
0
 /**
  * Set a new list of profiles for the header
  *
  * @param profiles
  */
 public void setProfiles(ArrayList<IProfile> profiles) {
   mAccountHeaderBuilder.mProfiles = IdDistributor.checkIds(profiles);
   mAccountHeaderBuilder.updateHeaderAndList();
 }
Пример #7
0
 /**
  * set this to define the second line in the selection area if there is no profile note this will
  * block any values from profiles!
  *
  * @param selectionSecondLine
  */
 public void setSelectionSecondLine(String selectionSecondLine) {
   mAccountHeaderBuilder.mSelectionSecondLine = selectionSecondLine;
   mAccountHeaderBuilder.updateHeaderAndList();
 }
Пример #8
0
 /**
  * set this to false if you want to hide the second line of the selection box in the header
  * (second line would be the e-mail)
  *
  * @param selectionSecondLineShown
  */
 public void setSelectionSecondLineShown(boolean selectionSecondLineShown) {
   mAccountHeaderBuilder.mSelectionSecondLineShown = selectionSecondLineShown;
   mAccountHeaderBuilder.updateHeaderAndList();
 }