コード例 #1
0
  /** Updates list of post views from given FBFeed. */
  private void updateFeedView(FBFeed fbFeed) {
    LinearLayout contentView = (LinearLayout) findViewById(R.id.activity_feed_content);
    contentView.setVisibility(View.GONE);
    contentView.removeAllViews();
    int j = 0;
    for (FBPost post : fbFeed.getPosts()) {
      View postView = createPostView(post);
      postView.setTag(post.getId());
      if (j == 0) {
        FirstPostId = post.getId();
        Log.e("----------FirstPostId=", FirstPostId);
      }
      ;
      Log.e("postId", post.getId());
      Log.e("FirstPostId=", FirstPostId);
      j++;
      ImageView imageView = (ImageView) postView.findViewById(R.id.view_post_picture);
      if (post.getPicture() != null) {
        imageView.setVisibility(View.GONE);
        FBBitmap fbBitmap = getGlobalState().getFBFactory().getBitmap(post.getPicture());
        Bitmap bitmap = fbBitmap.getBitmap();
        if (bitmap != null) {
          imageView.setImageBitmap(bitmap);
        } else {
          PostPictureRequest request = new PostPictureRequest(this, imageView, fbBitmap);
          getGlobalState().getRequestQueue().addRequest(request);
        }
      } else {
        imageView.setVisibility(View.GONE);
      }

      BitmapSwitcher profilePic =
          (BitmapSwitcher) postView.findViewById(R.id.view_post_from_picture);
      FBUser fbUser = getGlobalState().getFBFactory().getUser(post.getFromId());
      if (fbUser.getLevel() == FBUser.Level.UNINITIALIZED) {
        profilePic.setBitmap(mDefaultPicture);
        FromPictureRequest request = new FromPictureRequest(this, profilePic, fbUser);
        getGlobalState().getRequestQueue().addRequest(request);
      } else {
        FBBitmap fbBitmap = getGlobalState().getFBFactory().getBitmap(fbUser.getPicture());
        Bitmap bitmap = fbBitmap.getBitmap();
        if (bitmap != null) {
          profilePic.setBitmap(BitmapUtils.roundBitmap(bitmap, PICTURE_ROUND_RADIUS));
        } else {
          profilePic.setBitmap(mDefaultPicture);
          FromPictureRequest request = new FromPictureRequest(this, profilePic, fbUser);
          getGlobalState().getRequestQueue().addRequest(request);
        }
      }
      postView.setOnClickListener(mPostClickObserver);
      if (!(j == 0)) {
        contentView.addView(postView);
      }
      ;
    }
    TextView textForAdvise = (TextView) findViewById(R.id.textForAdvise);
    textForAdvise.setVisibility(View.GONE);
    contentView.setVisibility(View.VISIBLE);
  }
コード例 #2
0
  private void setUserInfo(FBUser fbUser) {
    mUserName = fbUser.getName();
    if (fbUser.getName() != null) {
      TextView nameView = (TextView) findViewById(R.id.activity_user_name);
      nameView.setText(fbUser.getName());
    }

    BitmapSwitcher picView = (BitmapSwitcher) findViewById(R.id.activity_user_picture);
    FBBitmap fbBitmap = getGlobalState().getFBFactory().getBitmap(fbUser.getPicture());
    Bitmap bitmap = fbBitmap.getBitmap();
    if (bitmap == null) {
      picView.setBitmap(getGlobalState().getDefaultPicture());
      PictureRequest request = new PictureRequest(this, picView, fbBitmap);
      getGlobalState().getRequestQueue().addRequest(request);
    } else {
      picView.setBitmap(bitmap);
    }

    LinearLayout details = (LinearLayout) findViewById(R.id.activity_user_content);

    if (fbUser.getStatus() != null) {
      details.addView(createDetailView("Status", fbUser.getStatus()));
    }
    if (fbUser.getBirthday() != null) {
      details.addView(createDetailView("Birthday", fbUser.getBirthday()));
    }
    if (fbUser.getGender() != null) {
      details.addView(createDetailView("Gender", fbUser.getGender()));
    }
    if (fbUser.getAffiliations().size() > 0) {
      String networks = TextUtils.join(", ", fbUser.getAffiliations());
      details.addView(createDetailView("Networks", networks));
    }
    if (fbUser.getEmail() != null) {
      details.addView(createDetailView("Email", fbUser.getEmail()));
    }
    if (fbUser.getWebsite() != null) {
      details.addView(createDetailView("Web Site", fbUser.getWebsite()));
    }
    if (fbUser.getHometown() != null) {
      details.addView(createDetailView("Hometown", fbUser.getHometown()));
    }
    if (fbUser.getLocation() != null) {
      details.addView(createDetailView("Current Location", fbUser.getLocation()));
    }
    if (fbUser.getPhone() != null) {
      details.addView(createDetailView("Phone", fbUser.getPhone()));
    }
  }
コード例 #3
0
 public void executeUI(Exception ex) {
   if (ex == null) {
     mImageView.setImageBitmap(mFBBitmap.getBitmap());
     // TODO: Image size is (0, 0) and animation never takes place.
     Rect r = new Rect();
     if (mImageView.getLocalVisibleRect(r)) {
       AlphaAnimation inAnimation = new AlphaAnimation(0, 1);
       inAnimation.setDuration(700);
       mImageView.startAnimation(inAnimation);
     }
   }
 }
コード例 #4
0
 public void execute() throws Exception {
   mFBBitmap.load();
 }
コード例 #5
0
 public void executeUI(Exception ex) {
   if (ex == null) {
     Bitmap rounded = BitmapUtils.roundBitmap(mFBBitmap.getBitmap(), PICTURE_ROUND_RADIUS);
     mProfilePic.setBitmap(rounded);
   }
 }
コード例 #6
0
 public void execute() throws Exception {
   mFBUser.load(FBUser.Level.DEFAULT);
   mFBBitmap = getGlobalState().getFBFactory().getBitmap(mFBUser.getPicture());
   mFBBitmap.load();
 }
コード例 #7
0
 public void executeUI(Exception ex) {
   if (ex == null) {
     mPicView.setBitmap(mFBBitmap.getBitmap());
   }
 }