本文整理汇总了Java中net.oschina.app.bean.TweetList类的典型用法代码示例。如果您正苦于以下问题:Java TweetList类的具体用法?Java TweetList怎么用?Java TweetList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TweetList类属于net.oschina.app.bean包,在下文中一共展示了TweetList类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTweetList
import net.oschina.app.bean.TweetList; //导入依赖的package包/类
/**
* 获取动弹列表
* @param uid
* @param pageIndex
* @param pageSize
* @return
* @throws AppException
*/
public static TweetList getTweetList(AppContext appContext, final int uid, final int pageIndex, final int pageSize) throws AppException {
String newUrl = _MakeURL(URLs.TWEET_LIST, new HashMap<String, Object>(){{
put("uid", uid);
put("pageIndex", pageIndex);
put("pageSize", pageSize);
}});
try{
return TweetList.parse(http_get(appContext, newUrl));
}catch(Exception e){
if(e instanceof AppException)
throw (AppException)e;
throw AppException.network(e);
}
}
示例2: loadLvTweetData
import net.oschina.app.bean.TweetList; //导入依赖的package包/类
/**
* 线程加载动弹数据
* @param catalog -1 热门,0 最新,大于0 某用户的动弹(uid)
* @param pageIndex 当前页数
* @param handler 处理器
* @param action 动作标识
*/
private void loadLvTweetData(final int catalog,final int pageIndex,final Handler handler,final int action){
mHeadProgress.setVisibility(ProgressBar.VISIBLE);
new Thread(){
public void run() {
Message msg = new Message();
boolean isRefresh = false;
if(action == UIHelper.LISTVIEW_ACTION_REFRESH || action == UIHelper.LISTVIEW_ACTION_SCROLL)
isRefresh = true;
try {
TweetList list = appContext.getTweetList(catalog, pageIndex, isRefresh);
msg.what = list.getPageSize();
msg.obj = list;
} catch (AppException e) {
e.printStackTrace();
msg.what = -1;
msg.obj = e;
}
msg.arg1 = action;
msg.arg2 = UIHelper.LISTVIEW_DATATYPE_TWEET;
if(curTweetCatalog == catalog)
handler.sendMessage(msg);
}
}.start();
}
示例3: loadLvTweetData
import net.oschina.app.bean.TweetList; //导入依赖的package包/类
/**
* 线程加载动弹数据
*
* @param catalog
* -1 热门,0 最新,大于0 某用户的动弹(uid)
* @param pageIndex
* 当前页数
* @param handler
* 处理器
* @param action
* 动作标识
*/
private void loadLvTweetData(final int catalog, final int pageIndex,
final Handler handler, final int action) {
mHeadProgress.setVisibility(ProgressBar.VISIBLE);
new Thread() {
public void run() {
Message msg = new Message();
boolean isRefresh = false;
if (action == UIHelper.LISTVIEW_ACTION_REFRESH
|| action == UIHelper.LISTVIEW_ACTION_SCROLL)
isRefresh = true;
try {
TweetList list = appContext.getTweetList(catalog,
pageIndex, isRefresh);
msg.what = list.getPageSize();
msg.obj = list;
} catch (AppException e) {
e.printStackTrace();
msg.what = -1;
msg.obj = e;
}
msg.arg1 = action;
msg.arg2 = UIHelper.LISTVIEW_DATATYPE_TWEET;
if (curTweetCatalog == catalog)
handler.sendMessage(msg);
}
}.start();
}
示例4: getLvHandler
import net.oschina.app.bean.TweetList; //导入依赖的package包/类
/**
* 获取listview的初始化Handler
*
* @param lv
* @param adapter
* @return
*/
private Handler getLvHandler(final PullToRefreshListView lv,
final BaseAdapter adapter, final TextView more,
final ProgressBar progress, final int pageSize) {
return new Handler() {
public void handleMessage(Message msg) {
if (msg.what >= 0) {
// listview数据处理
Notice notice = handleLvData(msg.what, msg.obj, msg.arg2,
msg.arg1);
if (msg.what < pageSize) {
lv.setTag(UIHelper.LISTVIEW_DATA_FULL);
adapter.notifyDataSetChanged();
more.setText(R.string.load_full);
} else if (msg.what == pageSize) {
lv.setTag(UIHelper.LISTVIEW_DATA_MORE);
adapter.notifyDataSetChanged();
more.setText(R.string.load_more);
// 特殊处理-热门动弹不能翻页
if (lv == lvTweet) {
TweetList tlist = (TweetList) msg.obj;
if (lvTweetData.size() == tlist.getTweetCount()) {
lv.setTag(UIHelper.LISTVIEW_DATA_FULL);
more.setText(R.string.load_full);
}
}
}
// 发送通知广播
if (notice != null) {
UIHelper.sendBroadCast(lv.getContext(), notice);
}
// 是否清除通知信息
if (isClearNotice) {
ClearNotice(curClearNoticeType);
isClearNotice = false;// 重置
curClearNoticeType = 0;
}
} else if (msg.what == -1) {
// 有异常--显示加载出错 & 弹出错误消息
lv.setTag(UIHelper.LISTVIEW_DATA_MORE);
more.setText(R.string.load_error);
((AppException) msg.obj).makeToast(Main.this);
}
if (adapter.getCount() == 0) {
lv.setTag(UIHelper.LISTVIEW_DATA_EMPTY);
more.setText(R.string.load_empty);
}
progress.setVisibility(ProgressBar.GONE);
mHeadProgress.setVisibility(ProgressBar.GONE);
if (msg.arg1 == UIHelper.LISTVIEW_ACTION_REFRESH) {
lv.onRefreshComplete(getString(R.string.pull_to_refresh_update)
+ new Date().toLocaleString());
lv.setSelection(0);
} else if (msg.arg1 == UIHelper.LISTVIEW_ACTION_CHANGE_CATALOG) {
lv.onRefreshComplete();
lv.setSelection(0);
}
}
};
}
示例5: initFrameButton
import net.oschina.app.bean.TweetList; //导入依赖的package包/类
/**
* 初始化各个主页的按钮(资讯、问答、动弹、动态、留言)
*/
private void initFrameButton()
{
//初始化按钮控件
framebtn_News_lastest = (Button)findViewById(R.id.frame_btn_news_lastest);
framebtn_News_blog = (Button)findViewById(R.id.frame_btn_news_blog);
framebtn_News_recommend = (Button)findViewById(R.id.frame_btn_news_recommend);
framebtn_Question_ask = (Button)findViewById(R.id.frame_btn_question_ask);
framebtn_Question_share = (Button)findViewById(R.id.frame_btn_question_share);
framebtn_Question_other = (Button)findViewById(R.id.frame_btn_question_other);
framebtn_Question_job = (Button)findViewById(R.id.frame_btn_question_job);
framebtn_Question_site = (Button)findViewById(R.id.frame_btn_question_site);
framebtn_Tweet_lastest = (Button)findViewById(R.id.frame_btn_tweet_lastest);
framebtn_Tweet_hot = (Button)findViewById(R.id.frame_btn_tweet_hot);
framebtn_Tweet_my = (Button)findViewById(R.id.frame_btn_tweet_my);
framebtn_Active_lastest = (Button)findViewById(R.id.frame_btn_active_lastest);
framebtn_Active_atme = (Button)findViewById(R.id.frame_btn_active_atme);
framebtn_Active_comment = (Button)findViewById(R.id.frame_btn_active_comment);
framebtn_Active_myself = (Button)findViewById(R.id.frame_btn_active_myself);
framebtn_Active_message = (Button)findViewById(R.id.frame_btn_active_message);
//设置首选择项
framebtn_News_lastest.setEnabled(false);
framebtn_Question_ask.setEnabled(false);
framebtn_Tweet_lastest.setEnabled(false);
framebtn_Active_lastest.setEnabled(false);
//资讯+博客
framebtn_News_lastest.setOnClickListener(frameNewsBtnClick(framebtn_News_lastest,NewsList.CATALOG_ALL));
framebtn_News_blog.setOnClickListener(frameNewsBtnClick(framebtn_News_blog,BlogList.CATALOG_LATEST));
framebtn_News_recommend.setOnClickListener(frameNewsBtnClick(framebtn_News_recommend,BlogList.CATALOG_RECOMMEND));
//问答
framebtn_Question_ask.setOnClickListener(frameQuestionBtnClick(framebtn_Question_ask,PostList.CATALOG_ASK));
framebtn_Question_share.setOnClickListener(frameQuestionBtnClick(framebtn_Question_share,PostList.CATALOG_SHARE));
framebtn_Question_other.setOnClickListener(frameQuestionBtnClick(framebtn_Question_other,PostList.CATALOG_OTHER));
framebtn_Question_job.setOnClickListener(frameQuestionBtnClick(framebtn_Question_job,PostList.CATALOG_JOB));
framebtn_Question_site.setOnClickListener(frameQuestionBtnClick(framebtn_Question_site,PostList.CATALOG_SITE));
//动弹
framebtn_Tweet_lastest.setOnClickListener(frameTweetBtnClick(framebtn_Tweet_lastest,TweetList.CATALOG_LASTEST));
framebtn_Tweet_hot.setOnClickListener(frameTweetBtnClick(framebtn_Tweet_hot,TweetList.CATALOG_HOT));
framebtn_Tweet_my.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//判断登录
int uid = appContext.getLoginUid();
if(uid == 0){
UIHelper.showLoginDialog(Main.this);
return;
}
framebtn_Tweet_lastest.setEnabled(true);
framebtn_Tweet_hot.setEnabled(true);
framebtn_Tweet_my.setEnabled(false);
curTweetCatalog = uid;
loadLvTweetData(curTweetCatalog, 0, lvTweetHandler, UIHelper.LISTVIEW_ACTION_CHANGE_CATALOG);
}
});
//动态+留言
framebtn_Active_lastest.setOnClickListener(frameActiveBtnClick(framebtn_Active_lastest,ActiveList.CATALOG_LASTEST));
framebtn_Active_atme.setOnClickListener(frameActiveBtnClick(framebtn_Active_atme,ActiveList.CATALOG_ATME));
framebtn_Active_comment.setOnClickListener(frameActiveBtnClick(framebtn_Active_comment,ActiveList.CATALOG_COMMENT));
framebtn_Active_myself.setOnClickListener(frameActiveBtnClick(framebtn_Active_myself,ActiveList.CATALOG_MYSELF));
framebtn_Active_message.setOnClickListener(frameActiveBtnClick(framebtn_Active_message,0));
//特殊处理
framebtn_Active_atme.setText("@"+getString(R.string.frame_title_active_atme));
}
示例6: getLvHandler
import net.oschina.app.bean.TweetList; //导入依赖的package包/类
/**
* 获取listview的初始化Handler
* @param lv
* @param adapter
* @return
*/
private Handler getLvHandler(final PullToRefreshListView lv,final BaseAdapter adapter,final TextView more,final ProgressBar progress,final int pageSize){
return new Handler(){
public void handleMessage(Message msg) {
if(msg.what >= 0){
//listview数据处理
Notice notice = handleLvData(msg.what, msg.obj, msg.arg2, msg.arg1);
if(msg.what < pageSize){
lv.setTag(UIHelper.LISTVIEW_DATA_FULL);
adapter.notifyDataSetChanged();
more.setText(R.string.load_full);
}else if(msg.what == pageSize){
lv.setTag(UIHelper.LISTVIEW_DATA_MORE);
adapter.notifyDataSetChanged();
more.setText(R.string.load_more);
//特殊处理-热门动弹不能翻页
if(lv == lvTweet) {
TweetList tlist = (TweetList)msg.obj;
if(lvTweetData.size() == tlist.getTweetCount()){
lv.setTag(UIHelper.LISTVIEW_DATA_FULL);
more.setText(R.string.load_full);
}
}
}
//发送通知广播
if(notice != null){
UIHelper.sendBroadCast(lv.getContext(), notice);
}
//是否清除通知信息
if(isClearNotice){
ClearNotice(curClearNoticeType);
isClearNotice = false;//重置
curClearNoticeType = 0;
}
}
else if(msg.what == -1){
//有异常--显示加载出错 & 弹出错误消息
lv.setTag(UIHelper.LISTVIEW_DATA_MORE);
more.setText(R.string.load_error);
((AppException)msg.obj).makeToast(Main.this);
}
if(adapter.getCount()==0){
lv.setTag(UIHelper.LISTVIEW_DATA_EMPTY);
more.setText(R.string.load_empty);
}
progress.setVisibility(ProgressBar.GONE);
mHeadProgress.setVisibility(ProgressBar.GONE);
if(msg.arg1 == UIHelper.LISTVIEW_ACTION_REFRESH){
lv.onRefreshComplete(getString(R.string.pull_to_refresh_update) + new Date().toLocaleString());
lv.setSelection(0);
}else if(msg.arg1 == UIHelper.LISTVIEW_ACTION_CHANGE_CATALOG){
lv.onRefreshComplete();
lv.setSelection(0);
}
}
};
}