@nativescript-community/ui-material-core 6.2.24 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -1
- package/package.json +2 -2
- package/platforms/android/include.gradle +3 -3
- package/platforms/android/java/com/nativescript/material/core/BottomNavigationBar.java +0 -311
- package/platforms/android/java/com/nativescript/material/core/TabItemSpec.java +0 -15
- package/platforms/android/java/com/nativescript/material/core/TabLayout.java +0 -441
- package/platforms/android/java/com/nativescript/material/core/TabStrip.java +0 -264
- package/platforms/android/java/com/nativescript/material/core/TabViewPager.java +0 -62
- package/platforms/android/java/com/nativescript/material/core/TabsBar.java +0 -442
@@ -1,62 +0,0 @@
|
|
1
|
-
package com.nativescript.material.core;
|
2
|
-
|
3
|
-
import android.content.Context;
|
4
|
-
import androidx.viewpager.widget.ViewPager;
|
5
|
-
import android.util.AttributeSet;
|
6
|
-
import android.view.MotionEvent;
|
7
|
-
import android.view.KeyEvent;
|
8
|
-
|
9
|
-
// See this thread for more information https://stackoverflow.com/questions/9650265
|
10
|
-
public class TabViewPager extends ViewPager {
|
11
|
-
private boolean swipePageEnabled = true;
|
12
|
-
private boolean animationEnabled = true;
|
13
|
-
|
14
|
-
public TabViewPager(Context context) {
|
15
|
-
super(context);
|
16
|
-
}
|
17
|
-
|
18
|
-
public TabViewPager(Context context, AttributeSet attrs) {
|
19
|
-
super(context, attrs);
|
20
|
-
}
|
21
|
-
|
22
|
-
public void setSwipePageEnabled(boolean enabled) {
|
23
|
-
this.swipePageEnabled = enabled;
|
24
|
-
}
|
25
|
-
|
26
|
-
public void setAnimationEnabled(boolean enabled) {
|
27
|
-
this.animationEnabled = enabled;
|
28
|
-
}
|
29
|
-
|
30
|
-
@Override
|
31
|
-
public boolean onInterceptTouchEvent(MotionEvent event) {
|
32
|
-
if (this.swipePageEnabled) {
|
33
|
-
return super.onInterceptTouchEvent(event);
|
34
|
-
}
|
35
|
-
|
36
|
-
return false;
|
37
|
-
}
|
38
|
-
|
39
|
-
@Override
|
40
|
-
public boolean onTouchEvent(MotionEvent event) {
|
41
|
-
if (this.swipePageEnabled) {
|
42
|
-
return super.onTouchEvent(event);
|
43
|
-
}
|
44
|
-
|
45
|
-
return false;
|
46
|
-
}
|
47
|
-
|
48
|
-
@Override
|
49
|
-
public boolean executeKeyEvent(KeyEvent event) {
|
50
|
-
if (this.swipePageEnabled) {
|
51
|
-
return super.executeKeyEvent(event);
|
52
|
-
}
|
53
|
-
|
54
|
-
return false;
|
55
|
-
}
|
56
|
-
|
57
|
-
@Override
|
58
|
-
public void setCurrentItem(int item) {
|
59
|
-
boolean smoothScroll = this.animationEnabled;
|
60
|
-
super.setCurrentItem(item, smoothScroll);
|
61
|
-
}
|
62
|
-
}
|
@@ -1,442 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright 2014 Google Inc. All rights reserved.
|
3
|
-
*
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
* you may not use this file except in compliance with the License.
|
6
|
-
* You may obtain a copy of the License at
|
7
|
-
*
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
*
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
* See the License for the specific language governing permissions and
|
14
|
-
* limitations under the License.
|
15
|
-
*/
|
16
|
-
|
17
|
-
package com.nativescript.material.core;
|
18
|
-
|
19
|
-
import android.content.Context;
|
20
|
-
import android.graphics.Typeface;
|
21
|
-
import androidx.viewpager.widget.PagerAdapter;
|
22
|
-
import androidx.viewpager.widget.ViewPager;
|
23
|
-
import android.text.TextUtils;
|
24
|
-
import android.util.AttributeSet;
|
25
|
-
import android.util.SparseArray;
|
26
|
-
import android.util.TypedValue;
|
27
|
-
import android.view.Gravity;
|
28
|
-
import android.view.View;
|
29
|
-
import android.view.ViewGroup;
|
30
|
-
import android.widget.HorizontalScrollView;
|
31
|
-
import android.widget.ImageView;
|
32
|
-
import android.widget.ImageView.ScaleType;
|
33
|
-
import android.widget.LinearLayout;
|
34
|
-
import android.widget.TextView;
|
35
|
-
|
36
|
-
/**
|
37
|
-
* To be used with ViewPager to provide a tab indicator component which give
|
38
|
-
* constant feedback as to the user's scroll progress.
|
39
|
-
* <p>
|
40
|
-
* To use the component, simply add it to your view hierarchy. Then in your
|
41
|
-
* {@link android.app.Activity} or {@link android.support.v4.app.Fragment} call
|
42
|
-
* {@link #setViewPager(ViewPager)} providing it the ViewPager this layout is
|
43
|
-
* being used for.
|
44
|
-
* <p>
|
45
|
-
* The colors can be customized in two ways. The first and simplest is to
|
46
|
-
* provide an array of colors via {@link #setSelectedIndicatorColors(int...)}.
|
47
|
-
* The alternative is via the {@link TabColorizer} interface which provides you
|
48
|
-
* complete control over which color is used for any individual position.
|
49
|
-
* <p>
|
50
|
-
*/
|
51
|
-
public class TabsBar extends HorizontalScrollView {
|
52
|
-
/**
|
53
|
-
* Allows complete control over the colors drawn in the tab layout. Set with
|
54
|
-
* {@link #setCustomTabColorizer(TabColorizer)}.
|
55
|
-
*/
|
56
|
-
public interface TabColorizer {
|
57
|
-
|
58
|
-
/**
|
59
|
-
* @return return the color of the indicator used when {@code position}
|
60
|
-
* is selected.
|
61
|
-
*/
|
62
|
-
int getIndicatorColor(int position);
|
63
|
-
|
64
|
-
}
|
65
|
-
|
66
|
-
private static final int TITLE_OFFSET_DIPS = 24;
|
67
|
-
private static final int TAB_VIEW_PADDING_DIPS = 16;
|
68
|
-
private static final int TAB_VIEW_TEXT_SIZE_SP = 12;
|
69
|
-
private static final int TEXT_MAX_WIDTH = 180;
|
70
|
-
private static final int SMALL_MIN_HEIGHT = 48;
|
71
|
-
private static final int LARGE_MIN_HEIGHT = 72;
|
72
|
-
|
73
|
-
private int mTitleOffset;
|
74
|
-
|
75
|
-
private boolean mDistributeEvenly = true;
|
76
|
-
|
77
|
-
private TabItemSpec[] mTabItems;
|
78
|
-
private ViewPager mViewPager;
|
79
|
-
private SparseArray<String> mContentDescriptions = new SparseArray<String>();
|
80
|
-
private ViewPager.OnPageChangeListener mViewPagerPageChangeListener;
|
81
|
-
|
82
|
-
private final TabStrip mTabStrip;
|
83
|
-
|
84
|
-
public TabsBar(Context context) {
|
85
|
-
this(context, null);
|
86
|
-
}
|
87
|
-
|
88
|
-
public TabsBar(Context context, AttributeSet attrs) {
|
89
|
-
this(context, attrs, 0);
|
90
|
-
}
|
91
|
-
|
92
|
-
public TabsBar(Context context, AttributeSet attrs, int defStyle) {
|
93
|
-
super(context, attrs, defStyle);
|
94
|
-
// Disable the Scroll Bar
|
95
|
-
setHorizontalScrollBarEnabled(false);
|
96
|
-
// Make sure that the Tab Strips fills this View
|
97
|
-
setFillViewport(true);
|
98
|
-
|
99
|
-
mTitleOffset = (int) (TITLE_OFFSET_DIPS * getResources().getDisplayMetrics().density);
|
100
|
-
|
101
|
-
mTabStrip = new TabStrip(context);
|
102
|
-
addView(mTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
|
103
|
-
}
|
104
|
-
|
105
|
-
/**
|
106
|
-
* Set the custom {@link TabColorizer} to be used.
|
107
|
-
*
|
108
|
-
* If you only require simple customisation then you can use
|
109
|
-
* {@link #setSelectedIndicatorColors(int...)} to achieve similar effects.
|
110
|
-
*/
|
111
|
-
public void setCustomTabColorizer(TabColorizer tabColorizer) {
|
112
|
-
//mTabStrip.setCustomTabColorizer(tabColorizer);
|
113
|
-
}
|
114
|
-
|
115
|
-
public void setDistributeEvenly(boolean distributeEvenly) {
|
116
|
-
mDistributeEvenly = distributeEvenly;
|
117
|
-
}
|
118
|
-
|
119
|
-
/**
|
120
|
-
* Sets the colors to be used for indicating the selected tab. These colors
|
121
|
-
* are treated as a circular array. Providing one color will mean that all
|
122
|
-
* tabs are indicated with the same color.
|
123
|
-
*/
|
124
|
-
public void setSelectedIndicatorColors(int... colors) {
|
125
|
-
mTabStrip.setSelectedIndicatorColors(colors);
|
126
|
-
this.mSelectedIndicatorColors = colors;
|
127
|
-
}
|
128
|
-
|
129
|
-
private int[] mSelectedIndicatorColors;
|
130
|
-
public int[] getSelectedIndicatorColors() {
|
131
|
-
return this.mSelectedIndicatorColors;
|
132
|
-
}
|
133
|
-
|
134
|
-
public void setTabTextColor(int color){
|
135
|
-
mTabStrip.setTabTextColor(color);
|
136
|
-
}
|
137
|
-
|
138
|
-
public int getTabTextColor(){
|
139
|
-
return mTabStrip.getTabTextColor();
|
140
|
-
}
|
141
|
-
|
142
|
-
public void setSelectedTabTextColor(int color){
|
143
|
-
mTabStrip.setSelectedTabTextColor(color);
|
144
|
-
}
|
145
|
-
|
146
|
-
public int getSelectedTabTextColor(){
|
147
|
-
return mTabStrip.getSelectedTabTextColor();
|
148
|
-
}
|
149
|
-
|
150
|
-
public void setTabTextFontSize(float fontSize){
|
151
|
-
mTabStrip.setTabTextFontSize(fontSize);
|
152
|
-
}
|
153
|
-
|
154
|
-
public float getTabTextFontSize(){
|
155
|
-
return mTabStrip.getTabTextFontSize();
|
156
|
-
}
|
157
|
-
|
158
|
-
/**
|
159
|
-
* Set the {@link ViewPager.OnPageChangeListener}. When using
|
160
|
-
* {@link TabsBar} you are required to set any
|
161
|
-
* {@link ViewPager.OnPageChangeListener} through this method. This is so
|
162
|
-
* that the layout can update it's scroll position correctly.
|
163
|
-
*
|
164
|
-
* @see ViewPager#setOnPageChangeListener(ViewPager.OnPageChangeListener)
|
165
|
-
*/
|
166
|
-
public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) {
|
167
|
-
mViewPagerPageChangeListener = listener;
|
168
|
-
}
|
169
|
-
|
170
|
-
/**
|
171
|
-
* Sets the associated view pager. Note that the assumption here is that the
|
172
|
-
* pager content (number of tabs and tab titles) does not change after this
|
173
|
-
* call has been made.
|
174
|
-
*/
|
175
|
-
public void setViewPager(ViewPager viewPager) {
|
176
|
-
this.setItems(null, viewPager);
|
177
|
-
}
|
178
|
-
|
179
|
-
public void setItems(TabItemSpec[] items, ViewPager viewPager) {
|
180
|
-
mTabStrip.removeAllViews();
|
181
|
-
|
182
|
-
mViewPager = viewPager;
|
183
|
-
mTabItems = items;
|
184
|
-
if (viewPager != null) {
|
185
|
-
viewPager.addOnPageChangeListener(new InternalViewPagerListener());
|
186
|
-
populateTabStrip();
|
187
|
-
}
|
188
|
-
}
|
189
|
-
|
190
|
-
/**
|
191
|
-
* Updates the UI of an item at specified index
|
192
|
-
*/
|
193
|
-
public void updateItemAt(int position, TabItemSpec tabItem) {
|
194
|
-
LinearLayout ll = (LinearLayout)mTabStrip.getChildAt(position);
|
195
|
-
ImageView imgView = (ImageView)ll.getChildAt(0);
|
196
|
-
TextView textView = (TextView)ll.getChildAt(1);
|
197
|
-
this.setupItem(ll, textView, imgView, tabItem);
|
198
|
-
}
|
199
|
-
|
200
|
-
/**
|
201
|
-
* Gets the TextView for tab item at index
|
202
|
-
*/
|
203
|
-
public TextView getTextViewForItemAt(int index){
|
204
|
-
LinearLayout ll = this.getViewForItemAt(index);
|
205
|
-
return (ll != null) ? (TextView)ll.getChildAt(1) : null;
|
206
|
-
}
|
207
|
-
|
208
|
-
/**
|
209
|
-
* Gets the LinearLayout container for tab item at index
|
210
|
-
*/
|
211
|
-
public LinearLayout getViewForItemAt(int index){
|
212
|
-
LinearLayout result = null;
|
213
|
-
|
214
|
-
if(this.mTabStrip.getChildCount() > index){
|
215
|
-
result = (LinearLayout)this.mTabStrip.getChildAt(index);
|
216
|
-
}
|
217
|
-
|
218
|
-
return result;
|
219
|
-
}
|
220
|
-
|
221
|
-
/**
|
222
|
-
* Gets the number of realized tabs.
|
223
|
-
*/
|
224
|
-
public int getItemCount(){
|
225
|
-
return this.mTabStrip.getChildCount();
|
226
|
-
}
|
227
|
-
|
228
|
-
/**
|
229
|
-
* Create a default view to be used for tabs.
|
230
|
-
*/
|
231
|
-
protected View createDefaultTabView(Context context, TabItemSpec tabItem) {
|
232
|
-
float density = getResources().getDisplayMetrics().density;
|
233
|
-
int padding = (int) (TAB_VIEW_PADDING_DIPS * density);
|
234
|
-
|
235
|
-
LinearLayout ll = new LinearLayout(context);
|
236
|
-
ll.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
237
|
-
ll.setGravity(Gravity.CENTER);
|
238
|
-
ll.setOrientation(LinearLayout.VERTICAL);
|
239
|
-
TypedValue outValue = new TypedValue();
|
240
|
-
getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
|
241
|
-
ll.setBackgroundResource(outValue.resourceId);
|
242
|
-
|
243
|
-
ImageView imgView = new ImageView(context);
|
244
|
-
imgView.setScaleType(ScaleType.FIT_CENTER);
|
245
|
-
LinearLayout.LayoutParams imgLP = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
246
|
-
imgLP.gravity = Gravity.CENTER;
|
247
|
-
imgView.setLayoutParams(imgLP);
|
248
|
-
|
249
|
-
TextView textView = new TextView(context);
|
250
|
-
textView.setGravity(Gravity.CENTER);
|
251
|
-
textView.setMaxWidth((int) (TEXT_MAX_WIDTH * density));
|
252
|
-
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
|
253
|
-
textView.setEllipsize(TextUtils.TruncateAt.END);
|
254
|
-
textView.setMaxLines(2);
|
255
|
-
textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
256
|
-
textView.setPadding(padding, 0, padding, 0);
|
257
|
-
|
258
|
-
this.setupItem(ll, textView, imgView, tabItem);
|
259
|
-
|
260
|
-
ll.addView(imgView);
|
261
|
-
ll.addView(textView);
|
262
|
-
return ll;
|
263
|
-
}
|
264
|
-
|
265
|
-
private void setupItem(LinearLayout ll, TextView textView,ImageView imgView, TabItemSpec tabItem){
|
266
|
-
float density = getResources().getDisplayMetrics().density;
|
267
|
-
|
268
|
-
if (tabItem.iconId != 0) {
|
269
|
-
imgView.setImageResource(tabItem.iconId);
|
270
|
-
imgView.setVisibility(VISIBLE);
|
271
|
-
} else if (tabItem.iconDrawable != null) {
|
272
|
-
imgView.setImageDrawable(tabItem.iconDrawable);
|
273
|
-
imgView.setVisibility(VISIBLE);
|
274
|
-
} else {
|
275
|
-
imgView.setVisibility(GONE);
|
276
|
-
}
|
277
|
-
|
278
|
-
if (tabItem.title != null && !tabItem.title.isEmpty()) {
|
279
|
-
textView.setText(tabItem.title);
|
280
|
-
textView.setVisibility(VISIBLE);
|
281
|
-
|
282
|
-
if (tabItem.typeFace != null) {
|
283
|
-
textView.setTypeface(tabItem.typeFace);
|
284
|
-
}
|
285
|
-
|
286
|
-
if (tabItem.fontSize != 0) {
|
287
|
-
textView.setTextSize(tabItem.fontSize);
|
288
|
-
}
|
289
|
-
|
290
|
-
if (tabItem.color != 0) {
|
291
|
-
textView.setTextColor(tabItem.color);
|
292
|
-
mTabStrip.setShouldUpdateTabsTextColor(false);
|
293
|
-
}
|
294
|
-
} else {
|
295
|
-
textView.setVisibility(GONE);
|
296
|
-
}
|
297
|
-
|
298
|
-
if (tabItem.backgroundColor != 0) {
|
299
|
-
ll.setBackgroundColor(tabItem.backgroundColor);
|
300
|
-
}
|
301
|
-
|
302
|
-
if (imgView.getVisibility() == VISIBLE && textView.getVisibility() == VISIBLE) {
|
303
|
-
ll.setMinimumHeight((int) (LARGE_MIN_HEIGHT * density));
|
304
|
-
} else {
|
305
|
-
ll.setMinimumHeight((int) (SMALL_MIN_HEIGHT * density));
|
306
|
-
}
|
307
|
-
|
308
|
-
if (mDistributeEvenly) {
|
309
|
-
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) ll.getLayoutParams();
|
310
|
-
lp.width = 0;
|
311
|
-
lp.weight = 1;
|
312
|
-
}
|
313
|
-
}
|
314
|
-
|
315
|
-
public boolean onTap(int position) {
|
316
|
-
// to be overridden in JS
|
317
|
-
return true;
|
318
|
-
}
|
319
|
-
|
320
|
-
private void populateTabStrip() {
|
321
|
-
final PagerAdapter adapter = mViewPager.getAdapter();
|
322
|
-
final OnClickListener tabClickListener = new TabClickListener();
|
323
|
-
|
324
|
-
for (int i = 0; i < adapter.getCount(); i++) {
|
325
|
-
View tabView = null;
|
326
|
-
|
327
|
-
TabItemSpec tabItem;
|
328
|
-
if (this.mTabItems != null && this.mTabItems.length > i) {
|
329
|
-
tabItem = this.mTabItems[i];
|
330
|
-
} else {
|
331
|
-
tabItem = new TabItemSpec();
|
332
|
-
tabItem.title = adapter.getPageTitle(i).toString();
|
333
|
-
}
|
334
|
-
|
335
|
-
tabView = createDefaultTabView(getContext(), tabItem);
|
336
|
-
|
337
|
-
tabView.setOnClickListener(tabClickListener);
|
338
|
-
String desc = mContentDescriptions.get(i, null);
|
339
|
-
if (desc != null) {
|
340
|
-
tabView.setContentDescription(desc);
|
341
|
-
}
|
342
|
-
|
343
|
-
mTabStrip.addView(tabView);
|
344
|
-
if (i == mViewPager.getCurrentItem()) {
|
345
|
-
tabView.setSelected(true);
|
346
|
-
}
|
347
|
-
}
|
348
|
-
}
|
349
|
-
|
350
|
-
public void setContentDescription(int i, String desc) {
|
351
|
-
mContentDescriptions.put(i, desc);
|
352
|
-
}
|
353
|
-
|
354
|
-
@Override
|
355
|
-
protected void onAttachedToWindow() {
|
356
|
-
super.onAttachedToWindow();
|
357
|
-
|
358
|
-
if (mViewPager != null) {
|
359
|
-
scrollToTab(mViewPager.getCurrentItem(), 0);
|
360
|
-
}
|
361
|
-
}
|
362
|
-
|
363
|
-
private void scrollToTab(int tabIndex, int positionOffset) {
|
364
|
-
final int tabStripChildCount = mTabStrip.getChildCount();
|
365
|
-
if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) {
|
366
|
-
return;
|
367
|
-
}
|
368
|
-
|
369
|
-
View selectedChild = mTabStrip.getChildAt(tabIndex);
|
370
|
-
if (selectedChild != null) {
|
371
|
-
int targetScrollX = selectedChild.getLeft() + positionOffset;
|
372
|
-
|
373
|
-
if (tabIndex > 0 || positionOffset > 0) {
|
374
|
-
// If we're not at the first child and are mid-scroll, make sure
|
375
|
-
// we obey the offset
|
376
|
-
targetScrollX -= mTitleOffset;
|
377
|
-
}
|
378
|
-
|
379
|
-
scrollTo(targetScrollX, 0);
|
380
|
-
}
|
381
|
-
}
|
382
|
-
|
383
|
-
private class InternalViewPagerListener implements ViewPager.OnPageChangeListener {
|
384
|
-
private int mScrollState;
|
385
|
-
|
386
|
-
@Override
|
387
|
-
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
388
|
-
int tabStripChildCount = mTabStrip.getChildCount();
|
389
|
-
if ((tabStripChildCount == 0) || (position < 0) || (position >= tabStripChildCount)) {
|
390
|
-
return;
|
391
|
-
}
|
392
|
-
|
393
|
-
mTabStrip.onTabsViewPagerPageChanged(position, positionOffset);
|
394
|
-
|
395
|
-
View selectedTitle = mTabStrip.getChildAt(position);
|
396
|
-
int extraOffset = (selectedTitle != null) ? (int) (positionOffset * selectedTitle.getWidth()) : 0;
|
397
|
-
scrollToTab(position, extraOffset);
|
398
|
-
|
399
|
-
if (mViewPagerPageChangeListener != null) {
|
400
|
-
mViewPagerPageChangeListener.onPageScrolled(position, positionOffset, positionOffsetPixels);
|
401
|
-
}
|
402
|
-
}
|
403
|
-
|
404
|
-
@Override
|
405
|
-
public void onPageScrollStateChanged(int state) {
|
406
|
-
mScrollState = state;
|
407
|
-
|
408
|
-
if (mViewPagerPageChangeListener != null) {
|
409
|
-
mViewPagerPageChangeListener.onPageScrollStateChanged(state);
|
410
|
-
}
|
411
|
-
}
|
412
|
-
|
413
|
-
@Override
|
414
|
-
public void onPageSelected(int position) {
|
415
|
-
if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {
|
416
|
-
mTabStrip.onTabsViewPagerPageChanged(position, 0f);
|
417
|
-
scrollToTab(position, 0);
|
418
|
-
}
|
419
|
-
for (int i = 0; i < mTabStrip.getChildCount(); i++) {
|
420
|
-
mTabStrip.getChildAt(i).setSelected(position == i);
|
421
|
-
}
|
422
|
-
if (mViewPagerPageChangeListener != null) {
|
423
|
-
mViewPagerPageChangeListener.onPageSelected(position);
|
424
|
-
}
|
425
|
-
}
|
426
|
-
|
427
|
-
}
|
428
|
-
|
429
|
-
private class TabClickListener implements OnClickListener {
|
430
|
-
@Override
|
431
|
-
public void onClick(View v) {
|
432
|
-
for (int i = 0; i < mTabStrip.getChildCount(); i++) {
|
433
|
-
if (v == mTabStrip.getChildAt(i)) {
|
434
|
-
if (onTap(i)) {
|
435
|
-
mViewPager.setCurrentItem(i);
|
436
|
-
}
|
437
|
-
return;
|
438
|
-
}
|
439
|
-
}
|
440
|
-
}
|
441
|
-
}
|
442
|
-
}
|