Skip to content

Commit 70c2b9e

Browse files
committed
Fix search results bottom padding remaining when jetpack banner slides out of view
1 parent a27df4a commit 70c2b9e

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

WordPress/src/main/java/org/wordpress/android/ui/FilteredRecyclerView.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ public RecyclerView getInternalRecyclerView() {
8787
return mRecyclerView;
8888
}
8989

90+
public RecyclerView getSearchSuggestionsRecyclerView() {
91+
return mSearchSuggestionsRecyclerView;
92+
}
93+
94+
9095
public void setRefreshing(boolean refreshing) {
9196
mSwipeToRefreshHelper.setRefreshing(refreshing);
9297
}

WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostListFragment.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ public void onCreate(Bundle savedInstanceState) {
503503
}
504504

505505
private void toggleJetpackBannerIfEnabled(final boolean forceShow) {
506-
if (!isAdded() || getView() == null) return;
506+
if (!isAdded() || getView() == null || !isSearching()) return;
507507

508508
if (forceShow && mJetpackBrandingUtils.shouldShowJetpackBranding()) {
509509
showJetpackBanner();
@@ -523,15 +523,19 @@ private void showJetpackBanner() {
523523
.show(getChildFragmentManager(), JetpackPoweredBottomSheetFragment.TAG);
524524
});
525525
}
526-
// Add bottom margin to post list and empty view.
527-
int jetpackBannerHeight = getResources().getDimensionPixelSize(R.dimen.jetpack_banner_height);
528-
((MarginLayoutParams) mRecyclerView.getLayoutParams()).bottomMargin = jetpackBannerHeight;
529-
((MarginLayoutParams) mActionableEmptyView.getLayoutParams()).bottomMargin = jetpackBannerHeight;
526+
527+
if (!isSearching()) {
528+
// Add bottom margin to search suggestions post list and empty view.
529+
int jetpackBannerHeight = getResources().getDimensionPixelSize(R.dimen.jetpack_banner_height);
530+
((MarginLayoutParams) mRecyclerView.getSearchSuggestionsRecyclerView().getLayoutParams()).bottomMargin
531+
= jetpackBannerHeight;
532+
((MarginLayoutParams) mActionableEmptyView.getLayoutParams()).bottomMargin = jetpackBannerHeight;
533+
}
530534
}
531535

532536
private void hideJetpackBanner() {
533537
mJetpackBanner.setVisibility(View.GONE);
534-
// Remove bottom margin from post list and empty view.
538+
// Remove bottom margin from search suggestions post list and empty view
535539
((MarginLayoutParams) mRecyclerView.getLayoutParams()).bottomMargin = 0;
536540
((MarginLayoutParams) mActionableEmptyView.getLayoutParams()).bottomMargin = 0;
537541
}

0 commit comments

Comments
 (0)