use of android.support.v13.app.FragmentPagerAdapter in project FolderLayout by kyze8439690.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mFolderLayout = (FolderLayout) findViewById(R.id.folder_layout);
text1 = (TextView) findViewById(R.id.item1);
text2 = (TextView) findViewById(R.id.item2);
text3 = (TextView) findViewById(R.id.item3);
text4 = (TextView) findViewById(R.id.item4);
text1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mFolderLayout.toggleItem(3);
}
});
text2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mFolderLayout.toggleItem(2);
}
});
text3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mFolderLayout.toggleItem(1);
}
});
text4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mFolderLayout.toggleItem(0);
}
});
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int position) {
return new ListFragment();
}
@Override
public int getCount() {
return 3;
}
});
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, new String[] { "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item", "list item" });
mListView = (ListView) findViewById(R.id.list);
mListView.setAdapter(adapter);
mGridView = (GridView) findViewById(R.id.grid);
mGridView.setAdapter(adapter);
}
use of android.support.v13.app.FragmentPagerAdapter in project FishChatAndroid by oikomi.
the class ChatMainActivity method initView.
private void initView() {
mViewPager = (ViewPager) findViewById(R.id.id_viewpager);
mChatTextView = (TextView) findViewById(R.id.id_tv_chat);
mFriendTextView = (TextView) findViewById(R.id.id_tv_friend);
mContactTextView = (TextView) findViewById(R.id.id_tv_contact);
mMeTextView = (TextView) findViewById(R.id.id_tv_me);
mChatLinearLayout = (LinearLayout) findViewById(R.id.id_ll_chat);
mDatas = new ArrayList<Fragment>();
mDatas.add(tab01);
mDatas.add(tab02);
mDatas.add(tab03);
mDatas.add(tab04);
mAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public int getCount() {
return mDatas.size();
}
@Override
public Fragment getItem(int arg0) {
return mDatas.get(arg0);
}
};
mViewPager.setAdapter(mAdapter);
mViewPager.setOnPageChangeListener(new OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
resetTextView();
switch(position) {
case 0:
if (mBadgeView != null) {
mChatLinearLayout.removeView(mBadgeView);
}
mBadgeView = new BadgeView(ChatMainActivity.this);
mBadgeView.setBadgeCount(7);
mChatLinearLayout.addView(mBadgeView);
mChatTextView.setTextColor(Color.parseColor("#008000"));
break;
case 1:
mContactTextView.setTextColor(Color.parseColor("#008000"));
break;
case 2:
mFriendTextView.setTextColor(Color.parseColor("#008000"));
break;
case 3:
mMeTextView.setTextColor(Color.parseColor("#008000"));
break;
}
mCurrentPageIndex = position;
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPx) {
Log.e("TAG", position + " , " + positionOffset + " , " + positionOffsetPx);
LinearLayout.LayoutParams lp = (android.widget.LinearLayout.LayoutParams) mTabline.getLayoutParams();
if (// 0->1
mCurrentPageIndex == 0 && position == 0) {
lp.leftMargin = (int) (positionOffset * mScreen1_4 + mCurrentPageIndex * mScreen1_4);
} else if (// 1->0
mCurrentPageIndex == 1 && position == 0) {
lp.leftMargin = (int) (mCurrentPageIndex * mScreen1_4 + (positionOffset - 1) * mScreen1_4);
} else if (// 1->2
mCurrentPageIndex == 1 && position == 1) {
lp.leftMargin = (int) (mCurrentPageIndex * mScreen1_4 + positionOffset * mScreen1_4);
} else if (// 2->1
mCurrentPageIndex == 2 && position == 1) {
lp.leftMargin = (int) (mCurrentPageIndex * mScreen1_4 + (positionOffset - 1) * mScreen1_4);
} else if (// 2->3
mCurrentPageIndex == 2 && position == 2) {
lp.leftMargin = (int) (mCurrentPageIndex * mScreen1_4 + (positionOffset) * mScreen1_4);
} else if (// 3->2
mCurrentPageIndex == 3 && position == 1) {
lp.leftMargin = (int) (mCurrentPageIndex * mScreen1_4 + (positionOffset - 1) * mScreen1_4);
}
mTabline.setLayoutParams(lp);
}
@Override
public void onPageScrollStateChanged(int arg0) {
}
});
}
use of android.support.v13.app.FragmentPagerAdapter in project StickerCamera by Skykai521.
the class AlbumActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_album);
ButterKnife.inject(this);
albums = ImageUtils.findGalleries(this, paths, 0);
//ViewPagerçš„adapter
FragmentPagerAdapter adapter = new TabPageIndicatorAdapter(getSupportFragmentManager());
pager.setAdapter(adapter);
tab.setViewPager(pager);
}
use of android.support.v13.app.FragmentPagerAdapter in project RxJavaSamples by rengwuxian.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
setSupportActionBar(toolBar);
viewPager.setAdapter(new FragmentPagerAdapter(getFragmentManager()) {
@Override
public int getCount() {
return 6;
}
@Override
public Fragment getItem(int position) {
switch(position) {
case 0:
return new ElementaryFragment();
case 1:
return new MapFragment();
case 2:
return new ZipFragment();
case 3:
return new TokenFragment();
case 4:
return new TokenAdvancedFragment();
case 5:
return new CacheFragment();
default:
return new ElementaryFragment();
}
}
@Override
public CharSequence getPageTitle(int position) {
switch(position) {
case 0:
return getString(R.string.title_elementary);
case 1:
return getString(R.string.title_map);
case 2:
return getString(R.string.title_zip);
case 3:
return getString(R.string.title_token);
case 4:
return getString(R.string.title_token_advanced);
case 5:
return getString(R.string.title_cache);
default:
return getString(R.string.title_elementary);
}
}
});
tabLayout.setupWithViewPager(viewPager);
}
use of android.support.v13.app.FragmentPagerAdapter in project ViewPagerIndicator by JakeWharton.
the class SampleTabsStyled method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_tabs);
FragmentPagerAdapter adapter = new GoogleMusicAdapter(getSupportFragmentManager());
ViewPager pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(adapter);
TabPageIndicator indicator = (TabPageIndicator) findViewById(R.id.indicator);
indicator.setViewPager(pager);
}
Aggregations