mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 22:09:30 +00:00
Conversation names and members number are displayed in the list
This commit is contained in:
parent
c92587cf26
commit
9b08184b1f
@ -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">
|
||||||
|
@ -211,4 +211,17 @@ public class Utilities {
|
|||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
return (int) Math.ceil(date.getTime()/1000);
|
return (int) Math.ceil(date.getTime()/1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transform an amount of seconds into a string like "3min" or "10hours"s
|
||||||
|
*
|
||||||
|
* @param time The Time to convert
|
||||||
|
* @return Generated string
|
||||||
|
*/
|
||||||
|
public String timeToString(int time){
|
||||||
|
//TODO : implement seconds to string function
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package org.communiquons.android.comunic.client.data.conversations;
|
package org.communiquons.android.comunic.client.data.conversations;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.os.Build;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -64,6 +66,29 @@ public class ConversationsListAdapter extends ArrayAdapter<ConversationsInfo> {
|
|||||||
.findViewById(R.id.fragment_conversationslist_item_name);
|
.findViewById(R.id.fragment_conversationslist_item_name);
|
||||||
conversationName.setText(infos.getDisplayName());
|
conversationName.setText(infos.getDisplayName());
|
||||||
|
|
||||||
|
//Retrieve colors
|
||||||
|
int blue, grey;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
grey = getContext().getResources().getColor(R.color.darker_darker_gray,
|
||||||
|
getContext().getTheme());
|
||||||
|
blue = getContext().getResources().getColor(R.color.dark_blue, getContext().getTheme());
|
||||||
|
} else {
|
||||||
|
grey = getContext().getResources().getColor(R.color.darker_darker_gray);
|
||||||
|
blue = getContext().getResources().getColor(R.color.dark_blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Check whether the conversation has new messages or not and update conversation name color
|
||||||
|
conversationName.setTextColor(infos.hasSaw_last_message() ? grey : blue);
|
||||||
|
|
||||||
|
|
||||||
|
//Update the number of members of the conversation
|
||||||
|
TextView number_members = convertView
|
||||||
|
.findViewById(R.id.fragment_conversationslist_item_number_members);
|
||||||
|
String members_text = String.format(getContext().getResources()
|
||||||
|
.getString(R.string.conversations_members_number), infos.countMembers());
|
||||||
|
number_members.setText(members_text);
|
||||||
|
|
||||||
return convertView;
|
return convertView;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,65 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
android:orientation="horizontal"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
|
android:paddingEnd="8dp"
|
||||||
|
android:paddingStart="8dp"
|
||||||
|
android:paddingTop="8dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<!-- Conversation name -->
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/fragment_conversationslist_item_name"
|
android:id="@+id/fragment_conversationslist_item_name"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
tools:text="Conversation name" />
|
tools:text="Conversation name" />
|
||||||
|
|
||||||
|
<!-- Number of members -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="@dimen/fragment_conversations_list_icon_width"
|
||||||
|
android:layout_height="@dimen/fragment_conversations_list_icon_height"
|
||||||
|
android:src="@drawable/ic_menu_allfriends" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/fragment_conversationslist_item_number_members"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:text="x Members" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="@dimen/fragment_conversations_list_icon_width"
|
||||||
|
android:layout_height="@dimen/fragment_conversations_list_icon_height"
|
||||||
|
android:src="@android:drawable/ic_menu_my_calendar"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="1min" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -6,4 +6,6 @@
|
|||||||
|
|
||||||
<color name="holo_green_dark">#ff669900</color>
|
<color name="holo_green_dark">#ff669900</color>
|
||||||
<color name="darker_gray">#aaa</color>
|
<color name="darker_gray">#aaa</color>
|
||||||
|
<color name="darker_darker_gray">#5b5b5b</color>
|
||||||
|
<color name="dark_blue">#303F9F</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -3,5 +3,7 @@
|
|||||||
<dimen name="account_image_default_width">64dp</dimen>
|
<dimen name="account_image_default_width">64dp</dimen>
|
||||||
<dimen name="account_image_default_height">64dp</dimen>
|
<dimen name="account_image_default_height">64dp</dimen>
|
||||||
|
|
||||||
|
<!-- Dimensions for the conversation list -->
|
||||||
|
<dimen name="fragment_conversations_list_icon_width">20dp</dimen>
|
||||||
|
<dimen name="fragment_conversations_list_icon_height">20dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -34,4 +34,14 @@
|
|||||||
<string name="popup_respond_friendship_request_title">Respond to the request</string>
|
<string name="popup_respond_friendship_request_title">Respond to the request</string>
|
||||||
<string name="popup_respond_friendship_request_message">Do you want to accept or deny this friendship request ?</string>
|
<string name="popup_respond_friendship_request_message">Do you want to accept or deny this friendship request ?</string>
|
||||||
<string name="fragment_conversationslist_err_get_list">An error occurred while retrieving conversations list !</string>
|
<string name="fragment_conversationslist_err_get_list">An error occurred while retrieving conversations list !</string>
|
||||||
|
<string name="conversations_members_number">%d members</string>
|
||||||
|
<string name="date_now">now</string>
|
||||||
|
<string name="date_seconds">seconds</string>
|
||||||
|
<string name="date_minutes">minutes</string>
|
||||||
|
<string name="date_min">min</string>
|
||||||
|
<string name="date_sec">sec</string>
|
||||||
|
<string name="date_h">h</string>
|
||||||
|
<string name="date_m">m</string>
|
||||||
|
<string name="date_s">s</string>
|
||||||
|
<string name="date_hours">date_hours</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user