Added option to hide bottom tab bar on secondary level screens

This commit is contained in:
Sylvain Berfini 2018-11-08 16:22:03 +01:00
parent b5362bbee3
commit ab5951ef25
14 changed files with 39 additions and 12 deletions

View file

@ -372,7 +372,6 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
} }
fragment = null; fragment = null;
switch (newFragmentType) { switch (newFragmentType) {
case HISTORY_LIST: case HISTORY_LIST:
fragment = new HistoryListFragment(); fragment = new HistoryListFragment();
@ -862,35 +861,49 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
public void selectMenu(FragmentsAvailable menuToSelect) { public void selectMenu(FragmentsAvailable menuToSelect) {
currentFragment = menuToSelect; currentFragment = menuToSelect;
resetSelection(); resetSelection();
boolean hideBottomBar = getResources().getBoolean(R.bool.hide_bottom_bar_on_second_level_views);
switch (menuToSelect) { switch (menuToSelect) {
case HISTORY_LIST: case HISTORY_LIST:
hideTabBar(false);
history_selected.setVisibility(View.VISIBLE);
break;
case HISTORY_DETAIL: case HISTORY_DETAIL:
hideTabBar(hideBottomBar);
history_selected.setVisibility(View.VISIBLE); history_selected.setVisibility(View.VISIBLE);
break; break;
case CONTACTS_LIST: case CONTACTS_LIST:
hideTabBar(false);
contacts_selected.setVisibility(View.VISIBLE);
break;
case CONTACT_DETAIL: case CONTACT_DETAIL:
case CONTACT_EDITOR: case CONTACT_EDITOR:
hideTabBar(hideBottomBar);
contacts_selected.setVisibility(View.VISIBLE); contacts_selected.setVisibility(View.VISIBLE);
break; break;
case DIALER: case DIALER:
hideTabBar(false);
dialer_selected.setVisibility(View.VISIBLE); dialer_selected.setVisibility(View.VISIBLE);
break; break;
case SETTINGS: case SETTINGS:
case ACCOUNT_SETTINGS: case ACCOUNT_SETTINGS:
hideTabBar(true); hideTabBar(hideBottomBar);
mTopBar.setVisibility(View.VISIBLE); mTopBar.setVisibility(View.VISIBLE);
break; break;
case ABOUT: case ABOUT:
hideTabBar(true); hideTabBar(hideBottomBar);
break; break;
case CHAT_LIST: case CHAT_LIST:
hideTabBar(false);
chat_selected.setVisibility(View.VISIBLE);
break;
case CREATE_CHAT: case CREATE_CHAT:
case GROUP_CHAT: case GROUP_CHAT:
case INFO_GROUP_CHAT: case INFO_GROUP_CHAT:
case MESSAGE_IMDN: case MESSAGE_IMDN:
case CONTACT_DEVICES: case CONTACT_DEVICES:
case CHAT: case CHAT:
hideTabBar(hideBottomBar);
chat_selected.setVisibility(View.VISIBLE); chat_selected.setVisibility(View.VISIBLE);
break; break;
} }

View file

@ -52,6 +52,7 @@ import org.linphone.core.ChatRoom;
import org.linphone.core.ChatRoomListenerStub; import org.linphone.core.ChatRoomListenerStub;
import org.linphone.core.Core; import org.linphone.core.Core;
import org.linphone.core.ProxyConfig; import org.linphone.core.ProxyConfig;
import org.linphone.fragments.FragmentsAvailable;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.ui.ContactSelectView; import org.linphone.ui.ContactSelectView;
@ -245,6 +246,10 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
ContactsManager.addContactsListener(this); ContactsManager.addContactsListener(this);
super.onResume(); super.onResume();
if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CREATE_CHAT);
}
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(INPUT_METHOD_SERVICE); InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(INPUT_METHOD_SERVICE);
if (getActivity().getCurrentFocus() != null) { if (getActivity().getCurrentFocus() != null) {
inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0); inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0);

View file

@ -202,7 +202,6 @@ public class ChatListFragment extends Fragment implements ContactsUpdatedListene
if (LinphoneActivity.isInstanciated()) { if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CHAT_LIST); LinphoneActivity.instance().selectMenu(FragmentsAvailable.CHAT_LIST);
LinphoneActivity.instance().hideTabBar(false);
} }
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();

View file

@ -42,6 +42,7 @@ import org.linphone.core.Core;
import org.linphone.core.Factory; import org.linphone.core.Factory;
import org.linphone.core.Participant; import org.linphone.core.Participant;
import org.linphone.core.ParticipantDevice; import org.linphone.core.ParticipantDevice;
import org.linphone.fragments.FragmentsAvailable;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import java.util.Arrays; import java.util.Arrays;
@ -118,6 +119,11 @@ public class DevicesFragment extends Fragment {
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CONTACT_DEVICES);
}
initValues(); initValues();
} }

View file

