作者 liyan

新功能页面基本完成修改部分功能

1 package com.yinhebairong.shejiao.mine; 1 package com.yinhebairong.shejiao.mine;
2 2
3 import android.os.Bundle; 3 import android.os.Bundle;
4 -import android.view.LayoutInflater;  
5 import android.view.View; 4 import android.view.View;
6 -import android.widget.ImageView;  
7 import android.widget.TextView; 5 import android.widget.TextView;
8 -  
9 import androidx.fragment.app.Fragment; 6 import androidx.fragment.app.Fragment;
10 import androidx.viewpager.widget.ViewPager; 7 import androidx.viewpager.widget.ViewPager;
11 -  
12 import com.google.android.material.tabs.TabLayout; 8 import com.google.android.material.tabs.TabLayout;
13 import com.yinhebairong.shejiao.R; 9 import com.yinhebairong.shejiao.R;
14 -import com.yinhebairong.shejiao.bang.RankingListFragment;  
15 import com.yinhebairong.shejiao.base.BasePBActivity; 10 import com.yinhebairong.shejiao.base.BasePBActivity;
16 -import com.yinhebairong.shejiao.main.adapter.MyAdapter;  
17 import com.yinhebairong.shejiao.main.adapter.MyTextAndImageAdapter; 11 import com.yinhebairong.shejiao.main.adapter.MyTextAndImageAdapter;
18 import com.yinhebairong.shejiao.main.bean.TabBean; 12 import com.yinhebairong.shejiao.main.bean.TabBean;
19 import com.yinhebairong.shejiao.mine.fragment.CreateIntroduceWebFragment; 13 import com.yinhebairong.shejiao.mine.fragment.CreateIntroduceWebFragment;
20 -import com.yinhebairong.shejiao.mine.fragment.IncomeLineChartFragment;  
21 -import com.yinhebairong.shejiao.topic.TopicNewFragment;  
22 -import com.yinhebairong.shejiao.view.ScrollableNestedScrollView;  
23 -  
24 import java.lang.reflect.Field; 14 import java.lang.reflect.Field;
25 import java.util.ArrayList; 15 import java.util.ArrayList;
26 import java.util.List; 16 import java.util.List;
27 -  
28 import butterknife.BindView; 17 import butterknife.BindView;
29 -  
30 import static com.yinhebairong.shejiao.main.fragment.SquareFragment.POSITION_ATTENTION; 18 import static com.yinhebairong.shejiao.main.fragment.SquareFragment.POSITION_ATTENTION;
31 import static com.yinhebairong.shejiao.main.fragment.SquareFragment.POSITION_SUGGEST; 19 import static com.yinhebairong.shejiao.main.fragment.SquareFragment.POSITION_SUGGEST;
32 20
@@ -62,8 +50,6 @@ public class CreateIntroduceActivity extends BasePBActivity { @@ -62,8 +50,6 @@ public class CreateIntroduceActivity extends BasePBActivity {
62 mTabBeanList.add(new TabBean("规范说明", false));//1 50 mTabBeanList.add(new TabBean("规范说明", false));//1
63 mTabBeanList.add(new TabBean("信用分规则", false)); 51 mTabBeanList.add(new TabBean("信用分规则", false));
64 mTabBeanList.add(new TabBean("云创计划", false)); 52 mTabBeanList.add(new TabBean("云创计划", false));
65 - // todo 隐藏榜单  
66 -// mTabBeanList.add(new TabBean("榜单", false));  
67 53
68 fragmentList.add(CreateIntroduceWebFragment.newInstance(0)); 54 fragmentList.add(CreateIntroduceWebFragment.newInstance(0));
69 fragmentList.add(CreateIntroduceWebFragment.newInstance(0)); 55 fragmentList.add(CreateIntroduceWebFragment.newInstance(0));
@@ -75,8 +61,6 @@ public class CreateIntroduceActivity extends BasePBActivity { @@ -75,8 +61,6 @@ public class CreateIntroduceActivity extends BasePBActivity {
75 viewPager.setOffscreenPageLimit(fragmentList.size()); 61 viewPager.setOffscreenPageLimit(fragmentList.size());
76 tabLayout.setupWithViewPager(viewPager); 62 tabLayout.setupWithViewPager(viewPager);
77 63
78 -// viewPager.resetHeight(0);  
79 -  
80 //初始化Tab样式 64 //初始化Tab样式
81 for (int i = 0; i < tabLayout.getTabCount(); i++) { 65 for (int i = 0; i < tabLayout.getTabCount(); i++) {
82 TabLayout.Tab tab = tabLayout.getTabAt(i).setCustomView(fragmentAdapter.getTabView(i)); 66 TabLayout.Tab tab = tabLayout.getTabAt(i).setCustomView(fragmentAdapter.getTabView(i));
@@ -86,8 +70,6 @@ public class CreateIntroduceActivity extends BasePBActivity { @@ -86,8 +70,6 @@ public class CreateIntroduceActivity extends BasePBActivity {
86 textView.getPaint().setFakeBoldText(i == POSITION_SUGGEST); 70 textView.getPaint().setFakeBoldText(i == POSITION_SUGGEST);
87 textView.setTextColor(getResources().getColor(i == POSITION_SUGGEST ? R.color.textBlackB1 : R.color.textBlackB3)); 71 textView.setTextColor(getResources().getColor(i == POSITION_SUGGEST ? R.color.textBlackB1 : R.color.textBlackB3));
88 if (i == POSITION_ATTENTION) { 72 if (i == POSITION_ATTENTION) {
89 -// textView.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, R.mipmap.icon_triangle_n, 0);  
90 - //反射设置TabLayout的点击事件  
91 Class c = tab.getClass(); 73 Class c = tab.getClass();
92 try { 74 try {
93 Field field = c.getDeclaredField("view"); 75 Field field = c.getDeclaredField("view");
@@ -109,7 +91,6 @@ public class CreateIntroduceActivity extends BasePBActivity { @@ -109,7 +91,6 @@ public class CreateIntroduceActivity extends BasePBActivity {
109 e.printStackTrace(); 91 e.printStackTrace();
110 } 92 }
111 } 93 }
112 -  
113 } 94 }
114 } 95 }
115 if (tabName.equals("0")){ 96 if (tabName.equals("0")){
@@ -148,20 +129,6 @@ public class CreateIntroduceActivity extends BasePBActivity { @@ -148,20 +129,6 @@ public class CreateIntroduceActivity extends BasePBActivity {
148 tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { 129 tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
149 @Override 130 @Override
150 public void onTabSelected(TabLayout.Tab tab) { 131 public void onTabSelected(TabLayout.Tab tab) {
151 -// switch (tab.getPosition()) {  
152 -// case 0:  
153 -// tab.getCustomView().findViewById(R.id.iv_image).setBackgroundResource(R.mipmap.icon_shouyixiangqing);  
154 -// break;  
155 -// case 1:  
156 -// tab.getCustomView().findViewById(R.id.iv_image).setBackgroundResource(R.mipmap.icon_guifanshuoming);  
157 -// break;  
158 -// case 2:  
159 -// tab.getCustomView().findViewById(R.id.iv_image).setBackgroundResource(R.mipmap.icon_xinyongfenguize);  
160 -// break;  
161 -// case 3:  
162 -// tab.getCustomView().findViewById(R.id.iv_image).setBackgroundResource(R.mipmap.icon_yunchaungjihua);  
163 -// break;  
164 -// }  
165 TextView textView = (TextView) tab.getCustomView().findViewById(R.id.tv_text); 132 TextView textView = (TextView) tab.getCustomView().findViewById(R.id.tv_text);
166 133
167 textView.setText(tab.getText()); 134 textView.setText(tab.getText());