Improved memory while in chat view
This commit is contained in:
parent
cebe5d9b00
commit
19381472a4
3 changed files with 17 additions and 3 deletions
|
@ -369,10 +369,20 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
LinphoneChatMessage message = history.get(position);
|
||||
RelativeLayout rlayout = new RelativeLayout(context);
|
||||
RelativeLayout rlayout;
|
||||
|
||||
if (convertView != null) {
|
||||
rlayout = (RelativeLayout) convertView;
|
||||
View bbv = rlayout.getChildAt(0);
|
||||
rlayout.removeAllViews();
|
||||
BubbleChat bbc = (BubbleChat) bbv.getTag();
|
||||
bbc.destroy();
|
||||
} else {
|
||||
rlayout = new RelativeLayout(context);
|
||||
}
|
||||
BubbleChat bubble = new BubbleChat(context, message, contact);
|
||||
View v = bubble.getView();
|
||||
v.setTag(bubble);
|
||||
|
||||
registerForContextMenu(v);
|
||||
|
||||
|
@ -470,7 +480,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
adapter.refreshHistory();
|
||||
adapter.notifyDataSetChanged();
|
||||
} else {
|
||||
adapter = new ChatMessageAdapter(getActivity());
|
||||
adapter = new ChatMessageAdapter(getActivity().getApplicationContext());
|
||||
messagesList.setAdapter(adapter);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
||||
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
||||
historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
historyList.setAdapter(new CallHistoryAdapter(getActivity()));
|
||||
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -236,6 +236,10 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
|
|||
public View getView() {
|
||||
return view;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
defaultBitmap.recycle();
|
||||
}
|
||||
|
||||
private String timestampToHumanDate(Context context, long timestamp) {
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue