-
Notifications
You must be signed in to change notification settings - Fork 0
MOB-5807 Added Interstitial screen #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sanjacurcic-taboola
merged 7 commits into
main
from
feature/MOB-5807-interstitial-screen
Feb 20, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9969e05
MOB-5807 Added Interstitial screen in Java project
sanjacurcic-taboola 9cf3aea
MOB-5807 Added Interstitial screen in Kotlin project
sanjacurcic-taboola bf268c2
MOB-5807 Added javadoc for Interstitial frgments
sanjacurcic-taboola d1a71be
MOB-5807 Added Interstitial Compose screen and fixed PR issues
sanjacurcic-taboola 95a4382
MOB-5807 Updated sdk version
sanjacurcic-taboola 3213097
MOB-5807 Updated SDK version
sanjacurcic-taboola 5deb2fd
MOB-5807 Removed launched effect
sanjacurcic-taboola File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
Java/app/src/main/java/com/taboola/sdk4example/sdk_classic/InterstitialFragment.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| package com.taboola.sdk4example.sdk_classic; | ||
|
|
||
| import android.os.Bundle; | ||
| import android.util.Log; | ||
| import android.view.LayoutInflater; | ||
| import android.view.View; | ||
| import android.view.ViewGroup; | ||
| import android.widget.Button; | ||
| import android.widget.LinearLayout; | ||
| import android.widget.Toast; | ||
|
|
||
| import androidx.annotation.NonNull; | ||
| import androidx.annotation.Nullable; | ||
| import androidx.fragment.app.Fragment; | ||
|
|
||
| import com.taboola.android.TBLClassicPage; | ||
| import com.taboola.android.Taboola; | ||
| import com.taboola.android.listeners.TBLClassicInterstitialListener; | ||
| import com.taboola.sdk4example.Const; | ||
| import com.taboola.sdk4example.R; | ||
|
|
||
| /** | ||
| * Shows a Taboola Classic interstitial flow. | ||
| * <p> | ||
| * This fragment initializes a Classic page and demonstrates how to load and present | ||
| * a full-screen interstitial using the Taboola SDK. | ||
| * <p> | ||
| * Interstitial implementation overview: | ||
| * <ul> | ||
| * <li>Creates a {@link TBLClassicPage} with the page URL/type from {@link Const}.</li> | ||
| * <li>Initializes the interstitial placement with placement name, mode, and custom segment.</li> | ||
| * <li>Loads the ad immediately; the loading UI is visible until {@code onInterstitialLoaded}.</li> | ||
| * <li>Enables the "show" button only after a successful load to avoid empty presentation.</li> | ||
| * <li>Presents the interstitial on user action and reacts to lifecycle callbacks | ||
| * (presented/dismissed/clicked) for UI updates and logging.</li> | ||
| * <li>If loading fails, the loading UI is hidden and the error is surfaced to the user.</li> | ||
| * </ul> | ||
| */ | ||
| public class InterstitialFragment extends Fragment { | ||
|
|
||
| private static final String TAG = InterstitialFragment.class.getSimpleName(); | ||
| private TBLClassicPage tblClassicPage; | ||
|
|
||
| @Nullable | ||
| @Override | ||
| public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
| return inflater.inflate(R.layout.fragment_interstitial, container, false); | ||
| } | ||
|
|
||
| /** | ||
| * Initializes the Taboola Classic page, sets up callbacks, and loads the interstitial. | ||
| */ | ||
| @Override | ||
| public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | ||
| super.onViewCreated(view, savedInstanceState); | ||
|
|
||
| LinearLayout interstitialLoadingContainer = view.findViewById(R.id.interstitial_loading_container); | ||
| Button showInterstitialButton = view.findViewById(R.id.show_interstitial_btn); | ||
|
|
||
| tblClassicPage = Taboola.getClassicPage(Const.PAGE_URL, Const.PAGE_TYPE); | ||
| TBLClassicInterstitialListener tblClassicInterstitialListener = new TBLClassicInterstitialListener() { | ||
| @Override | ||
| public void onInterstitialLoaded() { | ||
| super.onInterstitialLoaded(); | ||
| interstitialLoadingContainer.setVisibility(View.GONE); | ||
| showInterstitialButton.setVisibility(View.VISIBLE); | ||
| Log.d(TAG, "The Interstitial is loaded successfully."); | ||
| } | ||
|
|
||
| @Override | ||
| public void onInterstitialWillPresent() { | ||
| super.onInterstitialWillPresent(); | ||
| Log.d(TAG, "The Interstitial will be presented."); | ||
| } | ||
|
|
||
| @Override | ||
| public void onInterstitialPresented() { | ||
| super.onInterstitialPresented(); | ||
| showInterstitialButton.setVisibility(View.GONE); | ||
| Log.d(TAG, "The Interstitial is presented."); | ||
| } | ||
|
|
||
| @Override | ||
| public void onInterstitialWillDismiss() { | ||
| super.onInterstitialWillDismiss(); | ||
| Log.d(TAG, "The Interstitial will be dismissed."); | ||
| } | ||
|
|
||
| @Override | ||
| public void onInterstitialDismissed() { | ||
| super.onInterstitialDismissed(); | ||
| Log.d(TAG, "The Interstitial is dismissed."); | ||
| } | ||
|
|
||
| @Override | ||
| public void onInterstitialClicked() { | ||
| super.onInterstitialClicked(); | ||
| Log.d(TAG, "The Interstitial is clicked."); | ||
| } | ||
|
|
||
| @Override | ||
| public void interstitialDidFailToLoadAdWithError(String error) { | ||
| super.interstitialDidFailToLoadAdWithError(error); | ||
| interstitialLoadingContainer.setVisibility(View.GONE); | ||
| Toast.makeText(requireContext(), error, Toast.LENGTH_SHORT).show(); | ||
| Log.d(TAG, error); | ||
| } | ||
| }; | ||
|
|
||
| tblClassicPage.initInterstitial( | ||
| Const.INTERSTITIAL_PLACEMENT_NAME, | ||
| Const.INTERSTITIAL_MODE, | ||
| Const.INTERSTITIAL_CUSTOM_SEGMENT_DEFAULT, | ||
| tblClassicInterstitialListener | ||
| ); | ||
|
|
||
| tblClassicPage.loadInterstitial(); | ||
|
|
||
| showInterstitialButton.setOnClickListener(v -> { | ||
| tblClassicPage.showInterstitial(); | ||
| }); | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent"> | ||
|
|
||
| <LinearLayout | ||
| android:id="@+id/main_lyt" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:orientation="vertical"> | ||
|
|
||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_margin="10dp" | ||
| android:layout_marginBottom="10dp" | ||
| android:text="@string/fake_text" /> | ||
|
|
||
| <LinearLayout | ||
| android:id="@+id/interstitial_loading_container" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:layout_margin="10dp" | ||
| android:gravity="center_vertical" | ||
| android:orientation="horizontal"> | ||
|
|
||
| <ProgressBar | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginEnd="10dp" /> | ||
|
|
||
| <TextView | ||
| android:id="@+id/loading_text" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="@string/interstitial_loading" /> | ||
|
|
||
| </LinearLayout> | ||
|
|
||
| <Button | ||
| android:id="@+id/show_interstitial_btn" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:layout_margin="10dp" | ||
| android:text="@string/interstitial_show" | ||
| android:visibility="gone" /> | ||
|
|
||
| </LinearLayout> | ||
|
|
||
| </ScrollView> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.