Use ContextCompat.getDrawable().
This commit is contained in:
parent
07f3e778d3
commit
6a0cd0a14a
@ -23,6 +23,7 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.cursoradapter.widget.CursorAdapter;
|
||||
import androidx.loader.app.LoaderManager;
|
||||
import androidx.loader.content.CursorLoader;
|
||||
@ -147,7 +148,7 @@ public class SelectAppsView extends SwapView implements LoaderManager.LoaderCall
|
||||
|
||||
private Drawable getDefaultAppIcon(Context context) {
|
||||
if (defaultAppIcon == null) {
|
||||
defaultAppIcon = context.getResources().getDrawable(android.R.drawable.sym_def_app_icon);
|
||||
defaultAppIcon = ContextCompat.getDrawable(context, android.R.drawable.sym_def_app_icon);
|
||||
}
|
||||
return defaultAppIcon;
|
||||
}
|
||||
@ -225,7 +226,7 @@ public class SelectAppsView extends SwapView implements LoaderManager.LoaderCall
|
||||
resource = R.drawable.ic_add_circle_outline;
|
||||
colour = 0xFFD0D0D4;
|
||||
}
|
||||
imageView.setImageDrawable(getResources().getDrawable(resource));
|
||||
imageView.setImageDrawable(ContextCompat.getDrawable(getContext(), resource));
|
||||
imageView.setColorFilter(colour, PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,11 @@ import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import androidx.appcompat.widget.AppCompatSeekBar;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatSeekBar;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import org.fdroid.fdroid.R;
|
||||
|
||||
/**
|
||||
@ -34,12 +36,7 @@ public class SeekBarForegroundThumb extends AppCompatSeekBar {
|
||||
|
||||
private void init(Context context) {
|
||||
this.context = context;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
tickMark = context.getDrawable(R.drawable.seekbar_tickmark);
|
||||
} else {
|
||||
tickMark = context.getResources().getDrawable(R.drawable.seekbar_tickmark);
|
||||
}
|
||||
tickMark = ContextCompat.getDrawable(context, R.drawable.seekbar_tickmark);
|
||||
}
|
||||
|
||||
private Drawable getThumbCompat() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user