use of android.support.v4.app.FragmentStatePagerAdapter in project making-apps-beautiful by ankurkotwal.
the class ArticleDetailActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_article_detail);
ViewPager pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int i) {
Bundle arguments = new Bundle();
arguments.putString(ArticleDetailFragment.ARG_ITEM_ID, DummyContent.ITEMS.get(i).id);
ArticleDetailFragment fragment = new ArticleDetailFragment();
fragment.setArguments(arguments);
return fragment;
}
@Override
public int getCount() {
return DummyContent.ITEMS.size();
}
});
pager.setPageMarginDrawable(getResources().getDrawable(R.drawable.list_divider_holo_light));
pager.setPageMargin((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
String startId = getIntent().getStringExtra(ArticleDetailFragment.ARG_ITEM_ID);
for (int i = 0; i < DummyContent.ITEMS.size(); i++) {
if (DummyContent.ITEMS.get(i).id.equals(startId)) {
pager.setCurrentItem(i);
return;
}
}
}
use of android.support.v4.app.FragmentStatePagerAdapter in project making-apps-beautiful by ankurkotwal.
the class ArticleDetailActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_article_detail);
ViewPager pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int i) {
Bundle arguments = new Bundle();
arguments.putString(ArticleDetailFragment.ARG_ITEM_ID, DummyContent.ITEMS.get(i).id);
ArticleDetailFragment fragment = new ArticleDetailFragment();
fragment.setArguments(arguments);
return fragment;
}
@Override
public int getCount() {
return DummyContent.ITEMS.size();
}
});
pager.setPageMarginDrawable(getResources().getDrawable(R.drawable.list_divider_holo_light));
pager.setPageMargin((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
String startId = getIntent().getStringExtra(ArticleDetailFragment.ARG_ITEM_ID);
for (int i = 0; i < DummyContent.ITEMS.size(); i++) {
if (DummyContent.ITEMS.get(i).id.equals(startId)) {
pager.setCurrentItem(i);
return;
}
}
}
use of android.support.v4.app.FragmentStatePagerAdapter in project making-apps-beautiful by ankurkotwal.
the class ArticleDetailActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_article_detail);
ViewPager pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int i) {
Bundle arguments = new Bundle();
arguments.putString(ArticleDetailFragment.ARG_ITEM_ID, DummyContent.ITEMS.get(i).id);
ArticleDetailFragment fragment = new ArticleDetailFragment();
fragment.setArguments(arguments);
return fragment;
}
@Override
public int getCount() {
return DummyContent.ITEMS.size();
}
});
pager.setPageMarginDrawable(getResources().getDrawable(R.drawable.list_divider_holo_light));
pager.setPageMargin((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
String startId = getIntent().getStringExtra(ArticleDetailFragment.ARG_ITEM_ID);
for (int i = 0; i < DummyContent.ITEMS.size(); i++) {
if (DummyContent.ITEMS.get(i).id.equals(startId)) {
pager.setCurrentItem(i);
return;
}
}
}
use of android.support.v4.app.FragmentStatePagerAdapter in project making-apps-beautiful by ankurkotwal.
the class ArticleDetailActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_article_detail);
ViewPager pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int i) {
Bundle arguments = new Bundle();
arguments.putString(ArticleDetailFragment.ARG_ITEM_ID, DummyContent.ITEMS.get(i).id);
ArticleDetailFragment fragment = new ArticleDetailFragment();
fragment.setArguments(arguments);
return fragment;
}
@Override
public int getCount() {
return DummyContent.ITEMS.size();
}
});
pager.setPageMarginDrawable(getResources().getDrawable(R.drawable.list_divider_holo_light));
pager.setPageMargin((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
String startId = getIntent().getStringExtra(ArticleDetailFragment.ARG_ITEM_ID);
for (int i = 0; i < DummyContent.ITEMS.size(); i++) {
if (DummyContent.ITEMS.get(i).id.equals(startId)) {
pager.setCurrentItem(i);
return;
}
}
}
use of android.support.v4.app.FragmentStatePagerAdapter in project making-apps-beautiful by ankurkotwal.
the class ArticleDetailActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_article_detail);
// Show the Up button in the action bar.
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
ViewPager pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int i) {
Bundle arguments = new Bundle();
arguments.putString(ArticleDetailFragment.ARG_ITEM_ID, DummyContent.ITEMS.get(i).id);
ArticleDetailFragment fragment = new ArticleDetailFragment();
fragment.setArguments(arguments);
return fragment;
}
@Override
public int getCount() {
return DummyContent.ITEMS.size();
}
});
pager.setPageMarginDrawable(getResources().getDrawable(R.drawable.list_divider_holo_light));
pager.setPageMargin((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
String startId = getIntent().getStringExtra(ArticleDetailFragment.ARG_ITEM_ID);
for (int i = 0; i < DummyContent.ITEMS.size(); i++) {
if (DummyContent.ITEMS.get(i).id.equals(startId)) {
pager.setCurrentItem(i);
return;
}
}
}
Aggregations