Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23d9b6e8 authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Use ContextCompat to handle getColor (2/2)

Bug: 25629359
Change-Id: I982172555532f4e7a8a756d7b4880ff0821d5f7a
parent 56dfa580
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.content.SharedPreferences;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.content.ContextCompat;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
@@ -44,7 +45,6 @@ import com.android.contacts.R;
import com.android.contacts.activities.ActionBarAdapter.Listener.Action;
import com.android.contacts.list.ContactsRequest;

import com.android.contacts.common.compat.CompatUtils;

/**
 * Adapter for the action bar at the top of the Contacts activity.
@@ -508,8 +508,8 @@ public class ActionBarAdapter implements OnCloseListener {
                    R.color.contextual_selection_bar_status_bar_color);
            mActivity.getWindow().setStatusBarColor(cabStatusBarColor);
        } else {
            final int normalStatusBarColor = CompatUtils.getColorCompat
                    (mActivity, R.color.primary_color_dark);
            final int normalStatusBarColor = ContextCompat.getColor(
                    mActivity, R.color.primary_color_dark);
            mActivity.getWindow().setStatusBarColor(normalStatusBarColor);
        }
    }
+5 −6
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ import android.provider.ContactsContract.DataUsageFeedback;
import android.provider.ContactsContract.Intents;
import android.provider.ContactsContract.QuickContact;
import android.provider.ContactsContract.RawContacts;
import android.support.v4.content.ContextCompat;
import android.support.v7.graphics.Palette;
import android.support.v7.widget.CardView;
import android.telecom.PhoneAccount;
@@ -183,8 +184,6 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;

import com.android.contacts.common.compat.CompatUtils;

/**
 * Mostly translucent {@link Activity} that shows QuickContact dialog. It loads
 * data asynchronously, and then shows a popup with details centered around
@@ -644,10 +643,10 @@ public class QuickContactActivity extends ContactsActivity
    private void enableLinkButton() {
        mSuggestionsLinkButton.setClickable(true);
        mSuggestionsLinkButton.getBackground().setColorFilter(
                CompatUtils.getColorCompat(this, R.color.primary_color),
                ContextCompat.getColor(this, R.color.primary_color),
                PorterDuff.Mode.SRC_ATOP);
        mSuggestionsLinkButton.setTextColor(
                CompatUtils.getColorCompat(this, android.R.color.white));
                ContextCompat.getColor(this, android.R.color.white));
        mSuggestionsLinkButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
@@ -669,10 +668,10 @@ public class QuickContactActivity extends ContactsActivity
    private void disableLinkButton() {
        mSuggestionsLinkButton.setClickable(false);
        mSuggestionsLinkButton.getBackground().setColorFilter(
                CompatUtils.getColorCompat(this, R.color.disabled_button_background),
                ContextCompat.getColor(this, R.color.disabled_button_background),
                PorterDuff.Mode.SRC_ATOP);
        mSuggestionsLinkButton.setTextColor(
                CompatUtils.getColorCompat(this, R.color.disabled_button_text));
                ContextCompat.getColor(this, R.color.disabled_button_text));
    }

    private interface ContextMenuIds {