@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mContext = this;
    setContentView(R.layout.activity_account_book_custom_view);

    mViewPager = (MaterialViewPager) findViewById(R.id.materialViewPager);

    View view = mViewPager.getRootView();
    TextView title = (TextView) view.findViewById(R.id.logo_white);
    title.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    title.setText(SettingManager.getInstance().getAccountBookName());

    mViewPager.getPagerTitleStrip().setTypeface(CoCoinUtil.GetTypeface(), Typeface.NORMAL);
    mViewPager.getPagerTitleStrip().setVisibility(View.INVISIBLE);

    setTitle("");

    toolbar = mViewPager.getToolbar();

    if (toolbar != null) {
      setSupportActionBar(toolbar);

      final ActionBar actionBar = getSupportActionBar();
      if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayUseLogoEnabled(false);
        actionBar.setHomeButtonEnabled(true);
      }
    }

    View logo = findViewById(R.id.logo_white);
    if (logo != null) {
      logo.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              mViewPager.notifyHeaderChanged();
            }
          });
    }

    customViewFragmentAdapter = new CustomViewFragmentAdapter(getSupportFragmentManager());
    mViewPager.getViewPager().setOffscreenPageLimit(1);
    mViewPager.getViewPager().setAdapter(customViewFragmentAdapter);
    mViewPager.getPagerTitleStrip().setViewPager(mViewPager.getViewPager());

    mViewPager.setMaterialViewPagerListener(
        new MaterialViewPager.Listener() {
          @Override
          public HeaderDesign getHeaderDesign(int page) {
            return HeaderDesign.fromColorAndDrawable(
                CoCoinUtil.GetTagColor(-3), CoCoinUtil.GetTagDrawable(-3));
          }
        });
  }
Пример #2
0
  @Override
  public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    fragmentPosition = FragmentPagerItem.getPosition(getArguments());
    button0 = (RadioButton) view.findViewById(R.id.button0);
    button1 = (RadioButton) view.findViewById(R.id.button1);
    button2 = (RadioButton) view.findViewById(R.id.button2);
    button3 = (RadioButton) view.findViewById(R.id.button3);
    ly = (LinearLayout) view.findViewById(R.id.buttonLy);
    passwordTip = (TextView) view.findViewById(R.id.password_tip);
    passwordTip.setTypeface(CoCoinUtil.GetTypeface());
    switch (fragmentPosition) {
      case 0:
        if (SettingManager.getInstance().getFirstTime()) {
          passwordTip.setText(
              CoCoinApplication.getAppContext()
                  .getResources()
                  .getString(R.string.first_time_set_password));
        } else {
          passwordTip.setText(
              CoCoinApplication.getAppContext().getResources().getString(R.string.password_tip_0));
        }
        break;
      case 1:
        if (SettingManager.getInstance().getFirstTime()) {
          passwordTip.setText(
              CoCoinApplication.getAppContext()
                  .getResources()
                  .getString(R.string.first_time_set_password_again));
        } else {
          passwordTip.setText(
              CoCoinApplication.getAppContext().getResources().getString(R.string.password_tip_1));
        }
        break;
      case 2:
        passwordTip.setText(
            CoCoinApplication.getAppContext().getResources().getString(R.string.password_tip_2));
        break;
      default:
        break;
    }
  }