mm
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.tianrun.sipcall.db;
|
package com.tianrun.sipcall.db;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -18,12 +19,16 @@ public class DBUser {
|
|||||||
public String name = "";
|
public String name = "";
|
||||||
public String phone = "";
|
public String phone = "";
|
||||||
public String status = "";
|
public String status = "";
|
||||||
|
public int groupOrder = 0;
|
||||||
|
public int priority = 0;
|
||||||
public boolean isManager = true;
|
public boolean isManager = true;
|
||||||
public boolean isAddFlag = false;
|
public boolean isAddFlag = false;
|
||||||
|
|
||||||
public boolean isMute = false;
|
public boolean isMute = false;
|
||||||
public boolean isVMute = false;
|
public boolean isVMute = false;
|
||||||
public boolean isLayout = false;
|
public boolean isLayout = false;
|
||||||
|
public boolean isEmpty = false;
|
||||||
|
private static final String TAG = "DBUser";
|
||||||
|
|
||||||
public DBUser(String name, String phone, String status) {
|
public DBUser(String name, String phone, String status) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -31,21 +36,34 @@ public class DBUser {
|
|||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DBUser () {
|
||||||
|
}
|
||||||
|
|
||||||
public DBUser(JSONObject d) {
|
public DBUser(JSONObject d) {
|
||||||
this.name = d.getString("name");
|
try {
|
||||||
this.phone = d.getString("extn");
|
this.name = d.getString("name");
|
||||||
this.status = d.getString("sip_state");
|
this.phone = d.getString("extn");
|
||||||
status = status == null ? "" : status;
|
this.status = d.getString("sip_state");
|
||||||
String weight = d.getString("weight");
|
status = status == null ? "" : status;
|
||||||
if (weight != null) {
|
String weight = d.getString("weight");
|
||||||
this.isManager = weight.equals("1") ? true : false;
|
if (weight != null) {
|
||||||
} else {
|
this.isManager = weight.equals("1") ? true : false;
|
||||||
this.isManager = false;
|
} else {
|
||||||
|
this.isManager = false;
|
||||||
|
}
|
||||||
|
String ifMute = d.getString("ifMute");
|
||||||
|
this.isMute = ifMute != null ? ifMute.equals("true") : false;
|
||||||
|
String ifVMute = d.getString("ifVMute");
|
||||||
|
this.isVMute = ifVMute != null ? ifVMute.equals("true") : false;
|
||||||
|
|
||||||
|
String _groupOrder = d.getString("group_order");
|
||||||
|
this.groupOrder = _groupOrder != null ? Integer.parseInt(_groupOrder) : 0;
|
||||||
|
String _priority = d.getString("priority");
|
||||||
|
this.priority = _priority != null ? Integer.parseInt(_priority) : 0;
|
||||||
|
isEmpty = false;
|
||||||
|
} catch (Exception e){
|
||||||
|
Log.i(TAG, "onRequestComplete: " + e);
|
||||||
}
|
}
|
||||||
String ifMute = d.getString("ifMute");
|
|
||||||
this.isMute = ifMute != null ? ifMute.equals("true") : false;
|
|
||||||
String ifVMute = d.getString("ifVMute");
|
|
||||||
this.isVMute = ifVMute != null ? ifVMute.equals("true") : false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBusy() {
|
public boolean isBusy() {
|
||||||
@@ -63,8 +81,23 @@ public class DBUser {
|
|||||||
public static void onGetUsers(JSONArray array) {
|
public static void onGetUsers(JSONArray array) {
|
||||||
allUser.clear();
|
allUser.clear();
|
||||||
DBUser u;
|
DBUser u;
|
||||||
|
int cellSize = 5;
|
||||||
|
int oldGroupOrder = -1;
|
||||||
for (Object o : array) {
|
for (Object o : array) {
|
||||||
u = new DBUser((JSONObject) o);
|
u = new DBUser((JSONObject) o);
|
||||||
|
if(oldGroupOrder >= 0 && oldGroupOrder != u.groupOrder) {
|
||||||
|
//需要分组
|
||||||
|
int yushu = allUser.size() % cellSize;
|
||||||
|
if(yushu > 0){
|
||||||
|
yushu = cellSize - yushu;
|
||||||
|
for (int i=0;i<yushu;i++){
|
||||||
|
DBUser _u = new DBUser();
|
||||||
|
_u.isEmpty = true;
|
||||||
|
allUser.add(_u);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
oldGroupOrder = u.groupOrder;
|
||||||
allUser.add(u);
|
allUser.add(u);
|
||||||
mapUsers.put(u.phone, u);
|
mapUsers.put(u.phone, u);
|
||||||
if (mySelf != null && u.phone.equals(mySelf.phone)) {
|
if (mySelf != null && u.phone.equals(mySelf.phone)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user