Search in sources :

Example 1 with GroupListed

use of org.aisen.weibo.sina.sinasdk.bean.GroupListed in project AisenWeiBo by wangdan.

the class ProfileAboutFragment method onFriendshipCreated.

@Override
public void onFriendshipCreated(WeiBoUser targetUser) {
    if (mFriendship != null)
        mFriendship.getSource().setFollowing(true);
    mUser.setRecentStatusId(targetUser.getRecentStatusId());
    mGroupMemberListed = new GroupMemberListed();
    mGroupMemberListed.setLists(new ArrayList<GroupListed>());
    mGroupMemberListed.setUid(mUser.getIdstr());
    setProfile();
    setGroupList();
    // 设置Pager的菜单显示
    Fragment fragment = getActivity().getFragmentManager().findFragmentByTag(SinaCommonActivity.FRAGMENT_TAG);
    ((ProfilePagerFragment) fragment).setFriendshipShow(mFriendship);
}
Also used : GroupListed(org.aisen.weibo.sina.sinasdk.bean.GroupListed) GroupMemberListed(org.aisen.weibo.sina.sinasdk.bean.GroupMemberListed) BizFragment(org.aisen.weibo.sina.ui.fragment.base.BizFragment) ABaseFragment(org.aisen.android.ui.fragment.ABaseFragment) Fragment(android.app.Fragment)

Example 2 with GroupListed

use of org.aisen.weibo.sina.sinasdk.bean.GroupListed in project AisenWeiBo by wangdan.

the class ProfileAboutFragment method setGroupList.

public void setGroupList() {
    if (mGroupMemberListed == null)
        return;
    if (groupDialog != null && groupDialog.isShowing())
        groupDialog.dismiss();
    String[] items = new String[AppContext.getAccount().getGroups().getLists().size()];
    final boolean[] checkedItems = new boolean[AppContext.getAccount().getGroups().getLists().size()];
    final boolean[] editCheckedItems = new boolean[AppContext.getAccount().getGroups().getLists().size()];
    for (int i = 0; i < AppContext.getAccount().getGroups().getLists().size(); i++) {
        Group group = AppContext.getAccount().getGroups().getLists().get(i);
        items[i] = group.getName();
        checkedItems[i] = false;
        editCheckedItems[i] = false;
        for (GroupListed groupListed : mGroupMemberListed.getLists()) {
            if (groupListed.getIdstr().equals(group.getIdstr())) {
                checkedItems[i] = true;
                editCheckedItems[i] = true;
                break;
            }
        }
    }
    //        View customTitle = View.inflate(getActivity(), R.layout.lay_group_dialogtitle, null);
    //        customTitle.findViewById(R.id.btnSettings).setOnClickListener(new View.OnClickListener() {
    //
    //            @Override
    //            public void onClick(View v) {
    //                // 设置分组
    //                GroupSortFragment.lanuch(getActivity());
    //            }
    //        });
    AlertDialogWrapper.Builder dialogBuilder = new AlertDialogWrapper.Builder(getActivity()).setTitle(R.string.profile_group_setting).setMultiChoiceItems(items, editCheckedItems, new DialogInterface.OnMultiChoiceClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which, boolean isChecked) {
            editCheckedItems[which] = isChecked;
        }
    });
    try {
        try {
            // 解决有些设备版本较低的BUG,没查这个方法的最低版本要求
            dialogBuilder.setOnDismissListener(new DialogInterface.OnDismissListener() {

                @Override
                public void onDismiss(DialogInterface dialog) {
                    groupDialog = null;
                }
            });
        } catch (NoSuchMethodError e) {
            e.printStackTrace();
        }
    } catch (Exception e) {
    }
    groupDialog = dialogBuilder.setNegativeButton(R.string.cancel, null).setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            new SetGroupTask().execute(checkedItems, editCheckedItems);
        }
    }).show();
}
Also used : Group(org.aisen.weibo.sina.sinasdk.bean.Group) GroupListed(org.aisen.weibo.sina.sinasdk.bean.GroupListed) DialogInterface(android.content.DialogInterface) TaskException(org.aisen.android.network.task.TaskException) AlertDialogWrapper(com.afollestad.materialdialogs.AlertDialogWrapper)

