3
3
import android .app .Activity ;
4
4
import android .content .Context ;
5
5
import android .content .Intent ;
6
+ import android .content .res .Configuration ;
6
7
import android .graphics .drawable .Drawable ;
7
8
import android .os .Bundle ;
8
9
import android .text .Html ;
@@ -506,16 +507,15 @@ public void onCreate(Bundle savedInstanceState) {
506
507
private void toggleJetpackBannerIfEnabled (final boolean showIfEnabled , boolean animateOnScroll ) {
507
508
if (!isAdded () || getView () == null || !isSearching ()) return ;
508
509
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
+ }
518
517
518
+ if (mJetpackBrandingUtils .shouldShowJetpackBranding ()) {
519
519
if (showIfEnabled && !mDisplayUtilsWrapper .isPhoneLandscape ()) {
520
520
showJetpackBanner ();
521
521
} else {
@@ -525,8 +525,8 @@ private void toggleJetpackBannerIfEnabled(final boolean showIfEnabled, boolean a
525
525
}
526
526
527
527
private void showJetpackBanner () {
528
- mJetpackBrandingUtils .setNavigationBarColorForBanner (requireActivity ().getWindow ());
529
528
mJetpackBanner .setVisibility (View .VISIBLE );
529
+ mJetpackBrandingUtils .setNavigationBarColorForBanner (requireActivity ().getWindow ());
530
530
531
531
// Add bottom margin to search suggestions list and empty view.
532
532
int jetpackBannerHeight = getResources ().getDimensionPixelSize (R .dimen .jetpack_banner_height );
@@ -537,8 +537,13 @@ private void showJetpackBanner() {
537
537
538
538
private void hideJetpackBanner () {
539
539
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 ;
542
547
((MarginLayoutParams ) mActionableEmptyView .getLayoutParams ()).bottomMargin = 0 ;
543
548
}
544
549
0 commit comments