[Android] HeaderScrollView: don't get attrs unnecessarily

Edward Wang git at videolan.org
Wed Jul 16 18:16:02 CEST 2014


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Wed Jul 16 12:15:48 2014 -0400| [1a95364a49ce7217e544f2139007e73b3d2abab3] | committer: Edward Wang

HeaderScrollView: don't get attrs unnecessarily

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=1a95364a49ce7217e544f2139007e73b3d2abab3
---

 vlc-android/src/org/videolan/vlc/widget/HeaderScrollView.java |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/widget/HeaderScrollView.java b/vlc-android/src/org/videolan/vlc/widget/HeaderScrollView.java
index 8567bdf..873447e 100644
--- a/vlc-android/src/org/videolan/vlc/widget/HeaderScrollView.java
+++ b/vlc-android/src/org/videolan/vlc/widget/HeaderScrollView.java
@@ -1,7 +1,7 @@
 /*****************************************************************************
- * AudioBrowserActivity.java
+ * HeaderScrollView.java
  *****************************************************************************
- * Copyright © 2011-2013 VLC authors and VideoLAN
+ * Copyright © 2011-2014 VLC authors and VideoLAN
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -91,9 +91,10 @@ public class HeaderScrollView extends HorizontalScrollView {
 
     public void highlightTab(int existingPosition, int newPosition) {
         LinearLayout hl = (LinearLayout) findViewById(R.id.header_layout);
-        TypedArray attrs = getContext().obtainStyledAttributes(new int[] { R.attr.font_light, R.attr.font_default});
         if (hl == null)
             return;
+
+        TypedArray attrs = getContext().obtainStyledAttributes(new int[] { R.attr.font_light, R.attr.font_default});
         TextView oldView = (TextView) hl.getChildAt(existingPosition);
         if (oldView != null)
             oldView.setTextColor(attrs.getColor(0, 0));



More information about the Android mailing list