@nativescript-community/ui-material-core-tabs
Advanced tools
+3
-3
| { | ||
| "name": "@nativescript-community/ui-material-core-tabs", | ||
| "version": "7.2.70", | ||
| "version": "7.2.71", | ||
| "description": "Material Core Tabs component", | ||
@@ -42,5 +42,5 @@ "main": "./index", | ||
| "dependencies": { | ||
| "@nativescript-community/ui-material-core": "^7.2.70" | ||
| "@nativescript-community/ui-material-core": "^7.2.71" | ||
| }, | ||
| "gitHead": "ca426777b4d884b1e9b5220e27c99840b953d6ca" | ||
| "gitHead": "e6076200bd06401a5e915a8dcda6fe3d90caff35" | ||
| } |
@@ -171,2 +171,3 @@ /* | ||
| mTabStrip.onTabsViewPagerPageChanged(position, 0); | ||
| makeTabVisible(position, true); | ||
| } | ||
@@ -427,2 +428,50 @@ | ||
| private void makeTabVisible(int tabIndex) { | ||
| makeTabVisible(tabIndex, true); | ||
| } | ||
| private void makeTabVisible(int tabIndex, boolean smoothScroll) { | ||
| final int tabStripChildCount = mTabStrip.getChildCount(); | ||
| if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) { | ||
| return; | ||
| } | ||
| View selectedChild = mTabStrip.getChildAt(tabIndex); | ||
| if (selectedChild == null) { | ||
| return; | ||
| } | ||
| int selectedLeft = selectedChild.getLeft(); | ||
| int selectedRight = selectedChild.getRight(); | ||
| int myWidth = getWidth(); | ||
| // add padding to the sides so it's clear that we have more tabs to scroll to | ||
| if (tabIndex > 0) { | ||
| selectedLeft = selectedLeft - mTitleOffset; | ||
| } | ||
| if (tabIndex < tabStripChildCount - 1) { | ||
| selectedRight = selectedRight + mTitleOffset; | ||
| } | ||
| int scrollX = getScrollX(); | ||
| if (selectedLeft < scrollX && selectedRight > myWidth + scrollX) { | ||
| // the tab is already visible and can't fit the screen, no need to scroll | ||
| return; | ||
| } | ||
| if (selectedLeft < scrollX) { | ||
| if (smoothScroll) { | ||
| smoothScrollTo(selectedLeft, 0); | ||
| } else { | ||
| scrollTo(selectedLeft, 0); | ||
| } | ||
| } else if (selectedRight > myWidth + scrollX) { | ||
| if (smoothScroll) { | ||
| smoothScrollTo(selectedRight - myWidth, 0); | ||
| } else { | ||
| scrollTo(selectedRight - myWidth, 0); | ||
| } | ||
| } | ||
| } | ||
| private class InternalViewPagerListener extends OnPageChangeCallback { | ||
@@ -439,3 +488,3 @@ private int mScrollState; | ||
| if (positionOffset == 0 && mScrollState == androidx.viewpager.widget.ViewPager.SCROLL_STATE_SETTLING) { | ||
| scrollToTab(position, 0); | ||
| makeTabVisible(position); | ||
| } | ||
@@ -442,0 +491,0 @@ } |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
254558
0.65%3944
1.08%