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

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

Merge "Cancel Old SpeedDial contact loaders when they are reset."

parents a39e732c 35ecd12f
Loading
Loading
Loading
Loading
+7 −12
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import com.android.dialer.app.R;
import com.android.dialer.callintent.CallInitiationType;
import com.android.dialer.callintent.CallSpecificAppData;
import com.android.dialer.callintent.SpeedDialContactType;
import com.android.dialer.common.LogUtil;
import com.android.dialer.contactphoto.ContactPhotoManager.DefaultImageRequest;
import com.android.dialer.lettertile.LetterTileDrawable;
import com.android.dialer.logging.InteractionEvent;
@@ -192,21 +191,17 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
    this.position = position;
  }

  private ContactLoader loader;

  /**
   * Send a notification using a {@link ContactLoader} to inform the sync adapter that we are
   * viewing a particular contact, so that it can download the high-res photo.
   */
  private static void sendViewNotification(Context context, Uri contactUri) {
    ContactLoader loader = new ContactLoader(context, contactUri, true /* postViewNotification */);
    loader.registerListener(
        0,
        (loader1, contact) -> {
          try {
            loader1.reset();
          } catch (RuntimeException e) {
            LogUtil.e("PhoneFavoriteTileView.onLoadComplete", "error resetting loader", e);
  private void sendViewNotification(Context context, Uri contactUri) {
    if (loader != null) {
      loader.cancelLoad();
    }
        });
    loader = new ContactLoader(context, contactUri, true /* postViewNotification */);
    loader.startLoading();
  }
}
+12 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.dialer.common.Assert;
import com.android.dialer.configprovider.ConfigProviderBindings;

/** Navigation item in a bottom nav. */
final class BottomNavItem extends LinearLayout {
@@ -68,7 +69,17 @@ final class BottomNavItem extends LinearLayout {
    if (count == 0) {
      notificationBadge.setVisibility(View.INVISIBLE);
    } else {
      String countString = count > 99 ? "99+" : String.format(Integer.toString(count));
      String countString = String.format(Integer.toString(count));

      boolean use99PlusCount =
          ConfigProviderBindings.get(getContext()).getBoolean("use_99_plus", false);
      boolean use9Plus = !use99PlusCount;

      if (use99PlusCount && count > 99) {
        countString = getContext().getString(R.string.bottom_nav_count_99_plus);
      } else if (use9Plus && count > 9) {
        countString = getContext().getString(R.string.bottom_nav_count_9_plus);
      }
      notificationBadge.setVisibility(View.VISIBLE);
      notificationBadge.setText(countString);

+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@
        android:id="@+id/bottom_nav_item_image"
        android:layout_width="24dp"
        android:layout_height="24dp"
        android:layout_marginTop="7dp"/>
        android:layout_marginTop="4dp"/>

    <TextView
        android:id="@+id/notification_badge"
+6 −0
Original line number Diff line number Diff line
@@ -23,4 +23,10 @@
  <string name="tab_title_voicemail">Voicemail</string>
  <!-- Tab text to show users their contacts  [CHAR LIMIT=10] -->
  <string name="tab_title_contacts">Contacts</string>

  <!-- Notification badge indicating that there are more than 9 notifications for the user [CHAR LIMIT=3] -->
  <string name="bottom_nav_count_9_plus">9+</string>

  <!-- Notification badge indicating that there are more than 9 notifications for the user [CHAR LIMIT=3] -->
  <string name="bottom_nav_count_99_plus">99+</string>
</resources>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
  <style name="NuiActivityTheme" parent="NuiActivityThemeBase">
    <!-- Used to change the navigation bar color -->
    <item name="android:windowLightNavigationBar">true</item>
    <item name="android:navigationBarColor">?android:windowBackground</item>
    <item name="android:navigationBarColor">@color/background_dialer_white</item>
    <item name="android:navigationBarDividerColor">#E0E0E0</item>
  </style>
</resources>
 No newline at end of file
Loading