From 15ba3f8f609cc141d6c354fe6486371a864ad296 Mon Sep 17 00:00:00 2001 From: Nikhil Aggarwal <35090769+nikhil097@users.noreply.github.com> Date: Wed, 28 Oct 2020 13:45:18 +0530 Subject: [PATCH] Fixed episodes page no longer shows empty view (#4573) --- .../danoeh/antennapod/view/EmptyViewHandler.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/view/EmptyViewHandler.java b/app/src/main/java/de/danoeh/antennapod/view/EmptyViewHandler.java index 9471db0a1..89d9e26c7 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/EmptyViewHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/view/EmptyViewHandler.java @@ -84,12 +84,16 @@ public class EmptyViewHandler { private void addToParentView(View view) { ViewGroup parent = ((ViewGroup) view.getParent()); - parent.addView(emptyView); - if (parent instanceof RelativeLayout) { - RelativeLayout.LayoutParams layoutParams = - (RelativeLayout.LayoutParams) emptyView.getLayoutParams(); - layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); - emptyView.setLayoutParams(layoutParams); + while (parent != null) { + if (parent instanceof RelativeLayout) { + parent.addView(emptyView); + RelativeLayout.LayoutParams layoutParams = + (RelativeLayout.LayoutParams) emptyView.getLayoutParams(); + layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); + emptyView.setLayoutParams(layoutParams); + break; + } + parent = (ViewGroup) parent.getParent(); } }