Merge pull request #5567 from ByteHamster/fix-crash-api21

Fix crash on API 21 when showing subscriptions screen
This commit is contained in:
ByteHamster 2021-11-21 21:02:51 +01:00 committed by GitHub
commit 782341f534
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package de.danoeh.antennapod.adapter;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.MenuInflater;
@ -15,6 +16,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.text.TextUtilsCompat;
import androidx.core.view.ViewCompat;
import androidx.fragment.app.Fragment;
@ -188,6 +190,9 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription
}
public void bind(NavDrawerData.DrawerItem drawerItem) {
Drawable drawable = AppCompatResources.getDrawable(selectView.getContext(),
R.drawable.ic_checkbox_background);
selectView.setBackground(drawable); // Setting this in XML crashes API <= 21
feedTitle.setText(drawerItem.getTitle());
imageView.setContentDescription(drawerItem.getTitle());
feedTitle.setVisibility(View.VISIBLE);

View File

@ -49,8 +49,7 @@
<FrameLayout
android:id="@+id/selectView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_checkbox_background">
android:layout_height="wrap_content">
<CheckBox
android:id="@+id/selectCheckBox"