1
0
Fork 0
mirror of https://github.com/MatomoCamp/matomocamp-companion-android.git synced 2024-09-19 16:13:46 +02:00

Replaced deprecated Resources.getColor() with ContextCompat.getColor()

This commit is contained in:
Christophe Beyls 2016-01-06 21:12:02 +01:00
parent b6a3f7e1af
commit 3320f96cd2
2 changed files with 5 additions and 5 deletions

View file

@ -2,13 +2,13 @@ package be.digitalia.fosdem.fragments;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.database.Cursor;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.Loader;
import android.support.v4.widget.CursorAdapter;
import android.support.v4.widget.TextViewCompat;
@ -252,9 +252,8 @@ public class TrackScheduleListFragment extends SmoothListFragment implements Han
super(context, null, 0);
inflater = LayoutInflater.from(context);
timeDateFormat = DateUtils.getTimeDateFormat(context);
Resources res = context.getResources();
timeBackgroundColor = res.getColor(R.color.schedule_time_background);
timeRunningBackgroundColor = res.getColor(R.color.schedule_time_running_background);
timeBackgroundColor = ContextCompat.getColor(context, R.color.schedule_time_background);
timeRunningBackgroundColor = ContextCompat.getColor(context, R.color.schedule_time_running_background);
TypedArray a = context.getTheme().obtainStyledAttributes(PRIMARY_TEXT_COLORS);
timeForegroundColor = a.getColor(0, 0);

View file

@ -15,6 +15,7 @@ import android.preference.PreferenceManager;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.TaskStackBuilder;
import android.support.v4.content.ContextCompat;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
@ -177,7 +178,7 @@ public class AlarmIntentService extends IntentService {
bigText = spannableBigText;
}
int notificationColor = getResources().getColor(R.color.color_primary);
int notificationColor = ContextCompat.getColor(this, R.color.color_primary);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_stat_fosdem)