Example 3 with GroupListed

use of org.aisen.weibo.sina.sinasdk.bean.GroupListed in project AisenWeiBo by wangdan.

the class ProfileAboutFragment method setProfile.

void setProfile() {
    View reasonView = item03;
    View locationView = item04;
    View descView = item05;
    View remarkView = item01;
    View groupsView = item02;
    // 认证原因
    if (!TextUtils.isEmpty(mUser.getVerified_reason())) {
        reasonView.setVisibility(View.VISIBLE);
        setItemTitle(reasonView, getString(R.string.profile_ver_reason_hint));
        setItemBody(reasonView, mUser.getVerified_reason() + "");
    } else {
        reasonView.setVisibility(View.GONE);
    }
    // 所在地
    setItemTitle(locationView, getString(R.string.profile_location_hint));
    setItemBody(locationView, mUser.getLocation() + "");
    // 简介
    setItemTitle(descView, getString(R.string.profile_des_hint02));
    if (!TextUtils.isEmpty(mUser.getDescription())) {
        setItemBody(descView, mUser.getDescription());
    } else {
        setItemBody(descView, getString(R.string.profile_des_none));
    }
    // 备注
    setItemTitle(remarkView, getString(R.string.profile_remark_hint));
    remarkView.setVisibility(mFriendship == null || !mFriendship.getSource().getFollowing() ? View.GONE : View.VISIBLE);
    if (mFriendship != null) {
        TextView txtRemark = (TextView) remarkView.findViewById(R.id.txtBody);
        try {
            BizFragment.createBizFragment(this).modifyUserMark(remarkView.findViewById(R.id.btnItem), mUser, this);
        } catch (Exception e) {
        }
        if (!TextUtils.isEmpty(mUser.getRemark()))
            txtRemark.setText(mUser.getRemark());
        else
            txtRemark.setText(R.string.profile_remark_none02);
    }
    // 分组
    TextView txtGroups = (TextView) groupsView.findViewById(R.id.txtBody);
    groupsView.setVisibility(mGroupMemberListed == null ? View.GONE : View.VISIBLE);
    groupsView.findViewById(R.id.btnItem).setTag("groups");
    groupsView.findViewById(R.id.btnItem).setOnClickListener(this);
    if (mGroupMemberListed != null) {
        if (mGroupMemberListed.getLists().size() == 0) {
            txtGroups.setText(R.string.profile_group_none);
        } else {
            StringBuffer sb = new StringBuffer();
            for (GroupListed groupListed : mGroupMemberListed.getLists()) sb.append(groupListed.getName()).append(" ");
            txtGroups.setText(sb.toString().trim());
        }
    }
    // 最后一个Divider不显示
    if (item05.getVisibility() == View.VISIBLE) {
        item05.findViewById(R.id.viewDivider).setVisibility(View.GONE);
    } else if (item04.getVisibility() == View.VISIBLE) {
        if (item04.getVisibility() == View.VISIBLE) {
            item04.findViewById(R.id.viewDivider).setVisibility(View.GONE);
        }
    }
}
Also used : GroupListed(org.aisen.weibo.sina.sinasdk.bean.GroupListed) TextView(android.widget.TextView) View(android.view.View) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) TaskException(org.aisen.android.network.task.TaskException)

Aggregations

GroupListed (org.aisen.weibo.sina.sinasdk.bean.GroupListed)3 TaskException (org.aisen.android.network.task.TaskException)2 Fragment (android.app.Fragment)1 DialogInterface (android.content.DialogInterface)1 View (android.view.View)1 ScrollView (android.widget.ScrollView)1 TextView (android.widget.TextView)1 AlertDialogWrapper (com.afollestad.materialdialogs.AlertDialogWrapper)1 ABaseFragment (org.aisen.android.ui.fragment.ABaseFragment)1 Group (org.aisen.weibo.sina.sinasdk.bean.Group)1 GroupMemberListed (org.aisen.weibo.sina.sinasdk.bean.GroupMemberListed)1 BizFragment (org.aisen.weibo.sina.ui.fragment.base.BizFragment)1