@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_my_tba, container, false); mViewPager = (ViewPager) v.findViewById(R.id.my_tba_pager); // Make this ridiculously big mViewPager.setOffscreenPageLimit(50); mViewPager.setPageMargin(Utilities.getPixelsFromDp(getActivity(), 16)); mTabs = (SlidingTabs) v.findViewById(R.id.my_tba_tabs); ViewCompat.setElevation(mTabs, getResources().getDimension(R.dimen.toolbar_elevation)); /** * Fix for really strange bug. Menu bar items wouldn't appear only when navigated to from * 'Events' in the nav drawer Bug is some derivation of this: * https://code.google.com/p/android/issues/detail?id=29472 So set the view pager's adapter in * another thread to avoid a race condition, or something. */ mViewPager.post( () -> { mViewPager.setAdapter(new MyTBAFragmentPagerAdapter(getChildFragmentManager())); mTabs.setViewPager(mViewPager); }); return v; }
private final void i() { com.dianxinos.dxbs.R.id _tmp = ly.f; t = (MainTitle) findViewById(0x7f070018); com.dianxinos.dxbs.R.id _tmp1 = ly.f; u = findViewById(0x7f0700ed); n = a(p); Intent intent = getIntent(); if (intent != null) { n = intent.getIntExtra("tab", n); } q = new rf(this, this, e(), p); com.dianxinos.dxbs.R.id _tmp2 = ly.f; r = (ViewPager) findViewById(0x7f0700ef); r.setAdapter(q); r.setOnPageChangeListener(this); r.setOffscreenPageLimit(p.size()); com.dianxinos.dxbs.R.id _tmp3 = ly.f; s = (TitleIndicator) findViewById(0x7f0700ee); s.a(n, p, r); r.setCurrentItem(n); Message message = g(); if (message != null) { r.post(new re(this, message)); } }
private final void initViews() { // Show the main screen by default mCurrentTab = onPrepareTabInfoData(mTabs); Intent intent = getIntent(); if (intent != null) { mCurrentTab = intent.getIntExtra(EXTRA_TAB, mCurrentTab); } myAdapter = new MyAdapter(this, getSupportFragmentManager(), mTabs); // Setup the views mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(myAdapter); mPager.setOnPageChangeListener(this); mPager.setOffscreenPageLimit(mTabs.size()); mIndicator = (TitleIndicator) findViewById(R.id.pagerindicator); mIndicator.init(mCurrentTab, mTabs, mPager); mPager.setCurrentItem(mCurrentTab); final Message msg = getInitMessage(); mPager.post( new Runnable() { @Override public void run() { TabInfo ti = getFragmentById(mCurrentTab); mLastTab = mCurrentTab; if (ti != null) { if (ti.fragment != null) ti.fragment.onScrollIn(); } if (msg != null) { msg.sendToTarget(); } } }); }