diff --git a/java/advanced/APIDemo/app/src/main/java/com/google/android/gms/example/apidemo/AdManagerCustomControlsFragment.java b/java/advanced/APIDemo/app/src/main/java/com/google/android/gms/example/apidemo/AdManagerCustomControlsFragment.java
index 04dcbe656..5e546b1dd 100644
--- a/java/advanced/APIDemo/app/src/main/java/com/google/android/gms/example/apidemo/AdManagerCustomControlsFragment.java
+++ b/java/advanced/APIDemo/app/src/main/java/com/google/android/gms/example/apidemo/AdManagerCustomControlsFragment.java
@@ -56,16 +56,14 @@ public class AdManagerCustomControlsFragment extends Fragment {
private CheckBox customControlsCheckbox;
private CheckBox nativeAdsCheckbox;
private CheckBox customFormatAdsCheckbox;
- private CustomControlsView customControlsView;
private NativeAd nativeAd;
private NativeCustomFormatAd nativeCustomFormatAd;
- public AdManagerCustomControlsFragment() {
- }
+ public AdManagerCustomControlsFragment() {}
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
+ public View onCreateView(
+ LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_gam_customcontrols, container, false);
}
@@ -77,7 +75,6 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
customControlsCheckbox = view.findViewById(R.id.cb_custom_controls);
nativeAdsCheckbox = view.findViewById(R.id.cb_native);
customFormatAdsCheckbox = view.findViewById(R.id.cb_custom_format);
- customControlsView = view.findViewById(R.id.custom_controls);
refresh.setOnClickListener(unusedView -> refreshAd());
@@ -111,6 +108,7 @@ private void populateNativeAdView(NativeAd nativeAd, NativeAdView adView) {
adView.setPriceView(adView.findViewById(R.id.ad_price));
adView.setStarRatingView(adView.findViewById(R.id.ad_stars));
adView.setStoreView(adView.findViewById(R.id.ad_store));
+ adView.setMediaView(adView.findViewById(R.id.ad_media));
// Some assets are guaranteed to be in every NativeAd.
((TextView) adView.getHeadlineView()).setText(nativeAd.getHeadline());
@@ -137,20 +135,20 @@ private void populateNativeAdView(NativeAd nativeAd, NativeAdView adView) {
if (nativeAd.getStarRating() == null) {
adView.getStarRatingView().setVisibility(View.INVISIBLE);
} else {
- ((RatingBar) adView.getStarRatingView())
- .setRating(nativeAd.getStarRating().floatValue());
+ ((RatingBar) adView.getStarRatingView()).setRating(nativeAd.getStarRating().floatValue());
adView.getStarRatingView().setVisibility(View.VISIBLE);
}
- // Assign native ad object to the native view.
- adView.setNativeAd(nativeAd);
-
- // Set up the custom video controls functionality.
+ // Set up the custom video controls.
MediaContent mediaContent = nativeAd.getMediaContent();
if (mediaContent != null) {
- customControlsView.setMediaContent(mediaContent);
+ CustomControlsView customControls = adView.findViewById(R.id.custom_video_controls);
+ customControls.initalize(mediaContent, startVideoAdsMuted.isChecked());
}
+ // Assign native ad object to the native view.
+ adView.setNativeAd(nativeAd);
+
refresh.setEnabled(true);
}
@@ -161,8 +159,8 @@ private void populateNativeAdView(NativeAd nativeAd, NativeAdView adView) {
* @param nativeCustomFormatAd the object containing the ad's assets
* @param adView the view to be populated
*/
- private void populateSimpleTemplateAdView(final NativeCustomFormatAd nativeCustomFormatAd,
- View adView) {
+ private void populateSimpleTemplateAdView(
+ final NativeCustomFormatAd nativeCustomFormatAd, View adView) {
TextView headline = adView.findViewById(R.id.simplecustom_headline);
TextView caption = adView.findViewById(R.id.simplecustom_caption);
@@ -175,11 +173,15 @@ private void populateSimpleTemplateAdView(final NativeCustomFormatAd nativeCusto
// Apps can check the MediaContent's hasVideoContent property to determine if the
// NativeCustomTemplateAd has a video asset.
- if (nativeCustomFormatAd.getMediaContent() != null
- && nativeCustomFormatAd.getMediaContent().hasVideoContent()) {
+ MediaContent mediaContent = nativeCustomFormatAd.getMediaContent();
+ if (mediaContent != null && mediaContent.hasVideoContent()) {
MediaView mediaView = new MediaView(requireActivity());
- mediaView.setMediaContent(nativeCustomFormatAd.getMediaContent());
+ mediaView.setMediaContent(mediaContent);
mediaPlaceholder.addView(mediaView);
+ CustomControlsView customControls = new CustomControlsView(getContext());
+ customControls.initalize(mediaContent, startVideoAdsMuted.isChecked());
+ ViewGroup videoControlHolder = adView.findViewById(R.id.simplecustom_video_control_holder);
+ videoControlHolder.addView(customControls);
} else {
ImageView mainImage = new ImageView(getActivity());
mainImage.setAdjustViewBounds(true);
@@ -188,12 +190,10 @@ private void populateSimpleTemplateAdView(final NativeCustomFormatAd nativeCusto
mainImage.setOnClickListener(unusedView -> nativeCustomFormatAd.performClick("MainImage"));
mediaPlaceholder.addView(mainImage);
}
- customControlsView.setMediaContent(nativeCustomFormatAd.getMediaContent());
refresh.setEnabled(true);
}
-
/**
* Creates a request for a new native ad based on the boolean parameters and calls the
* corresponding "populate" method when one is successfully returned.
@@ -202,8 +202,9 @@ private void refreshAd() {
refresh.setEnabled(false);
Resources resources = getActivity().getResources();
- AdLoader.Builder builder = new AdLoader.Builder(getActivity(),
- resources.getString(R.string.customcontrols_fragment_ad_unit_id));
+ AdLoader.Builder builder =
+ new AdLoader.Builder(
+ getActivity(), resources.getString(R.string.customcontrols_fragment_ad_unit_id));
if (customFormatAdsCheckbox.isChecked()) {
builder.forCustomFormatAd(
@@ -264,14 +265,13 @@ public void onNativeAdLoaded(NativeAd ad) {
});
}
- VideoOptions videoOptions = new VideoOptions.Builder()
- .setStartMuted(startVideoAdsMuted.isChecked())
- .setCustomControlsRequested(customControlsCheckbox.isChecked())
- .build();
+ VideoOptions videoOptions =
+ new VideoOptions.Builder()
+ .setStartMuted(startVideoAdsMuted.isChecked())
+ .setCustomControlsRequested(customControlsCheckbox.isChecked())
+ .build();
- NativeAdOptions adOptions = new NativeAdOptions.Builder()
- .setVideoOptions(videoOptions)
- .build();
+ NativeAdOptions adOptions = new NativeAdOptions.Builder().setVideoOptions(videoOptions).build();
builder.withNativeAdOptions(adOptions);
@@ -296,7 +296,5 @@ public void onAdFailedToLoad(LoadAdError loadAdError) {
})
.build();
adLoader.loadAd(new AdManagerAdRequest.Builder().build());
-
- customControlsView.reset();
}
}
diff --git a/java/advanced/APIDemo/app/src/main/java/com/google/android/gms/example/apidemo/CustomControlsView.java b/java/advanced/APIDemo/app/src/main/java/com/google/android/gms/example/apidemo/CustomControlsView.java
index 22410ca0c..b702f157b 100644
--- a/java/advanced/APIDemo/app/src/main/java/com/google/android/gms/example/apidemo/CustomControlsView.java
+++ b/java/advanced/APIDemo/app/src/main/java/com/google/android/gms/example/apidemo/CustomControlsView.java
@@ -2,12 +2,13 @@
import android.annotation.SuppressLint;
import android.content.Context;
+import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
-import android.widget.Button;
+import android.widget.ImageButton;
import android.widget.LinearLayout;
-import android.widget.TextView;
+import androidx.core.content.ContextCompat;
import com.google.android.gms.ads.MediaContent;
import com.google.android.gms.ads.VideoController;
@@ -17,10 +18,9 @@
*/
public class CustomControlsView extends LinearLayout {
- private Button playButton;
- private Button muteButton;
+ private ImageButton playButton;
+ private ImageButton muteButton;
private View controlsView;
- private TextView videoStatusText;
private boolean isVideoPlaying;
public CustomControlsView(Context context) {
@@ -43,42 +43,40 @@ private void init(Context context, AttributeSet unusedAttrs, int unusedDefStyle)
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.custom_video_controls, this, true);
- videoStatusText = findViewById(R.id.tv_video_status);
playButton = findViewById(R.id.btn_play);
muteButton = findViewById(R.id.btn_mute);
controlsView = findViewById(R.id.video_controls);
controlsView.setVisibility(View.GONE);
}
- /*
- * Reset the custom controls view.
- */
- public void reset() {
- controlsView.setVisibility(View.GONE);
- videoStatusText.setText("");
- }
-
/*
* Sets up the custom controls view with the provided VideoController.
*/
@SuppressLint("SetTextI18n")
- public void setMediaContent(MediaContent mediaContent) {
+ public void initalize(MediaContent mediaContent, final boolean muted) {
controlsView.setVisibility(View.GONE);
if (mediaContent.hasVideoContent()) {
- videoStatusText.setText("Video status: Ad contains a video asset.");
configureVideoContent(mediaContent.getVideoController());
- } else {
- videoStatusText.setText("Video status: Ad does not contain a video asset.");
}
+ setMuteImage(muted);
}
private boolean isVideoPlaying() {
return isVideoPlaying;
}
+ private void setMuteImage(final boolean muted) {
+ Drawable img;
+ if (muted) {
+ img = ContextCompat.getDrawable(getContext(), R.drawable.video_mute);
+ } else {
+ img = ContextCompat.getDrawable(getContext(), R.drawable.video_unmute);
+ }
+ muteButton.setImageDrawable(img);
+ }
+
private void configureVideoContent(final VideoController videoController) {
if (videoController.isCustomControlsEnabled()) {
- muteButton.setText(videoController.isMuted() ? "Unmute" : "Mute");
controlsView.setVisibility(View.VISIBLE);
muteButton.setOnClickListener(new View.OnClickListener() {
@@ -109,17 +107,15 @@ public void onClick(View unusedView) {
@SuppressLint("SetTextI18n")
@Override
public void onVideoMute(final boolean muted) {
- videoStatusText.setText(
- ("Video status: " + (muted ? "Video did mute" : "Video did un-mute")));
- muteButton.setText(muted ? "Unmute" : "Mute");
+ setMuteImage(muted);
super.onVideoMute(muted);
}
@SuppressLint("SetTextI18n")
@Override
public void onVideoPause() {
- videoStatusText.setText("Video status: Video did pause.");
- playButton.setText("Play");
+ Drawable img = ContextCompat.getDrawable(getContext(), R.drawable.video_play);
+ playButton.setImageDrawable(img);
isVideoPlaying = false;
super.onVideoPause();
}
@@ -127,17 +123,18 @@ public void onVideoPause() {
@SuppressLint("SetTextI18n")
@Override
public void onVideoPlay() {
- videoStatusText.setText("Video status: Video did play.");
- playButton.setText("Pause");
+ Drawable img = ContextCompat.getDrawable(getContext(), R.drawable.video_pause);
+ playButton.setImageDrawable(img);
isVideoPlaying = true;
+ setMuteImage(videoController.isMuted());
super.onVideoPlay();
}
@SuppressLint("SetTextI18n")
@Override
public void onVideoStart() {
- videoStatusText.setText("Video status: Video did start.");
- playButton.setText("Pause");
+ Drawable img = ContextCompat.getDrawable(getContext(), R.drawable.video_pause);
+ playButton.setImageDrawable(img);
isVideoPlaying = true;
super.onVideoStart();
}
@@ -145,8 +142,8 @@ public void onVideoStart() {
@SuppressLint("SetTextI18n")
@Override
public void onVideoEnd() {
- videoStatusText.setText("Video status: Video playback has ended.");
- playButton.setText("Play");
+ Drawable img = ContextCompat.getDrawable(getContext(), R.drawable.video_play);
+ playButton.setImageDrawable(img);
isVideoPlaying = false;
super.onVideoEnd();
}
diff --git a/java/advanced/APIDemo/app/src/main/res/drawable/video_mute.png b/java/advanced/APIDemo/app/src/main/res/drawable/video_mute.png
new file mode 100644
index 000000000..53726693f
Binary files /dev/null and b/java/advanced/APIDemo/app/src/main/res/drawable/video_mute.png differ
diff --git a/java/advanced/APIDemo/app/src/main/res/drawable/video_pause.png b/java/advanced/APIDemo/app/src/main/res/drawable/video_pause.png
new file mode 100644
index 000000000..c19e51ab4
Binary files /dev/null and b/java/advanced/APIDemo/app/src/main/res/drawable/video_pause.png differ
diff --git a/java/advanced/APIDemo/app/src/main/res/drawable/video_play.png b/java/advanced/APIDemo/app/src/main/res/drawable/video_play.png
new file mode 100644
index 000000000..51ef616d1
Binary files /dev/null and b/java/advanced/APIDemo/app/src/main/res/drawable/video_play.png differ
diff --git a/java/advanced/APIDemo/app/src/main/res/drawable/video_unmute.png b/java/advanced/APIDemo/app/src/main/res/drawable/video_unmute.png
new file mode 100644
index 000000000..e4fc961be
Binary files /dev/null and b/java/advanced/APIDemo/app/src/main/res/drawable/video_unmute.png differ
diff --git a/java/advanced/APIDemo/app/src/main/res/layout/ad_simple_custom_template.xml b/java/advanced/APIDemo/app/src/main/res/layout/ad_simple_custom_template.xml
index bcaaf1bc1..e61fb002c 100644
--- a/java/advanced/APIDemo/app/src/main/res/layout/ad_simple_custom_template.xml
+++ b/java/advanced/APIDemo/app/src/main/res/layout/ad_simple_custom_template.xml
@@ -32,4 +32,8 @@
android:textColor="#888888"
android:textStyle="italic" />
+
diff --git a/java/advanced/APIDemo/app/src/main/res/layout/custom_video_controls.xml b/java/advanced/APIDemo/app/src/main/res/layout/custom_video_controls.xml
index 27d0a6393..f78b21f77 100644
--- a/java/advanced/APIDemo/app/src/main/res/layout/custom_video_controls.xml
+++ b/java/advanced/APIDemo/app/src/main/res/layout/custom_video_controls.xml
@@ -1,38 +1,26 @@
-
-
diff --git a/java/advanced/APIDemo/app/src/main/res/layout/fragment_gam_customcontrols.xml b/java/advanced/APIDemo/app/src/main/res/layout/fragment_gam_customcontrols.xml
index 8eeca8a7f..4d8303713 100644
--- a/java/advanced/APIDemo/app/src/main/res/layout/fragment_gam_customcontrols.xml
+++ b/java/advanced/APIDemo/app/src/main/res/layout/fragment_gam_customcontrols.xml
@@ -2,7 +2,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context="com.google.android.gms.example.apidemo.AdManagerCustomControlsFragment">
+ tools:context=".AdManagerCustomControlsFragment">
-
-
-
-
-
-
+
+
+
+
+
(R.id.simplecustom_headline)
- val caption = adView.findViewById(R.id.simplecustom_caption)
+ val headline = adView.findViewById(R.id.headline)
+ val caption = adView.findViewById(R.id.caption)
+ val customControls = adView.findViewById(R.id.custom_video_controls)
+ val mediaView = adView.findViewById(R.id.ad_media)
+ val imageView = adView.findViewById(R.id.ad_image)
headline.text = nativeCustomFormatAd.getText("Headline")
caption.text = nativeCustomFormatAd.getText("Caption")
-
headline.setOnClickListener { nativeCustomFormatAd.performClick("Headline") }
- val mediaPlaceholder = adView.findViewById(R.id.simplecustom_media_placeholder)
-
// Get the media content for the ad.
val mediaContent = nativeCustomFormatAd.mediaContent
// Apps can check the MediaContent's hasVideoContent property to
// determine if the NativeCustomFormatAd has a video asset.
if (mediaContent != null && mediaContent.hasVideoContent()) {
- val mediaView = MediaView(mediaPlaceholder.getContext())
+ customControls.visibility = View.VISIBLE
+ mediaView.visibility = View.VISIBLE
+ imageView.visibility = View.GONE
mediaView.mediaContent = mediaContent
+ customControls.initialize(mediaContent, fragmentBinding.cbStartMuted.isChecked)
} else {
- val mainImage = ImageView(activity)
- mainImage.adjustViewBounds = true
- mainImage.setImageDrawable(nativeCustomFormatAd.getImage("MainImage")?.drawable)
-
- mainImage.setOnClickListener { nativeCustomFormatAd.performClick("MainImage") }
- mediaPlaceholder.addView(mainImage)
+ customControls.visibility = View.GONE
+ mediaView.visibility = View.GONE
+ imageView.visibility = View.VISIBLE
+ imageView.setImageDrawable(nativeCustomFormatAd.getImage("MainImage")?.drawable)
+ imageView.setOnClickListener { nativeCustomFormatAd.performClick("MainImage") }
}
- mediaContent?.let { fragmentBinding.customControls.setMediaContent(it) }
fragmentBinding.btnRefresh.isEnabled = true
}
@@ -257,7 +261,5 @@ class AdManagerCustomControlsFragment : Fragment() {
.build()
adLoader.loadAd(AdManagerAdRequest.Builder().build())
-
- fragmentBinding.customControls.reset()
}
}
diff --git a/kotlin/advanced/APIDemo/app/src/main/java/com/google/android/gms/example/apidemo/CustomControlsView.kt b/kotlin/advanced/APIDemo/app/src/main/java/com/google/android/gms/example/apidemo/CustomControlsView.kt
index 7ccb88f91..7bfe83720 100644
--- a/kotlin/advanced/APIDemo/app/src/main/java/com/google/android/gms/example/apidemo/CustomControlsView.kt
+++ b/kotlin/advanced/APIDemo/app/src/main/java/com/google/android/gms/example/apidemo/CustomControlsView.kt
@@ -4,9 +4,8 @@ import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
-import android.widget.Button
+import android.widget.ImageButton
import android.widget.LinearLayout
-import android.widget.TextView
import com.google.android.gms.ads.MediaContent
import com.google.android.gms.ads.VideoController
@@ -18,10 +17,9 @@ class CustomControlsView
@JvmOverloads
constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) :
LinearLayout(context, attrs, defStyle) {
- private val playButton: Button
- private val muteButton: Button
+ private val playButton: ImageButton
+ private val muteButton: ImageButton
private val controlsView: View
- private val videoStatusText: TextView
private var isVideoPlaying: Boolean = false
init {
@@ -31,37 +29,34 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) :
playButton = findViewById(R.id.btn_play)
muteButton = findViewById(R.id.btn_mute)
controlsView = findViewById(R.id.video_controls)
- videoStatusText = findViewById(R.id.tv_video_status)
controlsView.visibility = View.GONE
}
/*
- * Reset the custom controls view.
+ * Sets up the custom controls view with the provided VideoController and mute state.
*/
- fun reset() {
+ fun initialize(mediaContent: MediaContent?, muted: Boolean) {
controlsView.visibility = View.GONE
- videoStatusText.text = ""
- }
-
- /*
- * Sets up the custom controls view with the provided VideoController.
- */
- fun setMediaContent(mediaContent: MediaContent) {
- controlsView.visibility = View.GONE
- if (mediaContent.hasVideoContent()) {
+ if (mediaContent != null && mediaContent.hasVideoContent()) {
configureVideoContent(mediaContent.videoController)
- } else {
- videoStatusText.text = "Video status: Ad does not contain a video asset."
}
+ setMuteImage(muted)
+ }
+
+ private fun setMuteImage(isMuted: Boolean) {
+ val muteResource =
+ if (isMuted) {
+ R.drawable.video_mute
+ } else {
+ R.drawable.video_unmute
+ }
+ muteButton.setImageResource(muteResource)
}
private fun configureVideoContent(videoController: VideoController) {
if (videoController.isCustomControlsEnabled) {
- muteButton.text = if (videoController.isMuted) "Unmute" else "Mute"
controlsView.visibility = View.VISIBLE
-
muteButton.setOnClickListener { videoController.mute(!videoController.isMuted) }
-
playButton.setOnClickListener {
if (isVideoPlaying) {
videoController.pause()
@@ -78,36 +73,31 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) :
object : VideoController.VideoLifecycleCallbacks() {
override fun onVideoMute(muted: Boolean) {
- videoStatusText.text =
- "Video status: " + if (muted) "Video did mute" else "Video did un-mute"
- muteButton.text = if (muted) "Unmute" else "Mute"
+ setMuteImage(muted)
super.onVideoMute(muted)
}
override fun onVideoPause() {
- videoStatusText.text = "Video status: Video did pause."
- playButton.text = "Play"
+ playButton.setImageResource(R.drawable.video_play)
isVideoPlaying = false
super.onVideoPause()
}
override fun onVideoPlay() {
- videoStatusText.text = "Video status: Video did play."
- playButton.text = "Pause"
+ playButton.setImageResource(R.drawable.video_pause)
isVideoPlaying = true
+ setMuteImage(videoController.isMuted)
super.onVideoPlay()
}
override fun onVideoStart() {
- videoStatusText.text = "Video status: Video did start."
- playButton.text = "Pause"
+ playButton.setImageResource(R.drawable.video_pause)
isVideoPlaying = true
super.onVideoStart()
}
override fun onVideoEnd() {
- videoStatusText.text = "Video status: Video playback has ended."
- playButton.text = "Play"
+ playButton.setImageResource(R.drawable.video_play)
isVideoPlaying = false
super.onVideoEnd()
}
diff --git a/kotlin/advanced/APIDemo/app/src/main/res/drawable/video_mute.png b/kotlin/advanced/APIDemo/app/src/main/res/drawable/video_mute.png
new file mode 100644
index 000000000..53726693f
Binary files /dev/null and b/kotlin/advanced/APIDemo/app/src/main/res/drawable/video_mute.png differ
diff --git a/kotlin/advanced/APIDemo/app/src/main/res/drawable/video_pause.png b/kotlin/advanced/APIDemo/app/src/main/res/drawable/video_pause.png
new file mode 100644
index 000000000..c19e51ab4
Binary files /dev/null and b/kotlin/advanced/APIDemo/app/src/main/res/drawable/video_pause.png differ
diff --git a/kotlin/advanced/APIDemo/app/src/main/res/drawable/video_play.png b/kotlin/advanced/APIDemo/app/src/main/res/drawable/video_play.png
new file mode 100644
index 000000000..51ef616d1
Binary files /dev/null and b/kotlin/advanced/APIDemo/app/src/main/res/drawable/video_play.png differ
diff --git a/kotlin/advanced/APIDemo/app/src/main/res/drawable/video_unmute.png b/kotlin/advanced/APIDemo/app/src/main/res/drawable/video_unmute.png
new file mode 100644
index 000000000..e4fc961be
Binary files /dev/null and b/kotlin/advanced/APIDemo/app/src/main/res/drawable/video_unmute.png differ
diff --git a/kotlin/advanced/APIDemo/app/src/main/res/layout/ad_simple_custom_template.xml b/kotlin/advanced/APIDemo/app/src/main/res/layout/ad_simple_custom_template.xml
index bcaaf1bc1..30b9a346e 100644
--- a/kotlin/advanced/APIDemo/app/src/main/res/layout/ad_simple_custom_template.xml
+++ b/kotlin/advanced/APIDemo/app/src/main/res/layout/ad_simple_custom_template.xml
@@ -1,35 +1,58 @@
-
+ android:orientation="vertical">
+
+
-
+
+
-
+ android:adjustViewBounds="true"
+ android:layout_marginTop="5dp"/>
-
-
+ android:layout_marginBottom="5dp" />
+
+
diff --git a/kotlin/advanced/APIDemo/app/src/main/res/layout/custom_video_controls.xml b/kotlin/advanced/APIDemo/app/src/main/res/layout/custom_video_controls.xml
index 27d0a6393..f78b21f77 100644
--- a/kotlin/advanced/APIDemo/app/src/main/res/layout/custom_video_controls.xml
+++ b/kotlin/advanced/APIDemo/app/src/main/res/layout/custom_video_controls.xml
@@ -1,38 +1,26 @@
-
+
-
+
-
+ android:background="#CC000000"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:scaleType="centerInside"
+ android:src="@drawable/video_mute" />
-
diff --git a/kotlin/advanced/APIDemo/app/src/main/res/layout/fragment_gam_customcontrols.xml b/kotlin/advanced/APIDemo/app/src/main/res/layout/fragment_gam_customcontrols.xml
index 8009334d3..eee6e4128 100644
--- a/kotlin/advanced/APIDemo/app/src/main/res/layout/fragment_gam_customcontrols.xml
+++ b/kotlin/advanced/APIDemo/app/src/main/res/layout/fragment_gam_customcontrols.xml
@@ -2,6 +2,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:minHeight="32dp"
+ android:minWidth="100dp"
tools:context=".AdManagerCustomControlsFragment">
-
-
-
-
-
-
+
+
+
+
+
Ad Manager PPID
/21775744923/example/native-video
- 12406343
+ 12387226
Request Native Ads
Request Custom Native Ad Formats
Start video ads muted
diff --git a/kotlin/advanced/APIDemo/app/src/main/res/xml/security.xml b/kotlin/advanced/APIDemo/app/src/main/res/xml/security.xml
new file mode 100644
index 000000000..506d72131
--- /dev/null
+++ b/kotlin/advanced/APIDemo/app/src/main/res/xml/security.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+