slight speed up on re-coloring inactive drawer items
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 31 Dec 2018 19:07:21 +0000 (19:07 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 31 Dec 2018 19:07:21 +0000 (19:07 +0000)
app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java

index 5c2c6f5c1d23f616ff480606dc80931d39bcb1e6..5aa6ace2adb5d3abbca451002ed48336b786bb49 100644 (file)
@@ -21,6 +21,7 @@ import android.content.Intent;
 import android.content.pm.PackageInfo;
 import android.os.Build;
 import android.os.Bundle;
+import android.support.annotation.ColorInt;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentTransaction;
@@ -100,11 +101,13 @@ public class MainActivity extends AppCompatActivity {
             item.setBackgroundColor(getResources().getColor(R.color.table_row_even_bg));
         }
 
+        @ColorInt int transparent = getResources().getColor(android.R.color.transparent);
+
         LinearLayout actions = drawer.findViewById(R.id.nav_actions);
         for (int i = 0; i < actions.getChildCount(); i++) {
             View view = actions.getChildAt(i);
             if (view.getId() != id) {
-                view.setBackgroundColor(getResources().getColor(android.R.color.transparent));
+                view.setBackgroundColor(transparent);
             }
         }
     }