Revert to using a chat fragment, but load it in a separated activity on phones to still have the rotation feature
This commit is contained in:
parent
459ba85533
commit
af7048f125
6 changed files with 1160 additions and 1069 deletions
|
@ -95,7 +95,8 @@
|
|||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.33" />
|
||||
android:layout_weight="0.33"
|
||||
android:paddingBottom="10dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
8
res/layout/chat_activity.xml
Normal file
8
res/layout/chat_activity.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/fragmentContainer"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</LinearLayout>
|
File diff suppressed because it is too large
Load diff
1100
src/org/linphone/ChatFragment.java
Normal file
1100
src/org/linphone/ChatFragment.java
Normal file
File diff suppressed because it is too large
Load diff
|
@ -33,7 +33,8 @@ public enum FragmentsAvailable {
|
|||
ABOUT_INSTEAD_OF_CHAT,
|
||||
ACCOUNT_SETTINGS,
|
||||
SETTINGS,
|
||||
CHATLIST;
|
||||
CHATLIST,
|
||||
CHAT;
|
||||
|
||||
public boolean shouldAnimate() {
|
||||
return true;
|
||||
|
@ -71,6 +72,9 @@ public enum FragmentsAvailable {
|
|||
case ACCOUNT_SETTINGS:
|
||||
return SETTINGS.isRightOf(fragment) || fragment == SETTINGS;
|
||||
|
||||
case CHAT:
|
||||
return CHATLIST.isRightOf(fragment) || fragment == CHATLIST;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -87,6 +91,9 @@ public enum FragmentsAvailable {
|
|||
case EDIT_CONTACT:
|
||||
return fragment == CONTACT || fragment == CONTACTS;
|
||||
|
||||
case CHAT:
|
||||
return fragment == CHATLIST;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -314,9 +314,8 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
|||
changeCurrentFragment(newFragmentType, extras, false);
|
||||
}
|
||||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
private void changeCurrentFragment(FragmentsAvailable newFragmentType, Bundle extras, boolean withoutAnimation) {
|
||||
if (newFragmentType == currentFragment) {
|
||||
if (newFragmentType == currentFragment && newFragmentType != FragmentsAvailable.CHAT) {
|
||||
return;
|
||||
}
|
||||
nextFragment = newFragmentType;
|
||||
|
@ -382,6 +381,11 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
|||
newFragment = new ChatListFragment();
|
||||
messageListFragment = new Fragment();
|
||||
break;
|
||||
case CHAT:
|
||||
newFragment = new ChatFragment();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (newFragment != null) {
|
||||
|
@ -610,6 +614,22 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
|||
String displayName = lAddress.getDisplayName();
|
||||
String pictureUri = uri == null ? null : uri.toString();
|
||||
|
||||
if (currentFragment == FragmentsAvailable.CHATLIST || currentFragment == FragmentsAvailable.CHAT) {
|
||||
if (isTablet()) {
|
||||
Fragment fragment2 = getSupportFragmentManager().findFragmentById(R.id.fragmentContainer2);
|
||||
if (fragment2 != null && fragment2.isVisible() && currentFragment == FragmentsAvailable.CHAT) {
|
||||
ChatFragment chatFragment = (ChatFragment) fragment2;
|
||||
chatFragment.changeDisplayedChat(sipUri, displayName, pictureUri);
|
||||
} else {
|
||||
Bundle extras = new Bundle();
|
||||
extras.putString("SipUri", sipUri);
|
||||
if (lAddress.getDisplayName() != null) {
|
||||
extras.putString("DisplayName", displayName);
|
||||
extras.putString("PictureUri", pictureUri);
|
||||
}
|
||||
changeCurrentFragment(FragmentsAvailable.CHAT, extras);
|
||||
}
|
||||
} else {
|
||||
Intent intent = new Intent(this, ChatActivity.class);
|
||||
intent.putExtra("SipUri", sipUri);
|
||||
if (lAddress.getDisplayName() != null) {
|
||||
|
@ -618,6 +638,8 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
|||
}
|
||||
startOrientationSensor();
|
||||
startActivityForResult(intent, CHAT_ACTIVITY);
|
||||
}
|
||||
}
|
||||
|
||||
LinphoneService.instance().resetMessageNotifCount();
|
||||
LinphoneService.instance().removeMessageNotification();
|
||||
|
@ -698,6 +720,7 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
|||
aboutSettings.setSelected(true);
|
||||
break;
|
||||
case CHATLIST:
|
||||
case CHAT:
|
||||
chat.setSelected(true);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue