use of com.my.targetDemoApp.models.AdvertisingType in project mytarget-android by myTargetSDK.
the class FeedFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Bundle args = getArguments();
AdvertisingType advertisingType = args.getParcelable(ARG_KEY);
listView = (ListView) view.findViewById(R.id.list_view);
if (advertisingType != null) {
feedAdapter = new FeedAdapter(advertisingType, view.getContext());
listView.setAdapter(feedAdapter);
}
}
use of com.my.targetDemoApp.models.AdvertisingType in project mytarget-android by myTargetSDK.
the class MainActivity method onSaveType.
@Override
public void onSaveType(int adType, int slotId) {
Set<String> set = sharedPreferences.getStringSet(KEY_STRING_SET, new HashSet<String>());
set.add(adType + ":" + slotId);
sharedPreferences.edit().remove(KEY_STRING_SET).apply();
sharedPreferences.edit().putStringSet(KEY_STRING_SET, set).apply();
AdvertisingType newType = new AdvertisingType(adType, slotId);
typeList.add(newType);
adapter.notifyItemInserted(typeList.size() - 1);
}
use of com.my.targetDemoApp.models.AdvertisingType 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