2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 13:47:41 +00:00

Use ContextCompat.getColor().

This commit is contained in:
Isira Seneviratne
2020-07-07 18:20:31 +05:30
committed by Nicolas Fella
parent 58be146c29
commit 2b25d26a7c
3 changed files with 5 additions and 3 deletions

View File

@@ -269,7 +269,7 @@ public class MprisActivity extends AppCompatActivity {
final Drawable drawable = ContextCompat.getDrawable(this, R.drawable.ic_album_art_placeholder);
assert drawable != null;
Drawable placeholder_art = DrawableCompat.wrap(drawable);
DrawableCompat.setTint(placeholder_art, getResources().getColor(R.color.primary));
DrawableCompat.setTint(placeholder_art, ContextCompat.getColor(this, R.color.primary));
albumArtView.setImageDrawable(placeholder_art);
} else {
albumArtView.setImageBitmap(albumArt);

View File

@@ -375,7 +375,7 @@ public class MprisMediaSession implements SharedPreferences.OnSharedPreferenceCh
.setContentIntent(piOpenActivity)
.setSmallIcon(R.drawable.ic_play_white)
.setShowWhen(false)
.setColor(service.getResources().getColor(R.color.primary))
.setColor(ContextCompat.getColor(service, R.color.primary))
.setVisibility(androidx.core.app.NotificationCompat.VISIBILITY_PUBLIC)
.setSubText(service.getDevice(notificationDevice).getName());

View File

@@ -29,6 +29,7 @@ import org.kde.kdeconnect_tp.R;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.preference.PreferenceDialogFragmentCompat;
import butterknife.BindView;
@@ -87,7 +88,8 @@ public class StoragePreferenceDialogFragment extends PreferenceDialogFragmentCom
Drawable drawable = AppCompatResources.getDrawable(requireContext(), R.drawable.ic_arrow_drop_down_24px);
if (drawable != null) {
drawable = DrawableCompat.wrap(drawable);
DrawableCompat.setTint(drawable, getResources().getColor(android.R.color.darker_gray));
DrawableCompat.setTint(drawable, ContextCompat.getColor(requireContext(),
android.R.color.darker_gray));
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
arrowDropDownDrawable = drawable;
}