Fix ui in Chat fragments for tablet
This commit is contained in:
parent
399d219d51
commit
4eaf8b7025
2 changed files with 26 additions and 0 deletions
|
@ -74,6 +74,7 @@ import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.linphone.compatibility.Compatibility;
|
import org.linphone.compatibility.Compatibility;
|
||||||
|
import org.linphone.core.LinphoneAccountCreator;
|
||||||
import org.linphone.core.LinphoneAddress;
|
import org.linphone.core.LinphoneAddress;
|
||||||
import org.linphone.core.LinphoneBuffer;
|
import org.linphone.core.LinphoneBuffer;
|
||||||
import org.linphone.core.LinphoneChatMessage;
|
import org.linphone.core.LinphoneChatMessage;
|
||||||
|
@ -441,6 +442,13 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
LinphoneChatMessage message = getMessageForId(item.getGroupId());
|
LinphoneChatMessage message = getMessageForId(item.getGroupId());
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
chatRoom.deleteMessage(message);
|
chatRoom.deleteMessage(message);
|
||||||
|
if (getResources().getBoolean(R.bool.isTablet) && chatRoom.getHistorySize() <= 0) {
|
||||||
|
if (LinphoneActivity.isInstanciated()) {
|
||||||
|
LinphoneActivity.instance().displayChat("", null);
|
||||||
|
LinphoneActivity.instance().onMessageSent("", null);
|
||||||
|
initNewChatConversation();
|
||||||
|
}
|
||||||
|
}
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -573,6 +581,13 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
chatRoom.deleteMessage(message);
|
chatRoom.deleteMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (getResources().getBoolean(R.bool.isTablet) && chatRoom.getHistorySize() <= 0) {
|
||||||
|
if (LinphoneActivity.isInstanciated()) {
|
||||||
|
LinphoneActivity.instance().displayChat("", null);
|
||||||
|
LinphoneActivity.instance().onMessageSent("", null);
|
||||||
|
initNewChatConversation();
|
||||||
|
}
|
||||||
|
}
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,6 +669,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
&& chatRoom != null && chatRoom.islimeAvailable())){
|
&& chatRoom != null && chatRoom.islimeAvailable())){
|
||||||
sendTextMessage(message.getText().toString());
|
sendTextMessage(message.getText().toString());
|
||||||
message.setText("");
|
message.setText("");
|
||||||
|
invalidate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -961,6 +977,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initNewChatConversation(){
|
private void initNewChatConversation(){
|
||||||
|
newChatConversation = true;
|
||||||
|
chatRoom = null;
|
||||||
messagesList.setVisibility(View.GONE);
|
messagesList.setVisibility(View.GONE);
|
||||||
edit.setVisibility(View.INVISIBLE);
|
edit.setVisibility(View.INVISIBLE);
|
||||||
startCall.setVisibility(View.INVISIBLE);
|
startCall.setVisibility(View.INVISIBLE);
|
||||||
|
@ -969,6 +987,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
searchAdapter = new SearchContactsListAdapter(null);
|
searchAdapter = new SearchContactsListAdapter(null);
|
||||||
resultContactsSearch.setAdapter(searchAdapter);
|
resultContactsSearch.setAdapter(searchAdapter);
|
||||||
searchContactField.setVisibility(View.VISIBLE);
|
searchContactField.setVisibility(View.VISIBLE);
|
||||||
|
searchContactField.setText("");
|
||||||
searchContactField.requestFocus();
|
searchContactField.requestFocus();
|
||||||
searchContactField.addTextChangedListener(new TextWatcher() {
|
searchContactField.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -130,6 +130,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
quitEditMode();
|
||||||
LinphoneActivity.instance().updateMissedChatCount();
|
LinphoneActivity.instance().updateMissedChatCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,6 +181,9 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
|
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
mConversations = LinphoneActivity.instance().getChatList();
|
mConversations = LinphoneActivity.instance().getChatList();
|
||||||
|
if (getResources().getBoolean(R.bool.isTablet)) {
|
||||||
|
LinphoneActivity.instance().displayChat("", null);
|
||||||
|
}
|
||||||
hideAndDisplayMessageIfNoChat();
|
hideAndDisplayMessageIfNoChat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,6 +253,9 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
|
|
||||||
LinphoneActivity.instance().removeFromChatList(sipUri);
|
LinphoneActivity.instance().removeFromChatList(sipUri);
|
||||||
mConversations = LinphoneActivity.instance().getChatList();
|
mConversations = LinphoneActivity.instance().getChatList();
|
||||||
|
if (getResources().getBoolean(R.bool.isTablet)) {
|
||||||
|
quitEditMode();
|
||||||
|
}
|
||||||
hideAndDisplayMessageIfNoChat();
|
hideAndDisplayMessageIfNoChat();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue