diff --git a/.idea/other.xml b/.idea/other.xml
index 94c96f6..49481ad 100644
--- a/.idea/other.xml
+++ b/.idea/other.xml
@@ -25,6 +25,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -245,6 +256,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -301,17 +323,6 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sdkdemo/src/main/java/io/tenmax/sdkdemo/MainActivity.java b/sdkdemo/src/main/java/io/tenmax/sdkdemo/MainActivity.java
index f0186d0..69b232b 100644
--- a/sdkdemo/src/main/java/io/tenmax/sdkdemo/MainActivity.java
+++ b/sdkdemo/src/main/java/io/tenmax/sdkdemo/MainActivity.java
@@ -22,15 +22,5 @@ protected void onCreate(Bundle savedInstanceState) {
binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
-
- BottomNavigationView navView = findViewById(R.id.nav_view);
- // Passing each menu ID as a set of Ids because each
- // menu should be considered as top level destinations.
- AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
- R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications)
- .build();
- NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main);
- NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
- NavigationUI.setupWithNavController(binding.navView, navController);
}
-}
\ No newline at end of file
+}
diff --git a/sdkdemo/src/main/java/io/tenmax/sdkdemo/ui/home/HomeFragment.java b/sdkdemo/src/main/java/io/tenmax/sdkdemo/ui/home/HomeFragment.java
index ced9fdb..49ead0b 100644
--- a/sdkdemo/src/main/java/io/tenmax/sdkdemo/ui/home/HomeFragment.java
+++ b/sdkdemo/src/main/java/io/tenmax/sdkdemo/ui/home/HomeFragment.java
@@ -11,13 +11,17 @@
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.ViewModelProvider;
import io.tenmax.mobilesdk.TenMaxAd;
+import io.tenmax.sdkdemo.R;
import io.tenmax.sdkdemo.SupportedSpaces;
import io.tenmax.sdkdemo.databinding.FragmentHomeBinding;
import io.tenmax.sdkdemo.ui.SimpleAdSessionListener;
import io.tenmax.sdkdemo.ui.SimpleInitiationCallback;
+import io.tenmax.sdkdemo.ui.dashboard.DashboardFragment;
+import io.tenmax.sdkdemo.ui.notifications.NotificationsFragment;
public class HomeFragment extends Fragment {
@@ -30,18 +34,27 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
binding = FragmentHomeBinding.inflate(inflater, container, false);
View root = binding.getRoot();
- final TextView textView = binding.textHome;
- homeViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);
SimpleAdSessionListener listener = new SimpleAdSessionListener(this.getContext());
SimpleInitiationCallback callback = new SimpleInitiationCallback(this.getContext());
this.fullscreenAd = interstitialAd(SupportedSpaces.interstitialId, this.getActivity(), listener, callback);
+ this.binding.showInterstitialAd.setOnClickListener((view) -> {
+ this.fullscreenAd.show();
+ });
+
+ this.binding.showInlineAd.setOnClickListener((view) -> {
+ Fragment dashboard = new DashboardFragment();
+ this.pushFragment(dashboard);
+ });
+ this.binding.showBannerAd.setOnClickListener((view) -> {
+ Fragment notifications = new NotificationsFragment();
+ this.pushFragment(notifications);
+ });
return root;
}
@Override
public void onResume() {
super.onResume();
- this.fullscreenAd.show();
}
@Override
@@ -50,4 +63,13 @@ public void onDestroyView() {
binding = null;
cleanAd(this.fullscreenAd);
}
+
+ private void pushFragment(Fragment fragment) {
+ FragmentManager manager = getParentFragmentManager();
+ manager.beginTransaction()
+ .add(R.id.fragmentContainer, fragment)
+ .hide(this)
+ .addToBackStack("home")
+ .commit();
+ }
}
diff --git a/sdkdemo/src/main/res/layout/activity_main.xml b/sdkdemo/src/main/res/layout/activity_main.xml
index e05c2f1..bbd5f2b 100644
--- a/sdkdemo/src/main/res/layout/activity_main.xml
+++ b/sdkdemo/src/main/res/layout/activity_main.xml
@@ -1,29 +1,12 @@
-
-
-
\ No newline at end of file
+ android:layout_height="match_parent" />
+
diff --git a/sdkdemo/src/main/res/layout/fragment_home.xml b/sdkdemo/src/main/res/layout/fragment_home.xml
index f3d9b08..c309712 100644
--- a/sdkdemo/src/main/res/layout/fragment_home.xml
+++ b/sdkdemo/src/main/res/layout/fragment_home.xml
@@ -6,17 +6,34 @@
android:layout_height="match_parent"
tools:context=".ui.home.HomeFragment">
-
-
\ No newline at end of file
+ app:layout_constraintTop_toTopOf="parent"
+ android:text="Show Interstitial AD" />
+
+
+