use of org.qii.weiciyuan.bean.MessageBean in project weiciyuan by qii.
the class RepostsByIdTimeLineFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.repostsbyidtimelinefragment_layout, container, false);
empty = (TextView) view.findViewById(R.id.empty);
progressBar = (ProgressBar) view.findViewById(R.id.progressbar);
quick_repost = (LinearLayout) view.findViewById(R.id.quick_repost);
pullToRefreshListView = (PullToRefreshListView) view.findViewById(R.id.listView);
pullToRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
loadNewMsg();
}
});
pullToRefreshListView.setOnLastItemVisibleListener(new PullToRefreshBase.OnLastItemVisibleListener() {
@Override
public void onLastItemVisible() {
loadOldMsg(null);
}
});
getListView().setScrollingCacheEnabled(false);
getListView().setHeaderDividersEnabled(false);
footerView = inflater.inflate(R.layout.listview_footer_layout, null);
getListView().addFooterView(footerView);
dismissFooterView();
getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (actionMode != null) {
getListView().clearChoices();
actionMode.finish();
actionMode = null;
return;
}
getListView().clearChoices();
if (position - 1 < getList().getSize() && position - 1 >= 0) {
listViewItemClick(parent, view, position - 1, id);
} else if (position - 1 >= getList().getSize()) {
loadOldMsg(view);
}
}
});
if (savedInstanceState == null && msg != null) {
if (msg.getRetweeted_status() == null) {
quick_repost.setVisibility(View.VISIBLE);
}
} else if (savedInstanceState != null) {
msg = (MessageBean) savedInstanceState.getParcelable("msg");
if (msg.getRetweeted_status() == null) {
quick_repost.setVisibility(View.VISIBLE);
}
}
et = (EditText) view.findViewById(R.id.content);
view.findViewById(R.id.send).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendRepost();
}
});
buildListAdapter();
return view;
}
use of org.qii.weiciyuan.bean.MessageBean in project weiciyuan by qii.
the class FriendsMsgLoader method loadData.
public MessageListBean loadData() throws WeiboException {
MessageListBean result = null;
MessageListBean tmp = get(token, currentGroupId, sinceId, maxId);
result = tmp;
if (isLoadNewData() && Utility.isWifi(getContext()) && SettingUtility.isWifiUnlimitedMsgCount()) {
int retryCount = 0;
while (tmp.getReceivedCount() >= Integer.valueOf(SettingUtility.getMsgCount()) && retryCount < MAX_RETRY_COUNT) {
String tmpMaxId = tmp.getItemList().get(tmp.getItemList().size() - 1).getId();
tmp = get(token, currentGroupId, sinceId, tmpMaxId);
result.addOldData(tmp);
retryCount++;
}
if (tmp.getReceivedCount() >= Integer.valueOf(SettingUtility.getMsgCount())) {
MessageBean middleUnreadItem = new MessageBean();
middleUnreadItem.setId(String.valueOf(System.currentTimeMillis()));
middleUnreadItem.setMiddleUnreadItem(true);
result.getItemList().add(middleUnreadItem);
}
} else {
return result;
}
return result;
}
use of org.qii.weiciyuan.bean.MessageBean in project weiciyuan by qii.
the class MentionsWeiboTimeLineFragment method addUnreadMessage.
private void addUnreadMessage(MessageListBean data) {
if (data != null && data.getSize() > 0) {
MessageBean last = data.getItem(data.getSize() - 1);
boolean dup = getList().getItemList().contains(last);
if (!dup) {
addNewDataAndRememberPosition(data);
}
}
}
use of org.qii.weiciyuan.bean.MessageBean in project weiciyuan by qii.
the class WifiAutoDownloadPictureRunnable method startDownload.
private void startDownload(MessageBean msg) {
if (!msg.isMultiPics()) {
String url = msg.getOriginal_pic();
if (!TextUtils.isEmpty(url)) {
downloadPic(url);
}
} else {
ArrayList<String> urls = msg.getHighPicUrls();
for (String url : urls) {
downloadPic(url);
}
}
MessageBean reTweetedMsg = msg.getRetweeted_status();
if (reTweetedMsg != null) {
if (!reTweetedMsg.isMultiPics()) {
String url = reTweetedMsg.getOriginal_pic();
if (!TextUtils.isEmpty(url)) {
downloadPic(url);
}
} else {
ArrayList<String> urls = reTweetedMsg.getHighPicUrls();
for (String url : urls) {
downloadPic(url);
}
}
}
UserBean user = msg.getUser();
if (user != null) {
downloadAvatar(user.getAvatar_large());
}
}
use of org.qii.weiciyuan.bean.MessageBean in project weiciyuan by qii.
the class SendCommentService method onStartCommand.
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
int lastNotificationId = intent.getIntExtra("lastNotificationId", -1);
if (lastNotificationId != -1) {
NotificationUtility.cancel(lastNotificationId);
}
String token = intent.getStringExtra("token");
AccountBean account = (AccountBean) intent.getParcelableExtra("account");
String content = intent.getStringExtra("content");
MessageBean oriMsg = (MessageBean) intent.getParcelableExtra("oriMsg");
boolean comment_ori = intent.getBooleanExtra("comment_ori", false);
CommentDraftBean commentDraftBean = (CommentDraftBean) intent.getParcelableExtra("draft");
WeiboSendTask task = new WeiboSendTask(account, token, content, oriMsg, comment_ori, commentDraftBean);
task.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
tasksResult.put(task, false);
return START_REDELIVER_INTENT;
}
Aggregations