diff --git a/res/layout/frag_call_list.xml b/res/layout/frag_call_list.xml index dec110d6d6ddd970a42fcf3bdef32c190f780f6e..3be66f9e7fce08b4552cccd2efb824c2d558c097 100644 --- a/res/layout/frag_call_list.xml +++ b/res/layout/frag_call_list.xml @@ -31,46 +31,29 @@ as that of the covered work. --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" > + android:layout_width="match_parent" + android:layout_height="match_parent"> <RelativeLayout - android:id="@+id/confs_layouts" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="10dp" - android:background="@drawable/item_generic_selector" > - - <LinearLayout - android:id="@+id/linear2" + android:id="@+id/confs_layouts" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_alignParentLeft="true" - android:layout_alignParentTop="true" - android:weightSum="4" > + android:layout_margin="10dp" + android:background="@drawable/item_generic_selector"> - <TextView + <TextView android:id="@+id/confs_counter" - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" android:gravity="center" - android:textSize="40sp" /> - - <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" /> - </LinearLayout> + android:layout_alignParentTop="true" + android:textSize="30sp"/> <ListView - android:id="@+id/confs_list" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_below="@+id/linear2" > + android:id="@+id/confs_list" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@+id/confs_counter"> </ListView> </RelativeLayout> diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 88fbe807463a8f61821ba20b4ea790eb5a5e865f..ec3ab258cb873c451f128a6c8a884d5e63485a17 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -76,8 +76,10 @@ as that of the covered work. <string name="detail_hist_call_number">Appeler %1$s</string> <!-- Home Fragment --> - <string name="home_conferences_title">Conversations</string> - <string name="home_calls_title">Appels</string> + <plurals name="home_conferences_title"> + <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_transfer_complet">Transfert terminé</string> <string name="home_conf_item">%1$s participants</string> diff --git a/res/values/strings.xml b/res/values/strings.xml index 5c4052bceae9d1e6f81699b1cae933a3f93b83eb..c6ad653914fb6268580ed0301f90c512aaca895c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -76,8 +76,11 @@ as that of the covered work. <string name="detail_hist_call_number">Call %1$s</string> <!-- Home Fragment --> - <string name="home_conferences_title">Conversations</string> - <string name="home_calls_title">Calls</string> + <plurals name="home_conferences_title"> + <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_transfer_complet">Transfer complete</string> <string name="home_conf_item">%1$s participants</string> diff --git a/src/org/sflphone/fragments/CallListFragment.java b/src/org/sflphone/fragments/CallListFragment.java index ea63b7ea15333a3eb619b0a573e36710878b726b..825d16d014deb43706f08aa6a29d2cdd45418395 100644 --- a/src/org/sflphone/fragments/CallListFragment.java +++ b/src/org/sflphone/fragments/CallListFragment.java @@ -68,9 +68,9 @@ public class CallListFragment extends Fragment implements CallInterface { private static final String TAG = CallListFragment.class.getSimpleName(); private Callbacks mCallbacks = sDummyCallbacks; - private TextView nb_confs; - CallListAdapter confs_adapter; - CallReceiver callReceiver; + private TextView mConversationsTitleTextView; + CallListAdapter mConferenceAdapter; + CallReceiver mCallReceiver; public static final int REQUEST_TRANSFER = 10; public static final int REQUEST_CONF = 20; @@ -158,7 +158,7 @@ public class CallListFragment extends Fragment implements CallInterface { int minutes = seconds / 60; seconds = seconds % 60; - confs_adapter.notifyDataSetChanged(); + mConferenceAdapter.notifyDataSetChanged(); mHandler.postAtTime(this, start + (((minutes * 60) + seconds + 1) * 1000)); } }; @@ -172,11 +172,11 @@ public class CallListFragment extends Fragment implements CallInterface { intentFilter.addAction(CallManagerCallBack.INCOMING_CALL); intentFilter.addAction(CallManagerCallBack.INCOMING_TEXT); intentFilter.addAction(CallManagerCallBack.CALL_STATE_CHANGED); - getActivity().registerReceiver(callReceiver, intentFilter); + getActivity().registerReceiver(mCallReceiver, intentFilter); if (mCallbacks.getService() != null) { updateLists(); - if (!confs_adapter.isEmpty()) { + if (!mConferenceAdapter.isEmpty()) { mHandler.postDelayed(mUpdateTimeTask, 0); } } @@ -186,11 +186,11 @@ public class CallListFragment extends Fragment implements CallInterface { @SuppressWarnings("unchecked") // No proper solution with HashMap runtime cast public void updateLists() { - HashMap<String, Conference> confs; try { - confs = (HashMap<String, Conference>) mCallbacks.getService().getConferenceList(); - nb_confs.setText("" + confs.size()); - confs_adapter.updateDataset(new ArrayList<Conference>(confs.values())); + HashMap<String, Conference> confs = (HashMap<String, Conference>) mCallbacks.getService().getConferenceList(); + String newTitle = getResources().getQuantityString(R.plurals.home_conferences_title, confs.size(), confs.size()); + mConversationsTitleTextView.setText(newTitle); + mConferenceAdapter.updateDataset(new ArrayList<Conference>(confs.values())); } catch (RemoteException e) { e.printStackTrace(); } @@ -207,14 +207,14 @@ public class CallListFragment extends Fragment implements CallInterface { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - callReceiver = new CallReceiver(this); + mCallReceiver = new CallReceiver(this); } @Override public void onPause() { super.onPause(); mHandler.removeCallbacks(mUpdateTimeTask); - getActivity().unregisterReceiver(callReceiver); + getActivity().unregisterReceiver(mCallReceiver); } @Override @@ -227,10 +227,10 @@ public class CallListFragment extends Fragment implements CallInterface { Log.i(TAG, "onCreateView"); 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()); - ((ListView) inflatedView.findViewById(R.id.confs_list)).setAdapter(confs_adapter); + mConferenceAdapter = new CallListAdapter(getActivity()); + ((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)).setOnItemLongClickListener(mItemLongClickListener); @@ -413,9 +413,9 @@ public class CallListFragment extends Fragment implements CallInterface { try { mCallbacks.getService().attendedTransfer(transfer.getParticipants().get(0).getCallId(), c.getParticipants().get(0).getCallId()); - confs_adapter.remove(transfer); - confs_adapter.remove(c); - confs_adapter.notifyDataSetChanged(); + mConferenceAdapter.remove(transfer); + mConferenceAdapter.remove(c); + mConferenceAdapter.notifyDataSetChanged(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace();