use of android.support.design.widget.TabLayout.Tab in project mytarget-android by myTargetSDK.
the class NativeAdFragment method initAds.
private void initAds() {
switch(fragmentType) {
case R.id.action_native_static:
default:
int slot = slotId == 0 ? DefaultSlots.CONTENT_STREAM : slotId;
AdvertisingType contentStream = new AdvertisingType(AdTypes.AD_TYPE_NATIVE, slot);
contentStream.setName(getResources().getString(R.string.content_stream));
contentStream.setType(FeedAdapter.Type.CONTENT_STREAM);
AdvertisingType newsFeed = new AdvertisingType(AdTypes.AD_TYPE_NATIVE, slot);
newsFeed.setName(getResources().getString(R.string.news_feed));
newsFeed.setType(FeedAdapter.Type.NEWS_FEED);
AdvertisingType chatList = new AdvertisingType(AdTypes.AD_TYPE_NATIVE, slot);
chatList.setName(getResources().getString(R.string.chat_list));
chatList.setType(FeedAdapter.Type.CHAT_LIST);
AdvertisingType contentWall = new AdvertisingType(AdTypes.AD_TYPE_NATIVE, slot);
contentWall.setName(getResources().getString(R.string.content_wall));
contentWall.setType(FeedAdapter.Type.CONTENT_WALL);
typeList.add(contentStream);
typeList.add(newsFeed);
typeList.add(chatList);
typeList.add(contentWall);
break;
case R.id.action_native_video:
slot = slotId == 0 ? DefaultSlots.NATIVE_VIDEO : slotId;
AdvertisingType contentStreamVideo = new AdvertisingType(AdTypes.AD_TYPE_NATIVE, slot);
contentStreamVideo.setName(getResources().getString(R.string.content_stream_video));
contentStreamVideo.setType(FeedAdapter.Type.CONTENT_STREAM_VIDEO);
typeList.add(contentStreamVideo);
break;
case R.id.action_native_slider:
slot = slotId == 0 ? DefaultSlots.NATIVE_SLIDER : slotId;
AdvertisingType nativeSlider = new AdvertisingType(AdTypes.AD_TYPE_NATIVE, slot);
nativeSlider.setName(getResources().getString(R.string.native_slider));
nativeSlider.setType(FeedAdapter.Type.NATIVE_SLIDER);
typeList.add(nativeSlider);
break;
}
pagerAdapter = new PagerAdapter(getChildFragmentManager(), typeList);
viewPager.setAdapter(pagerAdapter);
tabLayout.setupWithViewPager(viewPager);
final int tabCount = tabLayout.getTabCount();
for (int i = 0; i < tabCount; i++) {
final Tab tabAt = tabLayout.getTabAt(i);
if (tabAt != null) {
tabAt.setContentDescription(fragmentType + "_tab_" + i);
}
}
}
Aggregations