summaryrefslogtreecommitdiff
path: root/library/main/src/com/android/setupwizardlib/view
diff options
context:
space:
mode:
authorMaurice Lam <yukl@google.com>2015-05-28 12:57:55 -0700
committerMaurice Lam <yukl@google.com>2015-05-28 13:22:19 -0700
commit6c093727dc5ab7b13f142506803b1d98a642c910 (patch)
treefd19320d39ed869c1a4fa8911cb1857cf6a7fb9b /library/main/src/com/android/setupwizardlib/view
parentb5c78954c32ef124b5df7ab539d6579cb4506f50 (diff)
downloadsetupwizard-6c093727dc5ab7b13f142506803b1d98a642c910.tar.gz
Center nav bar button icon
Center the navigation bar button icon when there is no text label. Bug: 21465490 Change-Id: Ie2d890b29c721f6f2fb0608637b5a76ab389294e
Diffstat (limited to 'library/main/src/com/android/setupwizardlib/view')
-rw-r--r--library/main/src/com/android/setupwizardlib/view/NavigationBar.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/library/main/src/com/android/setupwizardlib/view/NavigationBar.java b/library/main/src/com/android/setupwizardlib/view/NavigationBar.java
index bc06976..2386339 100644
--- a/library/main/src/com/android/setupwizardlib/view/NavigationBar.java
+++ b/library/main/src/com/android/setupwizardlib/view/NavigationBar.java
@@ -23,6 +23,7 @@ import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
+import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.ContextThemeWrapper;
import android.view.View;
@@ -153,6 +154,14 @@ public class NavigationBar extends LinearLayout implements View.OnClickListener
}
}
}
+
+ @Override
+ protected void onTextChanged(CharSequence text, int start, int lengthBefore,
+ int lengthAfter) {
+ super.onTextChanged(text, start, lengthBefore, lengthAfter);
+ setCompoundDrawablePadding(TextUtils.isEmpty(text) ? 0 : getResources()
+ .getDimensionPixelSize(R.dimen.suw_navbar_button_drawable_padding));
+ }
}
}