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

Commit f976beb4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes Ic5616af0,I5e4c3e61

* changes:
  Add flags for the Duo install, activate and invite buttons
  Support dual alphabets in smart dial.
parents 0f76636b e12f924c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1400,7 +1400,7 @@ public class DialtactsActivity extends TransactionSafeActivity
      mNewSearchFragment.setRawNumber(query);
    }
    final String normalizedQuery =
        SmartDialNameMatcher.normalizeNumber(query, SmartDialNameMatcher.LATIN_SMART_DIAL_MAP);
        SmartDialNameMatcher.normalizeNumber(/* context = */ this, query);

    if (!TextUtils.equals(mSearchView.getText(), normalizedQuery)) {
      if (DEBUG) {
+15 −5
Original line number Diff line number Diff line
@@ -691,16 +691,26 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
          videoCallButtonView.setTag(IntentProvider.getDuoVideoIntentProvider(number));
          videoCallButtonView.setVisibility(View.VISIBLE);
        } else if (duo.isActivated(mContext) && !identifiedSpamCall) {
          if (ConfigProviderBindings.get(mContext)
              .getBoolean("enable_call_log_duo_invite_button", false)) {
            inviteVideoButtonView.setTag(IntentProvider.getDuoInviteIntentProvider(number));
            inviteVideoButtonView.setVisibility(View.VISIBLE);
          }
        } else if (duo.isEnabled(mContext) && !identifiedSpamCall) {
          if (!duo.isInstalled(mContext)) {
            if (ConfigProviderBindings.get(mContext)
                .getBoolean("enable_call_log_install_duo_button", false)) {
              setUpVideoButtonView.setTag(IntentProvider.getInstallDuoIntentProvider());
              setUpVideoButtonView.setVisibility(View.VISIBLE);
            }
          } else {
            if (ConfigProviderBindings.get(mContext)
                .getBoolean("enable_call_log_activate_duo_button", false)) {
              setUpVideoButtonView.setTag(IntentProvider.getSetUpDuoIntentProvider());
          }
              setUpVideoButtonView.setVisibility(View.VISIBLE);
            }
          }
        }
        break;
      default:
        callButtonView.setVisibility(View.GONE);
+5 −4
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import com.android.dialer.common.LogUtil;
import com.android.dialer.dialpadview.SmartDialCursorLoader;
import com.android.dialer.smartdial.SmartDialMatchPosition;
import com.android.dialer.smartdial.SmartDialNameMatcher;
import com.android.dialer.smartdial.SmartDialPrefix;
import com.android.dialer.util.CallUtil;
import java.util.ArrayList;

@@ -35,11 +34,13 @@ public class SmartDialNumberListAdapter extends DialerPhoneNumberListAdapter {
  private static final String TAG = SmartDialNumberListAdapter.class.getSimpleName();
  private static final boolean DEBUG = false;

  private final Context mContext;
  @NonNull private final SmartDialNameMatcher mNameMatcher;

  public SmartDialNumberListAdapter(Context context) {
    super(context);
    mNameMatcher = new SmartDialNameMatcher("", SmartDialPrefix.getMap());
    mContext = context;
    mNameMatcher = new SmartDialNameMatcher("");
    setShortcutEnabled(SmartDialNumberListAdapter.SHORTCUT_DIRECT_CALL, false);

    if (DEBUG) {
@@ -72,7 +73,7 @@ public class SmartDialNumberListAdapter extends DialerPhoneNumberListAdapter {
  protected void setHighlight(ContactListItemView view, Cursor cursor) {
    view.clearHighlightSequences();

    if (mNameMatcher.matches(cursor.getString(PhoneQuery.DISPLAY_NAME))) {
    if (mNameMatcher.matches(mContext, cursor.getString(PhoneQuery.DISPLAY_NAME))) {
      final ArrayList<SmartDialMatchPosition> nameMatches = mNameMatcher.getMatchPositions();
      for (SmartDialMatchPosition match : nameMatches) {
        view.addNameHighlightSequence(match.start, match.end);
@@ -89,7 +90,7 @@ public class SmartDialNumberListAdapter extends DialerPhoneNumberListAdapter {
    }

    final SmartDialMatchPosition numberMatch =
        mNameMatcher.matchesNumber(cursor.getString(PhoneQuery.PHONE_NUMBER));
        mNameMatcher.matchesNumber(mContext, cursor.getString(PhoneQuery.PHONE_NUMBER));
    if (numberMatch != null) {
      view.addNumberHighlightSequence(numberMatch.start, numberMatch.end);
    }
+5 −4
Original line number Diff line number Diff line
@@ -535,7 +535,7 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper {
        insert.executeInsert();
        final String contactPhoneNumber = updatedContactCursor.getString(PhoneQuery.PHONE_NUMBER);
        final ArrayList<String> numberPrefixes =
            SmartDialPrefix.parseToNumberTokens(contactPhoneNumber);
            SmartDialPrefix.parseToNumberTokens(mContext, contactPhoneNumber);

        for (String numberPrefix : numberPrefixes) {
          numberInsert.bindLong(1, updatedContactCursor.getLong(PhoneQuery.PHONE_CONTACT_ID));
@@ -578,7 +578,7 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper {
      while (nameCursor.moveToNext()) {
        /** Computes a list of prefixes of a given contact name. */
        final ArrayList<String> namePrefixes =
            SmartDialPrefix.generateNamePrefixes(nameCursor.getString(columnIndexName));
            SmartDialPrefix.generateNamePrefixes(mContext, nameCursor.getString(columnIndexName));

        for (String namePrefix : namePrefixes) {
          insert.bindLong(1, nameCursor.getLong(columnIndexContactId));
@@ -912,8 +912,9 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper {
        /**
         * If the contact has either the name or number that matches the query, add to the result.
         */
        final boolean nameMatches = nameMatcher.matches(displayName);
        final boolean numberMatches = (nameMatcher.matchesNumber(phoneNumber, query) != null);
        final boolean nameMatches = nameMatcher.matches(mContext, displayName);
        final boolean numberMatches =
            (nameMatcher.matchesNumber(mContext, phoneNumber, query) != null);
        if (nameMatches || numberMatches) {
          /** If a contact has not been added, add it to the result and the hash set. */
          duplicates.add(contactMatch);
+2 −3
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import com.android.dialer.database.Database;
import com.android.dialer.database.DialerDatabaseHelper;
import com.android.dialer.database.DialerDatabaseHelper.ContactNumber;
import com.android.dialer.smartdial.SmartDialNameMatcher;
import com.android.dialer.smartdial.SmartDialPrefix;
import com.android.dialer.util.PermissionsUtil;
import java.util.ArrayList;

@@ -59,10 +58,10 @@ public class SmartDialCursorLoader extends AsyncTaskLoader<Cursor> {
    if (DEBUG) {
      LogUtil.v(TAG, "Configure new query to be " + query);
    }
    mQuery = SmartDialNameMatcher.normalizeNumber(query, SmartDialPrefix.getMap());
    mQuery = SmartDialNameMatcher.normalizeNumber(mContext, query);

    /** Constructs a name matcher object for matching names. */
    mNameMatcher = new SmartDialNameMatcher(mQuery, SmartDialPrefix.getMap());
    mNameMatcher = new SmartDialNameMatcher(mQuery);
    mNameMatcher.setShouldMatchEmptyQuery(!mShowEmptyListForNullQuery);
  }

Loading