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

Commit 5c51c72c authored by Mohit Mali's avatar Mohit Mali
Browse files

Change views color according to system accent color

parent d720cd17
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -435,8 +435,6 @@ public class DialtactsActivity extends TransactionSafeActivity
        LogUtil.enterBlock("DialtactsActivity.onCreate");
        super.onCreate(savedInstanceState);

        getWindow().setStatusBarColor(ColorUtil.getAccentColor(this));

        firstLaunch = true;
        isLastTabEnabled = ConfigProviderBindings.get(this).getBoolean("last_tab_enabled", false);

+242 −230
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package com.android.dialer.app.calllog;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.provider.CallLog;
import android.provider.CallLog.Calls;
@@ -30,12 +32,14 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.ViewGroup;

import com.android.contacts.common.list.ViewPagerTabs;
import com.android.dialer.app.DialtactsActivity;
import com.android.dialer.app.R;
import com.android.dialer.calldetails.CallDetailsActivity;
import com.android.dialer.callstats.CallStatsFragment;
import com.android.dialer.callstats.DoubleDatePickerDialog;
import com.android.dialer.colorutil.ColorUtil;
import com.android.dialer.common.Assert;
import com.android.dialer.constants.ActivityRequestCodes;
import com.android.dialer.database.CallLogQueryHandler;
@@ -47,12 +51,16 @@ import com.android.dialer.postcall.PostCall;
import com.android.dialer.util.TransactionSafeActivity;
import com.android.dialer.util.ViewUtil;

/** Activity for viewing call history. */
/**
 * Activity for viewing call history.
 */
