Add chat edition for deleting chat message

fix new conversation
This commit is contained in:
Margaux Clerc 2015-11-10 17:57:26 +01:00
parent 5e7b18b2ff
commit 0da770e015
6 changed files with 245 additions and 196 deletions

View file

@ -62,89 +62,71 @@
android:layout_toRightOf="@id/back"
android:layout_toLeftOf="@id/start_call"
android:paddingLeft="10dp"
android:gravity="center"/>
android:gravity="center_vertical"/>
</RelativeLayout>
<include layout="@layout/edit_list"/>
<LinearLayout
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@color/colorF">
<RelativeLayout
android:id="@+id/messageLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/sendPicture"
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@color/colorF">
<RelativeLayout
android:id="@+id/messageLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/sendPicture"
android:padding="5dp"
android:scaleType="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="@drawable/chat_send_file" />
<ImageView
android:id="@+id/sendMessage"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="@drawable/chat_send_file" />
<ImageView
android:id="@+id/sendMessage"
android:gravity="center"
android:padding="5dp"
android:scaleType="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/chat_send_message"
android:layout_alignTop="@+id/message"
android:layout_alignParentRight="true"/>
<EditText
android:imeOptions="flagNoExtractUi"
android:textCursorDrawable="@null"
android:id="@+id/message"
android:inputType="textMultiLine"
android:maxLines="3"
android:textColor="@android:color/black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/sendPicture"
android:layout_toLeftOf="@id/sendMessage"
android:background="@drawable/resizable_textfield"
android:layout_centerVertical="true"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/uploadLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:contentDescription="@string/content_description_cancel"
android:id="@+id/cancelUpload"
android:src="@drawable/clean_field_default"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_alignParentRight="true"
android:padding="20dp" />
</RelativeLayout>
<EditText
android:imeOptions="flagNoExtractUi"
android:textCursorDrawable="@null"
android:id="@+id/message"
android:inputType="textMultiLine"
android:maxLines="3"
android:textColor="@android:color/black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/sendPicture"
android:layout_toLeftOf="@id/sendMessage"
android:background="@drawable/resizable_textfield"
android:layout_centerVertical="true"/>
</RelativeLayout>
</LinearLayout>
<TextView
android:id="@+id/remoteComposing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/remoteComposing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorB"
android:text="@string/remote_composing"
android:layout_above="@id/footer"/>
android:text="@string/remote_composing"
android:layout_above="@id/footer"/>
<ListView
android:id="@+id/chatMessageList"
@ -154,8 +136,8 @@
android:stackFromBottom="true"
android:transcriptMode="alwaysScroll"
android:cacheColorHint="@color/transparent"
android:dividerHeight="10dp"
android:layout_above="@id/remoteComposing"
android:dividerHeight="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
@ -166,6 +148,7 @@
android:textCursorDrawable="@null"
android:visibility="gone"
android:layout_margin="10dp"
android:layout_below="@id/top_bar"
android:id="@+id/searchContactField"
android:layout_width="match_parent"
android:layout_height="40dp"
@ -173,9 +156,7 @@
android:background="@drawable/resizable_textfield"
android:gravity="center"
android:completionThreshold="1"
android:layout_below="@+id/top_bar"
android:paddingRight="5dp"
android:inputType="textPersonName"/>
</RelativeLayout>

View file

@ -108,12 +108,13 @@
android:id="@+id/delete"
android:button="@drawable/checkbox"
android:contentDescription="@string/content_description_delete"
android:paddingRight="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_width="30dp"
android:layout_height="30dp"
android:adjustViewBounds="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:visibility="gone" />
</LinearLayout>

View file

