Fix tablet display when pressing back button
This commit is contained in:
parent
26d69ee9b3
commit
1f54b20397
1 changed files with 25 additions and 7 deletions
|
@ -101,6 +101,7 @@ public class LinphoneActivity extends FragmentActivity implements
|
||||||
private LinearLayout menu, mark;
|
private LinearLayout menu, mark;
|
||||||
private RelativeLayout contacts, history, settings, chat, aboutChat, aboutSettings;
|
private RelativeLayout contacts, history, settings, chat, aboutChat, aboutSettings;
|
||||||
private FragmentsAvailable currentFragment, nextFragment;
|
private FragmentsAvailable currentFragment, nextFragment;
|
||||||
|
private List<FragmentsAvailable> fragmentsHistory;
|
||||||
private Fragment dialerFragment, messageListenerFragment, messageListFragment, friendStatusListenerFragment;
|
private Fragment dialerFragment, messageListenerFragment, messageListFragment, friendStatusListenerFragment;
|
||||||
private SavedState dialerSavedState;
|
private SavedState dialerSavedState;
|
||||||
private boolean preferLinphoneContacts = false, isAnimationDisabled = false, isContactPresenceDisabled = true;
|
private boolean preferLinphoneContacts = false, isAnimationDisabled = false, isContactPresenceDisabled = true;
|
||||||
|
@ -146,9 +147,11 @@ public class LinphoneActivity extends FragmentActivity implements
|
||||||
|
|
||||||
setContentView(R.layout.main);
|
setContentView(R.layout.main);
|
||||||
instance = this;
|
instance = this;
|
||||||
|
fragmentsHistory = new ArrayList<FragmentsAvailable>();
|
||||||
initButtons();
|
initButtons();
|
||||||
|
|
||||||
currentFragment = nextFragment = FragmentsAvailable.DIALER;
|
currentFragment = nextFragment = FragmentsAvailable.DIALER;
|
||||||
|
fragmentsHistory.add(currentFragment);
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
if (findViewById(R.id.fragmentContainer) != null) {
|
if (findViewById(R.id.fragmentContainer) != null) {
|
||||||
dialerFragment = new DialerFragment();
|
dialerFragment = new DialerFragment();
|
||||||
|
@ -422,6 +425,10 @@ public class LinphoneActivity extends FragmentActivity implements
|
||||||
getSupportFragmentManager().executePendingTransactions();
|
getSupportFragmentManager().executePendingTransactions();
|
||||||
|
|
||||||
currentFragment = newFragmentType;
|
currentFragment = newFragmentType;
|
||||||
|
if (currentFragment == FragmentsAvailable.DIALER) {
|
||||||
|
fragmentsHistory.clear();
|
||||||
|
}
|
||||||
|
fragmentsHistory.add(currentFragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayHistoryDetail(String sipUri, LinphoneCallLog log) {
|
public void displayHistoryDetail(String sipUri, LinphoneCallLog log) {
|
||||||
|
@ -673,11 +680,6 @@ public class LinphoneActivity extends FragmentActivity implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
private void reloadConfig() {
|
|
||||||
// Nothing to do here anymore
|
|
||||||
}
|
|
||||||
|
|
||||||
public void displayAccountSettings(int accountNumber) {
|
public void displayAccountSettings(int accountNumber) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putInt("Account", accountNumber);
|
bundle.putInt("Account", accountNumber);
|
||||||
|
@ -1357,7 +1359,6 @@ public class LinphoneActivity extends FragmentActivity implements
|
||||||
|
|
||||||
if (currentFragment == FragmentsAvailable.SETTINGS) {
|
if (currentFragment == FragmentsAvailable.SETTINGS) {
|
||||||
showStatusBar();
|
showStatusBar();
|
||||||
reloadConfig();
|
|
||||||
updateAnimationsState();
|
updateAnimationsState();
|
||||||
} else if (currentFragment == FragmentsAvailable.CHATLIST) {
|
} else if (currentFragment == FragmentsAvailable.CHATLIST) {
|
||||||
//Hack to ensure display the status bar on some devices
|
//Hack to ensure display the status bar on some devices
|
||||||
|
@ -1365,9 +1366,26 @@ public class LinphoneActivity extends FragmentActivity implements
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (currentFragment == FragmentsAvailable.SETTINGS) {
|
if (currentFragment == FragmentsAvailable.SETTINGS) {
|
||||||
reloadConfig();
|
|
||||||
updateAnimationsState();
|
updateAnimationsState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fragmentsHistory.remove(fragmentsHistory.size() - 1);
|
||||||
|
FragmentsAvailable newFragmentType = fragmentsHistory.get(fragmentsHistory.size() - 1);
|
||||||
|
LinearLayout ll = (LinearLayout) findViewById(R.id.fragmentContainer2);
|
||||||
|
if (newFragmentType.shouldAddItselfToTheRightOf(currentFragment)) {
|
||||||
|
ll.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
if (newFragmentType == FragmentsAvailable.DIALER
|
||||||
|
|| newFragmentType == FragmentsAvailable.ABOUT
|
||||||
|
|| newFragmentType == FragmentsAvailable.ABOUT_INSTEAD_OF_CHAT
|
||||||
|
|| newFragmentType == FragmentsAvailable.ABOUT_INSTEAD_OF_SETTINGS
|
||||||
|
|| newFragmentType == FragmentsAvailable.SETTINGS
|
||||||
|
|| newFragmentType == FragmentsAvailable.ACCOUNT_SETTINGS) {
|
||||||
|
ll.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
ll.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (keyCode == KeyEvent.KEYCODE_MENU && statusFragment != null) {
|
} else if (keyCode == KeyEvent.KEYCODE_MENU && statusFragment != null) {
|
||||||
|
|
Loading…
Reference in a new issue