|
|
|
@ -83,7 +83,8 @@ public class PersonContent extends Fragment {
|
|
|
|
|
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
|
|
|
|
super.onActivityCreated(savedInstanceState);
|
|
|
|
|
// rvFeed = (RecyclerView) appCompatActivity.findViewById(R.id.rvFeed);
|
|
|
|
|
viewPager = (ViewPager) appCompatActivity.findViewById(R.id.vp_vertical_ntb);
|
|
|
|
|
// 原来的viewpager
|
|
|
|
|
// viewPager = (ViewPager) appCompatActivity.findViewById(R.id.vp_vertical_ntb);
|
|
|
|
|
mDrawer = (FlowingDrawer) appCompatActivity.findViewById(R.id.drawerlayout);
|
|
|
|
|
mDrawer.setTouchMode(ElasticDrawer.TOUCH_MODE_BEZEL);
|
|
|
|
|
//设置工具栏
|
|
|
|
@ -91,17 +92,22 @@ public class PersonContent extends Fragment {
|
|
|
|
|
setuptoolbar();
|
|
|
|
|
//设置直接页面
|
|
|
|
|
// setupFeed();
|
|
|
|
|
setupViewpager();
|
|
|
|
|
// setupViewpager();
|
|
|
|
|
//设置侧滑菜单
|
|
|
|
|
setupMenu();
|
|
|
|
|
}
|
|
|
|
|
protected void setuptoolbar(){
|
|
|
|
|
//分别设置背景和头像
|
|
|
|
|
//背景
|
|
|
|
|
ImageView blurimageView = (ImageView) appCompatActivity.findViewById(R.id.iv_blur);
|
|
|
|
|
//头像
|
|
|
|
|
ImageView avatarImageView = (ImageView) appCompatActivity.findViewById(R.id.iv_avatar);
|
|
|
|
|
Glide.with(appCompatActivity).load(R.drawable.draw7)
|
|
|
|
|
.apply(RequestOptions.bitmapTransform(new BlurTransformation(25,3))).into(blurimageView);
|
|
|
|
|
int width = blurimageView.getWidth();
|
|
|
|
|
|
|
|
|
|
Glide.with(appCompatActivity).load(R.drawable.draw7)
|
|
|
|
|
.apply(RequestOptions.bitmapTransform(new BlurTransformation(18,3))).into(blurimageView);
|
|
|
|
|
// Glide.with(appCompatActivity).load(R.drawable.draw7).override(width,450)
|
|
|
|
|
// .into(blurimageView);
|
|
|
|
|
Glide.with(appCompatActivity).load(R.drawable.draw6).into(avatarImageView);
|
|
|
|
|
//用户名
|
|
|
|
|
final TextView rainbowTextView = (TextView) appCompatActivity.findViewById(R.id.user_name_person);
|
|
|
|
@ -112,156 +118,157 @@ public class PersonContent extends Fragment {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
avatarOnclickListener avatarOnclickListener = new avatarOnclickListener(getAppCompatActivity(),this);
|
|
|
|
|
avatarOnclickListener.setFlowingDrawerl(mDrawer);
|
|
|
|
|
avatarImageView.setOnClickListener(avatarOnclickListener);
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
//设置没有侧滑之前的状态页面
|
|
|
|
|
//在这里将东西其改成几个按钮
|
|
|
|
|
private void setupViewpager(){
|
|
|
|
|
/*
|
|
|
|
|
* 先设置适配器
|
|
|
|
|
* */
|
|
|
|
|
viewPager.setAdapter(new PagerAdapter() {
|
|
|
|
|
//设置菜单栏个数
|
|
|
|
|
@Override
|
|
|
|
|
public int getCount() {
|
|
|
|
|
return 5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isViewFromObject(final View view, final Object object) {
|
|
|
|
|
return view.equals(object);
|
|
|
|
|
}
|
|
|
|
|
//移除某一个
|
|
|
|
|
@Override
|
|
|
|
|
public void destroyItem(final View container, final int position, final Object object) {
|
|
|
|
|
((ViewPager) container).removeView((View) object);
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
*这里用来加载视图区,也就是每个菜单的对应的内容
|
|
|
|
|
*但是这里应该针对不同的菜单填选对应不同的内容
|
|
|
|
|
* */
|
|
|
|
|
@Override
|
|
|
|
|
public Object instantiateItem(final ViewGroup container, final int position) {
|
|
|
|
|
//每个position代表一个菜单,根据position来设置不同视图
|
|
|
|
|
// private void setupViewpager(){
|
|
|
|
|
// /*
|
|
|
|
|
// * 先设置适配器
|
|
|
|
|
// * */
|
|
|
|
|
// viewPager.setAdapter(new PagerAdapter() {
|
|
|
|
|
// //设置菜单栏个数
|
|
|
|
|
// @Override
|
|
|
|
|
// public int getCount() {
|
|
|
|
|
// return 5;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
switch (position){
|
|
|
|
|
case 0:
|
|
|
|
|
//饮食爱好
|
|
|
|
|
case 1:
|
|
|
|
|
//日历
|
|
|
|
|
View view = setCanlendar();
|
|
|
|
|
container.addView(view);
|
|
|
|
|
return view;
|
|
|
|
|
case 2:
|
|
|
|
|
//消息通知
|
|
|
|
|
case 3:
|
|
|
|
|
//我的文章
|
|
|
|
|
case 4:
|
|
|
|
|
//养生推荐
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//这是默认的,不要管,因为上面必须有个返回值
|
|
|
|
|
final View view = LayoutInflater.from(
|
|
|
|
|
appCompatActivity.getBaseContext()).inflate(R.layout.item_vp, null, false);
|
|
|
|
|
final TextView txtPage = (TextView) view.findViewById(R.id.txt_vp_item_page);
|
|
|
|
|
txtPage.setText(String.format("Page #%d", position));
|
|
|
|
|
container.addView(view);
|
|
|
|
|
|
|
|
|
|
return view;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//设置日历
|
|
|
|
|
public View setCanlendar(){
|
|
|
|
|
final View view = LayoutInflater.from(
|
|
|
|
|
appCompatActivity.getBaseContext()
|
|
|
|
|
).inflate(R.layout.canlendar_layout, null, false);
|
|
|
|
|
return view;
|
|
|
|
|
}
|
|
|
|
|
//设置饮食爱好
|
|
|
|
|
public View setfoodhobby(){
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
/*
|
|
|
|
|
* 这里开始设置菜单栏
|
|
|
|
|
* */
|
|
|
|
|
//每个菜单选取了不同的颜色
|
|
|
|
|
final String[] colors = getResources().getStringArray(R.array.vertical_ntb);
|
|
|
|
|
//这里菜单栏选取的是NavigationTabBar
|
|
|
|
|
final NavigationTabBar navigationTabBar = (NavigationTabBar) appCompatActivity.findViewById(R.id.ntb_vertical);
|
|
|
|
|
//这里用来加载每个model,可以设置几个菜单
|
|
|
|
|
final ArrayList<NavigationTabBar.Model> models = new ArrayList<>();
|
|
|
|
|
models.add(
|
|
|
|
|
new NavigationTabBar.Model.Builder(
|
|
|
|
|
getResources().getDrawable(R.drawable.ic_first),
|
|
|
|
|
Color.parseColor(colors[0]))
|
|
|
|
|
.title("ic_first")
|
|
|
|
|
.selectedIcon(getResources().getDrawable(R.drawable.ic_eighth))
|
|
|
|
|
.build()
|
|
|
|
|
);
|
|
|
|
|
models.add(
|
|
|
|
|
new NavigationTabBar.Model.Builder(
|
|
|
|
|
getResources().getDrawable(R.drawable.ic_second),
|
|
|
|
|
Color.parseColor(colors[1]))
|
|
|
|
|
.selectedIcon(getResources().getDrawable(R.drawable.ic_eighth))
|
|
|
|
|
.title("ic_second")
|
|
|
|
|
.build()
|
|
|
|
|
);
|
|
|
|
|
models.add(
|
|
|
|
|
new NavigationTabBar.Model.Builder(
|
|
|
|
|
getResources().getDrawable(R.drawable.ic_third),
|
|
|
|
|
Color.parseColor(colors[2]))
|
|
|
|
|
.selectedIcon(getResources().getDrawable(R.drawable.ic_eighth))
|
|
|
|
|
.title("ic_third")
|
|
|
|
|
.build()
|
|
|
|
|
);
|
|
|
|
|
models.add(
|
|
|
|
|
new NavigationTabBar.Model.Builder(
|
|
|
|
|
getResources().getDrawable(R.drawable.ic_fourth),
|
|
|
|
|
Color.parseColor(colors[3]))
|
|
|
|
|
.selectedIcon(getResources().getDrawable(R.drawable.ic_eighth))
|
|
|
|
|
.title("ic_fourth")
|
|
|
|
|
.build()
|
|
|
|
|
);
|
|
|
|
|
models.add(
|
|
|
|
|
new NavigationTabBar.Model.Builder(
|
|
|
|
|
getResources().getDrawable(R.drawable.ic_fifth),
|
|
|
|
|
Color.parseColor(colors[4]))
|
|
|
|
|
.selectedIcon(getResources().getDrawable(R.drawable.ic_eighth))
|
|
|
|
|
.title("ic_fifth")
|
|
|
|
|
.build()
|
|
|
|
|
);
|
|
|
|
|
// @Override
|
|
|
|
|
// public boolean isViewFromObject(final View view, final Object object) {
|
|
|
|
|
// return view.equals(object);
|
|
|
|
|
// }
|
|
|
|
|
// //移除某一个
|
|
|
|
|
// @Override
|
|
|
|
|
// public void destroyItem(final View container, final int position, final Object object) {
|
|
|
|
|
// ((ViewPager) container).removeView((View) object);
|
|
|
|
|
// }
|
|
|
|
|
// /*
|
|
|
|
|
// *这里用来加载视图区,也就是每个菜单的对应的内容
|
|
|
|
|
// *但是这里应该针对不同的菜单填选对应不同的内容
|
|
|
|
|
// * */
|
|
|
|
|
// @Override
|
|
|
|
|
// public Object instantiateItem(final ViewGroup container, final int position) {
|
|
|
|
|
// //每个position代表一个菜单,根据position来设置不同视图
|
|
|
|
|
////
|
|
|
|
|
// switch (position){
|
|
|
|
|
// case 0:
|
|
|
|
|
// //饮食爱好
|
|
|
|
|
// case 1:
|
|
|
|
|
// //日历
|
|
|
|
|
// View view = setCanlendar();
|
|
|
|
|
// container.addView(view);
|
|
|
|
|
// return view;
|
|
|
|
|
// case 2:
|
|
|
|
|
// //消息通知
|
|
|
|
|
// case 3:
|
|
|
|
|
// //我的文章
|
|
|
|
|
// case 4:
|
|
|
|
|
// //养生推荐
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// //这是默认的,不要管,因为上面必须有个返回值
|
|
|
|
|
// final View view = LayoutInflater.from(
|
|
|
|
|
// appCompatActivity.getBaseContext()).inflate(R.layout.item_vp, null, false);
|
|
|
|
|
// final TextView txtPage = (TextView) view.findViewById(R.id.txt_vp_item_page);
|
|
|
|
|
// txtPage.setText(String.format("Page #%d", position));
|
|
|
|
|
// container.addView(view);
|
|
|
|
|
//
|
|
|
|
|
// return view;
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// //设置日历
|
|
|
|
|
// public View setCanlendar(){
|
|
|
|
|
// final View view = LayoutInflater.from(
|
|
|
|
|
// appCompatActivity.getBaseContext()
|
|
|
|
|
// ).inflate(R.layout.canlendar_layout, null, false);
|
|
|
|
|
// return view;
|
|
|
|
|
// }
|
|
|
|
|
// //设置饮食爱好
|
|
|
|
|
// public View setfoodhobby(){
|
|
|
|
|
// return null;
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// /*
|
|
|
|
|
// * 这里开始设置菜单栏
|
|
|
|
|
// * */
|
|
|
|
|
// //每个菜单选取了不同的颜色
|
|
|
|
|
// final String[] colors = getResources().getStringArray(R.array.vertical_ntb);
|
|
|
|
|
// //这里菜单栏选取的是NavigationTabBar
|
|
|
|
|
// final NavigationTabBar navigationTabBar = (NavigationTabBar) appCompatActivity.findViewById(R.id.ntb_vertical);
|
|
|
|
|
// //这里用来加载每个model,可以设置几个菜单
|
|
|
|
|
// final ArrayList<NavigationTabBar.Model> models = new ArrayList<>();
|
|
|
|
|
// models.add(
|
|
|
|
|
// new NavigationTabBar.Model.Builder(
|
|
|
|
|
// getResources().getDrawable(R.drawable.ic_sixth),
|
|
|
|
|
// Color.parseColor(colors[5]))
|
|
|
|
|
// getResources().getDrawable(R.drawable.ic_first),
|
|
|
|
|
// Color.parseColor(colors[0]))
|
|
|
|
|
// .title("ic_first")
|
|
|
|
|
// .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth))
|
|
|
|
|
// .title("ic_sixth")
|
|
|
|
|
// .build()
|
|
|
|
|
// );
|
|
|
|
|
// models.add(
|
|
|
|
|
// new NavigationTabBar.Model.Builder(
|
|
|
|
|
// getResources().getDrawable(R.drawable.ic_seventh),
|
|
|
|
|
// Color.parseColor(colors[6]))
|
|
|
|
|
// getResources().getDrawable(R.drawable.ic_second),
|
|
|
|
|
// Color.parseColor(colors[1]))
|
|
|
|
|
// .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth))
|
|
|
|
|
// .title("ic_seventh")
|
|
|
|
|
// .title("ic_second")
|
|
|
|
|
// .build()
|
|
|
|
|
// );
|
|
|
|
|
// models.add(
|
|
|
|
|
// new NavigationTabBar.Model.Builder(
|
|
|
|
|
// getResources().getDrawable(R.drawable.ic_eighth),
|
|
|
|
|
// Color.parseColor(colors[7]))
|
|
|
|
|
// getResources().getDrawable(R.drawable.ic_third),
|
|
|
|
|
// Color.parseColor(colors[2]))
|
|
|
|
|
// .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth))
|
|
|
|
|
// .title("ic_eighth")
|
|
|
|
|
// .title("ic_third")
|
|
|
|
|
// .build()
|
|
|
|
|
// );
|
|
|
|
|
//设置菜单
|
|
|
|
|
navigationTabBar.setModels(models);
|
|
|
|
|
//设置每个子菜单对一个的viewpager
|
|
|
|
|
navigationTabBar.setViewPager(viewPager, 0);
|
|
|
|
|
}
|
|
|
|
|
// models.add(
|
|
|
|
|
// new NavigationTabBar.Model.Builder(
|
|
|
|
|
// getResources().getDrawable(R.drawable.ic_fourth),
|
|
|
|
|
// Color.parseColor(colors[3]))
|
|
|
|
|
// .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth))
|
|
|
|
|
// .title("ic_fourth")
|
|
|
|
|
// .build()
|
|
|
|
|
// );
|
|
|
|
|
// models.add(
|
|
|
|
|
// new NavigationTabBar.Model.Builder(
|
|
|
|
|
// getResources().getDrawable(R.drawable.ic_fifth),
|
|
|
|
|
// Color.parseColor(colors[4]))
|
|
|
|
|
// .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth))
|
|
|
|
|
// .title("ic_fifth")
|
|
|
|
|
// .build()
|
|
|
|
|
// );
|
|
|
|
|
//// models.add(
|
|
|
|
|
//// new NavigationTabBar.Model.Builder(
|
|
|
|
|
//// getResources().getDrawable(R.drawable.ic_sixth),
|
|
|
|
|
//// Color.parseColor(colors[5]))
|
|
|
|
|
//// .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth))
|
|
|
|
|
//// .title("ic_sixth")
|
|
|
|
|
//// .build()
|
|
|
|
|
//// );
|
|
|
|
|
//// models.add(
|
|
|
|
|
//// new NavigationTabBar.Model.Builder(
|
|
|
|
|
//// getResources().getDrawable(R.drawable.ic_seventh),
|
|
|
|
|
//// Color.parseColor(colors[6]))
|
|
|
|
|
//// .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth))
|
|
|
|
|
//// .title("ic_seventh")
|
|
|
|
|
//// .build()
|
|
|
|
|
//// );
|
|
|
|
|
//// models.add(
|
|
|
|
|
//// new NavigationTabBar.Model.Builder(
|
|
|
|
|
//// getResources().getDrawable(R.drawable.ic_eighth),
|
|
|
|
|
//// Color.parseColor(colors[7]))
|
|
|
|
|
//// .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth))
|
|
|
|
|
//// .title("ic_eighth")
|
|
|
|
|
//// .build()
|
|
|
|
|
//// );
|
|
|
|
|
// //设置菜单
|
|
|
|
|
// navigationTabBar.setModels(models);
|
|
|
|
|
// //设置每个子菜单对一个的viewpager
|
|
|
|
|
// navigationTabBar.setViewPager(viewPager, 0);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//设置菜单
|
|
|
|
|