diff --git a/README.md b/README.md index b613921..8b32036 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ private TaboolaWidget taboola; 4. In your `Activity` `OnCreate` or `Fragment` `OnCreateView`, assign the inflated `TaboolaWidget` defined in the XML to the `TaboolaWidget` declared in the previous step, and then fetch the display of recommendations ```java -taboola = (TaboolaWidget) rootView.findViewById(R.id.taboolaView); +taboola = (TaboolaWidget) rootView.findViewById(R.id.taboolaWidget); taboola.fetchContent(); ``` @@ -128,11 +128,11 @@ In order to intercept clicks, you should implement the interface `com.taboola.an `TaboolaEventListener` include the methods: ```java -public boolean taboolaViewItemClickHandler(String url, boolean isOrganic); -public void taboolaViewResizeHandler(TaboolaWidget widget, int height); +public boolean taboolaWidgetItemClickHandler(String url, boolean isOrganic); +public void taboolaWidgetResizeHandler(TaboolaWidget widget, int height); ``` -##### 1.5.1. taboolaViewItemClickHandler +##### 1.5.1. taboolaWidgetItemClickHandler This method will be called every time a user clicks on a recommendation, right before triggering the default behavior with `Intent.ACTION_VIEW`. The app can intercept the click there, and should return a `boolean` value. @@ -145,7 +145,7 @@ This method will be called every time a user clicks on a recommendation, right b ##### 1.5.1.1. Example: ```java @Override -public boolean taboolaViewItemClickHandler(String url, boolean isOrganic) { +public boolean taboolaWidgetItemClickHandler(String url, boolean isOrganic) { if (isOragnic){ showInAppContent(url); return false; @@ -153,77 +153,74 @@ public boolean taboolaViewItemClickHandler(String url, boolean isOrganic) { return true; } ``` -### 1.6. How to set TaboolaView height and scroll: +### 1.6. How to set taboolaWidget height and scroll: #### 1.6.1 For widget: * Choose between fixed or automatic height #### Automatic height resize -By default, TaboolaView automatically adjusts its own height in run time to show the entire widget. +By default, taboolaWidget automatically adjusts its own height in run time to show the entire widget. The SDK will automatically decide the height, so you don’t need to give it. ``` - taboolaView.setAutoResizeHeight(true); // This is the default, no need to add this code + taboolaWidget.setAutoResizeHeight(true); // This is the default, no need to add this code ``` ``` //Disable scroll inside the widget -taboolaView. setInterceptScroll(false); // This is the default, no need to add this code +taboolaWidget. setInterceptScroll(false); // This is the default, no need to add this code ``` #### Fixed height: - * Set the TaboolaView frame(The most important is the height) + * Set the taboolaWidget frame(The most important is the height) ``` - taboolaView.setAutoResizeHeight(false); + taboolaWidget.setAutoResizeHeight(false); ``` ``` //Enable scroll inside the widget -taboolaView. setInterceptScroll(true); +taboolaWidget. setInterceptScroll(true); ``` #### 1.6.2 For Feed: Our widget is a custom webview. The feed is endless and it has a scroll functionality.When implementing feed, the view has a fixed size, usually in the bottom of the screen. When the app is scrolled and the view is taking up all the screen, the app scroll should hand over the scroll to our view (inner scroll of the webview). ``` -// To enable scroll switch between the scrollView and taboolaView -taboolaView. setInterceptScroll(true); +// To enable scroll switch between the scrollView and taboolaWidget +taboolaWidget. setInterceptScroll(true); ``` #### Automatic height -By default, TaboolaView automatically adjusts its own height in run time to show the entire widget. +By default, taboolaWidget automatically adjusts its own height in run time to show the entire widget. -``` -//To get the automatic height -taboolaView.widgetHeight; -``` -In collectionView or tabolaView, set your cell height with ```taboolaView.widgetHeight;``` + +In recyclerView or tabolaView, set your cell height with ```taboolaWidget.widgetHeight;``` ``` -taboolaView.setAutoResizeHeight(true); // This is the default, no need to add this code +taboolaWidget.setAutoResizeHeight(true); // This is the default, no need to add this code ``` ``` //Disable scroll inside the widget -taboolaView. setScrollEnabled(false); //This is the default, no need to add this code +taboolaWidget. setScrollEnabled(false); //This is the default, no need to add this code ``` #### Fixed height: -* Set the TaboolaView frame (The most important is the height). +* Set the taboolaWidget frame (The most important is the height). * In CollectionView or tableView, set the cell height the same to tabolaView. ``` -taboolaView.setAutoResizeHeight(false); +taboolaWidget.setAutoResizeHeight(false); ``` ``` //Enable scroll inside the widget -taboolaView. setScrollEnabled(true); +taboolaWidget. setScrollEnabled(true); ``` ### 1.7. Handling Taboola widget resize `TaboolaWidget` may resize its height after loading recommendations, to make sure that the full content is displayed (based on the actual widget `mode` loaded). -After resize, `TaboolaWidget` will call `taboolaViewResizeHandler` method of the `TaboolaEventListener`, to allow the host app to adjust its layout to the changes. (This behavior may be disabled by setting the property `autoResizeHeight` to `false`.) +After resize, `TaboolaWidget` will call `taboolaWidgetResizeHandler` method of the `TaboolaEventListener`, to allow the host app to adjust its layout to the changes. (This behavior may be disabled by setting the property `autoResizeHeight` to `false`.) ### 1.8. Catching global notifications (broadcasts) from TaboolaWidget