mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
97 lines
2.5 KiB
Java
97 lines
2.5 KiB
Java
package org.linphone;
|
|
|
|
/*
|
|
FragmentsAvailable.java
|
|
Copyright (C) 2017 Belledonne Communications, Grenoble, France
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License
|
|
as published by the Free Software Foundation; either version 2
|
|
of the License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
public enum FragmentsAvailable {
|
|
UNKNOW,
|
|
DIALER,
|
|
EMPTY,
|
|
HISTORY_LIST,
|
|
HISTORY_DETAIL,
|
|
CONTACTS_LIST,
|
|
CONTACT_DETAIL,
|
|
CONTACT_EDITOR,
|
|
ABOUT,
|
|
ACCOUNT_SETTINGS,
|
|
SETTINGS,
|
|
CHAT_LIST,
|
|
CHAT;
|
|
|
|
public boolean shouldAnimate() {
|
|
return true;
|
|
}
|
|
|
|
public boolean isRightOf(FragmentsAvailable fragment) {
|
|
switch (this) {
|
|
case HISTORY_LIST:
|
|
return fragment == UNKNOW;
|
|
|
|
case HISTORY_DETAIL:
|
|
return HISTORY_LIST.isRightOf(fragment) || fragment == HISTORY_LIST;
|
|
|
|
case CONTACTS_LIST:
|
|
return HISTORY_DETAIL.isRightOf(fragment) || fragment == HISTORY_DETAIL;
|
|
|
|
case CONTACT_DETAIL:
|
|
return CONTACTS_LIST.isRightOf(fragment) || fragment == CONTACTS_LIST;
|
|
|
|
case CONTACT_EDITOR:
|
|
return CONTACT_DETAIL.isRightOf(fragment) || fragment == CONTACT_DETAIL;
|
|
|
|
case DIALER:
|
|
return CONTACT_EDITOR.isRightOf(fragment) || fragment == CONTACT_EDITOR;
|
|
|
|
case CHAT_LIST:
|
|
return DIALER.isRightOf(fragment) || fragment == DIALER;
|
|
|
|
case SETTINGS:
|
|
return CHAT_LIST.isRightOf(fragment) || fragment == CHAT_LIST;
|
|
|
|
case ABOUT:
|
|
case ACCOUNT_SETTINGS:
|
|
return SETTINGS.isRightOf(fragment) || fragment == SETTINGS;
|
|
|
|
case CHAT:
|
|
return CHAT_LIST.isRightOf(fragment) || fragment == CHAT_LIST;
|
|
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public boolean shouldAddItselfToTheRightOf(FragmentsAvailable fragment) {
|
|
switch (this) {
|
|
case HISTORY_DETAIL:
|
|
return fragment == HISTORY_LIST || fragment == HISTORY_DETAIL;
|
|
|
|
case CONTACT_DETAIL:
|
|
return fragment == CONTACTS_LIST || fragment == CONTACT_EDITOR|| fragment == CONTACT_DETAIL;
|
|
|
|
case CONTACT_EDITOR:
|
|
return fragment == CONTACTS_LIST || fragment == CONTACT_DETAIL || fragment == CONTACT_EDITOR;
|
|
|
|
case CHAT:
|
|
return fragment == CHAT_LIST || fragment == CHAT;
|
|
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
}
|