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

Commit 11b7d1a5 authored by Michael W's avatar Michael W
Browse files

Dialer: Various other fixes

Change-Id: Ia664f17bc891d3cbe38020a3e7fb310c7789e03f
parent 8ad1ef9b
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009 The Android Open Source Project
 * Copyright (C) 2023 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -17,8 +18,9 @@
package com.android.contacts.common;

import android.content.Context;
import java.util.Iterator;

import java.util.List;
import java.util.Objects;

/**
 * Class used for collapsing data items into groups of similar items. The data items that should be
@@ -74,12 +76,7 @@ public final class Collapser {
    }

    // Remove the null items
    Iterator<T> itr = list.iterator();
    while (itr.hasNext()) {
      if (itr.next() == null) {
        itr.remove();
      }
    }
    list.removeIf(Objects::isNull);
  }

  /*
+3 −2
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009 The Android Open Source Project
 * Copyright (C) 2023 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -19,7 +20,7 @@ package com.android.contacts.common;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Directory;

import androidx.annotation.IntDef;
import androidx.annotation.LongDef;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -80,6 +81,6 @@ public class ContactsUtils {
   */
  @Retention(RetentionPolicy.SOURCE)
  // TODO: Switch to @LongDef when @LongDef is available in the support library
  @IntDef({(int) USER_TYPE_CURRENT, (int) USER_TYPE_WORK})
  @LongDef({USER_TYPE_CURRENT, USER_TYPE_WORK})
  public @interface UserType {}
}
+2 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012 The Android Open Source Project
 * Copyright (C) 2023 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@ import android.provider.ContactsContract;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.view.View;

import com.android.contacts.common.model.account.AccountType;
import com.google.i18n.phonenumbers.NumberParseException;
import com.google.i18n.phonenumbers.PhoneNumberUtil;
+18 −20
Original line number Diff line number Diff line
@@ -45,12 +45,12 @@ import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceManager;

import com.android.dialer.R;
import com.android.dialer.animation.AnimUtils;
import com.android.dialer.callintent.CallInitiationType;
import com.android.dialer.callintent.CallIntentBuilder;
import com.android.dialer.common.LogUtil;
import com.android.dialer.contactphoto.ContactPhotoManager;
import com.android.dialer.contacts.resources.R;
import com.android.dialer.lettertile.LetterTileDrawable;
import com.android.dialer.precall.PreCall;
import com.android.dialer.util.ViewUtil;
@@ -88,8 +88,6 @@ public class CallSubjectDialog extends AppCompatActivity {
  private TextView mNumberView;
  private EditText mCallSubjectView;
  private TextView mCharacterLimitView;
  private View mHistoryButton;
  private View mSendAndCallButton;
  private ListView mSubjectList;

  private int mLimit = CALL_SUBJECT_LIMIT;
@@ -276,22 +274,22 @@ public class CallSubjectDialog extends AppCompatActivity {
    mBackgroundView = findViewById(R.id.call_subject_dialog);
    mBackgroundView.setOnClickListener(mBackgroundListener);
    mDialogView = findViewById(R.id.dialog_view);
    mContactPhoto = (QuickContactBadge) findViewById(R.id.contact_photo);
    mNameView = (TextView) findViewById(R.id.name);
    mNumberView = (TextView) findViewById(R.id.number);
    mCallSubjectView = (EditText) findViewById(R.id.call_subject);
    mContactPhoto = findViewById(R.id.contact_photo);
    mNameView = findViewById(R.id.name);
    mNumberView = findViewById(R.id.number);
    mCallSubjectView = findViewById(R.id.call_subject);
    mCallSubjectView.addTextChangedListener(mTextWatcher);
    mCallSubjectView.setOnClickListener(mCallSubjectClickListener);
    InputFilter[] filters = new InputFilter[1];
    filters[0] = new InputFilter.LengthFilter(mLimit);
    mCallSubjectView.setFilters(filters);
    mCharacterLimitView = (TextView) findViewById(R.id.character_limit);
    mHistoryButton = findViewById(R.id.history_button);
    mHistoryButton.setOnClickListener(mHistoryOnClickListener);
    mHistoryButton.setVisibility(mSubjectHistory.isEmpty() ? View.GONE : View.VISIBLE);
    mSendAndCallButton = findViewById(R.id.send_and_call_button);
    mSendAndCallButton.setOnClickListener(mSendAndCallOnClickListener);
    mSubjectList = (ListView) findViewById(R.id.subject_list);
    mCharacterLimitView = findViewById(R.id.character_limit);
    View historyButton = findViewById(R.id.history_button);
    historyButton.setOnClickListener(mHistoryOnClickListener);
    historyButton.setVisibility(mSubjectHistory.isEmpty() ? View.GONE : View.VISIBLE);
    View sendAndCallButton = findViewById(R.id.send_and_call_button);
    sendAndCallButton.setOnClickListener(mSendAndCallOnClickListener);
    mSubjectList = findViewById(R.id.subject_list);
    mSubjectList.setOnItemClickListener(mItemClickListener);
    mSubjectList.setVisibility(View.GONE);

@@ -356,13 +354,14 @@ public class CallSubjectDialog extends AppCompatActivity {
      length = subjectText.length();
    }

    mCharacterLimitView.setText(getString(R.string.call_subject_limit, length, mLimit));
    mCharacterLimitView.setText(getString(R.string.call_subject_limit,
            String.valueOf(length), String.valueOf(mLimit)));
    if (length >= mLimit) {
      mCharacterLimitView.setTextColor(
          getResources().getColor(R.color.call_subject_limit_exceeded));
          getResources().getColor(R.color.call_subject_limit_exceeded, getTheme()));
    } else {
      mCharacterLimitView.setTextColor(
          getResources().getColor(R.color.dialer_secondary_text_color));
          getResources().getColor(R.color.dialer_secondary_text_color, getTheme()));
    }
  }

@@ -414,9 +413,8 @@ public class CallSubjectDialog extends AppCompatActivity {
    final int dialogStartingBottom = mDialogView.getBottom();
    if (show) {
      // Showing the subject list; bind the list of history items to the list and show it.
      ArrayAdapter<String> adapter =
          new ArrayAdapter<String>(
              CallSubjectDialog.this, R.layout.call_subject_history_list_item, mSubjectHistory);
      ArrayAdapter<String> adapter = new ArrayAdapter<>(CallSubjectDialog.this,
              R.layout.call_subject_history_list_item, mSubjectHistory);
      mSubjectList.setAdapter(adapter);
      mSubjectList.setVisibility(View.VISIBLE);
    } else {
+2 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2013 The Android Open Source Project
 * Copyright (C) 2023 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@ package com.android.contacts.common.list;
import android.content.Context;
import android.net.Uri;
import android.provider.ContactsContract.PinnedPositions;

import com.android.dialer.contacts.ContactsComponent;

/** Class to hold contact information */
Loading