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

Commit 2752fe03 authored by Michael W's avatar Michael W
Browse files

Dialer: Replace com.google.common.base.Optional with java type

* Recommended by AS
* Remove the Guava warning where applicable
* Also reduce the size of the LatinSmartDialMap by collapsing the
  various cases using a variation of the python script
* We also get two characters more out of it: 'Ƞ' and 'ȡ' - these look
  valid so keep them

Change-Id: I4de142a6eeb99320b3859adbd868a9db51319693
parent 958e6e1a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -52,7 +52,8 @@ import com.android.dialer.location.GeoUtil;
import com.android.dialer.phonenumberutil.PhoneNumberHelper;
import com.android.dialer.protos.ProtoParsers;
import com.android.dialer.telecom.TelecomUtil;
import com.google.common.base.Optional;

import java.util.Optional;

/**
 * Dialog that allows the user to select a phone accounts for a given action. Optionally provides
+3 −3
Original line number Diff line number Diff line
@@ -21,11 +21,11 @@ import android.telecom.PhoneAccountHandle;
import androidx.annotation.Nullable;

import com.google.auto.value.AutoValue;
import com.google.common.base.Optional;

import java.util.Optional;

/** Info of an active call */
@AutoValue
@SuppressWarnings("Guava")
public abstract class ActiveCallInfo {

  /** The {@link PhoneAccountHandle} the call is made with */
@@ -40,7 +40,7 @@ public abstract class ActiveCallInfo {
  public abstract static class Builder {

    public Builder setPhoneAccountHandle(@Nullable PhoneAccountHandle phoneAccountHandle) {
      return setPhoneAccountHandle(Optional.fromNullable(phoneAccountHandle));
      return setPhoneAccountHandle(Optional.ofNullable(phoneAccountHandle));
    }

    public abstract Builder setPhoneAccountHandle(Optional<PhoneAccountHandle> phoneAccountHandle);
+1 −1
Original line number Diff line number Diff line
@@ -25,11 +25,11 @@ import android.text.TextUtils;
import com.android.dialer.R;
import com.android.dialer.calllog.model.CoalescedRow;
import com.android.dialer.spam.Spam;
import com.google.common.base.Optional;
import com.google.common.collect.Collections2;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/**
 * Computes the primary text and secondary text for call log entries.
+3 −2
Original line number Diff line number Diff line
@@ -25,7 +25,8 @@ import android.text.TextDirectionHeuristics;
import android.text.TextUtils;

import com.android.dialer.phonenumberutil.PhoneNumberHelper;
import com.google.common.base.Optional;

import java.util.Optional;

/** Helper for formatting and managing the display of phone numbers. */
public class PhoneNumberDisplayUtil {
@@ -57,7 +58,7 @@ public class PhoneNumberDisplayUtil {
    if (presentation == Calls.PRESENTATION_PAYPHONE) {
      return Optional.of(appContext.getResources().getString(R.string.payphone));
    }
    return Optional.absent();
    return Optional.empty();
  }

  /**
+5 −6
Original line number Diff line number Diff line
@@ -55,10 +55,10 @@ import com.android.dialer.smartdial.util.SmartDialNameMatcher;
import com.android.dialer.util.DialerUtils;
import com.android.dialer.util.TransactionSafeActivity;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.common.base.Optional;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/**
 * Search controller for handling all the logic related to entering and exiting the search UI.
@@ -159,7 +159,7 @@ public class MainSearchController implements SearchBarListener {

    fab.hide();
    toolbar.slideUp(animate, fragmentContainer);
    toolbar.expand(animate, Optional.absent(), /* requestFocus */ false);
    toolbar.expand(animate, Optional.empty(), /* requestFocus */ false);

    activity.setTitle(R.string.dialpad_activity_title);

@@ -389,7 +389,7 @@ public class MainSearchController implements SearchBarListener {
  @Override
  public void onSearchBarClicked() {
    LogUtil.enterBlock("MainSearchController.onSearchBarClicked");
    openSearch(Optional.absent());
    openSearch(Optional.empty());
  }

  private void openSearch(Optional<String> query) {
@@ -411,8 +411,7 @@ public class MainSearchController implements SearchBarListener {
      transaction.show(searchFragment);
    }

    searchFragment.setQuery(
        query.isPresent() ? query.get() : "", CallInitiationType.Type.REGULAR_SEARCH);
    searchFragment.setQuery(query.orElse(""), CallInitiationType.Type.REGULAR_SEARCH);

    if (activity.isSafeToCommitTransactions()) {
      transaction.commit();
@@ -540,7 +539,7 @@ public class MainSearchController implements SearchBarListener {
    if (savedInstanceState.getBoolean(KEY_IS_TOOLBAR_EXPANDED, false)) {
      // If the toolbar is slide up, that means the dialpad is showing. Thus we don't want to
      // request focus or we'll break physical/bluetooth keyboards typing.
      toolbar.expand(/* animate */ false, Optional.absent(), /* requestFocus */ !isSlideUp);
      toolbar.expand(/* animate */ false, Optional.empty(), /* requestFocus */ !isSlideUp);
    }
  }

Loading