Support Forum
Android Taboola Classic Unit Implementation only loading single item
about 3 years ago by anu
Hi,
I am loading tblclassicunit in the following way and I am getting only one view
layout structure
<ObservableScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:overScrollMode="never">
<FrameLayout
android:id="@+id/scroll_view_child"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false">
and I am inflating a tblClassic in this container
code that I am using is,
private void buildBelowArticleWidget(TBLClassicUnit tblClassicUnit, final int position, final HashMap<Integer, Boolean> nativePositions) {
tblClassicUnit
.setTargetType("mix");
//optional
if (!TextUtils.isEmpty(mWidgetProperties.get(Constants.PAGE_URL_KEY))) {
tblClassicUnit.setPageId(mWidgetProperties.get(Constants.PAGE_URL_KEY));
}
//used for enable horizontal scroll
HashMap<String, String> extraProperties = new HashMap<>();
extraProperties.put("enableHorizontalScroll", "true");
extraProperties.put("useOnlineTemplate", "true");
extraProperties.put("darkMode", "true");
tblClassicUnit.getLayoutParams().height = TBLSdkDetailsHelper.getDisplayHeight(tblClassicUnit.getContext());
TBLClassicPage tblClassicPage= Taboola.getClassicPage(mWidgetProperties.get(Constants.PAGE_URL_KEY), "article");
tblClassicUnit.setAutoResizeHeight(true);
enableFeedContentScrolling(true);
tblClassicUnit.setUnitExtraProperties(extraProperties);
HashMap<String, String> extraProperties1 = new HashMap<>();
extraProperties1.put("setFetchPolicy", "1");
tblClassicPage.setPageExtraProperties(extraProperties1);
TBLClassicListener tblClassicListener;
tblClassicListener=new TBLClassicListener() {
@Override
public void onTaboolaWidgetOnTop() {
super.onTaboolaWidgetOnTop();
Log.e("taboola","onTaboolaWidgetOnTop");
// enableFeedContentScrolling(false);
}
@Override
public void onAdReceiveSuccess() {
Log.e("taboola","onAdReceiveSuccess");
mLoadTaboolaListener.onTaboolaAdLoaded();
super.onAdReceiveSuccess();
}
@Override
public void onAdReceiveFail(String error) {
Log.e("taboola","onAdReceiveSuccess");
mLoadTaboolaListener.onTaboolaAdFailed();
super.onAdReceiveFail(error);
}
@Override
public void onResize(int height) {
super.onResize(height);
}
@Override
public boolean onItemClick(String placementName, String itemId, String clickUrl, boolean isOrganic, String customData) {
//return super.onItemClick(placementName, itemId, clickUrl, isOrganic, customData);
if (isOrganic) {
//do something
return false;
}
return true;
}
};
tblClassicPage.addUnitToPage(tblClassicUnit,mWidgetProperties.get(Constants.PLACEMENT_KEY),mWidgetProperties.get(Constants.MODE_KEY),TBL_PLACEMENT_TYPE.FEED,tblClassicListener);
// tblClassicPage.addUnitToPage(tblClassicUnit,"Feed without video","thumbs-feed-01", TBL_PLACEMENT_TYPE.FEED,tblClassicListener);
fetchIfRequired();
}