diff --git a/res/layout/chatlist.xml b/res/layout/chatlist.xml
index 6dbe13a16..b1566f7cb 100644
--- a/res/layout/chatlist.xml
+++ b/res/layout/chatlist.xml
@@ -90,5 +90,15 @@
android:divider="@android:color/darker_gray"
android:cacheColorHint="@color/transparent"
android:dividerHeight="1dp" />
+
+
\ No newline at end of file
diff --git a/res/layout/contacts_list.xml b/res/layout/contacts_list.xml
index 8d6c4bac0..bc30c9ccf 100644
--- a/res/layout/contacts_list.xml
+++ b/res/layout/contacts_list.xml
@@ -67,6 +67,28 @@
android:fastScrollAlwaysVisible="true"
android:fastScrollEnabled="true"
android:dividerHeight="1dp" />
+
+
+
+
diff --git a/res/layout/history.xml b/res/layout/history.xml
index 8933dc0da..525788f15 100644
--- a/res/layout/history.xml
+++ b/res/layout/history.xml
@@ -91,5 +91,25 @@
android:divider="@android:color/darker_gray"
android:cacheColorHint="@color/transparent"
android:dividerHeight="1dp" />
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/history_simple.xml b/res/layout/history_simple.xml
index 1b1b04be7..4fbd1c181 100644
--- a/res/layout/history_simple.xml
+++ b/res/layout/history_simple.xml
@@ -91,5 +91,25 @@
android:divider="@android:color/darker_gray"
android:cacheColorHint="@color/transparent"
android:dividerHeight="1dp" />
+
+
+
+
\ No newline at end of file
diff --git a/res/values-FR/strings.xml b/res/values-FR/strings.xml
index 9e84cc952..559dc2758 100644
--- a/res/values-FR/strings.xml
+++ b/res/values-FR/strings.xml
@@ -203,7 +203,12 @@
Numéro ou adresse
Conférence
Brouillon
- Entrez une adresse SIP avec qui discuter…
+ Entrez une adresse SIP…
+ Aucun appel dans votre historique.
+ Aucun appel manqué dans votre historique.
+ Aucun contact dans votre carnet d\'adresse.
+ Aucun contact SIP dans votre carnet d\'adresse.
+ Aucun historique de chat.
@@ -295,7 +300,7 @@
Img
Envoi en cours…
- Mise à jour de l'appel
+ Mise à jour de l\'appel
Votre correspondant souhaite ajouter la vidéo à l\'appel en cours.
Accepter
Refuser
diff --git a/res/values/strings.xml b/res/values/strings.xml
index fce8489e5..9b0ef7c24 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -254,6 +254,11 @@
Conference
Draft
Enter a SIP address to chat with…
+ No call in your history.
+ No missed call in your history.
+ No contact in your address book.
+ No SIP contact in your address book.
+ No chat history.
Add to contacts button
diff --git a/src/org/linphone/ChatListFragment.java b/src/org/linphone/ChatListFragment.java
index 7fdb32662..38f0ff456 100644
--- a/src/org/linphone/ChatListFragment.java
+++ b/src/org/linphone/ChatListFragment.java
@@ -47,7 +47,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
private LayoutInflater mInflater;
private List mConversations, mDrafts;
private ListView chatList;
- private TextView edit, ok, newDiscussion;
+ private TextView edit, ok, newDiscussion, noChatHistory;
private ImageView clearFastChat;
private EditText fastNewChat;
private boolean isEditMode = false;
@@ -62,6 +62,8 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
chatList.setOnItemClickListener(this);
registerForContextMenu(chatList);
+ noChatHistory = (TextView) view.findViewById(R.id.noChatHistory);
+
edit = (TextView) view.findViewById(R.id.edit);
edit.setOnClickListener(this);
@@ -78,6 +80,17 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
return view;
}
+
+ private void hideAndDisplayMessageIfNoChat() {
+ if (mConversations.size() == 0 && mDrafts.size() == 0) {
+ noChatHistory.setVisibility(View.VISIBLE);
+ chatList.setVisibility(View.GONE);
+ } else {
+ noChatHistory.setVisibility(View.GONE);
+ chatList.setVisibility(View.VISIBLE);
+ chatList.setAdapter(new ChatListAdapter());
+ }
+ }
@Override
public void onResume() {
@@ -90,7 +103,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
mConversations = LinphoneActivity.instance().getChatList();
mDrafts = LinphoneActivity.instance().getDraftChatList();
mConversations.removeAll(mDrafts);
- chatList.setAdapter(new ChatListAdapter());
+ hideAndDisplayMessageIfNoChat();
}
@Override
@@ -111,7 +124,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
mConversations = LinphoneActivity.instance().getChatList();
mDrafts = LinphoneActivity.instance().getDraftChatList();
mConversations.removeAll(mDrafts);
- chatList.setAdapter(new ChatListAdapter());
+ hideAndDisplayMessageIfNoChat();
return true;
}
@@ -126,13 +139,13 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
edit.setVisibility(View.VISIBLE);
ok.setVisibility(View.GONE);
isEditMode = false;
- chatList.setAdapter(new ChatListAdapter());
+ hideAndDisplayMessageIfNoChat();
}
else if (id == R.id.edit) {
edit.setVisibility(View.GONE);
ok.setVisibility(View.VISIBLE);
isEditMode = true;
- chatList.setAdapter(new ChatListAdapter());
+ hideAndDisplayMessageIfNoChat();
}
else if (id == R.id.newDiscussion) {
String sipUri = fastNewChat.getText().toString();
@@ -163,7 +176,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
mConversations = LinphoneActivity.instance().getChatList();
mDrafts = LinphoneActivity.instance().getDraftChatList();
mConversations.removeAll(mDrafts);
- chatList.setAdapter(new ChatListAdapter());
+ hideAndDisplayMessageIfNoChat();
LinphoneActivity.instance().updateMissedChatCount();
}
diff --git a/src/org/linphone/ContactsFragment.java b/src/org/linphone/ContactsFragment.java
index 19f2b3405..5cdd31953 100644
--- a/src/org/linphone/ContactsFragment.java
+++ b/src/org/linphone/ContactsFragment.java
@@ -47,7 +47,7 @@ import android.widget.TextView;
public class ContactsFragment extends Fragment implements OnClickListener, OnItemClickListener {
private LayoutInflater mInflater;
private ListView contactsList;
- private TextView allContacts, linphoneContacts, newContact;
+ private TextView allContacts, linphoneContacts, newContact, noSipContact, noContact;
private boolean onlyDisplayLinphoneContacts;
private int lastKnownPosition;
private AlphabetIndexer indexer;
@@ -67,6 +67,9 @@ public class ContactsFragment extends Fragment implements OnClickListener, OnIte
onlyDisplayChatAddress = getArguments().getBoolean("ChatAddressOnly");
}
+ noSipContact = (TextView) view.findViewById(R.id.noSipContact);
+ noContact = (TextView) view.findViewById(R.id.noContact);
+
contactsList = (ListView) view.findViewById(R.id.contactsList);
contactsList.setOnItemClickListener(this);
@@ -111,13 +114,27 @@ public class ContactsFragment extends Fragment implements OnClickListener, OnIte
Cursor allContactsCursor = LinphoneActivity.instance().getAllContactsCursor();
Cursor sipContactsCursor = LinphoneActivity.instance().getSIPContactsCursor();
+
+ noSipContact.setVisibility(View.GONE);
+ noContact.setVisibility(View.GONE);
+ contactsList.setVisibility(View.VISIBLE);
if (onlyDisplayLinphoneContacts) {
- indexer = new AlphabetIndexer(sipContactsCursor, Compatibility.getCursorDisplayNameColumnIndex(sipContactsCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
- contactsList.setAdapter(new ContactsListAdapter(LinphoneActivity.instance().getSIPContacts(), sipContactsCursor));
+ if (sipContactsCursor.getCount() == 0) {
+ noSipContact.setVisibility(View.VISIBLE);
+ contactsList.setVisibility(View.GONE);
+ } else {
+ indexer = new AlphabetIndexer(sipContactsCursor, Compatibility.getCursorDisplayNameColumnIndex(sipContactsCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ contactsList.setAdapter(new ContactsListAdapter(LinphoneActivity.instance().getSIPContacts(), sipContactsCursor));
+ }
} else {
- indexer = new AlphabetIndexer(allContactsCursor, Compatibility.getCursorDisplayNameColumnIndex(allContactsCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
- contactsList.setAdapter(new ContactsListAdapter(LinphoneActivity.instance().getAllContacts(), allContactsCursor));
+ if (allContactsCursor.getCount() == 0) {
+ noContact.setVisibility(View.VISIBLE);
+ contactsList.setVisibility(View.GONE);
+ } else {
+ indexer = new AlphabetIndexer(allContactsCursor, Compatibility.getCursorDisplayNameColumnIndex(allContactsCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ contactsList.setAdapter(new ContactsListAdapter(LinphoneActivity.instance().getAllContacts(), allContactsCursor));
+ }
}
LinphoneActivity.instance().setLinphoneContactsPrefered(onlyDisplayLinphoneContacts);
}
diff --git a/src/org/linphone/HistoryFragment.java b/src/org/linphone/HistoryFragment.java
index c65dcf228..5acf9f3b2 100644
--- a/src/org/linphone/HistoryFragment.java
+++ b/src/org/linphone/HistoryFragment.java
@@ -38,10 +38,10 @@ import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-import android.view.animation.Animation.AnimationListener;
import android.view.ViewGroup;
+import android.view.animation.Animation;
+import android.view.animation.Animation.AnimationListener;
+import android.view.animation.AnimationUtils;
import android.widget.BaseExpandableListAdapter;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.OnChildClickListener;
@@ -56,7 +56,7 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
private Handler mHandler = new Handler();
private ExpandableListView historyList;
private LayoutInflater mInflater;
- private TextView allCalls, missedCalls, edit, ok, deleteAll;
+ private TextView allCalls, missedCalls, edit, ok, deleteAll, noCallHistory, noMissedCallHistory;
private boolean onlyDisplayMissedCalls, isEditMode;
private SparseArray> mLogs;
@@ -66,6 +66,9 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
mInflater = inflater;
View view = inflater.inflate(R.layout.history, container, false);
+ noCallHistory = (TextView) view.findViewById(R.id.noCallHistory);
+ noMissedCallHistory = (TextView) view.findViewById(R.id.noMissedCallHistory);
+
historyList = (ExpandableListView) view.findViewById(R.id.historyList);
historyList.setOnChildClickListener(this);
historyList.setOnGroupClickListener(this);
@@ -92,6 +95,23 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
return view;
}
+ private boolean hideHistoryListAndDisplayMessageIfEmpty() {
+ if (mLogs.size() == 0) {
+ if (onlyDisplayMissedCalls) {
+ noMissedCallHistory.setVisibility(View.VISIBLE);
+ } else {
+ noCallHistory.setVisibility(View.VISIBLE);
+ }
+ historyList.setVisibility(View.GONE);
+ return true;
+ } else {
+ noCallHistory.setVisibility(View.GONE);
+ noMissedCallHistory.setVisibility(View.GONE);
+ historyList.setVisibility(View.VISIBLE);
+ return false;
+ }
+ }
+
@Override
public void onResume() {
super.onResume();
@@ -99,7 +119,9 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
LinphoneActivity.instance().selectMenu(FragmentsAvailable.HISTORY);
initLogsLists(Arrays.asList(LinphoneManager.getLc().getCallLogs()));
- historyList.setAdapter(new CallHistoryAdapter(getActivity()));
+ if (!hideHistoryListAndDisplayMessageIfEmpty()) {
+ historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
+ }
expandAllGroups();
}
@@ -212,7 +234,9 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
initLogsLists(new ArrayList());
}
- historyList.setAdapter(new CallHistoryAdapter(getActivity()));
+ if (!hideHistoryListAndDisplayMessageIfEmpty()) {
+ historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
+ }
expandAllGroups();
}
@@ -224,7 +248,9 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
}
initLogsLists(Arrays.asList(LinphoneManager.getLc().getCallLogs()));
- historyList.setAdapter(new CallHistoryAdapter(getActivity()));
+ if (!hideHistoryListAndDisplayMessageIfEmpty()) {
+ historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
+ }
expandAllGroups();
}
return false;
@@ -236,7 +262,9 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
if (isEditMode) {
LinphoneManager.getLc().removeCallLog(log);
initLogsLists(Arrays.asList(LinphoneManager.getLc().getCallLogs()));
- historyList.setAdapter(new CallHistoryAdapter(getActivity()));
+ if (!hideHistoryListAndDisplayMessageIfEmpty()) {
+ historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
+ }
expandAllGroups();
} else {
LinphoneAddress address;
diff --git a/src/org/linphone/HistorySimpleFragment.java b/src/org/linphone/HistorySimpleFragment.java
index d8ed139e9..9236a584d 100644
--- a/src/org/linphone/HistorySimpleFragment.java
+++ b/src/org/linphone/HistorySimpleFragment.java
@@ -55,7 +55,7 @@ import android.widget.TextView;
public class HistorySimpleFragment extends Fragment implements OnClickListener, OnItemClickListener {
private ListView historyList;
private LayoutInflater mInflater;
- private TextView allCalls, missedCalls, edit, ok, deleteAll;
+ private TextView allCalls, missedCalls, edit, ok, deleteAll, noCallHistory, noMissedCallHistory;
private boolean onlyDisplayMissedCalls, isEditMode;
private List mLogs;
@@ -65,6 +65,9 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
mInflater = inflater;
View view = inflater.inflate(R.layout.history_simple, container, false);
+ noCallHistory = (TextView) view.findViewById(R.id.noCallHistory);
+ noMissedCallHistory = (TextView) view.findViewById(R.id.noMissedCallHistory);
+
historyList = (ListView) view.findViewById(R.id.historyList);
historyList.setOnItemClickListener(this);
registerForContextMenu(historyList);
@@ -91,6 +94,36 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
return view;
}
+ private void removeNotMissedCallsFromLogs() {
+ if (onlyDisplayMissedCalls) {
+ List missedCalls = new ArrayList();
+ for (LinphoneCallLog log : mLogs) {
+ if (log.getStatus() == CallStatus.Missed) {
+ missedCalls.add(log);
+ }
+ }
+ mLogs = missedCalls;
+ }
+ }
+
+ private boolean hideHistoryListAndDisplayMessageIfEmpty() {
+ removeNotMissedCallsFromLogs();
+ if (mLogs.isEmpty()) {
+ if (onlyDisplayMissedCalls) {
+ noMissedCallHistory.setVisibility(View.VISIBLE);
+ } else {
+ noCallHistory.setVisibility(View.VISIBLE);
+ }
+ historyList.setVisibility(View.GONE);
+ return true;
+ } else {
+ noCallHistory.setVisibility(View.GONE);
+ noMissedCallHistory.setVisibility(View.GONE);
+ historyList.setVisibility(View.VISIBLE);
+ return false;
+ }
+ }
+
@Override
public void onResume() {
super.onResume();
@@ -98,7 +131,9 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
LinphoneActivity.instance().selectMenu(FragmentsAvailable.HISTORY);
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
- historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
+ if (!hideHistoryListAndDisplayMessageIfEmpty()) {
+ historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
+ }
}
@Override
@@ -113,7 +148,9 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
LinphoneCallLog log = mLogs.get(info.position);
LinphoneManager.getLc().removeCallLog(log);
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
- historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
+ if (!hideHistoryListAndDisplayMessageIfEmpty()) {
+ historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
+ }
return true;
}
@@ -150,7 +187,9 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
mLogs = new ArrayList();
}
- historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
+ if (!hideHistoryListAndDisplayMessageIfEmpty()) {
+ historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
+ }
}
@Override
@@ -159,7 +198,9 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
LinphoneCallLog log = mLogs.get(position);
LinphoneManager.getLc().removeCallLog(log);
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
- historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
+ if (!hideHistoryListAndDisplayMessageIfEmpty()) {
+ historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
+ }
} else {
if (LinphoneActivity.isInstanciated()) {
LinphoneCallLog log = mLogs.get(position);
@@ -240,15 +281,7 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
CallHistoryAdapter(Context aContext) {
missedCall = BitmapFactory.decodeResource(getResources(), R.drawable.call_status_missed);
- if (onlyDisplayMissedCalls) {
- List missedCalls = new ArrayList();
- for (LinphoneCallLog log : mLogs) {
- if (log.getStatus() == CallStatus.Missed) {
- missedCalls.add(log);
- }
- }
- mLogs = missedCalls;
- } else {
+ if (!onlyDisplayMissedCalls) {
outgoingCall = BitmapFactory.decodeResource(getResources(), R.drawable.call_status_outgoing);
incomingCall = BitmapFactory.decodeResource(getResources(), R.drawable.call_status_incoming);
}
diff --git a/src/org/linphone/InCallActivity.java b/src/org/linphone/InCallActivity.java
index 807d958ba..5211d34fa 100644
--- a/src/org/linphone/InCallActivity.java
+++ b/src/org/linphone/InCallActivity.java
@@ -67,6 +67,7 @@ public class InCallActivity extends FragmentActivity implements
LinphoneOnCallEncryptionChangedListener,
OnClickListener {
private final static int SECONDS_BEFORE_HIDING_CONTROLS = 3000;
+ private final static int SECONDS_BEFORE_DENYING_CALL_UPDATE = 30000;
private static InCallActivity instance;
@@ -902,8 +903,7 @@ public class InCallActivity extends FragmentActivity implements
public void run() {
showAcceptCallUpdateDialog();
- // We let 30 secs for the user to decide
- timer = new CountDownTimer(30000, 1000) {
+ timer = new CountDownTimer(SECONDS_BEFORE_DENYING_CALL_UPDATE, 1000) {
public void onTick(long millisUntilFinished) { }
public void onFinish() {
acceptCallUpdate(false);