package net.oschina.app.ui;
import greendroid.widget.MyQuickAction;
import greendroid.widget.QuickActionGrid;
import greendroid.widget.QuickActionWidget;
import greendroid.widget.QuickActionWidget.OnQuickActionClickListener;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import net.oschina.app.AppConfig;
import net.oschina.app.AppContext;
import net.oschina.app.AppException;
import net.oschina.app.R;
import net.oschina.app.adapter.ListViewActiveAdapter;
import net.oschina.app.adapter.ListViewBlogAdapter;
import net.oschina.app.adapter.ListViewMessageAdapter;
import net.oschina.app.adapter.ListViewNewsAdapter;
import net.oschina.app.adapter.ListViewQuestionAdapter;
import net.oschina.app.adapter.ListViewTweetAdapter;
import net.oschina.app.bean.Active;
import net.oschina.app.bean.ActiveList;
import net.oschina.app.bean.Blog;
import net.oschina.app.bean.BlogList;
import net.oschina.app.bean.MessageList;
import net.oschina.app.bean.Messages;
import net.oschina.app.bean.News;
import net.oschina.app.bean.NewsList;
import net.oschina.app.bean.Notice;
import net.oschina.app.bean.Post;
import net.oschina.app.bean.PostList;
import net.oschina.app.bean.Result;
import net.oschina.app.bean.Tweet;
import net.oschina.app.bean.TweetList;
import net.oschina.app.common.StringUtils;
import net.oschina.app.common.UIHelper;
import net.oschina.app.common.UpdateManager;
import net.oschina.app.widget.BadgeView;
import net.oschina.app.widget.NewDataToast;
import net.oschina.app.widget.PullToRefreshListView;
import net.oschina.app.widget.ScrollLayout;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RadioButton;
import android.widget.TextView;
/**
* 应用程序首页
*
* @author liux (http://my.oschina.net/liux)
* @version 1.0
* @created 2012-3-21
*/
public class Main extends BaseActivity {
public static final int QUICKACTION_LOGIN_OR_LOGOUT = 0;
public static final int QUICKACTION_USERINFO = 1;
public static final int QUICKACTION_SOFTWARE = 2;
public static final int QUICKACTION_SEARCH = 3;
public static final int QUICKACTION_SETTING = 4;
public static final int QUICKACTION_EXIT = 5;
private ScrollLayout mScrollLayout;
private RadioButton[] mButtons;
private String[] mHeadTitles;
private int mViewCount;
private int mCurSel;
private ImageView mHeadLogo;
private TextView mHeadTitle;
private ProgressBar mHeadProgress;
private ImageButton mHead_search;
private ImageButton mHeadPub_post;
private ImageButton mHeadPub_tweet;
private int curNewsCatalog = NewsList.CATALOG_ALL;
private int curQuestionCatalog = PostList.CATALOG_ASK;
private int curTweetCatalog = TweetList.CATALOG_LASTEST;
private int curActiveCatalog = ActiveList.CATALOG_LASTEST;
private PullToRefreshListView lvNews;
private PullToRefreshListView lvBlog;
private PullToRefreshListView lvQuestion;
private PullToRefreshListView lvTweet;
private PullToRefreshListView lvActive;
private PullToRefreshListView lvMsg;
private ListViewNewsAdapter lvNewsAdapter;
private ListViewBlogAdapter lvBlogAdapter;
private ListViewQuestionAdapter lvQuestionAdapter;
private ListViewTweetAdapter lvTweetAdapter;
private ListViewActiveAdapter lvActiveAdapter;
private ListViewMessageAdapter lvMsgAdapter;
private List<News> lvNewsData = new ArrayList<News>();
private List<Blog> lvBlogData = new ArrayList<Blog>();
private List<Post> lvQuestionData = new ArrayList<Post>();
private List<Tweet> lvTweetData = new ArrayList<Tweet>();
private List<Active> lvActiveData = new ArrayList<Active>();
private List<Messages> lvMsgData = new ArrayList<Messages>();
private Handler lvNewsHandler;
private Handler lvBlogHandler;
private Handler lvQuestionHandler;
private Handler lvTweetHandler;
private Handler lvActiveHandler;
private Handler lvMsgHandler;
private int lvNewsSumData;
private int lvBlogSumData;
private int lvQuestionSumData;
private int lvTweetSumData;
private int lvActiveSumData;
private int lvMsgSumData;
private RadioButton fbNews;
private RadioButton fbQuestion;
private RadioButton fbTweet;
private RadioButton fbactive;
private ImageView fbSetting;
private Button framebtn_News_lastest;
private Button framebtn_News_blog;
private Button framebtn_News_recommend;
private Button framebtn_Question_ask;
private Button framebtn_Question_share;
private Button framebtn_Question_other;
private Button framebtn_Question_job;
private Button framebtn_Question_site;
private Button framebtn_Tweet_lastest;
private Button framebtn_Tweet_hot;
private Button framebtn_Tweet_my;
private Button framebtn_Active_lastest;
private Button framebtn_Active_atme;
private Button framebtn_Active_comment;
private Button framebtn_Active_myself;
private Button framebtn_Active_message;
private View lvNews_footer;
private View lvBlog_footer;
private View lvQuestion_footer;
private View lvTweet_footer;
private View lvActive_footer;
private View lvMsg_footer;
private TextView lvNews_foot_more;
private TextView lvBlog_foot_more;
private TextView lvQuestion_foot_more;
private TextView lvTweet_foot_more;
private TextView lvActive_foot_more;
private TextView lvMsg_foot_more;
private ProgressBar lvNews_foot_progress;
private ProgressBar lvBlog_foot_progress;
private ProgressBar lvQuestion_foot_progress;
private ProgressBar lvTweet_foot_progress;
private ProgressBar lvActive_foot_progress;
private ProgressBar lvMsg_foot_progress;
public static BadgeView bv_active;
public static BadgeView bv_message;
public static BadgeView bv_atme;
public static BadgeView bv_review;
private QuickActionWidget mGrid;// 快捷栏控件
private boolean isClearNotice = false;
private int curClearNoticeType = 0;
private TweetReceiver tweetReceiver;// 动弹发布接收器
private AppContext appContext;// 全局Context
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// 注册广播接收器
tweetReceiver = new TweetReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction("net.oschina.app.action.APP_TWEETPUB");
registerReceiver(tweetReceiver, filter);
appContext = (AppContext) getApplication();
// 网络连接判断
if (!appContext.isNetworkConnected())
UIHelper.ToastMessage(this, R.string.network_not_connected);
// 初始化登录
appContext.initLoginInfo();
this.initHeadView();
this.initFootBar();
this.initPageScroll();
this.initFrameButton();
this.initBadgeView();
this.initQuickActionGrid();
this.initFrameListView();
// 检查新版本
if (appContext.isCheckUp()) {
UpdateManager.getUpdateManager().checkAppUpdate(this, false);
}
// 启动轮询通知信息
this.foreachUserNotice();
}
@Override
protected void onResume() {
super.onResume();
if (mViewCount == 0)
mViewCount = 4;
if (mCurSel == 0 && !fbNews.isChecked()) {
fbNews.setChecked(true);
fbQuestion.setChecked(false);
fbTweet.setChecked(false);
fbactive.setChecked(false);
}
// 读取左右滑动配置
mScrollLayout.setIsScroll(appCont
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
osChina.zip (1189个子文件)
jarlist.cache 119B
Main.class 37KB
AppContext.class 35KB
ApiClient.class 34KB
UIHelper.class 31KB
Utility.class 20KB
QuestionDetail.class 18KB
R$id.class 17KB
UserCenter.class 17KB
ImageUtils.class 17KB
NewsDetail.class 17KB
BlogDetail.class 16KB
TweetDetail.class 15KB
R$drawable.class 13KB
SoftwareLib.class 12KB
UserInfo.class 11KB
ScreenShotView.class 11KB
TweetPub.class 11KB
FileUtils.class 11KB
Weibo.class 10KB
MessageDetail.class 10KB
UpdateManager.class 10KB
BadgeView.class 10KB
SoftwareDetail.class 8KB
Search.class 8KB
ImageZoomDialog.class 8KB
URLs.class 8KB
QuickActionWidget.class 7KB
ListViewActiveAdapter.class 7KB
AppException.class 7KB
UserFavorite.class 7KB
PullToRefreshListView.class 7KB
UserFriend.class 7KB
HttpHeaderFactory.class 7KB
News.class 7KB
WeiboDialog.class 7KB
Active.class 7KB
AppConfig.class 6KB
ScreenShotShare.class 6KB
User.class 6KB
ListViewCommentAdapter.class 6KB
ScrollLayout.class 6KB
PathChooseDialog.class 6KB
Setting.class 6KB
Post.class 6KB
NewsDetail$12.class 6KB
QuestionTag.class 6KB
ListViewMessageAdapter.class 6KB
R$string.class 6KB
ListViewTweetAdapter.class 6KB
Comment.class 6KB
SoftwareDetail$6.class 6KB
UserInformation.class 5KB
QQWeiboHelper2.class 5KB
ListViewMessageDetailAdapter.class 5KB
LoginDialog.class 5KB
Tweet.class 5KB
Software.class 5KB
SinaWeiboHelper.class 5KB
BitmapManager.class 5KB
Result.class 5KB
QuestionDetail$11.class 5KB
QuickActionBar.class 5KB
BlogDetail$11.class 5KB
ActiveList.class 5KB
Blog.class 5KB
Messages.class 5KB
MyInformation.class 5KB
CommentList.class 4KB
StringUtils.class 4KB
BlogCommentList.class 4KB
TweetDetail$13.class 4KB
LinkView.class 4KB
QuestionDetail$17.class 4KB
ListViewQuestionAdapter.class 4KB
NewsDetail$18.class 4KB
TweetPub$13.class 4KB
BlogDetail$17.class 4KB
QuestionPub.class 4KB
UpdateManager$2.class 4KB
CommentPub.class 4KB
NewsList.class 4KB
BroadCast.class 4KB
MessagePub.class 4KB
SearchList.class 4KB
SoftwareLib$9.class 4KB
WeiboDialog$WeiboWebViewClient.class 4KB
QuestionTag$5.class 4KB
SoftwareList.class 4KB
UserFavorite$5.class 4KB
UserFriend$4.class 4KB
HtmlRegexpUtils.class 4KB
TweetDetail$14.class 4KB
MessageDetail$9.class 4KB
MessageList.class 4KB
TweetList.class 4KB
Main$33.class 4KB
BlogList.class 4KB
FavoriteList.class 4KB
PostList.class 4KB
共 1189 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
资源评论
Soft_Leader
- 粉丝: 929
- 资源: 1628
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功