|
|
package com.yinhebairong.shejiao.mine;
|
|
|
|
|
|
import android.os.Bundle;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
import androidx.viewpager.widget.ViewPager;
|
|
|
|
|
|
import com.google.android.material.tabs.TabLayout;
|
|
|
import com.yinhebairong.shejiao.R;
|
|
|
import com.yinhebairong.shejiao.bang.RankingListFragment;
|
|
|
import com.yinhebairong.shejiao.base.BasePBActivity;
|
|
|
import com.yinhebairong.shejiao.main.adapter.MyAdapter;
|
|
|
import com.yinhebairong.shejiao.main.adapter.MyTextAndImageAdapter;
|
|
|
import com.yinhebairong.shejiao.main.bean.TabBean;
|
|
|
import com.yinhebairong.shejiao.mine.fragment.CreateIntroduceWebFragment;
|
|
|
import com.yinhebairong.shejiao.mine.fragment.IncomeLineChartFragment;
|
|
|
import com.yinhebairong.shejiao.topic.TopicNewFragment;
|
|
|
import com.yinhebairong.shejiao.view.ScrollableNestedScrollView;
|
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
|
|
|
import static com.yinhebairong.shejiao.main.fragment.SquareFragment.POSITION_ATTENTION;
|
|
|
import static com.yinhebairong.shejiao.main.fragment.SquareFragment.POSITION_SUGGEST;
|
|
|
|
...
|
...
|
@@ -62,8 +50,6 @@ public class CreateIntroduceActivity extends BasePBActivity { |
|
|
mTabBeanList.add(new TabBean("规范说明", false));//1
|
|
|
mTabBeanList.add(new TabBean("信用分规则", false));
|
|
|
mTabBeanList.add(new TabBean("云创计划", false));
|
|
|
// todo 隐藏榜单
|
|
|
// mTabBeanList.add(new TabBean("榜单", false));
|
|
|
|
|
|
fragmentList.add(CreateIntroduceWebFragment.newInstance(0));
|
|
|
fragmentList.add(CreateIntroduceWebFragment.newInstance(0));
|
...
|
...
|
@@ -75,8 +61,6 @@ public class CreateIntroduceActivity extends BasePBActivity { |
|
|
viewPager.setOffscreenPageLimit(fragmentList.size());
|
|
|
tabLayout.setupWithViewPager(viewPager);
|
|
|
|
|
|
// viewPager.resetHeight(0);
|
|
|
|
|
|
//初始化Tab样式
|
|
|
for (int i = 0; i < tabLayout.getTabCount(); i++) {
|
|
|
TabLayout.Tab tab = tabLayout.getTabAt(i).setCustomView(fragmentAdapter.getTabView(i));
|
...
|
...
|
@@ -86,8 +70,6 @@ public class CreateIntroduceActivity extends BasePBActivity { |
|
|
textView.getPaint().setFakeBoldText(i == POSITION_SUGGEST);
|
|
|
textView.setTextColor(getResources().getColor(i == POSITION_SUGGEST ? R.color.textBlackB1 : R.color.textBlackB3));
|
|
|
if (i == POSITION_ATTENTION) {
|
|
|
// textView.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, R.mipmap.icon_triangle_n, 0);
|
|
|
//反射设置TabLayout的点击事件
|
|
|
Class c = tab.getClass();
|
|
|
try {
|
|
|
Field field = c.getDeclaredField("view");
|
...
|
...
|
@@ -109,7 +91,6 @@ public class CreateIntroduceActivity extends BasePBActivity { |
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
if (tabName.equals("0")){
|
...
|
...
|
@@ -148,20 +129,6 @@ public class CreateIntroduceActivity extends BasePBActivity { |
|
|
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
|
|
@Override
|
|
|
public void onTabSelected(TabLayout.Tab tab) {
|
|
|
// switch (tab.getPosition()) {
|
|
|
// case 0:
|
|
|
// tab.getCustomView().findViewById(R.id.iv_image).setBackgroundResource(R.mipmap.icon_shouyixiangqing);
|
|
|
// break;
|
|
|
// case 1:
|
|
|
// tab.getCustomView().findViewById(R.id.iv_image).setBackgroundResource(R.mipmap.icon_guifanshuoming);
|
|
|
// break;
|
|
|
// case 2:
|
|
|
// tab.getCustomView().findViewById(R.id.iv_image).setBackgroundResource(R.mipmap.icon_xinyongfenguize);
|
|
|
// break;
|
|
|
// case 3:
|
|
|
// tab.getCustomView().findViewById(R.id.iv_image).setBackgroundResource(R.mipmap.icon_yunchaungjihua);
|
|
|
// break;
|
|
|
// }
|
|
|
TextView textView = (TextView) tab.getCustomView().findViewById(R.id.tv_text);
|
|
|
|
|
|
textView.setText(tab.getText());
|
...
|
...
|
|