@ -1,13 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bubble"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/delete"
android:button="@drawable/checkbox"
android:contentDescription="@string/content_description_delete"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_width="30dp"
android:layout_height="30dp"
android:adjustViewBounds="true"
android:layout_alignParentRight="true"
android:visibility="gone" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/delete"
android:background="@drawable/resizable_chat_bubble_outgoing"
android:orientation="horizontal" >
@ -41,15 +54,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ProgressBar
android:id="@+id/inprogress"
android:visibility="gone"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:layout_gravity="top|right"
android:layout_width="20dp"
android:layout_height="20dp"/>
<ImageView
android:id="@+id/image"
android:visibility="gone"
@ -70,7 +74,7 @@
android:id="@+id/progress_bar"
android:paddingRight="5dp"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="200dp"
android:layout_width="150dp"
android:layout_height="5dp"/>
<Button
android:id="@+id/cancel_upload"
@ -87,31 +91,24 @@
</LinearLayout>
<ImageView
android:id="@+id/status"
android:contentDescription="@string/content_description_message_status"
android:visibility="invisible"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:layout_gravity="top|right"
android:layout_width="20dp"
android:layout_height="20dp"
android:adjustViewBounds="true" />
<ImageView
android:id="@+id/status"
android:contentDescription="@string/content_description_message_status"
android:visibility="invisible"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:layout_gravity="top|right"
android:layout_width="20dp"
android:layout_height="20dp"
android:adjustViewBounds="true" />
<ProgressBar
android:id="@+id/inprogress"
android:visibility="gone"
android:paddingRight="5dp"
android:layout_gravity="top|right"
android:layout_width="20dp"
android:layout_height="20dp"/>
</LinearLayout>
<CheckBox
android:id="@+id/delete"
android:button="@drawable/checkbox"
android:contentDescription="@string/content_description_delete"
android:paddingRight="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:visibility="gone" />
</LinearLayout>
</RelativeLayout>

View file

