Skip to content

Commit

Permalink
2.0版本
Browse files Browse the repository at this point in the history
1. 修复TabcolorTextview 点击不同item时,颜色还残留的问题
2. 修复点击item跨度比较大,每一个都缩放的问题
3. 增加默认TextView和TextColorView,简便编写
  • Loading branch information
Zzhengsr committed Feb 28, 2022
1 parent 51a6fb8 commit 599e7b0
Show file tree
Hide file tree
Showing 35 changed files with 721 additions and 310 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions appx/src/main/java/com/zhengsr/tabhelper/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.zhengsr.tabhelper;

import android.app.Application;

import com.weikaiyun.fragmentation.Fragmentation;

/**
* @author by zhengshaorui 2022/2/26
* describe:
*/
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
Fragmentation.builder() // 设置 栈视图 模式为 (默认)悬浮球模式 SHAKE: 摇一摇唤出 NONE:隐藏, 仅在Debug环境生效
.stackViewMode(Fragmentation.BUBBLE)
.debug(BuildConfig.DEBUG) // 实际场景建议.debug(BuildConfig.DEBUG)
.animation(R.anim.v_fragment_enter, R.anim.v_fragment_pop_exit, R.anim.v_fragment_pop_enter, R.anim.v_fragment_exit) //设置默认动画
.install();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.zhengsr.tabhelper.activity;

import me.yokeyword.fragmentation.SupportActivity;

/**
* @author by zhengshaorui 2022/2/26
* describe:
*/
public class BaseActivity extends SupportActivity {
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,7 @@ private void rectFlow(){
final TabVpFlowLayout flowLayout = findViewById(R.id.rectflow);
// flowLayout.setViewPager(mViewPager,R.id.item_text,getResources().getColor(R.color.unselect),Color.WHITE);
flowLayout.setViewPager(mViewPager);
flowLayout.setAdapter(new TabFlowAdapter<String>(R.layout.tab_text_layout,mTitle) {
@Override
public void bindView(View view, String data, int position) {
setText(view, R.id.item_text,data);
}

@Override
public void onItemClick(View view, String data, int position) {
super.onItemClick(view, data, position);
//mViewPager.setCurrentItem(position);

}
});
flowLayout.setAdapter(new TabFlowAdapter<String>(mTitle));



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ protected void onCreate(Bundle savedInstanceState) {
flowLayout.setAdapter(new LabelFlowAdapter<String>(R.layout.item_textview,mTitle) {
@Override
public void bindView(View view, String data, int position) {
setText(view, R.id.item_text,data)
.setTextColor(view, R.id.item_text, Color.BLACK);
setDefaultText(view,data)
.setDefaultTextColor(view, Color.BLACK);
}
@Override
public void onItemSelectState(View view, boolean isSelected) {
super.onItemSelectState(view, isSelected);
if (isSelected){
setTextColor(view, R.id.item_text,getResources().getColor(R.color.colorPrimary));
setDefaultTextColor(view, getResources().getColor(R.color.colorPrimary));
}else{
setTextColor(view, R.id.item_text,Color.BLACK);
setDefaultTextColor(view,Color.BLACK);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ protected void onCreate(Bundle savedInstanceState) {

final TabFlowAdapter adapter ;


TabConfig config = new TabConfig.Builder()
.setViewPager(mViewPager)
.setTextId(R.id.item_text)
Expand All @@ -59,7 +60,7 @@ protected void onCreate(Bundle savedInstanceState) {

@Override
public void bindView(View view, String data, int position) {
setText(view, R.id.item_text,data);
setDefaultText(view,data);
}

@Override
Expand Down
Loading

0 comments on commit 599e7b0

Please sign in to comment.