|
|
@@ -56,6 +56,7 @@ import com.xzjmyk.pm.activity.volley.StringJsonArrayRequest;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
+import java.util.Comparator;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -267,11 +268,11 @@ public class MyFriendActivity extends BaseActivity {
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
if (mLoginUserId == null)
|
|
|
mLoginUserId = MyApplication.getInstance().mLoginUser.getUserId();
|
|
|
- if (isPeculiar) {
|
|
|
- friends = FriendDao.getInstance().getFriends(mLoginUserId, "clickNum", 10);
|
|
|
- } else {
|
|
|
- friends = FriendDao.getInstance().getFriends(mLoginUserId);
|
|
|
- }
|
|
|
+// if (isPeculiar) {
|
|
|
+// friends = FriendDao.getInstance().getFriends(mLoginUserId, "clickNum", 10);
|
|
|
+// } else {
|
|
|
+ friends = FriendDao.getInstance().getFriends(mLoginUserId);// 取所有好友
|
|
|
+// }
|
|
|
if (friends != null)
|
|
|
Log.i("wang", "friends size()=" + friends.size());
|
|
|
long delayTime = 200 - (startTime - System.currentTimeMillis());// 保证至少200ms的刷新过程
|
|
|
@@ -283,6 +284,7 @@ public class MyFriendActivity extends BaseActivity {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
handlerFriends(friends);
|
|
|
+ LogUtil.prinlnLongMsg("hifriends",JSON.toJSONString(friends));
|
|
|
}
|
|
|
}, delayTime);
|
|
|
}
|
|
|
@@ -339,6 +341,7 @@ public class MyFriendActivity extends BaseActivity {
|
|
|
friends.add(friend);
|
|
|
}
|
|
|
handlerFriends(friends);
|
|
|
+ LogUtil.prinlnLongMsg("hifriends",JSON.toJSONString(friend));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -366,9 +369,28 @@ public class MyFriendActivity extends BaseActivity {
|
|
|
mSortFriends.add(mode);
|
|
|
allFriends.add(mode);
|
|
|
}
|
|
|
- Collections.sort(mSortFriends, mBaseComparator);
|
|
|
- Collections.sort(allFriends, mBaseComparator);
|
|
|
+ Collections.sort(mSortFriends, new Comparator<BaseSortModel<Friend>>() {
|
|
|
+ @Override
|
|
|
+ public int compare(BaseSortModel<Friend> o1, BaseSortModel<Friend> o2) {
|
|
|
+ Friend f1 = o1.getBean();
|
|
|
+ Friend f2 = o2.getBean();
|
|
|
+ return f2.getClickNum()-f1.getClickNum();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ LogUtil.prinlnLongMsg("mSortFriends",JSON.toJSONString(mSortFriends));
|
|
|
+ Collections.sort(allFriends, new Comparator<BaseSortModel<Friend>>() {
|
|
|
+ @Override
|
|
|
+ public int compare(BaseSortModel<Friend> o1, BaseSortModel<Friend> o2) {
|
|
|
+ Friend f1 = o1.getBean();
|
|
|
+ Friend f2 = o2.getBean();
|
|
|
+ return f2.getClickNum()-f1.getClickNum();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ LogUtil.prinlnLongMsg("allFriends",JSON.toJSONString(allFriends));
|
|
|
+// Collections.sort(mSortFriends, mBaseComparator);
|
|
|
+// Collections.sort(allFriends, mBaseComparator);
|
|
|
}
|
|
|
+ mAdapter = new UUFriendSortAdapter(MyFriendActivity.this, mSortFriends);
|
|
|
this.friends = friends;
|
|
|
mAdapter.notifyDataSetInvalidated();
|
|
|
mPullToRefreshListView.onRefreshComplete();
|