Example #1
0
 @Override
 public void onBackPressed() {
   if (getIsDlCheckBoxShow()) {
     setOnDlCheckBoxShow(false, false);
   } else {
     super.onBackPressed();
   }
 }
Example #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ac_activity_content);
    ButterKnife.bind(this);
    mContentId = getIntent().getStringExtra(AcString.CONTENT_ID);

    ViewUtils.setToolbar(AcContentActivity.this, mToolbar, true);
    mCollapsingToolbarLayout.setTitle("AC" + mContentId);
    mCollapsingToolbarLayout.setExpandedTitleTextAppearance(R.style.ExpandedTitleText);

    mAdapter = new AcContentFmAdapter(getSupportFragmentManager());
    mViewPager.setAdapter(mAdapter);
    mViewPager.setOffscreenPageLimit(2);

    mTabLayout.setTabMode(TabLayout.MODE_FIXED);
    mTabLayout.setupWithViewPager(mViewPager);

    //        View contentView = findViewById(android.R.id.content);
    //        contentView.getViewTreeObserver()
    //                .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
    //                    @Override
    //                    public void onGlobalLayout() {
    //                        if (mContentId != null) {
    //                            for (int i = 0; i < mAdapter.getCount(); i++) {
    //                                String tag = mAdapter.getFragmentTag(i);
    //                                Fragment fragment =
    // getSupportFragmentManager().findFragmentByTag(tag);
    //
    //                                if (fragment instanceof AcContentInfoFragment) {
    //                                    ((AcContentInfoFragment) fragment)
    //                                            .onAcContentResult(mContentId);
    //                                } else if (fragment instanceof AcContentReplyFragment) {
    //                                    ((AcContentReplyFragment) fragment)
    //                                            .onAcContentResult(mContentId);
    //                                }
    //                            }
    //                        }
    //                    }
    //                });

    ((AcContentInfoFragment) getAcContentFragment(FRAGMENT_TPE_CONTENT_INFO))
        .onAcContentResult(mContentId);
    ((AcContentReplyFragment) getAcContentFragment(FRAGMENT_TPE_CONTENT_REPLY))
        .onAcContentResult(mContentId);
  }