diff options
author | ByteHamster <info@bytehamster.com> | 2021-11-21 19:33:01 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2021-11-21 19:33:01 +0100 |
commit | 218e3dd47d00915b5bf8f290fc6715a49c77d577 (patch) | |
tree | ef96f73a0f0ff006dbb3028c4e5412a00bd6ac7b | |
parent | efe66b20049d7e695792843ca0d91693b5aa1819 (diff) | |
download | AntennaPod-218e3dd47d00915b5bf8f290fc6715a49c77d577.zip |
Fix crash on API 21 when showing subscriptions screen
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsRecyclerAdapter.java | 5 | ||||
-rw-r--r-- | app/src/main/res/layout/subscription_item.xml | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsRecyclerAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsRecyclerAdapter.java index 06bfbedf1..73f67d016 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsRecyclerAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsRecyclerAdapter.java @@ -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); diff --git a/app/src/main/res/layout/subscription_item.xml b/app/src/main/res/layout/subscription_item.xml index 66628740f..8fb7a4b7b 100644 --- a/app/src/main/res/layout/subscription_item.xml +++ b/app/src/main/res/layout/subscription_item.xml @@ -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" |