Skip to content
Snippets Groups Projects
Commit cd6a82d2 authored by Alexandre Lision's avatar Alexandre Lision
Browse files

ui: change display of call list

parent 183bf45c
No related branches found
No related tags found
No related merge requests found
...@@ -41,36 +41,19 @@ as that of the covered work. ...@@ -41,36 +41,19 @@ as that of the covered work.
android:layout_margin="10dp" android:layout_margin="10dp"
android:background="@drawable/item_generic_selector"> android:background="@drawable/item_generic_selector">
<LinearLayout
android:id="@+id/linear2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:weightSum="4" >
<TextView <TextView
android:id="@+id/confs_counter" android:id="@+id/confs_counter"
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center" android:gravity="center"
android:textSize="40sp" /> android:layout_alignParentTop="true"
<TextView
android:id="@+id/textView4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="@string/home_conferences_title"
android:textSize="30sp"/> android:textSize="30sp"/>
</LinearLayout>
<ListView <ListView
android:id="@+id/confs_list" android:id="@+id/confs_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/linear2" > android:layout_below="@+id/confs_counter">
</ListView> </ListView>
</RelativeLayout> </RelativeLayout>
......
...@@ -76,8 +76,10 @@ as that of the covered work. ...@@ -76,8 +76,10 @@ as that of the covered work.
<string name="detail_hist_call_number">Appeler %1$s</string> <string name="detail_hist_call_number">Appeler %1$s</string>
<!-- Home Fragment --> <!-- Home Fragment -->
<string name="home_conferences_title">Conversations</string> <plurals name="home_conferences_title">
<string name="home_calls_title">Appels</string> <item quantity="zero">No Conversation</item>
<item quantity="other">%d Conversations</item>
</plurals>
<string name="home_transfering">Transfert de %1$s à %1$s</string> <string name="home_transfering">Transfert de %1$s à %1$s</string>
<string name="home_transfer_complet">Transfert terminé</string> <string name="home_transfer_complet">Transfert terminé</string>
<string name="home_conf_item">%1$s participants</string> <string name="home_conf_item">%1$s participants</string>
......
...@@ -76,8 +76,11 @@ as that of the covered work. ...@@ -76,8 +76,11 @@ as that of the covered work.
<string name="detail_hist_call_number">Call %1$s</string> <string name="detail_hist_call_number">Call %1$s</string>
<!-- Home Fragment --> <!-- Home Fragment -->
<string name="home_conferences_title">Conversations</string> <plurals name="home_conferences_title">
<string name="home_calls_title">Calls</string> <item quantity="zero">No Conversation</item>
<item quantity="one">%d Conversation</item>
<item quantity="other">%d Conversations</item>
</plurals>
<string name="home_transfering">Transferring %1$s to %1$s</string> <string name="home_transfering">Transferring %1$s to %1$s</string>
<string name="home_transfer_complet">Transfer complete</string> <string name="home_transfer_complet">Transfer complete</string>
<string name="home_conf_item">%1$s participants</string> <string name="home_conf_item">%1$s participants</string>
......
...@@ -68,9 +68,9 @@ public class CallListFragment extends Fragment implements CallInterface { ...@@ -68,9 +68,9 @@ public class CallListFragment extends Fragment implements CallInterface {
private static final String TAG = CallListFragment.class.getSimpleName(); private static final String TAG = CallListFragment.class.getSimpleName();
private Callbacks mCallbacks = sDummyCallbacks; private Callbacks mCallbacks = sDummyCallbacks;
private TextView nb_confs; private TextView mConversationsTitleTextView;
CallListAdapter confs_adapter; CallListAdapter mConferenceAdapter;
CallReceiver callReceiver; CallReceiver mCallReceiver;
public static final int REQUEST_TRANSFER = 10; public static final int REQUEST_TRANSFER = 10;
public static final int REQUEST_CONF = 20; public static final int REQUEST_CONF = 20;
...@@ -158,7 +158,7 @@ public class CallListFragment extends Fragment implements CallInterface { ...@@ -158,7 +158,7 @@ public class CallListFragment extends Fragment implements CallInterface {
int minutes = seconds / 60; int minutes = seconds / 60;
seconds = seconds % 60; seconds = seconds % 60;
confs_adapter.notifyDataSetChanged(); mConferenceAdapter.notifyDataSetChanged();
mHandler.postAtTime(this, start + (((minutes * 60) + seconds + 1) * 1000)); mHandler.postAtTime(this, start + (((minutes * 60) + seconds + 1) * 1000));
} }
}; };
...@@ -172,11 +172,11 @@ public class CallListFragment extends Fragment implements CallInterface { ...@@ -172,11 +172,11 @@ public class CallListFragment extends Fragment implements CallInterface {
intentFilter.addAction(CallManagerCallBack.INCOMING_CALL); intentFilter.addAction(CallManagerCallBack.INCOMING_CALL);
intentFilter.addAction(CallManagerCallBack.INCOMING_TEXT); intentFilter.addAction(CallManagerCallBack.INCOMING_TEXT);
intentFilter.addAction(CallManagerCallBack.CALL_STATE_CHANGED); intentFilter.addAction(CallManagerCallBack.CALL_STATE_CHANGED);
getActivity().registerReceiver(callReceiver, intentFilter); getActivity().registerReceiver(mCallReceiver, intentFilter);
if (mCallbacks.getService() != null) { if (mCallbacks.getService() != null) {
updateLists(); updateLists();
if (!confs_adapter.isEmpty()) { if (!mConferenceAdapter.isEmpty()) {
mHandler.postDelayed(mUpdateTimeTask, 0); mHandler.postDelayed(mUpdateTimeTask, 0);
} }
} }
...@@ -186,11 +186,11 @@ public class CallListFragment extends Fragment implements CallInterface { ...@@ -186,11 +186,11 @@ public class CallListFragment extends Fragment implements CallInterface {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
// No proper solution with HashMap runtime cast // No proper solution with HashMap runtime cast
public void updateLists() { public void updateLists() {
HashMap<String, Conference> confs;
try { try {
confs = (HashMap<String, Conference>) mCallbacks.getService().getConferenceList(); HashMap<String, Conference> confs = (HashMap<String, Conference>) mCallbacks.getService().getConferenceList();
nb_confs.setText("" + confs.size()); String newTitle = getResources().getQuantityString(R.plurals.home_conferences_title, confs.size(), confs.size());
confs_adapter.updateDataset(new ArrayList<Conference>(confs.values())); mConversationsTitleTextView.setText(newTitle);
mConferenceAdapter.updateDataset(new ArrayList<Conference>(confs.values()));
} catch (RemoteException e) { } catch (RemoteException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -207,14 +207,14 @@ public class CallListFragment extends Fragment implements CallInterface { ...@@ -207,14 +207,14 @@ public class CallListFragment extends Fragment implements CallInterface {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
callReceiver = new CallReceiver(this); mCallReceiver = new CallReceiver(this);
} }
@Override @Override
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
mHandler.removeCallbacks(mUpdateTimeTask); mHandler.removeCallbacks(mUpdateTimeTask);
getActivity().unregisterReceiver(callReceiver); getActivity().unregisterReceiver(mCallReceiver);
} }
@Override @Override
...@@ -227,10 +227,10 @@ public class CallListFragment extends Fragment implements CallInterface { ...@@ -227,10 +227,10 @@ public class CallListFragment extends Fragment implements CallInterface {
Log.i(TAG, "onCreateView"); Log.i(TAG, "onCreateView");
View inflatedView = inflater.inflate(R.layout.frag_call_list, container, false); View inflatedView = inflater.inflate(R.layout.frag_call_list, container, false);
nb_confs = (TextView) inflatedView.findViewById(R.id.confs_counter); mConversationsTitleTextView = (TextView) inflatedView.findViewById(R.id.confs_counter);
confs_adapter = new CallListAdapter(getActivity()); mConferenceAdapter = new CallListAdapter(getActivity());
((ListView) inflatedView.findViewById(R.id.confs_list)).setAdapter(confs_adapter); ((ListView) inflatedView.findViewById(R.id.confs_list)).setAdapter(mConferenceAdapter);
((ListView) inflatedView.findViewById(R.id.confs_list)).setOnItemClickListener(callClickListener); ((ListView) inflatedView.findViewById(R.id.confs_list)).setOnItemClickListener(callClickListener);
((ListView) inflatedView.findViewById(R.id.confs_list)).setOnItemLongClickListener(mItemLongClickListener); ((ListView) inflatedView.findViewById(R.id.confs_list)).setOnItemLongClickListener(mItemLongClickListener);
...@@ -413,9 +413,9 @@ public class CallListFragment extends Fragment implements CallInterface { ...@@ -413,9 +413,9 @@ public class CallListFragment extends Fragment implements CallInterface {
try { try {
mCallbacks.getService().attendedTransfer(transfer.getParticipants().get(0).getCallId(), c.getParticipants().get(0).getCallId()); mCallbacks.getService().attendedTransfer(transfer.getParticipants().get(0).getCallId(), c.getParticipants().get(0).getCallId());
confs_adapter.remove(transfer); mConferenceAdapter.remove(transfer);
confs_adapter.remove(c); mConferenceAdapter.remove(c);
confs_adapter.notifyDataSetChanged(); mConferenceAdapter.notifyDataSetChanged();
} catch (RemoteException e) { } catch (RemoteException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment