use of com.google.android.material.tabs.TabLayout in project MTweaks-KernelAdiutorMOD by morogoku.
the class ProfileActivity method initNewMode.
private void initNewMode(Bundle savedInstanceState) {
mMode = 1;
setContentView(R.layout.activity_profile);
Control.clearProfileCommands();
Control.setProfileMode(true);
final ViewPager viewPager = findViewById(R.id.viewpager);
if (savedInstanceState != null) {
mHideWarningDialog = savedInstanceState.getBoolean("hidewarningdialog");
}
if (!mHideWarningDialog) {
ViewUtils.dialogBuilder(getString(R.string.profile_warning), null, (dialogInterface, i) -> {
}, dialog -> mHideWarningDialog = true, this).show();
}
viewPager.setOffscreenPageLimit(mItems.size());
PagerAdapter pagerAdapter = new PagerAdapter(getSupportFragmentManager(), mItems);
viewPager.setAdapter(pagerAdapter);
TabLayout tabLayout = findViewById(R.id.tablayout);
tabLayout.setupWithViewPager(viewPager);
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
mCurPosition = position;
}
@Override
public void onPageSelected(int position) {
mCurPosition = position;
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
findViewById(R.id.done).setOnClickListener(view -> returnIntent(Control.getProfileCommands()));
}
Aggregations