Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Merge changes I72fca0bd,If5f505d4 into androidx-master-dev
Browse files Browse the repository at this point in the history
* changes:
  Use SimpleArrayMap in implementation
  Use SimpleArrayMap in implementation
  • Loading branch information
Treehugger Robot authored and Gerrit Code Review committed Jul 10, 2019
2 parents ddf7531 + 569c83a commit 5671f1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
14 changes: 7 additions & 7 deletions core/core/src/main/java/androidx/core/view/ViewCompat.java
Expand Up @@ -58,7 +58,7 @@
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.annotation.UiThread;
import androidx.collection.ArrayMap;
import androidx.collection.SimpleArrayMap;
import androidx.core.R;
import androidx.core.view.AccessibilityDelegateCompat.AccessibilityDelegateAdapter;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
Expand Down Expand Up @@ -3707,12 +3707,12 @@ public static int generateViewId() {
public static void addOnUnhandledKeyEventListener(@NonNull View v,
final @NonNull OnUnhandledKeyEventListenerCompat listener) {
if (Build.VERSION.SDK_INT >= 28) {
Map<OnUnhandledKeyEventListenerCompat, View.OnUnhandledKeyEventListener>
viewListeners = (Map<OnUnhandledKeyEventListenerCompat,
SimpleArrayMap<OnUnhandledKeyEventListenerCompat, View.OnUnhandledKeyEventListener>
viewListeners = (SimpleArrayMap<OnUnhandledKeyEventListenerCompat,
View.OnUnhandledKeyEventListener>)
v.getTag(R.id.tag_unhandled_key_listeners);
if (viewListeners == null) {
viewListeners = new ArrayMap<>();
viewListeners = new SimpleArrayMap<>();
v.setTag(R.id.tag_unhandled_key_listeners, viewListeners);
}

Expand Down Expand Up @@ -3751,9 +3751,9 @@ public boolean onUnhandledKeyEvent(View v, KeyEvent event) {
public static void removeOnUnhandledKeyEventListener(@NonNull View v,
@NonNull OnUnhandledKeyEventListenerCompat listener) {
if (Build.VERSION.SDK_INT >= 28) {
Map<OnUnhandledKeyEventListenerCompat, View.OnUnhandledKeyEventListener>
viewListeners =
(Map<OnUnhandledKeyEventListenerCompat, View.OnUnhandledKeyEventListener>)
SimpleArrayMap<OnUnhandledKeyEventListenerCompat, View.OnUnhandledKeyEventListener>
viewListeners = (SimpleArrayMap<OnUnhandledKeyEventListenerCompat,
View.OnUnhandledKeyEventListener>)
v.getTag(R.id.tag_unhandled_key_listeners);
if (viewListeners == null) {
return;
Expand Down
Expand Up @@ -28,14 +28,13 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.Px;
import androidx.collection.ArrayMap;
import androidx.collection.SimpleArrayMap;
import androidx.core.graphics.ColorUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
* A helper class to extract prominent colors from an image.
Expand Down Expand Up @@ -154,7 +153,7 @@ public static AsyncTask<Bitmap, Void, Palette> generateAsync(
private final List<Swatch> mSwatches;
private final List<Target> mTargets;

private final Map<Target, Swatch> mSelectedSwatches;
private final SimpleArrayMap<Target, Swatch> mSelectedSwatches;
private final SparseBooleanArray mUsedColors;

@Nullable private final Swatch mDominantSwatch;
Expand All @@ -164,7 +163,7 @@ public static AsyncTask<Bitmap, Void, Palette> generateAsync(
mTargets = targets;

mUsedColors = new SparseBooleanArray();
mSelectedSwatches = new ArrayMap<>();
mSelectedSwatches = new SimpleArrayMap<>();

mDominantSwatch = findDominantSwatch();
}
Expand Down

0 comments on commit 5671f1f

Please sign in to comment.