Use Resources.getDrawable(int, Theme)

- Resources.getDrawable(int) is deprecated. Use new function to replace
the old one.

Fixes: 143078105
Test: manual
Change-Id: Ieea5b415d1a771b253401d826bfdb9d9a26f5ff2
This commit is contained in:
Raff Tsai
2019-10-23 11:34:18 +08:00
parent 062baadf4e
commit 96635d9fb3

View File

@@ -38,6 +38,11 @@ import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceGroup;
import com.android.settings.R;
import com.android.settings.Settings.TetherSettingsActivity;
import com.android.settings.core.BasePreferenceController;
@@ -49,11 +54,6 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceGroup;
/**
* {@link BasePreferenceController} that populates a list of widgets that Settings app support.
*/
@@ -245,7 +245,7 @@ public class CreateShortcutPreferenceController extends BasePreferenceController
Drawable iconDrawable;
try {
iconDrawable = context.getPackageManager().getResourcesForApplication(app)
.getDrawable(resource);
.getDrawable(resource, themedContext.getTheme());
if (iconDrawable instanceof LayerDrawable) {
iconDrawable = ((LayerDrawable) iconDrawable).getDrawable(1);
}