Search in sources :

Example 6 with Group

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

the class PublishStatusFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // 所有人可见
    if (item.getItemId() == R.id.group_all_visiable) {
        getPublishBean().getParams().addParameter("visible", "0");
    } else // 设置定时
    if (item.getItemId() == R.id.publish_timing) {
        // 定时发布
        setTiming();
    } else // 取消定时
    if (item.getItemId() == R.id.cancel_timing) {
        getPublishBean().setTiming(0);
        setTimingHint();
    } else // 分组
    {
        int groupIndex = item.getItemId();
        if (groupIndex < AppContext.getAccount().getGroups().getLists().size()) {
            Group group = AppContext.getAccount().getGroups().getLists().get(groupIndex);
            if (group.getName().equalsIgnoreCase(item.getTitle().toString())) {
                getPublishBean().getParams().addParameter("visible", "3");
                getPublishBean().getParams().addParameter("list_id", group.getIdstr());
                setVisiableHint();
            }
        }
    }
    setVisiableHint();
    return super.onOptionsItemSelected(item);
}
Also used : Group(org.aisen.weibo.sina.sinasdk.bean.Group)

Example 7 with Group

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

the class SinaSDK method friendshipGroups.

/**
	 * 获取好友的分组信息
	 * 
	 * @return
	 */
public Groups friendshipGroups() throws TaskException {
    Groups groups = doGet(getSetting("friendshipGroups"), configParams(null), Groups.class);
    Map<String, String> groupMap = new HashMap<String, String>();
    List<Group> groupList = new ArrayList<Group>();
    // fuck 有两个特别关注
    for (Group group : groups.getLists()) {
        if (!groupMap.containsKey(group.getIdstr())) {
            groupList.add(group);
            groupMap.put(group.getIdstr(), group.getIdstr());
        }
    }
    groups.setLists(groupList);
    return groups;
}
Also used : Group(org.aisen.weibo.sina.sinasdk.bean.Group) HashMap(java.util.HashMap) Groups(org.aisen.weibo.sina.sinasdk.bean.Groups) ArrayList(java.util.ArrayList)

Example 8 with Group

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

the class OfflineService method prepareOffline.

// 准备离线
private void prepareOffline() {
    mStatus = OfflineStatus.prepare;
    mNotifier.cancelNotification(OfflineNotifier.OfflineStatus);
    mNotifier.cancelNotification(OfflineNotifier.OfflinePicture);
    // 开始离线微博
    unOfflineGroups = new ArrayList<>();
    unOfflineGroups.addAll(mGroups);
    for (Group group : mGroups) {
        new LoadStatusTask(group).executeOnSerialExecutor();
    }
}
Also used : Group(org.aisen.weibo.sina.sinasdk.bean.Group)

Example 9 with Group

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

the class OfflineSettingsFragment method setGroupsSummary.

private void setGroupsSummary() {
    List<Group> groups = SinaDB.getOfflineSqlite().select(new Extra(AppContext.getAccount().getUser().getIdstr(), null), Group.class);
    String summary = "";
    if (groups.size() == 0) {
        summary = getString(R.string.offline_none_groups) + ",";
    } else {
        for (Group group : groups) {
            summary = summary + group.getName() + ",";
        }
    }
    pOfflineGroups.setSummary(summary.substring(0, summary.length() - 1));
}
Also used : Group(org.aisen.weibo.sina.sinasdk.bean.Group) Extra(org.aisen.android.component.orm.extra.Extra)

Example 10 with Group

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

the class OfflineSettingsFragment method onPreferenceClick.

@Override
public boolean onPreferenceClick(Preference preference) {
    if (preference.getKey().equals("pOfflineGroups")) {
        final List<Group> groups = SinaDB.getOfflineSqlite().select(new Extra(AppContext.getAccount().getUser().getIdstr(), null), Group.class);
        OfflineUtils.showOfflineGroupsModifyDialog(getActivity(), groups, new OfflineUtils.OnOfflineGroupSetCallback() {

            @Override
            public void onChanged(List<Group> newGroups) {
                SinaDB.getOfflineSqlite().deleteAll(OfflineUtils.getLoggedExtra(null), Group.class);
                if (newGroups == null || newGroups.size() == 0) {
                } else {
                    SinaDB.getOfflineSqlite().insertOrReplace(OfflineUtils.getLoggedExtra(null), newGroups);
                }
                setGroupsSummary();
            }
        }, R.string.offline_groups_dialog);
    }
    return true;
}
Also used : Group(org.aisen.weibo.sina.sinasdk.bean.Group) Extra(org.aisen.android.component.orm.extra.Extra) OfflineUtils(org.aisen.weibo.sina.support.utils.OfflineUtils)

Aggregations

Group (org.aisen.weibo.sina.sinasdk.bean.Group)10 DialogInterface (android.content.DialogInterface)3 ArrayList (java.util.ArrayList)3 Extra (org.aisen.android.component.orm.extra.Extra)3 AlertDialogWrapper (com.afollestad.materialdialogs.AlertDialogWrapper)2 SubMenu (android.view.SubMenu)1 View (android.view.View)1 HashMap (java.util.HashMap)1 List (java.util.List)1 TaskException (org.aisen.android.network.task.TaskException)1 GroupListed (org.aisen.weibo.sina.sinasdk.bean.GroupListed)1 Groups (org.aisen.weibo.sina.sinasdk.bean.Groups)1 OfflineUtils (org.aisen.weibo.sina.support.utils.OfflineUtils)1 MaterialSheetFab (org.aisen.weibo.sina.ui.widget.sheetfab.MaterialSheetFab)1 MaterialSheetFabEventListener (org.aisen.weibo.sina.ui.widget.sheetfab.MaterialSheetFabEventListener)1