예제 #1
0
  private void initView() {
    user = (User) getIntent().getSerializableExtra(Constants.user);

    getToolbar().setTitle(user.getUsername());
    ll_tab = (LinearLayout) findViewById(R.id.ll_tab);
    vp_personalinfo = (ViewPager) findViewById(R.id.vp_personalinfo);
    tv_personalinfo_tab_basic = (TextView) findViewById(R.id.tv_personalinfo_tab_basic);
    tv_personalinfo_tab_more = (TextView) findViewById(R.id.tv_personalinfo_tab_more);
    // fragment
    basicInfoFragment = new BasicInfoFragment();
    moreInfoFragment = new MoreInfoFragment();
    // viewpager
    vp_personalinfo.setAdapter(
        new FragmentPagerAdapter(getSupportFragmentManager()) {

          @Override
          public int getCount() {
            return 2;
          }

          @Override
          public Fragment getItem(int position) {
            switch (position) {
              case 0:
                return basicInfoFragment;
              case 1:
                return moreInfoFragment;
              default:
                return null;
            }
          }
        });
  }
예제 #2
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   super.onCreateOptionsMenu(menu);
   // 如果传入的参数不是当前用户,显示私信图标
   if (!BmobUser.getCurrentUser(this).getObjectId().equals(user.getObjectId()))
     getMenuInflater().inflate(R.menu.menu_personalinfo, menu);
   //		else {
   //			if (!BmobUtils.isAdmin(getApplicationContext())) {
   //				// 申请管理员
   //				MenuItem reqAdminItem = menu.add(0, R.id.menu_req_admin, 0,
   //						R.string.menu_req_manager);
   //				MenuItemCompat.setShowAsAction(reqAdminItem,
   //						MenuItem.SHOW_AS_ACTION_NEVER);
   //			}
   //		}
   return true;
 }