第一次尝试对博客功能的添加
This commit is contained in:
parent
c2ad3cf3aa
commit
27e88df5e8
|
@ -0,0 +1,93 @@
|
|||
package net.oschina.app.viewpagerfragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.View;
|
||||
|
||||
import net.oschina.app.R;
|
||||
import net.oschina.app.adapter.ViewPageFragmentAdapter;
|
||||
import net.oschina.app.base.BaseListFragment;
|
||||
import net.oschina.app.base.BaseViewPagerFragment;
|
||||
import net.oschina.app.bean.BlogList;
|
||||
import net.oschina.app.bean.NewsList;
|
||||
import net.oschina.app.improve.general.fragments.BlogFragment;
|
||||
import net.oschina.app.improve.general.fragments.EventFragment;
|
||||
import net.oschina.app.improve.base.fragments.BaseGeneralListFragment;
|
||||
import net.oschina.app.improve.general.fragments.NewsFragment;
|
||||
import net.oschina.app.improve.general.fragments.QuestionFragment;
|
||||
import net.oschina.app.interf.OnTabReselectListener;
|
||||
|
||||
/**
|
||||
* 综合Tab界面
|
||||
*/
|
||||
public class GeneralViewPagerFragment extends BaseViewPagerFragment implements
|
||||
OnTabReselectListener {
|
||||
//综合界面的第一页显示内容
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSetupTabAdapter(ViewPageFragmentAdapter adapter) {
|
||||
String[] title = getResources().getStringArray(
|
||||
R.array.general_viewpage_arrays);
|
||||
|
||||
adapter.addTab(title[0], "news", NewsFragment.class,
|
||||
getBundle(NewsList.CATALOG_ALL));
|
||||
adapter.addTab(title[1], "latest_blog", BlogFragment.class,
|
||||
getBundle(NewsList.CATALOG_WEEK));
|
||||
adapter.addTab(title[2], "question", QuestionFragment.class,
|
||||
getBundle(BlogList.CATALOG_LATEST));
|
||||
adapter.addTab(title[3], "activity", EventFragment.class,
|
||||
getBundle(BlogList.CATALOG_RECOMMEND));
|
||||
adapter.addTab(title[4],"latest_blog",BlogFragment.class, //尝试在末尾加入一个相同的博客模块
|
||||
getBundle(NewsList.CATALOG_WEEK));
|
||||
}
|
||||
|
||||
private Bundle getBundle(int newType) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(BaseListFragment.BUNDLE_KEY_CATALOG, newType);
|
||||
return bundle;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setScreenPageLimit() {
|
||||
mViewPager.setOffscreenPageLimit(3);
|
||||
}
|
||||
|
||||
/**
|
||||
* 基类会根据不同的catalog展示相应的数据
|
||||
*
|
||||
* @param catalog 要显示的数据类别
|
||||
* @return
|
||||
*/
|
||||
private Bundle getBundle(String catalog) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(BlogFragment.BUNDLE_BLOG_TYPE, catalog);
|
||||
return bundle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(View view) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselect() {
|
||||
Fragment fragment = mTabsAdapter.getItem(mViewPager.getCurrentItem());
|
||||
if (fragment != null && fragment instanceof BaseGeneralListFragment) {
|
||||
((BaseGeneralListFragment) fragment).onTabReselect();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources>
|
||||
|
||||
<string-array name="news_viewpage_arrays">
|
||||
<item>资讯</item>
|
||||
<item>热点</item>
|
||||
<item>博客</item>
|
||||
<item>推荐</item>
|
||||
</string-array>
|
||||
<string-array name="general_viewpage_arrays">
|
||||
<item>资讯</item>
|
||||
<item>博客</item>
|
||||
<item>问答</item>
|
||||
<item>活动</item>
|
||||
<item>博客</item> //尝试在首页末尾加入一个博客模块
|
||||
</string-array>
|
||||
|
||||
<string-array name="main_titles_arrays">
|
||||
<item>@string/main_tab_name_news</item>
|
||||
<item>@string/main_tab_name_tweet</item>
|
||||
<item>@string/main_tab_name_explore</item>
|
||||
<item>@string/main_tab_name_my</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="tweets_viewpage_arrays">
|
||||
<item>最新动弹</item>
|
||||
<item>热门动弹</item>
|
||||
<item>我的动弹</item>
|
||||
</string-array>
|
||||
<string-array name="quests_viewpage_arrays">
|
||||
<item>提问</item>
|
||||
<item>分享</item>
|
||||
<item>综合</item>
|
||||
<item>职业</item>
|
||||
<item>站务</item>
|
||||
</string-array>
|
||||
<string-array name="blogs_viewpage_arrays">
|
||||
<item>最新博客</item>
|
||||
<item>推荐阅读</item>
|
||||
</string-array>
|
||||
<string-array name="mymes_viewpage_arrays">
|
||||
<item>\@我</item>
|
||||
<item>评论</item>
|
||||
<item>私信</item>
|
||||
<item>粉丝</item>
|
||||
<item>赞过我</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="choose_picture">
|
||||
<item>相册</item>
|
||||
<item>相机</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="opensourcesoftware">
|
||||
<item>分类</item>
|
||||
<item>推荐</item>
|
||||
<item>最新</item>
|
||||
<item>热门</item>
|
||||
<item>国产</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="userfavorite">
|
||||
<item>软件</item>
|
||||
<item>话题</item>
|
||||
<item>代码</item>
|
||||
<item>博客</item>
|
||||
<item>资讯</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="search">
|
||||
<item>软件</item>
|
||||
<item>问答</item>
|
||||
<item>博客</item>
|
||||
<item>资讯</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="friends_viewpage_arrays">
|
||||
<item>关注</item>
|
||||
<item>粉丝</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="message_list_options">
|
||||
<item>复制</item>
|
||||
<item>删除</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="report_reason">
|
||||
<item>广告</item>
|
||||
<item>色情</item>
|
||||
<item>翻墙</item>
|
||||
<item>非IT话题</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="gender">
|
||||
<item>男</item>
|
||||
<item>女</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="events">
|
||||
<item>近期活动</item>
|
||||
<item>我的活动</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="avatar_option">
|
||||
<item>更换头像</item>
|
||||
<item>查看大头像</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="font_size">
|
||||
<item>特大号字</item>
|
||||
<item>大号字</item>
|
||||
<item>中号字</item>
|
||||
<item>小号字</item>
|
||||
</string-array>
|
||||
|
||||
<!--created by fei 20160524-->
|
||||
<array name="ques_item">
|
||||
<item>提问</item>
|
||||
<item>分享</item>
|
||||
<item>综合</item>
|
||||
<item>职业</item>
|
||||
<item>站务</item>
|
||||
</array>
|
||||
|
||||
<array name="blog_item">
|
||||
<item>最新推荐</item>
|
||||
<item>本周热门</item>
|
||||
<item>最新博客</item>
|
||||
</array>
|
||||
|
||||
</resources>
|
Loading…
Reference in New Issue