33import android .app .Activity ;
44import android .content .Context ;
55import android .content .Intent ;
6+ import android .content .res .Configuration ;
67import android .graphics .drawable .Drawable ;
78import android .os .Bundle ;
89import android .text .Html ;
@@ -506,16 +507,15 @@ public void onCreate(Bundle savedInstanceState) {
506507 private void toggleJetpackBannerIfEnabled (final boolean showIfEnabled , boolean animateOnScroll ) {
507508 if (!isAdded () || getView () == null || !isSearching ()) return ;
508509
509- if (mJetpackBrandingUtils .shouldShowJetpackBranding ()) {
510- if (animateOnScroll ) {
511- mJetpackBrandingUtils .showJetpackBannerIfScrolledToTop (
512- mJetpackBanner ,
513- mRecyclerView .getInternalRecyclerView ()
514- );
515- // Return early since the visibility was handled by showJetpackBannerIfScrolledToTop
516- return ;
517- }
510+ if (animateOnScroll ) {
511+ RecyclerView scrollView = mRecyclerView .getInternalRecyclerView ();
512+ mJetpackBrandingUtils .showJetpackBannerIfScrolledToTop (mJetpackBanner , scrollView );
513+ mJetpackBrandingUtils .setNavigationBarColorForBanner (requireActivity ().getWindow ());
514+ // Return early since the banner visibility was handled by showJetpackBannerIfScrolledToTop
515+ return ;
516+ }
518517
518+ if (mJetpackBrandingUtils .shouldShowJetpackBranding ()) {
519519 if (showIfEnabled && !mDisplayUtilsWrapper .isPhoneLandscape ()) {
520520 showJetpackBanner ();
521521 } else {
@@ -525,8 +525,8 @@ private void toggleJetpackBannerIfEnabled(final boolean showIfEnabled, boolean a
525525 }
526526
527527 private void showJetpackBanner () {
528- mJetpackBrandingUtils .setNavigationBarColorForBanner (requireActivity ().getWindow ());
529528 mJetpackBanner .setVisibility (View .VISIBLE );
529+ mJetpackBrandingUtils .setNavigationBarColorForBanner (requireActivity ().getWindow ());
530530
531531 // Add bottom margin to search suggestions list and empty view.
532532 int jetpackBannerHeight = getResources ().getDimensionPixelSize (R .dimen .jetpack_banner_height );
@@ -537,8 +537,13 @@ private void showJetpackBanner() {
537537
538538 private void hideJetpackBanner () {
539539 mJetpackBanner .setVisibility (View .GONE );
540- // Remove bottom margin from search suggestions post list and empty view
541- ((MarginLayoutParams ) mRecyclerView .getLayoutParams ()).bottomMargin = 0 ;
540+
541+ if (getResources ().getConfiguration ().orientation == Configuration .ORIENTATION_PORTRAIT ) {
542+ requireActivity ().getWindow ().setNavigationBarColor (0 );
543+ }
544+
545+ // Remove bottom margin from search suggestions list and empty view.
546+ ((MarginLayoutParams ) mRecyclerView .getSearchSuggestionsRecyclerView ().getLayoutParams ()).bottomMargin = 0 ;
542547 ((MarginLayoutParams ) mActionableEmptyView .getLayoutParams ()).bottomMargin = 0 ;
543548 }
544549
0 commit comments