Merge pull request #4626 from ByteHamster/fix-empty-view-downloads
Fixed empty view in downloads fragment
This commit is contained in:
commit
13e2a67081
@ -3,7 +3,9 @@ package de.danoeh.antennapod.view;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.DataSetObserver;
|
import android.database.DataSetObserver;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.widget.AbsListView;
|
import android.widget.AbsListView;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ListAdapter;
|
import android.widget.ListAdapter;
|
||||||
import androidx.annotation.AttrRes;
|
import androidx.annotation.AttrRes;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
@ -21,7 +23,7 @@ public class EmptyViewHandler {
|
|||||||
private boolean layoutAdded = false;
|
private boolean layoutAdded = false;
|
||||||
private View list;
|
private View list;
|
||||||
private ListAdapter listAdapter;
|
private ListAdapter listAdapter;
|
||||||
private RecyclerView.Adapter recyclerAdapter;
|
private RecyclerView.Adapter<?> recyclerAdapter;
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final View emptyView;
|
private final View emptyView;
|
||||||
@ -92,12 +94,19 @@ public class EmptyViewHandler {
|
|||||||
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
|
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
|
||||||
emptyView.setLayoutParams(layoutParams);
|
emptyView.setLayoutParams(layoutParams);
|
||||||
break;
|
break;
|
||||||
|
} else if (parent instanceof FrameLayout) {
|
||||||
|
parent.addView(emptyView);
|
||||||
|
FrameLayout.LayoutParams layoutParams =
|
||||||
|
(FrameLayout.LayoutParams) emptyView.getLayoutParams();
|
||||||
|
layoutParams.gravity = Gravity.CENTER;
|
||||||
|
emptyView.setLayoutParams(layoutParams);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
parent = (ViewGroup) parent.getParent();
|
parent = (ViewGroup) parent.getParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateAdapter(RecyclerView.Adapter adapter) {
|
public void updateAdapter(RecyclerView.Adapter<?> adapter) {
|
||||||
if (this.recyclerAdapter != null) {
|
if (this.recyclerAdapter != null) {
|
||||||
this.recyclerAdapter.unregisterAdapterDataObserver(adapterObserver);
|
this.recyclerAdapter.unregisterAdapterDataObserver(adapterObserver);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user