Search in sources :

Example 1 with GroupBean

use of org.qii.weiciyuan.bean.GroupBean in project weiciyuan by qii.

the class GroupListDao method getInfo.

public List<String> getInfo() throws WeiboException {
    String url = URLHelper.GROUP_MEMBER_LIST;
    Map<String, String> map = new HashMap<String, String>();
    map.put("access_token", access_token);
    map.put("uids", uids);
    String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
    Gson gson = new Gson();
    List<GroupUser> value = null;
    try {
        value = gson.fromJson(jsonData, new TypeToken<List<GroupUser>>() {
        }.getType());
    } catch (JsonSyntaxException e) {
        AppLogger.e(e.getMessage());
    }
    if (value != null && value.size() > 0) {
        GroupUser user = value.get(0);
        List<String> ids = new ArrayList<String>();
        for (GroupBean b : user.lists) {
            ids.add(b.getIdstr());
        }
        return ids;
    }
    return null;
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Gson(com.google.gson.Gson) ArrayList(java.util.ArrayList) List(java.util.List) GroupBean(org.qii.weiciyuan.bean.GroupBean)

Example 2 with GroupBean

use of org.qii.weiciyuan.bean.GroupBean in project weiciyuan by qii.

the class UpdateGroupNameDao method update.

public GroupBean update() throws WeiboException {
    String url = URLHelper.GROUP_UPDATE;
    Map<String, String> map = new HashMap<String, String>();
    map.put("access_token", access_token);
    map.put("name", name);
    map.put("list_id", list_id);
    String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
    Gson gson = new Gson();
    GroupBean value = null;
    try {
        value = gson.fromJson(jsonData, GroupBean.class);
    } catch (JsonSyntaxException e) {
        AppLogger.e(e.getMessage());
    }
    return value;
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) HashMap(java.util.HashMap) Gson(com.google.gson.Gson) GroupBean(org.qii.weiciyuan.bean.GroupBean)

Example 3 with GroupBean

use of org.qii.weiciyuan.bean.GroupBean in project weiciyuan by qii.

the class FriendsTimeLineDBTask method getOtherGroupData.

public static List<MessageTimeLineData> getOtherGroupData(String accountId, String exceptGroupId) {
    List<MessageTimeLineData> data = new ArrayList<MessageTimeLineData>();
    if (!"0".equals(exceptGroupId)) {
        TimeLinePosition position = getPosition(accountId);
        MessageListBean msgList = getHomeLineMsgList(accountId, position.position + AppConfig.DB_CACHE_COUNT_OFFSET);
        MessageTimeLineData home = new MessageTimeLineData("0", msgList, position);
        data.add(home);
    }
    MessageTimeLineData biGroup = HomeOtherGroupTimeLineDBTask.getTimeLineData(accountId, "1");
    data.add(biGroup);
    GroupListBean groupListBean = GroupDBTask.get(accountId);
    if (groupListBean != null) {
        List<GroupBean> lists = groupListBean.getLists();
        for (GroupBean groupBean : lists) {
            MessageTimeLineData dbMsg = HomeOtherGroupTimeLineDBTask.getTimeLineData(accountId, groupBean.getId());
            data.add(dbMsg);
        }
    }
    Iterator<MessageTimeLineData> iterator = data.iterator();
    while (iterator.hasNext()) {
        MessageTimeLineData single = iterator.next();
        if (single.groupId.equals(exceptGroupId)) {
            iterator.remove();
            break;
        }
    }
    return data;
}
Also used : MessageListBean(org.qii.weiciyuan.bean.MessageListBean) ArrayList(java.util.ArrayList) GroupListBean(org.qii.weiciyuan.bean.GroupListBean) GroupBean(org.qii.weiciyuan.bean.GroupBean) TimeLinePosition(org.qii.weiciyuan.bean.android.TimeLinePosition) MessageTimeLineData(org.qii.weiciyuan.bean.android.MessageTimeLineData)

Example 4 with GroupBean

use of org.qii.weiciyuan.bean.GroupBean in project weiciyuan by qii.

the class ManageGroupDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        group = (GroupListBean) savedInstanceState.getParcelable("group");
        uid = savedInstanceState.getString("uid");
        valueArray = savedInstanceState.getStringArray("valueArray");
        selectedArray = savedInstanceState.getBooleanArray("selectedArray");
        currentList = savedInstanceState.getStringArrayList("currentList");
        addList = savedInstanceState.getStringArrayList("addList");
        removeList = savedInstanceState.getStringArrayList("removeList");
    }
    final List<GroupBean> list = group.getLists();
    selectedArray = new boolean[list.size()];
    List<String> name = new ArrayList<String>();
    for (int i = 0; i < list.size(); i++) {
        name.add(list.get(i).getName());
    }
    valueArray = name.toArray(new String[0]);
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    View customTitle = getActivity().getLayoutInflater().inflate(R.layout.managegroupdialog_title_layout, null);
    ImageView setting = (ImageView) customTitle.findViewById(R.id.title_button);
    setting.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            startActivity(new Intent(getActivity(), ManageGroupActivity.class));
        }
    });
    builder.setMultiChoiceItems(valueArray, selectedArray, new DialogMultiChoiceClickListener()).setPositiveButton(getString(R.string.save), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ModifyGroupMemberTask modifyGroupMemberTask = new ModifyGroupMemberTask(uid, addList, removeList);
            modifyGroupMemberTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
        }
    }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    }).setCustomTitle(customTitle);
    task = new Task();
    task.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
    return builder.create();
}
Also used : AlertDialog(android.app.AlertDialog) MyAsyncTask(org.qii.weiciyuan.support.lib.MyAsyncTask) DialogInterface(android.content.DialogInterface) ArrayList(java.util.ArrayList) GroupBean(org.qii.weiciyuan.bean.GroupBean) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) ImageView(android.widget.ImageView)

Example 5 with GroupBean

use of org.qii.weiciyuan.bean.GroupBean in project weiciyuan by qii.

the class FriendsTimeLineFragment method buildListNavData.

private String[] buildListNavData(List<GroupBean> list) {
    List<String> name = new ArrayList<String>();
    name.add(getString(R.string.all_people));
    name.add(getString(R.string.bilateral));
    for (GroupBean b : list) {
        name.add(b.getName());
    }
    String[] valueArray = name.toArray(new String[0]);
    return valueArray;
}
Also used : ArrayList(java.util.ArrayList) GroupBean(org.qii.weiciyuan.bean.GroupBean)

Aggregations

GroupBean (org.qii.weiciyuan.bean.GroupBean)6 ArrayList (java.util.ArrayList)4 Gson (com.google.gson.Gson)3 JsonSyntaxException (com.google.gson.JsonSyntaxException)3 HashMap (java.util.HashMap)3 AlertDialog (android.app.AlertDialog)1 DialogInterface (android.content.DialogInterface)1 Intent (android.content.Intent)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 List (java.util.List)1 GroupListBean (org.qii.weiciyuan.bean.GroupListBean)1 MessageListBean (org.qii.weiciyuan.bean.MessageListBean)1 MessageTimeLineData (org.qii.weiciyuan.bean.android.MessageTimeLineData)1 TimeLinePosition (org.qii.weiciyuan.bean.android.TimeLinePosition)1 MyAsyncTask (org.qii.weiciyuan.support.lib.MyAsyncTask)1