diff --git a/README.md b/README.md
index 696c0d2..eadf8d1 100644
--- a/README.md
+++ b/README.md
@@ -28,14 +28,14 @@
[BGABadgeView-Android](https://github.com/bingoogolapple/BGABadgeView-Android)
# Usage:
- 1.Introducing Gradle dependency
+1.Introducing Gradle dependency
```
repositories {
jcenter()
}
dependencies{
- compile 'com.jpeng:JPTabBar:1.3.5'
+ compile 'com.jpeng:JPTabBar:1.4.0'
}
```
@@ -122,37 +122,22 @@ In addition, if you want to achieve the effect of the highlight button, you need
* The Badge Can draggable when you use true.
*/
public void showBadge(int position,String text,boolean draggable);
-
- /**
- * set the icon and title filter when scroll page and click the tab
- * default value is false
- */
- public JPTabBar setUseFilter(boolean filter);
-
- /**
- * Set the boolean If Need the PageAnimate
- * default value is false
- */
- public JPTabBar setUseScrollAnimate(boolean scrollAnimate);
/**
*Show the Circle point
*/
public void showCircleBadge(int pos);
-
- /**
- * Set the Badge Message Count Limit
- * If you use ShowBadge(int position,int count)
- * If the Second parameters > limit , it will show "limit+"
- * you can see the screenshots
- */
- public void setCountLimit(int limit);
/**
* Hide the OVAL Badge
*/
public void hideBadge(int position);
+ /**
+ * get if the badge showing
+ */
+ public boolean isBadgeShow(int index)
+
/**
* Switch Tab page
*/
@@ -172,6 +157,16 @@ In addition, if you want to achieve the effect of the highlight button, you need
* get the TabMiddleItem View that you set in "TabMiddleView" attribute
*/
public View getMiddleView();
+
+ /**
+ * set TabItem title
+ */
+ public void setTitle(int pos, String title)
+
+ /**
+ * get TabItem
+ */
+ public JPTabItem getTabAtPosition(int pos)
```
### Attribute Explain:
| Attribute Name | Attribute Explain | Parameter Type | Default Value |
@@ -181,12 +176,16 @@ In addition, if you want to achieve the effect of the highlight button, you need
| TabTextSize |the textsize of the bottom text |dimension | 14sp |
| TabIconSize |the icon size of the tab |dimension| 24dp |
| TabIconFilter | Set the icon change by the font color|boolean | true |
+| TabTypeface | set tabitems font typeface| string | null |
| TabMargin |Set the icon distance above and below the distance from the text |dimension | 8dp |
| TabSelectBg |Set the TabItem Selected bg |color | transparent |
| TabAnimate |The animate type of the Tab Switch(None,Scale,Jump....) |enum | None |
| TabMiddleView |The middle View of the tab |layout | 无 |
| TabMiddleBottomDis | Midlle icon bottomMargin from TabBar |dimension | 20dp |
| TabMiddleHMargin | MiddleIcon both the left and right margin |dimension | 24dp |
+| TabPressAnimateEnable | enable press down TabItem animation effect |boolean | true |
+| TabPageAnimateEnable | enable page scroll animation |boolean | false |
+| TabGradientEnable | enable the alpha of the icon to change with the page |boolean | false |
| BadgeColor |The background of the badgeView |color | #f00(RED) |
| BadgePadding |The background expansion distance of the badge |dimension | 4dp |
| BadgeTextSize |The textSize of the Badge |dimension | 10dp |
@@ -208,6 +207,8 @@ In addition, if you want to achieve the effect of the highlight button, you need
```
2.If you want to Disable the scroll of ViewPager,you can use NoScrollViewPager in my demo
+3.The callback method of onInterruptSelect in OnTabSelectListener only interrupts the case of clicking on TabItem, and does not consider the page slide past and selected.
+
# The existence problem:
1.About badge function can not drag, drag, disappear and so on, this problem occurred
in a part of millet mobile phone model, the original author is Through the suspension
@@ -270,6 +271,20 @@ setRotationY and setRotationX,The Flip animation is called setRotationY
- Fix a crash when pressing down and not using animation
- Update the default animation is None
+### V1.3.5
+ - adding methods of dynamically modified nodes
+ - Modify the logical judgment of touch events (switch to other Tab ineminable badges)
+ - Fix the error value in TabAnimate in attrs.xml
+ - Exposing the TabItem interface, you can manipulate TabItem directly
+
+### V1.4.0
+ - Add the function of the font type for setting up TabItem
+ - Add the onInterruptSelect callback method to determine whether or not the click event is interrupted
+ - Remove methods and attributes that have little partial effect, such as message limit
+ - Add the control to press down the animation effect switch
+ - Add some TabBar methods, such as modifying a tab title, icons, and so on
+ - Rename the two method names of setUseScrollAnimate setUseFilter and can be set by nodes
+
# About Me
A college student, is still in the study of various techniques...
E-mail:peng8350@gmail.com
diff --git a/README_CN.md b/README_CN.md
index 3851fbb..6830465 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -35,7 +35,7 @@
}
dependencies{
- compile 'com.jpeng:JPTabBar:1.3.5'
+ compile 'com.jpeng:JPTabBar:1.4.0'
}
```
@@ -121,35 +121,20 @@
*/
public void showBadge(int position,String text,boolean draggable);
- /**
- * 设置图标和标题的滑动渐变以及点击渐变是否使用
- * 默认为false
- */
- public JPTabBar setUseFilter(boolean filter);
-
- /**
- * 设置是否需要页面滚动动画
- * 默认为false
- */
- public JPTabBar setUseScrollAnimate(boolean scrollAnimate);
-
/**
*显示圆点徽章
*/
public void showCircleBadge(int pos);
-
- /**
- * 设置徽章消息数量限制数
- * 如果你使用这个方法 ShowBadge(int position,int count)
- * 如果第二个参数 > limit , Badge将会显示 "limit+"
- * 可以看下参考图
- */
- public void setCountLimit(int limit);
/**
* 隐藏BadgeView
*/
public void hideBadge(int position);
+
+ /**
+ * 获取徽章是否显示
+ */
+ public boolean isBadgeShow(int index)
/**
* 切换Tab页面
@@ -170,6 +155,16 @@
* 这个方法用来获得中间TabItem的View对象(即你在XML设置的"TabMiddleView")
*/
public View getMiddleView();
+
+ /**
+ * 设置某个TabItem的标题
+ */
+ public void setTitle(int pos, String title)
+
+ /**
+ * 获取TabItem
+ */
+ public JPTabItem getTabAtPosition(int pos)
```
### 结点说明:
@@ -180,12 +175,16 @@
| TabTextSize |Tab底部文件大小 |dimension | 14sp |
| TabIconSize |Tab图标的大小 |dimension| 24dp |
| TabIconFilter | 设置图标是否随着字体颜色而改变|boolean | true |
+| TabTypeface | 设置所有TabItem的字体类型| string | null |
| TabMargin |设置图标距离上面和文字距离下面的距离 |dimension | 8dp |
| TabSelectBg |设置TabBarItem选中的背景颜色 |color | 透明 |
| TabAnimate |Tab切换的动画类型(None,Scale,Jump....) |enum | NULL |
| TabMiddleView |Tab中间自定义View |layout | 无 |
| TabMiddleBottomDis | 中间图标底部距离 |dimension | 20dp |
| TabMiddleHMargin | 中间图标的左右间距 |dimension | 24dp |
+| TabPressAnimateEnable | 允许按住TabItem的动画效果 |boolean | true |
+| TabPageAnimateEnable | 允许页面滑动效果 |boolean | false |
+| TabGradientEnable | 允许图标颜色随着页面滑动而改变 |boolean | false |
| BadgeColor |徽章的背景颜色 |color | #f00(红色) |
| BadgePadding |徽章的背景扩展距离 |dimension | 4dp |
| BadgeTextSize |徽章显示的字体大小 |dimension | 11dp |
@@ -205,6 +204,8 @@
```
2.如果你想让ViewPager禁止滑动,你可以使用我demo中的NoScrollViewPager
+3.OnTabSelectListener里的onInterruptSelect的回调方法只中断点击TabItem的情况,不考虑页面滑动过去后选中
+
# 存在的问题:
1.关于徽章的功能无法拖动,拖动消失等问题,这个问题发生在一部分小米手机机型上,原作者是
通过悬浮窗口实现徽章的爆炸效果,这类手机默认没有打开悬浮窗的权限
@@ -264,6 +265,20 @@ Flip动画正是调用了setRotationY
- 修正不使用动画时按下奔溃问题
- 修改默认动画为没有动画
+### V1.3.5
+ - 新增动态修改结点的方法
+ - 修正触摸事件逻辑判断问题(换到别的Tab不能滑动徽章)
+ - 修复在attrs里TabAnimate值的错误
+ - 暴露TabItem接口,可以直接操作TabItem
+
+### V1.4.0
+ - 添加设置TabItem的字体类型的功能
+ - 添加onInterruptSelect回调方法来决定是否中断点击事件
+ - 移除部分作用不大的方法和属性,比如:消息限制格式
+ - 增加可以控制按住动画效果开关
+ - 增加TabBar部分方法,比如:修改某个tab标题,图标等
+ - 重命名setUseScrollAnimate setUseFilter这两个方法名,并且可通过结点设置
+
# 关于我
一名在校大学生,目前还在专研学习各种技术中...
邮箱:peng8350@gmail.com
diff --git a/app/src/main/java/com/jpeng/demo/MainActivity.java b/app/src/main/java/com/jpeng/demo/MainActivity.java
index 18d5cdd..bf41484 100644
--- a/app/src/main/java/com/jpeng/demo/MainActivity.java
+++ b/app/src/main/java/com/jpeng/demo/MainActivity.java
@@ -50,9 +50,9 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);
mTabbar = (JPTabBar) findViewById(tabbar);
mPager = (ViewPager) findViewById(R.id.view_pager);
- mTabbar.setTitles("asd","页面二","页面三","页面四").setNormalIcons(R.mipmap.tab1_normal,R.mipmap.tab2_normal,R.mipmap.tab3_normal,R.mipmap.tab4_normal)
- .setSelectedIcons(R.mipmap.tab1_selected,R.mipmap.tab2_selected,R.mipmap.tab3_selected);
-// mTabbar.setTabTypeFace("fonts/Jaden.ttf");
+// mTabbar.setTitles("asd","页面二","页面三","页面四").setNormalIcons(R.mipmap.tab1_normal,R.mipmap.tab2_normal,R.mipmap.tab3_normal,R.mipmap.tab4_normal)
+// .setSelectedIcons(R.mipmap.tab1_selected,R.mipmap.tab2_selected,R.mipmap.tab3_selected,R.mipmap.tab4_selected).generate();
+ mTabbar.setTabTypeFace("fonts/Jaden.ttf");
mTab1 = new Tab1Pager();
mTab2 = new Tab2Pager();
mTab3 = new Tab3Pager();
@@ -70,6 +70,7 @@ protected void onCreate(Bundle savedInstanceState) {
//设置Badge消失的代理
mTabbar.setDismissListener(this);
mTabbar.setTabListener(this);
+ if(mTabbar.getMiddleView()!=null)
mTabbar.getMiddleView().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -91,6 +92,10 @@ public void onTabSelect(int index) {
@Override
public boolean onInterruptSelect(int index) {
+// if(index==2){
+// //如果这里有需要阻止Tab被选中的话,可以return true
+// return true;
+// }
return false;
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index ab86af0..f69a7ac 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -26,6 +26,5 @@
android:background="@drawable/tab_bg"
jp:TabMiddleView="@layout/view_mitem"
jp:TabAnimate="Scale"
- jp:TabPressAnimateEnable="false"
/>
diff --git a/library/build.gradle b/library/build.gradle
index 3064a27..e7b73a0 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -34,7 +34,7 @@ publish {
userOrg = 'peng83508440'//bintray.com用户名
groupId = 'com.jpeng'//jcenter上的路径
artifactId = 'JPTabBar'//项目名称
- publishVersion = '1.3.5'//版本号
+ publishVersion = '1.4.0'//版本号
desc = 'The library can make you build the TabBar more quicky,It contains many animate,and implements the filter like WeChat.'
licences = ['Apache-2.0']
}