Beispiel #1
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;
  }
  @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;
  }