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
荣华富贵8
- 粉丝: 223
- 资源: 7653
最新资源
- 西门子V90 Profinet控制新能源自动排列机:RFID读写与运动控制详解,西门子FB284伺服v90profinet程序西门子触摸屏程 序,新能源行业自动排列机,真实项目,V90 走PN 口控制
- 西门子四轴程序:新能源自动排列机项目详解-基于FB和RFID技术的高效自动化控制,西门子1200四轴程序 新能源自动排列机,真实项目 4个V90 走PN 口控制4轴4个FB284控制 RFID块采
- 粒子群优化算法下的电力系统经济调度与经济成本优化策略(基于IEEE30节点六机模型),基于粒子群算法的电力系统最优潮流 以IEEE30节点的六机为对象,建立考虑功率平衡、机组爬坡约束、出力限制约束的
- 齿轮生成器:轻松编辑参数,一键生成多种常用齿轮(约400MB,支持Creo格式),齿轮生成器 文件大小:约400MB 各种常用齿轮,点击重新生成编辑参数即可,是creo格式 ,齿轮生成器; 400MB
- FactoryIO与ABB机器人协同博图仿真实验:入门级的跨平台通讯实践,FactoryIO+ABB机器人+博图仿真实验程序 通过三个不同品牌的仿真平台相互通讯,实现一些简单的动作,内容简单,主要演示
- "ADC12D1600高速接口驱动源码Verilog实现,适用于XILINX FPGA的数据采集与处理",ADC12D1600高速ADC 接口驱动源码 verilog,适用于XILINX FPGA
- CNN-LSTM组合预测模型:多列输入单列输出的回归预测模型代码详解,适用于多种数据预测场景(附注释),适用于Python 2020及以上版本,CNN-LSTM组合预测模型,输入数据是多列输入,单列输
- 一万套Solidworks非标自动化设备的精细三维图纸与专业通用模型:UG机械设计必备资源,一万套Solidworks非标自动化设备三维图纸 3D通用模型 机械设计UG ,核心关键词:Solidwor
- 西门子PLC温度PID控制源程序揭秘:稳定温度控制实战应用,涵盖热电偶模块与固态继电器等硬件,西门子1200PLC温度PID控制源程序,主要硬件为PLC,热电偶模块,热电偶,加热棒,固态继电器等,实测
- 三菱PLC Q系列控制12轴伺服与多种通讯应用:详细中文注释的程序与完整系统图,三菱PLC Q系列大型程序伺服12轴Q01U RS232通讯CCD 应用 实际使用中程序,详细中文注释 2个模块QD7
- "威纶通触摸屏案例详解:EBPro软件打开EB8000工程及CMP文件应用",多个威纶通触摸屏案例,威纶案例 EBPro打开EB8000的方法,打开EBPro软件,文件,打开,选择EB8000工程
- 信捷PLC八轴伺服步进模块化编程框架:公式计算、报警功能及主流系统应用参考程序,信捷PLC程序,八轴程序,有伺服也有步进,内部有伺服和步进计算公式算,模块化编程框架,包含各功能区规划,伺服步进电机DO
- 基于Matlab的多功能生物识别与智能识别系统:人脸识别、指纹识别、考勤打卡、车牌识别及口罩佩戴规范检测,基于Matlab的人脸识别、指纹识别、考勤系统,车牌号分割截取识别、口罩佩戴规范识别等系统均可
- 西门子S7-1200 PLC程序详解:伺服分拣机自动化系统与V90轴控制实战教程,西门子伺服分拣机西门子S7-1200 PLC程序,有自己录4平详细讲解项目程序 有电气CAD图,机械整机结构,动作流程
- 三相PWM四象限可控整流器:高效双闭环控制,功率因数达一,直流电压稳定,能量双向流动,运行无纹波,四象限灵活运行 ,三相PWM四象限可控整流器,网侧电压与电流同相位,功率因数=1,响应速度快,控制精度
- 基于MATLAB+CPLEX仿真平台,考虑阶梯式碳交易机制与电制氢的综合能源系统热电优化调度研究:引入电解槽与氢燃料电池优化碳排放控制并提升氢能效益 ,MATLAB代码:考虑阶梯式碳交易机制与电制氢的
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