/** 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); }
public void executeUI(Exception ex) { if (ex == null) { Bitmap rounded = BitmapUtils.roundBitmap(mFBBitmap.getBitmap(), PICTURE_ROUND_RADIUS); mProfilePic.setBitmap(rounded); } }