use of com.mixiaoxiao.ninegag.fragment.GagFragmentFresh in project 9GAG by Mixiaoxiao.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MxxSystemBarTintUtil.setSystemBarTintColor(this);
SpannableString spannableString = new SpannableString("9GAG");
String font = "LockScreen_Clock.ttf";
spannableString.setSpan(new TypefaceSpan(font, Typeface.createFromAsset(getAssets(), font)), 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
getActionBar().setTitle(spannableString);
getActionBar().setDisplayShowHomeEnabled(false);
setContentView(R.layout.activity_main);
mViewPager = (ViewPager) findViewById(R.id.main_viewpager);
// scaleImageView = (MxxScaleImageView) findViewById(R.id.main_mxxScaleImageView1);
mViewPager.setOffscreenPageLimit(3);
mTabStrip = (MxxPagerSlidingTabStrip) findViewById(R.id.main_tab);
ArrayList<Fragment> fragments = new ArrayList<Fragment>();
fragments.add(new GagFragmentHot());
fragments.add(new GagFragmentTrending());
fragments.add(new GagFragmentFresh());
mViewPager.setAdapter(new GagAdapter2(getSupportFragmentManager(), fragments, new String[] { "hot", "trending", "fresh" }));
mTabStrip.setViewPager(mViewPager);
initTint();
mTabStrip.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageSelected(int arg0) {
// TODO Auto-generated method stub
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
// TODO Auto-generated method stub
if (((ViewGroup) tabLayout).getChildAt(0).getTranslationY() != 0) {
((ViewGroup) tabLayout).getChildAt(0).setTranslationY(0);
}
}
@Override
public void onPageScrollStateChanged(int arg0) {
// TODO Auto-generated method stub
}
});
mImageFragment = (ImageFragment) getSupportFragmentManager().findFragmentById(R.id.main_image_fragment);
mTabStrip.post(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
getSupportFragmentManager().beginTransaction().hide(mImageFragment).commit();
}
});
}
Aggregations