use of net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ClipPagerTitleView in project MagicIndicator by hackware1993.
the class DynamicTabExampleActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dynamic_tab_example_layout);
mViewPager = (ViewPager) findViewById(R.id.view_pager);
mViewPager.setAdapter(mExamplePagerAdapter);
mMagicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator1);
mMagicIndicator.setBackgroundColor(Color.parseColor("#d43d3d"));
mCommonNavigator = new CommonNavigator(this);
mCommonNavigator.setSkimOver(true);
mCommonNavigator.setAdapter(new CommonNavigatorAdapter() {
@Override
public int getCount() {
return mDataList.size();
}
@Override
public IPagerTitleView getTitleView(Context context, final int index) {
ClipPagerTitleView clipPagerTitleView = new ClipPagerTitleView(context);
clipPagerTitleView.setText(mDataList.get(index));
clipPagerTitleView.setTextColor(Color.parseColor("#f2c4c4"));
clipPagerTitleView.setClipColor(Color.WHITE);
clipPagerTitleView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mViewPager.setCurrentItem(index);
}
});
return clipPagerTitleView;
}
@Override
public IPagerIndicator getIndicator(Context context) {
return null;
}
});
mMagicIndicator.setNavigator(mCommonNavigator);
ViewPagerHelper.bind(mMagicIndicator, mViewPager);
mToast = Toast.makeText(this, "", Toast.LENGTH_SHORT);
}
use of net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ClipPagerTitleView in project MagicIndicator by hackware1993.
the class FixedTabExampleActivity method initMagicIndicator3.
private void initMagicIndicator3() {
MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator3);
magicIndicator.setBackgroundResource(R.drawable.round_indicator_bg);
CommonNavigator commonNavigator = new CommonNavigator(this);
commonNavigator.setAdapter(new CommonNavigatorAdapter() {
@Override
public int getCount() {
return mDataList == null ? 0 : mDataList.size();
}
@Override
public IPagerTitleView getTitleView(Context context, final int index) {
ClipPagerTitleView clipPagerTitleView = new ClipPagerTitleView(context);
clipPagerTitleView.setText(mDataList.get(index));
clipPagerTitleView.setTextColor(Color.parseColor("#e94220"));
clipPagerTitleView.setClipColor(Color.WHITE);
clipPagerTitleView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mViewPager.setCurrentItem(index);
}
});
return clipPagerTitleView;
}
@Override
public IPagerIndicator getIndicator(Context context) {
LinePagerIndicator indicator = new LinePagerIndicator(context);
float navigatorHeight = context.getResources().getDimension(R.dimen.common_navigator_height);
float borderWidth = UIUtil.dip2px(context, 1);
float lineHeight = navigatorHeight - 2 * borderWidth;
indicator.setLineHeight(lineHeight);
indicator.setRoundRadius(lineHeight / 2);
indicator.setYOffset(borderWidth);
indicator.setColors(Color.parseColor("#bc2a2a"));
return indicator;
}
});
magicIndicator.setNavigator(commonNavigator);
ViewPagerHelper.bind(magicIndicator, mViewPager);
}
use of net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ClipPagerTitleView in project MagicIndicator by hackware1993.
the class FragmentContainerExampleActivity method initMagicIndicator1.
private void initMagicIndicator1() {
MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator1);
magicIndicator.setBackgroundResource(R.drawable.round_indicator_bg);
CommonNavigator commonNavigator = new CommonNavigator(this);
commonNavigator.setAdapter(new CommonNavigatorAdapter() {
@Override
public int getCount() {
return CHANNELS.length;
}
@Override
public IPagerTitleView getTitleView(Context context, final int index) {
ClipPagerTitleView clipPagerTitleView = new ClipPagerTitleView(context);
clipPagerTitleView.setText(CHANNELS[index]);
clipPagerTitleView.setTextColor(Color.parseColor("#e94220"));
clipPagerTitleView.setClipColor(Color.WHITE);
clipPagerTitleView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mFragmentContainerHelper.handlePageSelected(index);
switchPages(index);
}
});
return clipPagerTitleView;
}
@Override
public IPagerIndicator getIndicator(Context context) {
LinePagerIndicator indicator = new LinePagerIndicator(context);
float navigatorHeight = context.getResources().getDimension(R.dimen.common_navigator_height);
float borderWidth = UIUtil.dip2px(context, 1);
float lineHeight = navigatorHeight - 2 * borderWidth;
indicator.setLineHeight(lineHeight);
indicator.setRoundRadius(lineHeight / 2);
indicator.setYOffset(borderWidth);
indicator.setColors(Color.parseColor("#bc2a2a"));
return indicator;
}
});
magicIndicator.setNavigator(commonNavigator);
mFragmentContainerHelper.attachMagicIndicator(magicIndicator);
}
use of net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ClipPagerTitleView in project MagicIndicator by hackware1993.
the class ScrollableTabExampleActivity method initMagicIndicator1.
private void initMagicIndicator1() {
MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator1);
magicIndicator.setBackgroundColor(Color.parseColor("#d43d3d"));
CommonNavigator commonNavigator = new CommonNavigator(this);
commonNavigator.setSkimOver(true);
int padding = UIUtil.getScreenWidth(this) / 2;
commonNavigator.setRightPadding(padding);
commonNavigator.setLeftPadding(padding);
commonNavigator.setAdapter(new CommonNavigatorAdapter() {
@Override
public int getCount() {
return mDataList == null ? 0 : mDataList.size();
}
@Override
public IPagerTitleView getTitleView(Context context, final int index) {
ClipPagerTitleView clipPagerTitleView = new ClipPagerTitleView(context);
clipPagerTitleView.setText(mDataList.get(index));
clipPagerTitleView.setTextColor(Color.parseColor("#f2c4c4"));
clipPagerTitleView.setClipColor(Color.WHITE);
clipPagerTitleView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mViewPager.setCurrentItem(index);
}
});
return clipPagerTitleView;
}
@Override
public IPagerIndicator getIndicator(Context context) {
return null;
}
});
magicIndicator.setNavigator(commonNavigator);
ViewPagerHelper.bind(magicIndicator, mViewPager);
}
use of net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ClipPagerTitleView in project MagicIndicator by hackware1993.
the class BadgeTabExampleActivity method initMagicIndicator3.
private void initMagicIndicator3() {
MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator3);
magicIndicator.setBackgroundResource(R.drawable.round_indicator_bg);
CommonNavigator commonNavigator = new CommonNavigator(this);
commonNavigator.setAdapter(new CommonNavigatorAdapter() {
@Override
public int getCount() {
return mDataList == null ? 0 : mDataList.size();
}
@Override
public IPagerTitleView getTitleView(Context context, final int index) {
BadgePagerTitleView badgePagerTitleView = new BadgePagerTitleView(context);
ClipPagerTitleView clipPagerTitleView = new ClipPagerTitleView(context);
clipPagerTitleView.setText(mDataList.get(index));
clipPagerTitleView.setTextColor(Color.parseColor("#e94220"));
clipPagerTitleView.setClipColor(Color.WHITE);
clipPagerTitleView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mViewPager.setCurrentItem(index);
}
});
badgePagerTitleView.setInnerPagerTitleView(clipPagerTitleView);
return badgePagerTitleView;
}
@Override
public IPagerIndicator getIndicator(Context context) {
LinePagerIndicator indicator = new LinePagerIndicator(context);
float navigatorHeight = context.getResources().getDimension(R.dimen.common_navigator_height);
float borderWidth = UIUtil.dip2px(context, 1);
float lineHeight = navigatorHeight - 2 * borderWidth;
indicator.setLineHeight(lineHeight);
indicator.setRoundRadius(lineHeight / 2);
indicator.setYOffset(borderWidth);
indicator.setColors(Color.parseColor("#bc2a2a"));
return indicator;
}
});
magicIndicator.setNavigator(commonNavigator);
ViewPagerHelper.bind(magicIndicator, mViewPager);
}
Aggregations