@ -546,7 +546,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
} }
public void hideKeyboardVisibleMode() { public void hideKeyboardVisibleMode() {
LinphoneActivity.instance().hideTabBar(false); LinphoneActivity.instance().hideTabBar(getResources().getBoolean(R.bool.hide_bottom_bar_on_second_level_views));
LinphoneActivity.instance().showStatusBar(); LinphoneActivity.instance().showStatusBar();
mTopBar.setVisibility(View.VISIBLE); mTopBar.setVisibility(View.VISIBLE);
} }

View file

@ -52,6 +52,7 @@ import org.linphone.core.ChatRoomListener;
import org.linphone.core.ChatRoomListenerStub; import org.linphone.core.ChatRoomListenerStub;
import org.linphone.core.EventLog; import org.linphone.core.EventLog;
import org.linphone.core.Participant; import org.linphone.core.Participant;
import org.linphone.fragments.FragmentsAvailable;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import java.util.ArrayList; import java.util.ArrayList;
@ -344,6 +345,10 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().selectMenu(FragmentsAvailable.INFO_GROUP_CHAT);
}
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(INPUT_METHOD_SERVICE); InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(INPUT_METHOD_SERVICE);
if (getActivity().getCurrentFocus() != null) { if (getActivity().getCurrentFocus() != null) {
inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0); inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0);

View file

@ -46,6 +46,7 @@ import org.linphone.core.ChatMessageListenerStub;
import org.linphone.core.ChatRoom; import org.linphone.core.ChatRoom;
import org.linphone.core.Core; import org.linphone.core.Core;
import org.linphone.core.ParticipantImdnState; import org.linphone.core.ParticipantImdnState;
import org.linphone.fragments.FragmentsAvailable;
import org.linphone.ui.ContactAvatar; import org.linphone.ui.ContactAvatar;
public class ImdnFragment extends Fragment { public class ImdnFragment extends Fragment {
@ -147,6 +148,10 @@ public class ImdnFragment extends Fragment {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().selectMenu(FragmentsAvailable.MESSAGE_IMDN);
}
refreshInfo(); refreshInfo();
} }

View file

@ -254,7 +254,6 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
if (LinphoneActivity.isInstanciated()) { if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CONTACT_DETAIL); LinphoneActivity.instance().selectMenu(FragmentsAvailable.CONTACT_DETAIL);
LinphoneActivity.instance().hideTabBar(false);
} }
contact.refresh(); contact.refresh();
displayContact(inflater, view); displayContact(inflater, view);

View file

@ -318,7 +318,6 @@ public class ContactEditorFragment extends Fragment {
super.onResume(); super.onResume();
if (LinphoneActivity.isInstanciated()) { if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().hideTabBar(false);
} }
// Force hide keyboard // Force hide keyboard

View file

@ -319,7 +319,6 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
if (LinphoneActivity.isInstanciated()) { if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CONTACTS_LIST); LinphoneActivity.instance().selectMenu(FragmentsAvailable.CONTACTS_LIST);
LinphoneActivity.instance().hideTabBar(false);
onlyDisplayLinphoneContacts = ContactsManager.getInstance().isLinphoneContactsPrefered() || getResources().getBoolean(R.bool.hide_non_linphone_contacts); onlyDisplayLinphoneContacts = ContactsManager.getInstance().isLinphoneContactsPrefered() || getResources().getBoolean(R.bool.hide_non_linphone_contacts);
} }
changeContactsToggle(); changeContactsToggle();

View file

@ -536,7 +536,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
super.onResume(); super.onResume();
if (LinphoneActivity.isInstanciated()) { if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().selectMenu(FragmentsAvailable.SETTINGS); LinphoneActivity.instance().selectMenu(FragmentsAvailable.ACCOUNT_SETTINGS);
} }
} }

View file

@ -154,7 +154,6 @@ public class DialerFragment extends Fragment {
LinphoneActivity.instance().selectMenu(FragmentsAvailable.DIALER); LinphoneActivity.instance().selectMenu(FragmentsAvailable.DIALER);
LinphoneActivity.instance().updateDialerFragment(this); LinphoneActivity.instance().updateDialerFragment(this);
LinphoneActivity.instance().showStatusBar(); LinphoneActivity.instance().showStatusBar();
LinphoneActivity.instance().hideTabBar(false);
} }
boolean isOrientationLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; boolean isOrientationLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;

View file

@ -181,7 +181,6 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
if (LinphoneActivity.isInstanciated()) { if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().selectMenu(FragmentsAvailable.HISTORY_DETAIL); LinphoneActivity.instance().selectMenu(FragmentsAvailable.HISTORY_DETAIL);
LinphoneActivity.instance().hideTabBar(false);
} }
} }

View file

@ -151,7 +151,6 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
if (LinphoneActivity.isInstanciated()) { if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().selectMenu(FragmentsAvailable.HISTORY_LIST); LinphoneActivity.instance().selectMenu(FragmentsAvailable.HISTORY_LIST);
LinphoneActivity.instance().hideTabBar(false);
LinphoneActivity.instance().displayMissedCalls(0); LinphoneActivity.instance().displayMissedCalls(0);
} }