mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-02-02 11:46:55 +01:00
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.database.DataSetObserver;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.Gravity;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ListAdapter;
|
||||
import androidx.annotation.AttrRes;
|
||||
import androidx.core.content.ContextCompat;
|
||||
@ -21,7 +23,7 @@ public class EmptyViewHandler {
|
||||
private boolean layoutAdded = false;
|
||||
private View list;
|
||||
private ListAdapter listAdapter;
|
||||
private RecyclerView.Adapter recyclerAdapter;
|
||||
private RecyclerView.Adapter<?> recyclerAdapter;
|
||||
|
||||
private final Context context;
|
||||
private final View emptyView;
|
||||
@ -92,12 +94,19 @@ public class EmptyViewHandler {
|
||||
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
|
||||
emptyView.setLayoutParams(layoutParams);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateAdapter(RecyclerView.Adapter adapter) {
|
||||
public void updateAdapter(RecyclerView.Adapter<?> adapter) {
|
||||
if (this.recyclerAdapter != null) {
|
||||
this.recyclerAdapter.unregisterAdapterDataObserver(adapterObserver);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user