예제 #1
0
 /** Update user's profile info */
 private void updateUI() {
   if (mUser != null) {
     mUserInfo.setText(buildUserInfoDisplay(mUser));
     mProfilePictureView.setProfileId(mUser.getId());
   } else {
     mUserInfo.setText(null);
     mProfilePictureView.setProfileId(null);
   }
 }
예제 #2
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View vi = convertView;

    if (convertView == null) {
      LayoutInflater inflater =
          (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      vi = inflater.inflate(R.layout.item_invitados_list, null);
    }

    GraphUser item = items.get(position);

    ProfilePictureView foto = (ProfilePictureView) vi.findViewById(R.id.fotoPerfil);
    foto.setProfileId(item.getId());

    TextView nombre = (TextView) vi.findViewById(R.id.nombrePerfil);
    nombre.setText(item.getName());

    ImageButton eliminar = (ImageButton) vi.findViewById(R.id.eliminarInvitado);
    // Usamos el SETTAG y despues el GETTAG para saber que botón ha sido pulsado de todos los items
    // que son visibles, y así poder saber que item borrar.
    eliminar.setTag(position);
    eliminar.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            if (view.getTag() instanceof Integer) {
              deleteItem(((Integer) view.getTag()));
              notifyDataSetChanged();
            }
          }
        });

    return vi;
  }
예제 #3
0
  private void updateUI() {
    Session session = Session.getActiveSession();
    boolean enableButtons = (session != null && session.isOpened());

    postStatusUpdateButton.setEnabled(enableButtons);
    postPhotoButton.setEnabled(enableButtons);
    pickFriendsButton.setEnabled(enableButtons);
    pickPlaceButton.setEnabled(enableButtons);

    if (enableButtons && user != null) {
      profilePictureView.setProfileId(user.getId());
      greeting.setText("Greetings " + user.getFirstName());
    } else {
      profilePictureView.setProfileId(null);
      greeting.setText(null);
    }
  }