Skip to content

Commit 76bf0d1

Browse files
committed
Tweek to DM item view to apply fix to remove profile images when not downloading them
1 parent 1e21192 commit 76bf0d1

File tree

2 files changed

+58
-59
lines changed

2 files changed

+58
-59
lines changed

android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/DirectMessageItemView.java

+54-54
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,43 @@
4444

4545
public class DirectMessageItemView extends LinearLayout {
4646

47+
private final Path mPath = new Path();
48+
private final Paint mPaint = new Paint();
49+
/*
50+
*
51+
*/
52+
private final OnTouchListener mOnTouchListener = new OnTouchListener() {
53+
54+
@Override
55+
public boolean onTouch(View v, MotionEvent event) {
56+
return mGestureDetector.onTouchEvent(event);
57+
}
58+
};
59+
/*
60+
*
61+
*/
62+
private final GestureDetector mGestureDetector = new GestureDetector(
63+
new GestureDetector.SimpleOnGestureListener() {
64+
65+
@Override
66+
public boolean onSingleTapConfirmed(MotionEvent e) {
67+
return mCallbacks != null && mCallbacks.onSingleTapConfirmed(DirectMessageItemView.this, mPosition);
68+
}
69+
70+
@Override
71+
public void onLongPress(MotionEvent e) {
72+
if (mCallbacks != null) {
73+
mCallbacks.onLongPress(DirectMessageItemView.this,
74+
mPosition);
75+
}
76+
// return true;
77+
}
78+
79+
@Override
80+
public boolean onDown(MotionEvent e) {
81+
return true;
82+
}
83+
});
4784
private Context mContext;
4885
private int mPosition;
4986
private TwitterDirectMessage mDirectMessage;
@@ -52,25 +89,9 @@ public class DirectMessageItemView extends LinearLayout {
5289
private QuickContactDivot mAvatar;
5390
private boolean mFullConversation;
5491
private ViewHolder mHolder;
55-
private final Path mPath = new Path();
56-
private final Paint mPaint = new Paint();
57-
58-
/*
59-
*
60-
*/
61-
public interface DirectMessageItemViewCallbacks {
62-
63-
public boolean onSingleTapConfirmed(View view, int position);
64-
65-
public void onLongPress(View view, int position);
66-
67-
public Activity getActivity();
68-
69-
public LazyImageLoader getProfileImageLoader();
70-
}
7192

7293
/*
73-
*
94+
*
7495
*/
7596
public DirectMessageItemView(Context context) {
7697
super(context);
@@ -259,6 +280,8 @@ public void onClick(View v) {
259280
if (imageLoader != null) {
260281
imageLoader.displayImage(imageUrl, mAvatar);
261282
}
283+
} else {
284+
mAvatar.setImageResource(R.drawable.ic_contact_picture);
262285
}
263286

264287
mMessageBlock = mHolder.messageBlock;
@@ -273,43 +296,6 @@ public void onClick(View v) {
273296
}
274297
}
275298

276-
/*
277-
*
278-
*/
279-
private final OnTouchListener mOnTouchListener = new OnTouchListener() {
280-
281-
@Override
282-
public boolean onTouch(View v, MotionEvent event) {
283-
return mGestureDetector.onTouchEvent(event);
284-
}
285-
};
286-
287-
/*
288-
*
289-
*/
290-
private final GestureDetector mGestureDetector = new GestureDetector(
291-
new GestureDetector.SimpleOnGestureListener() {
292-
293-
@Override
294-
public boolean onSingleTapConfirmed(MotionEvent e) {
295-
return mCallbacks != null && mCallbacks.onSingleTapConfirmed(DirectMessageItemView.this, mPosition);
296-
}
297-
298-
@Override
299-
public void onLongPress(MotionEvent e) {
300-
if (mCallbacks != null) {
301-
mCallbacks.onLongPress(DirectMessageItemView.this,
302-
mPosition);
303-
}
304-
// return true;
305-
}
306-
307-
@Override
308-
public boolean onDown(MotionEvent e) {
309-
return true;
310-
}
311-
});
312-
313299
public TwitterDirectMessage getDirectMessage() {
314300
return mDirectMessage;
315301
}
@@ -384,6 +370,20 @@ public void dispatchDraw(Canvas c) {
384370
}
385371
}
386372

373+
/*
374+
*
375+
*/
376+
public interface DirectMessageItemViewCallbacks {
377+
378+
public boolean onSingleTapConfirmed(View view, int position);
379+
380+
public void onLongPress(View view, int position);
381+
382+
public Activity getActivity();
383+
384+
public LazyImageLoader getProfileImageLoader();
385+
}
386+
387387
private static class ViewHolder {
388388
public ImageView replyIcon;
389389
public TextView authorScreenNameTextView;

android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/UserFeedItemView.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030

3131
public class UserFeedItemView extends LinearLayout {
3232

33+
private final Path mPath = new Path();
34+
private final Paint mPaint = new Paint();
3335
private Context mContext;
3436
private TwitterUser mUser;
3537
private long mUserId;
3638
private String mUserScreenName;
3739
private View mMessageBlock;
3840
private QuickContactDivot mAvatar;
39-
private final Path mPath = new Path();
40-
private final Paint mPaint = new Paint();
4141

4242
public UserFeedItemView(Context context) {
4343
super(context);
@@ -74,15 +74,14 @@ public void configure(TwitterUser user, int position,
7474
mAvatar = (QuickContactDivot) findViewById(R.id.avatar);
7575
if (AppSettings.get().downloadFeedImages()) {
7676
String imageUrl = user.getProfileImageUrl(TwitterManager.ProfileImageSize.BIGGER);
77-
// UrlImageViewHelper.setUrlDrawable(avatar, imageUrl,
78-
// R.drawable.ic_contact_picture);
79-
// avatar.setImageURL(imageUrl);
8077

8178
LazyImageLoader profileImageLoader = callbacks
8279
.getProfileImageLoader();
8380
if (profileImageLoader != null) {
8481
profileImageLoader.displayImage(imageUrl, mAvatar);
8582
}
83+
} else {
84+
mAvatar.setImageResource(R.drawable.ic_contact_picture);
8685
}
8786

8887
mMessageBlock = findViewById(R.id.message_block);

0 commit comments

Comments
 (0)