Improved conversations displayed name

This commit is contained in:
Pierre 2017-12-29 13:33:13 +01:00
parent 7dc2fabcd3
commit 7315ebbced
3 changed files with 17 additions and 2 deletions

View File

@ -55,7 +55,7 @@
<ConfirmationsSetting value="0" id="Add" /> <ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" /> <ConfirmationsSetting value="0" id="Remove" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View File

@ -9,6 +9,7 @@ import android.util.Log;
import org.communiquons.android.comunic.client.api.APIRequest; import org.communiquons.android.comunic.client.api.APIRequest;
import org.communiquons.android.comunic.client.api.APIRequestParameters; import org.communiquons.android.comunic.client.api.APIRequestParameters;
import org.communiquons.android.comunic.client.api.APIResponse; import org.communiquons.android.comunic.client.api.APIResponse;
import org.communiquons.android.comunic.client.data.Account.AccountUtils;
import org.communiquons.android.comunic.client.data.DatabaseHelper; import org.communiquons.android.comunic.client.data.DatabaseHelper;
import org.communiquons.android.comunic.client.data.UsersInfo.GetUsersHelper; import org.communiquons.android.comunic.client.data.UsersInfo.GetUsersHelper;
import org.communiquons.android.comunic.client.data.UsersInfo.UserInfo; import org.communiquons.android.comunic.client.data.UsersInfo.UserInfo;
@ -127,6 +128,11 @@ public class ConversationsListHelper {
int count = 0; int count = 0;
for(Integer id : users.keySet()){ for(Integer id : users.keySet()){
//Do not display current user name
if(id == new AccountUtils(mContext).get_current_user_id())
continue;
if(users.get(id) != null){ if(users.get(id) != null){
if(count > 0) if(count > 0)

View File

@ -18,6 +18,7 @@ import android.widget.Toast;
import org.communiquons.android.comunic.client.MainActivity; import org.communiquons.android.comunic.client.MainActivity;
import org.communiquons.android.comunic.client.R; import org.communiquons.android.comunic.client.R;
import org.communiquons.android.comunic.client.data.Account.AccountUtils;
import org.communiquons.android.comunic.client.data.DatabaseHelper; import org.communiquons.android.comunic.client.data.DatabaseHelper;
import org.communiquons.android.comunic.client.data.UsersInfo.GetUsersHelper; import org.communiquons.android.comunic.client.data.UsersInfo.GetUsersHelper;
import org.communiquons.android.comunic.client.data.UsersInfo.UserInfo; import org.communiquons.android.comunic.client.data.UsersInfo.UserInfo;
@ -204,12 +205,20 @@ public class ConversationsListFragment extends Fragment implements AdapterView.O
int count = 0; int count = 0;
for(int userID : conv.getMembers()){ for(int userID : conv.getMembers()){
//Do not display current user name
if(userID == new AccountUtils(getActivity()).get_current_user_id())
continue;
if(usersInfo.containsKey(userID)){ if(usersInfo.containsKey(userID)){
UserInfo userInfo = usersInfo.get(userID); UserInfo userInfo = usersInfo.get(userID);
if(count > 0){
conversationName += ", ";
}
if(userInfo != null){ if(userInfo != null){
conversationName += userInfo.getFullName() + ", "; conversationName += userInfo.getFullName();
count++; count++;
} }