@ -26,10 +26,7 @@ import android.app.Dialog;
import android.app.Fragment;
import android.graphics.Matrix;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.linphone.compatibility.Compatibility;
@ -65,7 +62,6 @@ import android.os.Environment;
import android.os.Parcelable;
import android.provider.MediaStore;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.view.ContextMenu;
import android.view.LayoutInflater;
@ -76,9 +72,12 @@ import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.AbsListView;
import android.widget.AutoCompleteTextView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Filter;
import android.widget.Filterable;
@ -86,10 +85,10 @@ import android.widget.ImageView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
public class ChatFragment extends Fragment implements OnClickListener, LinphoneChatMessage.LinphoneChatMessageListener {
private static ChatFragment instance;
@ -170,9 +169,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
remoteComposing = (TextView) view.findViewById(R.id.remoteComposing);
remoteComposing.setVisibility(View.GONE);
uploadLayout = (RelativeLayout) view.findViewById(R.id.uploadLayout);
uploadLayout.setVisibility(View.GONE);
cancel = (ImageView) view.findViewById(R.id.cancel);
cancel.setOnClickListener(this);
@ -200,6 +196,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
searchContactField.setAdapter(new SearchContactsListAdapter(ContactsManager.getInstance().getAllContacts(), null, inflater));
edit.setVisibility(View.INVISIBLE);
startCall.setVisibility(View.INVISIBLE);
contactName.setVisibility(View.INVISIBLE);
} else {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
@ -243,22 +240,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
}
});
}
cancelUpload = (ImageView) view.findViewById(R.id.cancelUpload);
cancelUpload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (currentMessageInFileTransferUploadState != null) {
uploadLayout.setVisibility(View.GONE);
textLayout.setVisibility(View.VISIBLE);
//progressBar.setProgress(0);
currentMessageInFileTransferUploadState.cancelFileTransfer();
currentMessageInFileTransferUploadState = null;
LinphoneManager.getInstance().setUploadPendingFileMessage(null);
}
}
});
mListener = new LinphoneCoreListenerBase(){
@Override
@ -348,6 +329,29 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
}
}
public int getNbItemsChecked(){
int size = messagesList.getAdapter().getCount();
int nb = 0;
for(int i=0; i<size; i++) {
if(messagesList.isItemChecked(i)) {
nb ++;
}
}
return nb;
}
public void enabledDeleteButton(Boolean enabled){
if(enabled){
delete.setEnabled(true);
delete.setAlpha(1f);
} else {
if (getNbItemsChecked() == 0){
delete.setEnabled(false);
delete.setAlpha(0.2f);
}
}
}
class ChatMessageAdapter extends BaseAdapter {
LinphoneChatMessage[] history;
Context context;
@ -397,21 +401,53 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
public View getView(final int position, View convertView, ViewGroup parent) {
LinphoneChatMessage message = history[position];
BubbleChat bubble = new BubbleChat(context, message, contact);
View v = bubble.getView();
registerForContextMenu(v);
RelativeLayout rlayout = new RelativeLayout(context);
CheckBox deleteChatBubble = (CheckBox) v.findViewById(R.id.delete);
if(isEditMode) {
v.findViewById(R.id.delete).setVisibility(View.VISIBLE);
Log.w("edit mode");
deleteChatBubble.setVisibility(View.VISIBLE);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
layoutParams.setMargins(0, 10, 30, 10);
layoutParams.setMargins(0, 10, 0, 10);
v.setLayoutParams(layoutParams);
deleteChatBubble.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
messagesList.setItemChecked(position, b);
if (getNbItemsChecked() == getCount()) {
deselectAll.setVisibility(View.VISIBLE);
selectAll.setVisibility(View.GONE);
enabledDeleteButton(true);
} else {
if (getNbItemsChecked() == 0) {
deselectAll.setVisibility(View.GONE);
selectAll.setVisibility(View.VISIBLE);
enabledDeleteButton(false);
} else {
deselectAll.setVisibility(View.GONE);
selectAll.setVisibility(View.VISIBLE);
enabledDeleteButton(true);
}
}
}
});
if(messagesList.isItemChecked(position)) {
deleteChatBubble.setChecked(true);
} else {
deleteChatBubble.setChecked(false);
}
rlayout.addView(v);
} else {
if(message.isOutgoing()){
@ -432,9 +468,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
}
public void dispayMessageList() {
messagesList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
adapter = new ChatMessageAdapter(getActivity(), chatRoom.getHistory());
messagesList.setAdapter(adapter);
adapter.notifyDataSetChanged();
}
private void displayChatHeader(LinphoneAddress address) {
@ -592,8 +628,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
backToCall.setVisibility(View.VISIBLE);
startCall.setVisibility(View.INVISIBLE);
} else {
backToCall.setVisibility(View.INVISIBLE);
startCall.setVisibility(View.VISIBLE);
if(!newChatConversation) {
backToCall.setVisibility(View.INVISIBLE);
startCall.setVisibility(View.VISIBLE);
}
}
LinphoneAddress lAddress;
@ -639,7 +677,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
}
private void selectAllList(boolean isSelectAll){
//TODO
int size = messagesList.getAdapter().getCount();
for(int i=0; i<size; i++) {
messagesList.setItemChecked(i,isSelectAll);
}
}
public void quitEditMode(){
@ -649,10 +690,23 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
dispayMessageList();
}
private void removeChats(){
int size = messagesList.getAdapter().getCount();
for(int i=0; i<size; i++) {
if(messagesList.isItemChecked(i)){
LinphoneChatMessage message = (LinphoneChatMessage) messagesList.getAdapter().getItem(i);
chatRoom.deleteMessage(message);
}
}
invalidate();
}
@Override
public void onClick(View v) {
int id = v.getId();
Log.w(id);
if (id == R.id.back_to_call) {
LinphoneActivity.instance().resetClassicMenuLayoutAndGoBackToCallIfStillRunning();
return;
@ -661,18 +715,19 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
if (id == R.id.select_all) {
deselectAll.setVisibility(View.VISIBLE);
selectAll.setVisibility(View.GONE);
//selectAllList(true);
enabledDeleteButton(true);
selectAllList(true);
return;
}
if (id == R.id.deselect_all) {
deselectAll.setVisibility(View.GONE);
selectAll.setVisibility(View.VISIBLE);
//selectAllList(false);
enabledDeleteButton(false);
selectAllList(false);
return;
}
if (id == R.id.cancel) {
Log.w("Cancel");
quitEditMode();
return;
}
@ -685,7 +740,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
delete.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
// removeCallLogs();
removeChats();
dialog.dismiss();
quitEditMode();
}
@ -704,8 +759,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
if(id == R.id.sendMessage){
sendTextMessage();
} else if (id == R.id.edit) {
topBar.setVisibility(View.GONE);
}
if (id == R.id.edit) {
topBar.setVisibility(View.INVISIBLE);
editList.setVisibility(View.VISIBLE);
isEditMode = true;
dispayMessageList();
@ -998,7 +1055,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
@Override
public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state) {
Log.w("ICI");
if (state == State.FileTransferDone || state == State.FileTransferError) {
currentMessageInFileTransferUploadState = null;
}
@ -1018,23 +1074,25 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
//progressBar.setProgress(offset * 100 / total);
}
class ContactAddress {
Contact contact;
String address;
private ContactAddress(Contact c, String a){
this.contact = c;
this.address = a;
}
}
class SearchContactsListAdapter extends BaseAdapter implements Filterable {
//private List<ContactAddress> contacts;
private HashMap<Contact, String> contactsList2;
private List<ContactAddress> contacts;
private Cursor cursor;
private LayoutInflater mInflater;
SearchContactsListAdapter(List<Contact> contactsList, Cursor c, LayoutInflater inflater) {
cursor = c;
mInflater = inflater;
contactsList2 = new HashMap<Contact, String>();
//contacts = new ArrayList<ContactAddress>();
for(Contact con: ContactsManager.getInstance().getAllContacts()){
for(String numberOrAddress : con.getNumbersOrAddresses()){
contactsList2.put(con,numberOrAddress);
//contacts.add(new ContactAddress(con,numberOrAddress));
}
}
contacts = getContactsList();
}
@Override
@ -1045,27 +1103,25 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
FilterResults results) {
if (results.count > 0) {
//contacts.clear();
contactsList2.clear();
contactsList2 = ( HashMap<Contact, String>) results.values;
//contacts = (List<ContactAddress>) results.values;
contacts.clear();
contacts = (List<ContactAddress>) results.values;
notifyDataSetChanged();
} else {;
//contacts.clear();
contactsList2.clear();
contactsList2 = getContactsList();
contacts.clear();
contacts = getContactsList();
notifyDataSetInvalidated();
}
}
@Override
protected FilterResults performFiltering(CharSequence constraint) {
//List<ContactAddress> result = new ArrayList<ContactAddress>();
HashMap<Contact, String> result = new HashMap<Contact, String>();
List<ContactAddress> result = new ArrayList<ContactAddress>();
if(constraint != null) {
for (HashMap.Entry<Contact, String> entry : contactsList2.entrySet()) {
if (entry.getKey().getName().toLowerCase().startsWith(constraint.toString()) || entry.getValue().startsWith(constraint.toString())) {
result.put(entry.getKey(),entry.getValue());
for (ContactAddress c : contacts) {
String address = c.address;
if(address.startsWith("sip")) address.substring(4);
if (c.contact.getName().toLowerCase().startsWith(constraint.toString()) || address.toLowerCase().startsWith(constraint.toString())) {
result.add(c);
}
}
}
@ -1077,29 +1133,26 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
};
}
public HashMap<Contact, String> getContactsList(){
HashMap<Contact, String> contacts = new HashMap<Contact, String>();
public List<ContactAddress>getContactsList(){
List<ContactAddress> list = new ArrayList<ContactAddress>();
for(Contact con: ContactsManager.getInstance().getAllContacts()){
for(String numberOrAddress : con.getNumbersOrAddresses()){
contacts.put(con, numberOrAddress);
list.add(new ContactAddress(con, numberOrAddress));
}
}
return contacts;
return list;
}
public int getCount() {
return contactsList2.size();
return contacts.size();
}
public Contact getItem(int position) {
if (contactsList2 == null || position >= contactsList2.size()) {
contactsList2 = getContactsList();
Contact[] s = (Contact[]) contactsList2.keySet().toArray();
return s[position];
public ContactAddress getItem(int position) {
if (contacts == null || position >= contacts.size()) {
contacts = getContactsList();
return contacts.get(position);
} else {
Object[] s = (Object[]) contactsList2.keySet().toArray();
return (Contact) s[position];
//return contactsList2.get();
return contacts.get(position);
}
}
@ -1109,7 +1162,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
public View getView(int position, View convertView, ViewGroup parent) {
View view = null;
Contact contact;
ContactAddress contact;
do {
contact = getItem(position);
} while (contact == null);
@ -1120,14 +1173,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
view = mInflater.inflate(R.layout.search_contact_cell, parent, false);
}
final String a = contact.address;
final Contact c = contact.contact;
TextView name = (TextView) view.findViewById(R.id.Contact_name);
name.setText(contact.getName());
name.setText(c.getName());
final TextView address = (TextView) view.findViewById(R.id.contact_address);
address.setText(contactsList2.get(contact));
final String a = contactsList2.get(contact);
final Contact c = contact;
address.setText(a);
view.setOnClickListener(new OnClickListener() {
@Override

View file

@ -78,7 +78,7 @@ public class ChatStorage {
private ChatStorage(Context c) {
context = c;
boolean useLinphoneStorage = false;
boolean useLinphoneStorage = true;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(LinphoneService.instance());
boolean updateNeeded = prefs.getBoolean(c.getString(R.string.pref_first_time_linphone_chat_storage), !LinphonePreferences.instance().isFirstLaunch());
updateNeeded = updateNeeded && !isVersionUsingNewChatStorage();
@ -378,7 +378,6 @@ public class ChatStorage {
for (LinphoneChatRoom chatroom : chats) {
if (chatroom.getHistory(1).length > 0) {
Log.w("History non nul " + chatroom.getPeerAddress().asString());
rooms.add(chatroom);
}
}

View file

@ -74,10 +74,11 @@ import android.widget.TextView;
public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListener {
private static final HashMap<String, Integer> emoticons = new HashMap<String, Integer>();
private LinearLayout view;
private View view;
private ImageView statusView, contactPicture;
private LinphoneChatMessage nativeMessage;
private Context mContext;
private Button cancelUpload, acceptDownload;
private static final int SIZE_MAX = 512;
private ProgressBar progressBar, inprogress;
private Bitmap defaultBitmap;
@ -91,9 +92,9 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
mContext = context;
if (message.isOutgoing()) {
view = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.chat_bubble_outgoing, null);
view = LayoutInflater.from(context).inflate(R.layout.chat_bubble_outgoing, null);
} else {
view = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.chat_bubble_incoming, null);
view = LayoutInflater.from(context).inflate(R.layout.chat_bubble_incoming, null);
}
defaultBitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.chat_picture_over);
@ -119,12 +120,29 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
}
}
if(nativeMessage.isOutgoing()){
cancelUpload = (Button) view.findViewById(R.id.cancel_upload);
cancelUpload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (LinphoneManager.getInstance().getMessageUploadPending() != null) {
progressBar.setVisibility(View.GONE);
//tex.setVisibility(View.VISIBLE);
progressBar.setProgress(0);
nativeMessage.cancelFileTransfer();
LinphoneManager.getInstance().setUploadPendingFileMessage(null);
}
}
});
}
String externalBodyUrl = message.getExternalBodyUrl();
LinphoneContent fileTransferContent = message.getFileTransferInformation();
if(LinphoneManager.getInstance().getMessageUploadPending() != null){
progressBar.setVisibility(View.VISIBLE);
nativeMessage.setListener(LinphoneManager.getInstance());
LinphoneManager.addListener(this);
}
if (externalBodyUrl != null || fileTransferContent != null ) {