mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-26 03:01:51 +08:00
fix: dont default to Font.default (#8401)
* fix: dont default to Font.default This would cause a font to be set for any label even when using default system font. This will also cause a typeface which is pretty long * lint: lint fixes * fix: added null font guards * fix: Used default bold for TabView Co-authored-by: Vasko <v.trifonov@gmail.com>
This commit is contained in:
@ -178,7 +178,6 @@ public class BottomNavigationBar extends LinearLayout {
|
||||
titleTextView.setGravity(Gravity.CENTER);
|
||||
titleTextView.setMaxWidth((int) (ITEM_TEXT_MAX_WIDTH * density));
|
||||
titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, ITEM_TEXT_SIZE_SP);
|
||||
titleTextView.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
titleTextView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
titleTextView.setMaxLines(1);
|
||||
titleTextView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
|
@ -160,7 +160,7 @@ public class TabLayout extends HorizontalScrollView {
|
||||
* {@link TabLayout} you are required to set any
|
||||
* {@link ViewPager.OnPageChangeListener} through this method. This is so
|
||||
* that the layout can update it's scroll position correctly.
|
||||
*
|
||||
*
|
||||
* @see ViewPager#setOnPageChangeListener(ViewPager.OnPageChangeListener)
|
||||
*/
|
||||
public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) {
|
||||
@ -196,25 +196,25 @@ public class TabLayout extends HorizontalScrollView {
|
||||
TextView textView = (TextView)ll.getChildAt(1);
|
||||
this.setupItem(ll, textView, imgView, tabItem);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the TextView for tab item at index
|
||||
*/
|
||||
public TextView getTextViewForItemAt(int index){
|
||||
LinearLayout ll = this.getViewForItemAt(index);
|
||||
return (ll != null) ? (TextView)ll.getChildAt(1) : null;
|
||||
return (ll != null) ? (TextView)ll.getChildAt(1) : null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the LinearLayout container for tab item at index
|
||||
*/
|
||||
public LinearLayout getViewForItemAt(int index){
|
||||
LinearLayout result = null;
|
||||
|
||||
|
||||
if(this.mTabStrip.getChildCount() > index){
|
||||
result = (LinearLayout)this.mTabStrip.getChildAt(index);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -263,10 +263,10 @@ public class TabLayout extends HorizontalScrollView {
|
||||
ll.addView(textView);
|
||||
return ll;
|
||||
}
|
||||
|
||||
|
||||
private void setupItem(LinearLayout ll, TextView textView,ImageView imgView, TabItemSpec tabItem){
|
||||
float density = getResources().getDisplayMetrics().density;
|
||||
|
||||
|
||||
if (tabItem.iconId != 0) {
|
||||
imgView.setImageResource(tabItem.iconId);
|
||||
imgView.setVisibility(VISIBLE);
|
||||
@ -293,7 +293,7 @@ public class TabLayout extends HorizontalScrollView {
|
||||
} else {
|
||||
ll.setMinimumHeight((int) (SMALL_MIN_HEIGHT * density));
|
||||
}
|
||||
|
||||
|
||||
if (mDistributeEvenly) {
|
||||
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) ll.getLayoutParams();
|
||||
lp.width = 0;
|
||||
@ -438,4 +438,4 @@ public class TabLayout extends HorizontalScrollView {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -250,7 +250,6 @@ public class TabsBar extends HorizontalScrollView {
|
||||
textView.setGravity(Gravity.CENTER);
|
||||
textView.setMaxWidth((int) (TEXT_MAX_WIDTH * density));
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
|
||||
textView.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
textView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
textView.setMaxLines(2);
|
||||
textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
|
Reference in New Issue
Block a user