mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Added selectedItemColor and unSelectedItemColor to the TabStrip (#8431)
* chore: add guard for ios * feat(bottom-nav): adding new properties * feat(tabs): new property implementation * feat: new feature implementation in android Implemented selectedItemColor and unSelectedItemColor properties on TabStrip * chore: added some comments * chore: change method return type * fix: setting icon color * fix: rendering mode setting * chore: rename variable * chore: fixed a typo * chore: updated log in build gradle * fix: item color setting in android * fix: tab styling when no css aplied * chore: private methods renamed * tests: added selected-item test pages * chore: renamed test pages * chore: move css-tree package to the right place * tests: added new ui tests * fix: use renamed function * fix: set item color * tests: aded automationText attribute * tests: trying to fix the tests Co-authored-by: Dimitar Topuzov <dtopuzov@gmail.com>
This commit is contained in:
@@ -71,9 +71,9 @@ android {
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
|
||||
|
||||
if(project.hasProperty("useAndroidX")) {
|
||||
println 'Using androix'
|
||||
println 'Using android X'
|
||||
def androidxVersion = computeAndroidXVersion()
|
||||
implementation 'androidx.viewpager:viewpager:' + androidxVersion
|
||||
implementation 'androidx.fragment:fragment:' + androidxVersion
|
||||
|
||||
@@ -160,7 +160,7 @@ public class TabsBar extends HorizontalScrollView {
|
||||
* {@link TabsBar} 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 TabsBar 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;
|
||||
}
|
||||
|
||||
@@ -262,10 +262,10 @@ public class TabsBar 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);
|
||||
@@ -283,14 +283,14 @@ public class TabsBar extends HorizontalScrollView {
|
||||
if (tabItem.typeFace != null) {
|
||||
textView.setTypeface(tabItem.typeFace);
|
||||
}
|
||||
|
||||
|
||||
if (tabItem.fontSize != 0) {
|
||||
textView.setTextSize(tabItem.fontSize);
|
||||
}
|
||||
|
||||
|
||||
if (tabItem.color != 0) {
|
||||
textView.setTextColor(tabItem.color);
|
||||
mTabStrip.setShouldUpdateTabsTextColor(false);
|
||||
mTabStrip.setShouldUpdateTabsTextColor(false);
|
||||
}
|
||||
} else {
|
||||
textView.setVisibility(GONE);
|
||||
@@ -305,7 +305,7 @@ public class TabsBar extends HorizontalScrollView {
|
||||
} else {
|
||||
ll.setMinimumHeight((int) (SMALL_MIN_HEIGHT * density));
|
||||
}
|
||||
|
||||
|
||||
if (mDistributeEvenly) {
|
||||
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) ll.getLayoutParams();
|
||||
lp.width = 0;
|
||||
|
||||
Reference in New Issue
Block a user