Skip to content

Commit

Permalink
[NavigationView] Change navigation item pointer icon to arrow instead…
Browse files Browse the repository at this point in the history
… of hand, since they are not external links

Resolves #4316
Resolves #4315

GIT_ORIGIN_REV_ID=4e40f118f90ed05a48c5877d45db91642c7dad31
PiperOrigin-RevId: 681079283
  • Loading branch information
pubiqq authored and dsn5ft committed Oct 1, 2024
1 parent 0ea7b58 commit 8f5a04c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@
import androidx.annotation.StyleRes;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.view.PointerIconCompat;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.CollectionItemInfoCompat;
Expand Down Expand Up @@ -659,13 +657,6 @@ public void setEnabled(boolean enabled) {
smallLabel.setEnabled(enabled);
largeLabel.setEnabled(enabled);
icon.setEnabled(enabled);

if (enabled) {
ViewCompat.setPointerIcon(
this, PointerIconCompat.getSystemIcon(getContext(), PointerIconCompat.TYPE_HAND));
} else {
ViewCompat.setPointerIcon(this, null);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
Expand All @@ -51,7 +52,6 @@
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.PointerIcon;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.ColorInt;
Expand Down Expand Up @@ -706,18 +706,17 @@ public void testSavedState() throws Throwable {
@TargetApi(Build.VERSION_CODES.N)
public void testPointerIcon() throws Throwable {
final Activity activity = activityTestRule.getActivity();
final PointerIcon expectedIcon = PointerIcon.getSystemIcon(activity, PointerIcon.TYPE_HAND);
final MotionEvent event = MotionEvent.obtain(0, 0, MotionEvent.ACTION_HOVER_MOVE, 0, 0, 0);
final Menu menu = bottomNavigation.getMenu();
for (int i = 0; i < menu.size(); i++) {
final MenuItem item = menu.getItem(i);
assertTrue(item.isEnabled());
final View itemView = activity.findViewById(item.getItemId());
assertEquals(expectedIcon, itemView.onResolvePointerIcon(event, 0));
assertNull(itemView.onResolvePointerIcon(event, 0));
item.setEnabled(false);
assertEquals(null, itemView.onResolvePointerIcon(event, 0));
assertNull(itemView.onResolvePointerIcon(event, 0));
item.setEnabled(true);
assertEquals(expectedIcon, itemView.onResolvePointerIcon(event, 0));
assertNull(itemView.onResolvePointerIcon(event, 0));
}
}

Expand Down

0 comments on commit 8f5a04c

Please sign in to comment.