示例#1
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;
  }
 /** 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);
   }
 }
  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);
    }
  }
示例#4
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.item_details);

    Intent intent = getIntent();
    disk = (Disk) intent.getSerializableExtra("disk");

    if (intent.hasExtra("fbusername")) {
      fbusername = intent.getStringExtra("fbusername");
    } else {
      fbusername = "******";
    }

    title = (TextView) findViewById(R.id.textView1);
    artist = (TextView) findViewById(R.id.artist);
    status = (TextView) findViewById(R.id.status);
    diskImage = (ImageView) findViewById(R.id.disk_image);

    title.setText(disk.getTitle());
    artist.setText(disk.getArtist());
    status.setText(disk.getStatus());

    // Set up image in view
    byte[] imageAsBytes = Base64.decode(disk.getImageEncoding(), Base64.DEFAULT);
    diskImage.setImageBitmap(BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length));

    // Find the user's profile picture custom view
    profilePictureView = (ProfilePictureView) findViewById(R.id.item_details_profile_pic);
    profilePictureView.setCropped(false);
    Session session = Session.getActiveSession();
    if (session != null && session.isOpened()) {
      // Get the user's data
      makeMeRequest(session);
    }

    // Set up action that will be triggered when user presses the Send button
    ((Button) findViewById(R.id.button2))
        .setOnClickListener(
            new OnClickListener() {
              public void onClick(View view) {
                send_message();
              }
            });

    // Set up action that will be triggered when user presses the Home button
    ((ImageButton) findViewById(R.id.home))
        .setOnClickListener(
            new View.OnClickListener() {
              public void onClick(View view) {
                go_home();
              }
            });
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    View view = inflater.inflate(R.layout.profile_fragment, container, false);
    mProfilePictureView = (ProfilePictureView) view.findViewById(R.id.profile_Picture);
    mProfilePictureView.setCropped(true);
    mUserInfo = (TextView) view.findViewById(R.id.user_info);

    mAlbumButton = (Button) view.findViewById(R.id.album_button);
    mAlbumButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            Context context = ProfileFragment.this.getActivity();
            Intent intent = new Intent(context, AlbumActivity.class);
            context.startActivity(intent);
          }
        });

    mLocationButton = (Button) view.findViewById(R.id.location_button);
    mLocationButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            Context context = ProfileFragment.this.getActivity();
            Intent intent = new Intent(context, GMSMapActivity.class);
            context.startActivity(intent);
          }
        });

    mGCMMessageButton = (Button) view.findViewById(R.id.gcm_message_button);
    mGCMMessageButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            Context context = ProfileFragment.this.getActivity();
            Intent intent = new Intent(context, NotificationEntryActivity.class);
            context.startActivity(intent);
          }
        });

    mStatusListView = (ListView) view.findViewById(R.id.status_list);
    View header = LayoutInflater.from(getActivity()).inflate(R.layout.status_list_header, null);
    mStatusListView.addHeaderView(header, null, false);
    mStatusListAdapter = new StatusListAdapter(getActivity());
    mStatusListView.setAdapter(mStatusListAdapter);

    return view;
  }
示例#6
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    super.onCreateView(inflater, container, savedInstanceState);
    View view = inflater.inflate(R.layout.selection, container, false);
    // Find the user's profile picture custom view
    profilePictureView = (ProfilePictureView) view.findViewById(R.id.selection_profile_pic);
    profilePictureView.setCropped(true);

    // Find the user's name view
    userNameView = (TextView) view.findViewById(R.id.selection_user_name);

    // Find the list view
    listView = (ListView) view.findViewById(R.id.selection_list);

    // Set up the list view items, based on a list of
    // BaseListElement items
    listElements = new ArrayList<BaseListElement>();
    // Add an item for the friend picker
    listElements.add(new PeopleListElement(0));
    // Set the list view adapter
    listView.setAdapter(new ActionListAdapter(getActivity(), R.id.selection_list, listElements));
    if (savedInstanceState != null) {
      // Restore the state for each list element
      for (BaseListElement listElement : listElements) {
        listElement.restoreState(savedInstanceState);
      }
    }

    // Check for an open session
    Session session = Session.getActiveSession();
    if (session != null && session.isOpened()) {
      // Get the user's data
      makeMeRequest(session);
    }

    return view;
  }