public class CallLogActivity extends TransactionSafeActivity implements
        ViewPager.OnPageChangeListener, DoubleDatePickerDialog.OnDateSetListener {

  @VisibleForTesting static final int TAB_INDEX_ALL = 0;
  @VisibleForTesting static final int TAB_INDEX_MISSED = 1;
    @VisibleForTesting
    static final int TAB_INDEX_ALL = 0;
    @VisibleForTesting
    static final int TAB_INDEX_MISSED = 1;
    private static final int TAB_INDEX_STATS = 2;
    private static final int TAB_INDEX_COUNT = 3;
    private ViewPager viewPager;
@@ -77,6 +85,8 @@ public class CallLogActivity extends TransactionSafeActivity implements
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setElevation(0);
        actionBar.setBackgroundDrawable(new ColorDrawable(ColorUtil.getAccentColor(this)));


        int startingTab = TAB_INDEX_ALL;
        final Intent intent = getIntent();
@@ -241,7 +251,9 @@ public class CallLogActivity extends TransactionSafeActivity implements
        super.onBackPressed();
    }

  /** Adapter for the view pager. */
    /**
     * Adapter for the view pager.
     */
    public class ViewPagerAdapter extends FragmentPagerAdapter {

        public ViewPagerAdapter(FragmentManager fm) {
+1251 −1193
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.net.Uri;
import android.os.AsyncTask;
@@ -52,6 +53,7 @@ import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.android.contacts.common.dialog.CallSubjectDialog;
import com.android.dialer.app.DialtactsActivity;
import com.android.dialer.app.R;
@@ -68,6 +70,7 @@ import com.android.dialer.calldetails.CallDetailsEntries;
import com.android.dialer.callintent.CallIntentBuilder;
import com.android.dialer.calllogutils.CallbackActionHelper.CallbackAction;
import com.android.dialer.clipboard.ClipboardUtils;
import com.android.dialer.colorutil.ColorUtil;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.AsyncTaskExecutors;
@@ -98,6 +101,7 @@ import com.android.dialer.telecom.TelecomUtil;
import com.android.dialer.util.CallUtil;
import com.android.dialer.util.DialerUtils;
import com.android.dialer.util.UriUtils;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
@@ -117,34 +121,56 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder

    private static final String TASK_DELETE = "task_delete";

  /** The root view of the call log list item */
    /**
     * The root view of the call log list item
     */
    public final View rootView;
  /** The quick contact badge for the contact. */
    /**
     * The quick contact badge for the contact.
     */
    public final DialerQuickContactBadge quickContactView;
  /** The primary action view of the entry. */
    /**
     * The primary action view of the entry.
     */
    public final View primaryActionView;
  /** The details of the phone call. */
    /**
     * The details of the phone call.
     */
    public final PhoneCallDetailsViews phoneCallDetailsViews;
  /** The text of the header for a day grouping. */
    /**
     * The text of the header for a day grouping.
     */
    public final TextView dayGroupHeader;
  /** The view containing the details for the call log row, including the action buttons. */
    /**
     * The view containing the details for the call log row, including the action buttons.
     */
    public final CardView callLogEntryView;
  /** The actionable view which places a call to the number corresponding to the call log row. */
    /**
     * The actionable view which places a call to the number corresponding to the call log row.
     */
    public final ImageView primaryActionButtonView;

    private final Context context;
  @Nullable private final PhoneAccountHandle defaultPhoneAccountHandle;
    @Nullable
    private final PhoneAccountHandle defaultPhoneAccountHandle;
    private final CallLogCache callLogCache;
    private final CallLogListItemHelper callLogListItemHelper;
    private final CachedNumberLookupService cachedNumberLookupService;
    private final VoicemailPlaybackPresenter voicemailPlaybackPresenter;
    private final OnClickListener blockReportListener;
  @HostUi private final int hostUi;
  /** Whether the data fields are populated by the worker thread, ready to be shown. */
    @HostUi
    private final int hostUi;
    /**
     * Whether the data fields are populated by the worker thread, ready to be shown.
     */
    public boolean isLoaded;
  /** The view containing call log item actions. Null until the ViewStub is inflated. */
    /**
     * The view containing call log item actions. Null until the ViewStub is inflated.
     */
    public View actionsView;
  /** The button views below are assigned only when the action section is expanded. */
    /**
     * The button views below are assigned only when the action section is expanded.
     */
    public VoicemailPlaybackLayout voicemailPlaybackView;

    public View callButtonView;
@@ -178,17 +204,24 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
     * The callable phone number for the current call log entry. Cached here as the call back intent
     * is set only when the actions ViewStub is inflated.
     */
  @Nullable public String number;
  /** The post-dial numbers that are dialed following the phone number. */
    @Nullable
    public String number;
    /**
     * The post-dial numbers that are dialed following the phone number.
     */
    public String postDialDigits;
  /** The formatted phone number to display. */
    /**
     * The formatted phone number to display.
     */
    public String displayNumber;
    /**
     * The phone number presentation for the current call log entry. Cached here as the call back
     * intent is set only when the actions ViewStub is inflated.
     */
    public int numberPresentation;
  /** The type of the phone number (e.g. main, work, etc). */
    /**
     * The type of the phone number (e.g. main, work, etc).
     */
    public String numberType;
    /**
     * The country iso for the call. Cached here as the call back intent is set only when the actions
@@ -218,17 +251,24 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
     * The name or number associated with the call. Cached here for use when setting content
     * descriptions on buttons in the actions ViewStub when it is inflated.
     */
  @Nullable public CharSequence nameOrNumber;
    @Nullable
    public CharSequence nameOrNumber;
    /**
     * The call type or Location associated with the call. Cached here for use when setting text for a
     * voicemail log's call button
     */
    public CharSequence callTypeOrLocation;
  /** The contact info for the contact displayed in this list item. */
    /**
     * The contact info for the contact displayed in this list item.
     */
    public volatile ContactInfo info;
  /** Whether spam feature is enabled, which affects UI. */
    /**
     * Whether spam feature is enabled, which affects UI.
     */
    public boolean isSpamFeatureEnabled;
  /** Whether the current log entry is a spam number or not. */
    /**
     * Whether the current log entry is a spam number or not.
     */
    public boolean isSpam;

    public boolean isCallComposerCapable;
@@ -477,11 +517,25 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder

            createNewContactButtonView = actionsView.findViewById(R.id.create_new_contact_action);

            //Change color matching to system accent color
            ImageView new_contact_img = createNewContactButtonView.findViewById(R.id.create_new_contact_img);
            new_contact_img.setImageTintList(ColorStateList.valueOf(ColorUtil.getAccentColor(context)));
            TextView create_new_contact_label = createNewContactButtonView.findViewById(R.id.create_new_contact_label);
            create_new_contact_label.setTextColor(ColorUtil.getAccentColor(context));

            createNewContactButtonView.setOnClickListener(this);

            addToExistingContactButtonView =
                    actionsView.findViewById(R.id.add_to_existing_contact_action);

            //Change color matching to system accent color
            ImageView add_to_contact_img =
                    createNewContactButtonView.findViewById(R.id.add_to_contact_icon);
            add_to_contact_img.setImageTintList(ColorStateList.valueOf(ColorUtil.getAccentColor(context)));
            TextView add_to_contact_label =
                    createNewContactButtonView.findViewById(R.id.add_to_contact_label);
            add_to_contact_label.setTextColor(ColorUtil.getAccentColor(context));

            addToExistingContactButtonView.setOnClickListener(this);

            sendMessageView = actionsView.findViewById(R.id.send_message_action);
@@ -930,7 +984,8 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
                        getContactType());
    }

  private @ContactType int getContactType() {
    private @ContactType
    int getContactType() {
        return LetterTileDrawable.getContactTypeFromPrimitives(
                callLogCache.isVoicemailNumber(accountHandle, number),
                isSpam,
@@ -1330,7 +1385,9 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
        Logger.get(context).logScreenView(ScreenEvent.Type.CALL_LOG_CONTEXT_MENU, (Activity) context);
    }

  /** Specifies where the view holder belongs. */
    /**
     * Specifies where the view holder belongs.
     */
    @IntDef({HostUi.CALL_LOG, HostUi.CALL_HISTORY, HostUi.VOICEMAIL})
    @Retention(RetentionPolicy.SOURCE)
    private @interface HostUi {
@@ -1407,7 +1464,8 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
        }

        @Override
    public void onPostExecute(Void result) {}
        public void onPostExecute(Void result) {
        }

        private String concatCallIds(long[] callIds) {
            if (callIds == null || callIds.length == 0) {
+2 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.content.res.TypedArray;
import android.database.ContentObserver;
import android.database.Cursor;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Trace;
@@ -223,7 +224,7 @@ public class ListsFragment extends Fragment
        viewPagerTabs = (ViewPagerTabs) parentView.findViewById(R.id.lists_pager_header);
        viewPagerTabs.configureTabIcons(tabIcons);
        viewPagerTabs.setViewPager(viewPager);
        viewPagerTabs.setBackgroundColor(ColorUtil.getAccentColor(getContext()));
        viewPagerTabs.setBackground(new ColorDrawable(ColorUtil.getAccentColor(getContext())));
        addOnPageChangeListener(viewPagerTabs);
        removeView = (RemoveView) parentView.findViewById(R.id.remove_view);
        removeViewContent = parentView.findViewById(R.id.remove_view_content);
+2 −0
Original line number Diff line number Diff line
@@ -121,10 +121,12 @@
        style="@style/CallLogActionStyle">

        <ImageView
            android:id="@+id/add_to_contact_icon"
            style="@style/CallLogActionIconStyle"
            android:src="@drawable/quantum_ic_person_white_24" />

        <TextView
            android:id="@+id/add_to_contact_label"
            style="@style/CallLogActionTextStyle"
            android:text="@string/search_shortcut_add_to_contact" />

Loading