From 3db689b78270220992f82d5580631cb96a52ef56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Wed, 1 Apr 2015 00:47:23 +0200 Subject: [PATCH] Use setBacground(Drawable) on newer apis setBacground(Drawable) might not just call setBackgroundDrawable(Drawable) in the future --- .../fdroid/views/fragments/AvailableAppsFragment.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/F-Droid/src/org/fdroid/fdroid/views/fragments/AvailableAppsFragment.java b/F-Droid/src/org/fdroid/fdroid/views/fragments/AvailableAppsFragment.java index cb984266e..532e28ba2 100644 --- a/F-Droid/src/org/fdroid/fdroid/views/fragments/AvailableAppsFragment.java +++ b/F-Droid/src/org/fdroid/fdroid/views/fragments/AvailableAppsFragment.java @@ -103,9 +103,7 @@ public class AvailableAppsFragment extends AppListFragment implements } /* Suppress deprecation warnings because: - * setBackgroundDrawable(Drawable) -> setBackground(Drawable) was only in API 16, and doesn't - * seems to simply delegate to the old method. I guess the deprecation is because of poor - * method signature, rather than better functionality in newer versions. + * * setBackgroundDrawable(Drawable) -> setBackground(Drawable) was only in API 16 */ @SuppressWarnings("deprecation") private Spinner createCategorySpinner() { @@ -130,7 +128,11 @@ public class AvailableAppsFragment extends AppListFragment implements if (FDroidApp.getCurTheme() == FDroidApp.Theme.dark) { menuButton.setAlpha(32); // make it darker via alpha } - categorySpinner.setBackgroundDrawable(menuButton); + if (Build.VERSION.SDK_INT >= 16) { + categorySpinner.setBackground(menuButton); + } else { + categorySpinner.setBackgroundDrawable(menuButton); + } } ArrayAdapter adapter = new ArrayAdapter(