Fix small issues in NavigationView.

These issues where found in the process of working on BottomNavigationView.

Change-Id: I53d71cfb119d236ed173353109cc3e1e193fa0cb
diff --git a/design/src/android/support/design/widget/NavigationView.java b/design/src/android/support/design/widget/NavigationView.java
index 6918632..e84aa19 100644
--- a/design/src/android/support/design/widget/NavigationView.java
+++ b/design/src/android/support/design/widget/NavigationView.java
@@ -18,7 +18,6 @@
 
 import android.content.Context;
 import android.content.res.ColorStateList;
-import android.content.res.TypedArray;
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
@@ -39,9 +38,11 @@
 import android.support.v4.os.ParcelableCompatCreatorCallbacks;
 import android.support.v4.view.AbsSavedState;
 import android.support.v4.view.ViewCompat;
+import android.support.v7.content.res.AppCompatResources;
 import android.support.v7.view.SupportMenuInflater;
 import android.support.v7.view.menu.MenuBuilder;
 import android.support.v7.view.menu.MenuItemImpl;
+import android.support.v7.widget.TintTypedArray;
 import android.util.AttributeSet;
 import android.util.TypedValue;
 import android.view.Menu;
@@ -105,7 +106,7 @@
         mMenu = new NavigationMenu(context);
 
         // Custom attributes
-        TypedArray a = context.obtainStyledAttributes(attrs,
+        TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs,
                 R.styleable.NavigationView, defStyleAttr,
                 R.style.Widget_Design_NavigationView);
 
@@ -198,11 +199,12 @@
     }
 
     /**
-     * Set a listener that will be notified when a menu item is clicked.
+     * Set a listener that will be notified when a menu item is selected.
      *
      * @param listener The listener to notify
      */
-    public void setNavigationItemSelectedListener(OnNavigationItemSelectedListener listener) {
+    public void setNavigationItemSelectedListener(
+            @Nullable OnNavigationItemSelectedListener listener) {
         mListener = listener;
     }
 
@@ -409,11 +411,12 @@
     }
 
     private ColorStateList createDefaultColorStateList(int baseColorThemeAttr) {
-        TypedValue value = new TypedValue();
+        final TypedValue value = new TypedValue();
         if (!getContext().getTheme().resolveAttribute(baseColorThemeAttr, value, true)) {
             return null;
         }
-        ColorStateList baseColor = getResources().getColorStateList(value.resourceId);
+        ColorStateList baseColor = AppCompatResources.getColorStateList(
+                getContext(), value.resourceId);
         if (!getContext().getTheme().resolveAttribute(
                     android.support.v7.appcompat.R.attr.colorPrimary, value, true)) {
             return null;
@@ -443,7 +446,7 @@
          *
          * @return true to display the item as the selected item
          */
-        public boolean onNavigationItemSelected(MenuItem item);
+        public boolean onNavigationItemSelected(@NonNull MenuItem item);
     }
 
     /**