|
@@ -1,8 +1,13 @@
|
|
|
package com.xplora.xplauncher.model;
|
|
|
|
|
|
+import android.content.Context;
|
|
|
+
|
|
|
+import com.xplora.xplauncher.R;
|
|
|
+
|
|
|
public class ContactBean extends BaseBean {
|
|
|
public long _id = 0;
|
|
|
public String id = "";
|
|
|
+ public String userId = "";
|
|
|
public String name = "";
|
|
|
public String profile = ""; //头像
|
|
|
public String profilePath = "";//头像本地路径
|
|
@@ -10,14 +15,79 @@ public class ContactBean extends BaseBean {
|
|
|
public String countryPN = "";
|
|
|
public int rate = 0;
|
|
|
public int unRead = 0;
|
|
|
-
|
|
|
- public int isGroup() {
|
|
|
- return id.startsWith("G_") ? 1:0;
|
|
|
- }
|
|
|
-
|
|
|
// 1 : First guardian(SOS target)
|
|
|
// 2 : Second guardian
|
|
|
// 3 : General contact(Not member of XPLORA server)
|
|
|
// 4 : Friend
|
|
|
+ // 100: Group
|
|
|
public int type = 0;
|
|
|
-}
|
|
|
+
|
|
|
+ public int isGroup() {
|
|
|
+ return id.startsWith("G_") || type >= 100 ? 1:0;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getNickName(Context context) {
|
|
|
+ String[] value = name.split("_");
|
|
|
+ int index = Integer.parseInt(value[0]);
|
|
|
+ if (index == 11) {
|
|
|
+ return value[1];
|
|
|
+ } else {
|
|
|
+ switch (index) {
|
|
|
+ case 0:
|
|
|
+ return context.getString(R.string.tcl_family_0);
|
|
|
+ case 1:
|
|
|
+ return context.getString(R.string.tcl_family_1);
|
|
|
+ case 2:
|
|
|
+ return context.getString(R.string.tcl_family_2);
|
|
|
+ case 3:
|
|
|
+ return context.getString(R.string.tcl_family_3);
|
|
|
+ case 4:
|
|
|
+ return context.getString(R.string.tcl_family_4);
|
|
|
+ case 5:
|
|
|
+ return context.getString(R.string.tcl_family_5);
|
|
|
+ case 6:
|
|
|
+ return context.getString(R.string.tcl_family_6);
|
|
|
+ case 7:
|
|
|
+ return context.getString(R.string.tcl_family_7);
|
|
|
+ default:
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getHeadDefaultId(Context context) {
|
|
|
+ String[] value = name.split("_");
|
|
|
+ int index = Integer.parseInt(value[0]);
|
|
|
+ if (index == 11) {
|
|
|
+ return R.drawable.default_contact;
|
|
|
+ } else {
|
|
|
+ switch (index) {
|
|
|
+ case 0:
|
|
|
+ return R.drawable.default_contact_0;
|
|
|
+ case 1:
|
|
|
+ return R.drawable.default_contact_1;
|
|
|
+ case 2:
|
|
|
+ return R.drawable.default_contact_2;
|
|
|
+ case 3:
|
|
|
+ return R.drawable.default_contact_3;
|
|
|
+ case 4:
|
|
|
+ return R.drawable.default_contact_4;
|
|
|
+ case 5:
|
|
|
+ return R.drawable.default_contact_5;
|
|
|
+ case 6:
|
|
|
+ return R.drawable.default_contact_6;
|
|
|
+ case 7:
|
|
|
+ return R.drawable.default_contact_7;
|
|
|
+ default:
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public String beanToString() {
|
|
|
+ return "_id:" + _id + " id:" + id + " type:" + type + " userId:" + userId +
|
|
|
+ " name:" + name + " profilePath:" + profilePath +
|
|
|
+ " countryPN:" + countryPN + " phoneNumber : " + phoneNumber +
|
|
|
+ " unRead:" + unRead;
|
|
|
+ }
|
|
|
+}
|