Display messages if lists are empty
This commit is contained in:
parent
5a7dedc836
commit
30753774c3
11 changed files with 210 additions and 37 deletions
|
@ -90,5 +90,15 @@
|
||||||
android:divider="@android:color/darker_gray"
|
android:divider="@android:color/darker_gray"
|
||||||
android:cacheColorHint="@color/transparent"
|
android:cacheColorHint="@color/transparent"
|
||||||
android:dividerHeight="1dp" />
|
android:dividerHeight="1dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/noChatHistory"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/no_chat_history"
|
||||||
|
android:textColor="@drawable/text_color"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Large"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -67,6 +67,28 @@
|
||||||
android:fastScrollAlwaysVisible="true"
|
android:fastScrollAlwaysVisible="true"
|
||||||
android:fastScrollEnabled="true"
|
android:fastScrollEnabled="true"
|
||||||
android:dividerHeight="1dp" />
|
android:dividerHeight="1dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/noSipContact"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:text="@string/no_sip_contact"
|
||||||
|
android:textColor="@drawable/text_color"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Large"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/noContact"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:text="@string/no_contact"
|
||||||
|
android:textColor="@drawable/text_color"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Large"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
|
@ -91,5 +91,25 @@
|
||||||
android:divider="@android:color/darker_gray"
|
android:divider="@android:color/darker_gray"
|
||||||
android:cacheColorHint="@color/transparent"
|
android:cacheColorHint="@color/transparent"
|
||||||
android:dividerHeight="1dp" />
|
android:dividerHeight="1dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/noCallHistory"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/no_call_history"
|
||||||
|
android:textColor="@drawable/text_color"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Large"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/noMissedCallHistory"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/no_missed_call_history"
|
||||||
|
android:textColor="@drawable/text_color"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Large"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -91,5 +91,25 @@
|
||||||
android:divider="@android:color/darker_gray"
|
android:divider="@android:color/darker_gray"
|
||||||
android:cacheColorHint="@color/transparent"
|
android:cacheColorHint="@color/transparent"
|
||||||
android:dividerHeight="1dp" />
|
android:dividerHeight="1dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/noCallHistory"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/no_call_history"
|
||||||
|
android:textColor="@drawable/text_color"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Large"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/noMissedCallHistory"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/no_missed_call_history"
|
||||||
|
android:textColor="@drawable/text_color"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Large"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -203,7 +203,12 @@
|
||||||
<string name="addressHint">Numéro ou adresse</string>
|
<string name="addressHint">Numéro ou adresse</string>
|
||||||
<string name="conference">Conférence</string>
|
<string name="conference">Conférence</string>
|
||||||
<string name="draft">Brouillon</string>
|
<string name="draft">Brouillon</string>
|
||||||
<string name="new_fast_chat">Entrez une adresse SIP avec qui discuter…</string>
|
<string name="new_fast_chat">Entrez une adresse SIP…</string>
|
||||||
|
<string name="no_call_history">Aucun appel dans votre historique.</string>
|
||||||
|
<string name="no_missed_call_history">Aucun appel manqué dans votre historique.</string>
|
||||||
|
<string name="no_contact">Aucun contact dans votre carnet d\'adresse.</string>
|
||||||
|
<string name="no_sip_contact">Aucun contact SIP dans votre carnet d\'adresse.</string>
|
||||||
|
<string name="no_chat_history">Aucun historique de chat.</string>
|
||||||
|
|
||||||
<!-- Used by Android to help blind people by describing them images -->
|
<!-- Used by Android to help blind people by describing them images -->
|
||||||
<string name="content_description_add_contact"></string>
|
<string name="content_description_add_contact"></string>
|
||||||
|
@ -295,7 +300,7 @@
|
||||||
<string name="button_send_picture">Img</string>
|
<string name="button_send_picture">Img</string>
|
||||||
<string name="uploading_image">Envoi en cours…</string>
|
<string name="uploading_image">Envoi en cours…</string>
|
||||||
|
|
||||||
<string name="call_update_title">Mise à jour de l'appel</string>
|
<string name="call_update_title">Mise à jour de l\'appel</string>
|
||||||
<string name="call_update_desc">Votre correspondant souhaite ajouter la vidéo à l\'appel en cours.</string>
|
<string name="call_update_desc">Votre correspondant souhaite ajouter la vidéo à l\'appel en cours.</string>
|
||||||
<string name="call_update_yes">Accepter</string>
|
<string name="call_update_yes">Accepter</string>
|
||||||
<string name="call_update_no">Refuser</string>
|
<string name="call_update_no">Refuser</string>
|
||||||
|
|
|
@ -254,6 +254,11 @@
|
||||||
<string name="conference">Conference</string>
|
<string name="conference">Conference</string>
|
||||||
<string name="draft">Draft</string>
|
<string name="draft">Draft</string>
|
||||||
<string name="new_fast_chat">Enter a SIP address to chat with…</string>
|
<string name="new_fast_chat">Enter a SIP address to chat with…</string>
|
||||||
|
<string name="no_call_history">No call in your history.</string>
|
||||||
|
<string name="no_missed_call_history">No missed call in your history.</string>
|
||||||
|
<string name="no_contact">No contact in your address book.</string>
|
||||||
|
<string name="no_sip_contact">No SIP contact in your address book.</string>
|
||||||
|
<string name="no_chat_history">No chat history.</string>
|
||||||
|
|
||||||
<!-- Used by Android to help blind people by describing them images -->
|
<!-- Used by Android to help blind people by describing them images -->
|
||||||
<string name="content_description_add_contact">Add to contacts button</string>
|
<string name="content_description_add_contact">Add to contacts button</string>
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private List<String> mConversations, mDrafts;
|
private List<String> mConversations, mDrafts;
|
||||||
private ListView chatList;
|
private ListView chatList;
|
||||||
private TextView edit, ok, newDiscussion;
|
private TextView edit, ok, newDiscussion, noChatHistory;
|
||||||
private ImageView clearFastChat;
|
private ImageView clearFastChat;
|
||||||
private EditText fastNewChat;
|
private EditText fastNewChat;
|
||||||
private boolean isEditMode = false;
|
private boolean isEditMode = false;
|
||||||
|
@ -62,6 +62,8 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
chatList.setOnItemClickListener(this);
|
chatList.setOnItemClickListener(this);
|
||||||
registerForContextMenu(chatList);
|
registerForContextMenu(chatList);
|
||||||
|
|
||||||
|
noChatHistory = (TextView) view.findViewById(R.id.noChatHistory);
|
||||||
|
|
||||||
edit = (TextView) view.findViewById(R.id.edit);
|
edit = (TextView) view.findViewById(R.id.edit);
|
||||||
edit.setOnClickListener(this);
|
edit.setOnClickListener(this);
|
||||||
|
|
||||||
|
@ -78,6 +80,17 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
|
|
||||||
return view;
|
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
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
@ -90,7 +103,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
mConversations = LinphoneActivity.instance().getChatList();
|
mConversations = LinphoneActivity.instance().getChatList();
|
||||||
mDrafts = LinphoneActivity.instance().getDraftChatList();
|
mDrafts = LinphoneActivity.instance().getDraftChatList();
|
||||||
mConversations.removeAll(mDrafts);
|
mConversations.removeAll(mDrafts);
|
||||||
chatList.setAdapter(new ChatListAdapter());
|
hideAndDisplayMessageIfNoChat();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -111,7 +124,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
mConversations = LinphoneActivity.instance().getChatList();
|
mConversations = LinphoneActivity.instance().getChatList();
|
||||||
mDrafts = LinphoneActivity.instance().getDraftChatList();
|
mDrafts = LinphoneActivity.instance().getDraftChatList();
|
||||||
mConversations.removeAll(mDrafts);
|
mConversations.removeAll(mDrafts);
|
||||||
chatList.setAdapter(new ChatListAdapter());
|
hideAndDisplayMessageIfNoChat();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,13 +139,13 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
edit.setVisibility(View.VISIBLE);
|
edit.setVisibility(View.VISIBLE);
|
||||||
ok.setVisibility(View.GONE);
|
ok.setVisibility(View.GONE);
|
||||||
isEditMode = false;
|
isEditMode = false;
|
||||||
chatList.setAdapter(new ChatListAdapter());
|
hideAndDisplayMessageIfNoChat();
|
||||||
}
|
}
|
||||||
else if (id == R.id.edit) {
|
else if (id == R.id.edit) {
|
||||||
edit.setVisibility(View.GONE);
|
edit.setVisibility(View.GONE);
|
||||||
ok.setVisibility(View.VISIBLE);
|
ok.setVisibility(View.VISIBLE);
|
||||||
isEditMode = true;
|
isEditMode = true;
|
||||||
chatList.setAdapter(new ChatListAdapter());
|
hideAndDisplayMessageIfNoChat();
|
||||||
}
|
}
|
||||||
else if (id == R.id.newDiscussion) {
|
else if (id == R.id.newDiscussion) {
|
||||||
String sipUri = fastNewChat.getText().toString();
|
String sipUri = fastNewChat.getText().toString();
|
||||||
|
@ -163,7 +176,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
mConversations = LinphoneActivity.instance().getChatList();
|
mConversations = LinphoneActivity.instance().getChatList();
|
||||||
mDrafts = LinphoneActivity.instance().getDraftChatList();
|
mDrafts = LinphoneActivity.instance().getDraftChatList();
|
||||||
mConversations.removeAll(mDrafts);
|
mConversations.removeAll(mDrafts);
|
||||||
chatList.setAdapter(new ChatListAdapter());
|
hideAndDisplayMessageIfNoChat();
|
||||||
|
|
||||||
LinphoneActivity.instance().updateMissedChatCount();
|
LinphoneActivity.instance().updateMissedChatCount();
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ import android.widget.TextView;
|
||||||
public class ContactsFragment extends Fragment implements OnClickListener, OnItemClickListener {
|
public class ContactsFragment extends Fragment implements OnClickListener, OnItemClickListener {
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private ListView contactsList;
|
private ListView contactsList;
|
||||||
private TextView allContacts, linphoneContacts, newContact;
|
private TextView allContacts, linphoneContacts, newContact, noSipContact, noContact;
|
||||||
private boolean onlyDisplayLinphoneContacts;
|
private boolean onlyDisplayLinphoneContacts;
|
||||||
private int lastKnownPosition;
|
private int lastKnownPosition;
|
||||||
private AlphabetIndexer indexer;
|
private AlphabetIndexer indexer;
|
||||||
|
@ -67,6 +67,9 @@ public class ContactsFragment extends Fragment implements OnClickListener, OnIte
|
||||||
onlyDisplayChatAddress = getArguments().getBoolean("ChatAddressOnly");
|
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 = (ListView) view.findViewById(R.id.contactsList);
|
||||||
contactsList.setOnItemClickListener(this);
|
contactsList.setOnItemClickListener(this);
|
||||||
|
|
||||||
|
@ -111,13 +114,27 @@ public class ContactsFragment extends Fragment implements OnClickListener, OnIte
|
||||||
|
|
||||||
Cursor allContactsCursor = LinphoneActivity.instance().getAllContactsCursor();
|
Cursor allContactsCursor = LinphoneActivity.instance().getAllContactsCursor();
|
||||||
Cursor sipContactsCursor = LinphoneActivity.instance().getSIPContactsCursor();
|
Cursor sipContactsCursor = LinphoneActivity.instance().getSIPContactsCursor();
|
||||||
|
|
||||||
|
noSipContact.setVisibility(View.GONE);
|
||||||
|
noContact.setVisibility(View.GONE);
|
||||||
|
contactsList.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
if (onlyDisplayLinphoneContacts) {
|
if (onlyDisplayLinphoneContacts) {
|
||||||
indexer = new AlphabetIndexer(sipContactsCursor, Compatibility.getCursorDisplayNameColumnIndex(sipContactsCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
if (sipContactsCursor.getCount() == 0) {
|
||||||
contactsList.setAdapter(new ContactsListAdapter(LinphoneActivity.instance().getSIPContacts(), sipContactsCursor));
|
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 {
|
} else {
|
||||||
indexer = new AlphabetIndexer(allContactsCursor, Compatibility.getCursorDisplayNameColumnIndex(allContactsCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
if (allContactsCursor.getCount() == 0) {
|
||||||
contactsList.setAdapter(new ContactsListAdapter(LinphoneActivity.instance().getAllContacts(), allContactsCursor));
|
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);
|
LinphoneActivity.instance().setLinphoneContactsPrefered(onlyDisplayLinphoneContacts);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,10 +38,10 @@ import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
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.ViewGroup;
|
||||||
|
import android.view.animation.Animation;
|
||||||
|
import android.view.animation.Animation.AnimationListener;
|
||||||
|
import android.view.animation.AnimationUtils;
|
||||||
import android.widget.BaseExpandableListAdapter;
|
import android.widget.BaseExpandableListAdapter;
|
||||||
import android.widget.ExpandableListView;
|
import android.widget.ExpandableListView;
|
||||||
import android.widget.ExpandableListView.OnChildClickListener;
|
import android.widget.ExpandableListView.OnChildClickListener;
|
||||||
|
@ -56,7 +56,7 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
|
||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
private ExpandableListView historyList;
|
private ExpandableListView historyList;
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private TextView allCalls, missedCalls, edit, ok, deleteAll;
|
private TextView allCalls, missedCalls, edit, ok, deleteAll, noCallHistory, noMissedCallHistory;
|
||||||
private boolean onlyDisplayMissedCalls, isEditMode;
|
private boolean onlyDisplayMissedCalls, isEditMode;
|
||||||
private SparseArray<List<LinphoneCallLog>> mLogs;
|
private SparseArray<List<LinphoneCallLog>> mLogs;
|
||||||
|
|
||||||
|
@ -66,6 +66,9 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
|
||||||
mInflater = inflater;
|
mInflater = inflater;
|
||||||
View view = inflater.inflate(R.layout.history, container, false);
|
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 = (ExpandableListView) view.findViewById(R.id.historyList);
|
||||||
historyList.setOnChildClickListener(this);
|
historyList.setOnChildClickListener(this);
|
||||||
historyList.setOnGroupClickListener(this);
|
historyList.setOnGroupClickListener(this);
|
||||||
|
@ -92,6 +95,23 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
|
||||||
return view;
|
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
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
@ -99,7 +119,9 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
|
||||||
LinphoneActivity.instance().selectMenu(FragmentsAvailable.HISTORY);
|
LinphoneActivity.instance().selectMenu(FragmentsAvailable.HISTORY);
|
||||||
|
|
||||||
initLogsLists(Arrays.asList(LinphoneManager.getLc().getCallLogs()));
|
initLogsLists(Arrays.asList(LinphoneManager.getLc().getCallLogs()));
|
||||||
historyList.setAdapter(new CallHistoryAdapter(getActivity()));
|
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
||||||
|
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
|
||||||
|
}
|
||||||
expandAllGroups();
|
expandAllGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +234,9 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
|
||||||
initLogsLists(new ArrayList<LinphoneCallLog>());
|
initLogsLists(new ArrayList<LinphoneCallLog>());
|
||||||
}
|
}
|
||||||
|
|
||||||
historyList.setAdapter(new CallHistoryAdapter(getActivity()));
|
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
||||||
|
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
|
||||||
|
}
|
||||||
expandAllGroups();
|
expandAllGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +248,9 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
|
||||||
}
|
}
|
||||||
|
|
||||||
initLogsLists(Arrays.asList(LinphoneManager.getLc().getCallLogs()));
|
initLogsLists(Arrays.asList(LinphoneManager.getLc().getCallLogs()));
|
||||||
historyList.setAdapter(new CallHistoryAdapter(getActivity()));
|
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
||||||
|
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
|
||||||
|
}
|
||||||
expandAllGroups();
|
expandAllGroups();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -236,7 +262,9 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
|
||||||
if (isEditMode) {
|
if (isEditMode) {
|
||||||
LinphoneManager.getLc().removeCallLog(log);
|
LinphoneManager.getLc().removeCallLog(log);
|
||||||
initLogsLists(Arrays.asList(LinphoneManager.getLc().getCallLogs()));
|
initLogsLists(Arrays.asList(LinphoneManager.getLc().getCallLogs()));
|
||||||
historyList.setAdapter(new CallHistoryAdapter(getActivity()));
|
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
||||||
|
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
|
||||||
|
}
|
||||||
expandAllGroups();
|
expandAllGroups();
|
||||||
} else {
|
} else {
|
||||||
LinphoneAddress address;
|
LinphoneAddress address;
|
||||||
|
|
|
@ -55,7 +55,7 @@ import android.widget.TextView;
|
||||||
public class HistorySimpleFragment extends Fragment implements OnClickListener, OnItemClickListener {
|
public class HistorySimpleFragment extends Fragment implements OnClickListener, OnItemClickListener {
|
||||||
private ListView historyList;
|
private ListView historyList;
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private TextView allCalls, missedCalls, edit, ok, deleteAll;
|
private TextView allCalls, missedCalls, edit, ok, deleteAll, noCallHistory, noMissedCallHistory;
|
||||||
private boolean onlyDisplayMissedCalls, isEditMode;
|
private boolean onlyDisplayMissedCalls, isEditMode;
|
||||||
private List<LinphoneCallLog> mLogs;
|
private List<LinphoneCallLog> mLogs;
|
||||||
|
|
||||||
|
@ -65,6 +65,9 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
|
||||||
mInflater = inflater;
|
mInflater = inflater;
|
||||||
View view = inflater.inflate(R.layout.history_simple, container, false);
|
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 = (ListView) view.findViewById(R.id.historyList);
|
||||||
historyList.setOnItemClickListener(this);
|
historyList.setOnItemClickListener(this);
|
||||||
registerForContextMenu(historyList);
|
registerForContextMenu(historyList);
|
||||||
|
@ -91,6 +94,36 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeNotMissedCallsFromLogs() {
|
||||||
|
if (onlyDisplayMissedCalls) {
|
||||||
|
List<LinphoneCallLog> missedCalls = new ArrayList<LinphoneCallLog>();
|
||||||
|
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
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
@ -98,7 +131,9 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
|
||||||
LinphoneActivity.instance().selectMenu(FragmentsAvailable.HISTORY);
|
LinphoneActivity.instance().selectMenu(FragmentsAvailable.HISTORY);
|
||||||
|
|
||||||
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
||||||
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
|
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
||||||
|
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -113,7 +148,9 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
|
||||||
LinphoneCallLog log = mLogs.get(info.position);
|
LinphoneCallLog log = mLogs.get(info.position);
|
||||||
LinphoneManager.getLc().removeCallLog(log);
|
LinphoneManager.getLc().removeCallLog(log);
|
||||||
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
||||||
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
|
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
||||||
|
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +187,9 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
|
||||||
mLogs = new ArrayList<LinphoneCallLog>();
|
mLogs = new ArrayList<LinphoneCallLog>();
|
||||||
}
|
}
|
||||||
|
|
||||||
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
|
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
||||||
|
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -159,7 +198,9 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
|
||||||
LinphoneCallLog log = mLogs.get(position);
|
LinphoneCallLog log = mLogs.get(position);
|
||||||
LinphoneManager.getLc().removeCallLog(log);
|
LinphoneManager.getLc().removeCallLog(log);
|
||||||
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
||||||
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
|
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
||||||
|
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (LinphoneActivity.isInstanciated()) {
|
if (LinphoneActivity.isInstanciated()) {
|
||||||
LinphoneCallLog log = mLogs.get(position);
|
LinphoneCallLog log = mLogs.get(position);
|
||||||
|
@ -240,15 +281,7 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
|
||||||
CallHistoryAdapter(Context aContext) {
|
CallHistoryAdapter(Context aContext) {
|
||||||
missedCall = BitmapFactory.decodeResource(getResources(), R.drawable.call_status_missed);
|
missedCall = BitmapFactory.decodeResource(getResources(), R.drawable.call_status_missed);
|
||||||
|
|
||||||
if (onlyDisplayMissedCalls) {
|
if (!onlyDisplayMissedCalls) {
|
||||||
List<LinphoneCallLog> missedCalls = new ArrayList<LinphoneCallLog>();
|
|
||||||
for (LinphoneCallLog log : mLogs) {
|
|
||||||
if (log.getStatus() == CallStatus.Missed) {
|
|
||||||
missedCalls.add(log);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mLogs = missedCalls;
|
|
||||||
} else {
|
|
||||||
outgoingCall = BitmapFactory.decodeResource(getResources(), R.drawable.call_status_outgoing);
|
outgoingCall = BitmapFactory.decodeResource(getResources(), R.drawable.call_status_outgoing);
|
||||||
incomingCall = BitmapFactory.decodeResource(getResources(), R.drawable.call_status_incoming);
|
incomingCall = BitmapFactory.decodeResource(getResources(), R.drawable.call_status_incoming);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
LinphoneOnCallEncryptionChangedListener,
|
LinphoneOnCallEncryptionChangedListener,
|
||||||
OnClickListener {
|
OnClickListener {
|
||||||
private final static int SECONDS_BEFORE_HIDING_CONTROLS = 3000;
|
private final static int SECONDS_BEFORE_HIDING_CONTROLS = 3000;
|
||||||
|
private final static int SECONDS_BEFORE_DENYING_CALL_UPDATE = 30000;
|
||||||
|
|
||||||
private static InCallActivity instance;
|
private static InCallActivity instance;
|
||||||
|
|
||||||
|
@ -902,8 +903,7 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
public void run() {
|
public void run() {
|
||||||
showAcceptCallUpdateDialog();
|
showAcceptCallUpdateDialog();
|
||||||
|
|
||||||
// We let 30 secs for the user to decide
|
timer = new CountDownTimer(SECONDS_BEFORE_DENYING_CALL_UPDATE, 1000) {
|
||||||
timer = new CountDownTimer(30000, 1000) {
|
|
||||||
public void onTick(long millisUntilFinished) { }
|
public void onTick(long millisUntilFinished) { }
|
||||||
public void onFinish() {
|
public void onFinish() {
|
||||||
acceptCallUpdate(false);
|
acceptCallUpdate(false);
|
||||||
|
|
Loading…
Reference in a new issue