Fix change chat on tablet drafts issues

This commit is contained in:
Sylvain Berfini 2012-12-03 12:11:20 +01:00
parent 8ea7073027
commit 28c428dfa0
2 changed files with 19 additions and 3 deletions

View file

@ -311,8 +311,25 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
});
}
public void changeDisplayedChat(String sipUri, String displayName, String pictureUri) {
this.sipUri = sipUri;
public void changeDisplayedChat(String newSipUri, String displayName, String pictureUri) {
if (!message.getText().toString().equals("") && LinphoneActivity.isInstanciated()) {
ChatStorage chatStorage = LinphoneActivity.instance().getChatStorage();
if (chatStorage.getDraft(sipUri) == null) {
chatStorage.saveDraft(sipUri, message.getText().toString());
} else {
chatStorage.updateDraft(sipUri, message.getText().toString());
}
} else if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().getChatStorage().deleteDraft(sipUri);
}
sipUri = newSipUri;
if (LinphoneActivity.isInstanciated()) {
String draft = LinphoneActivity.instance().getChatStorage().getDraft(sipUri);
if (draft == null)
draft = "";
message.setText(draft);
}
displayChat(displayName, pictureUri);
}

View file

@ -21,7 +21,6 @@ import java.util.List;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.Log;
import android.os.Bundle;
import android.os.Handler;