use of com.google.android.material.tabs.TabLayout in project MaterialDateTimePicker by wdullaer.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
adapter = new PickerAdapter(getSupportFragmentManager());
viewPager = findViewById(R.id.pager);
viewPager.setAdapter(adapter);
setSupportActionBar(findViewById(R.id.toolbar));
TabLayout tabLayout = findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
for (// noinspection ConstantConditions
int i = 0; // noinspection ConstantConditions
i < adapter.getCount(); // noinspection ConstantConditions
i++) tabLayout.getTabAt(i).setText(adapter.getTitle(i));
}
use of com.google.android.material.tabs.TabLayout in project Signal-Android by signalapp.
the class PaymentsAllActivityFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
ViewPager viewPager = view.findViewById(R.id.payments_all_activity_fragment_view_pager);
TabLayout tabLayout = view.findViewById(R.id.payments_all_activity_fragment_tabs);
Toolbar toolbar = view.findViewById(R.id.payments_all_activity_fragment_toolbar);
toolbar.setNavigationOnClickListener(v -> Navigation.findNavController(v).popBackStack());
viewPager.setAdapter(new Adapter(getChildFragmentManager()));
tabLayout.setupWithViewPager(viewPager);
}
use of com.google.android.material.tabs.TabLayout in project Signal-Android by signalapp.
the class ReactionsBottomSheetDialogFragment method setUpTabMediator.
private void setUpTabMediator(@Nullable Bundle savedInstanceState) {
if (savedInstanceState == null) {
FrameLayout container = requireDialog().findViewById(R.id.container);
LayoutInflater layoutInflater = LayoutInflater.from(requireContext());
View statusBarShader = layoutInflater.inflate(R.layout.react_with_any_emoji_status_fade, container, false);
TabLayout emojiTabs = (TabLayout) layoutInflater.inflate(R.layout.reactions_bottom_sheet_dialog_fragment_tabs, container, false);
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewUtil.getStatusBarHeight(container));
statusBarShader.setLayoutParams(params);
container.addView(statusBarShader, 0);
container.addView(emojiTabs);
ViewCompat.setOnApplyWindowInsetsListener(container, (v, insets) -> insets.consumeSystemWindowInsets());
new TabLayoutMediator(emojiTabs, recipientPagerView, (tab, position) -> {
tab.setCustomView(R.layout.reactions_bottom_sheet_dialog_fragment_emoji_item);
View customView = Objects.requireNonNull(tab.getCustomView());
EmojiImageView emoji = customView.findViewById(R.id.reactions_bottom_view_emoji_item_emoji);
TextView text = customView.findViewById(R.id.reactions_bottom_view_emoji_item_text);
EmojiCount emojiCount = recipientsAdapter.getEmojiCount(position);
if (position != 0) {
emoji.setVisibility(View.VISIBLE);
emoji.setImageEmoji(emojiCount.getDisplayEmoji());
text.setText(String.valueOf(emojiCount.getCount()));
} else {
emoji.setVisibility(View.GONE);
text.setText(customView.getContext().getString(R.string.ReactionsBottomSheetDialogFragment_all, emojiCount.getCount()));
}
}).attach();
}
}
use of com.google.android.material.tabs.TabLayout in project Slide by ccrama.
the class Discover method onCreate.
@Override
public void onCreate(Bundle savedInstance) {
overrideSwipeFromAnywhere();
super.onCreate(savedInstance);
applyColorTheme("");
setContentView(R.layout.activity_multireddits);
((DrawerLayout) findViewById(R.id.drawer_layout)).setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
setupAppBar(R.id.toolbar, R.string.discover_title, true, false);
mToolbar.setPopupTheme(new ColorPreferences(this).getFontStyle().getBaseId());
findViewById(R.id.header).setBackgroundColor(Palette.getDefaultColor());
TabLayout tabs = (TabLayout) findViewById(R.id.sliding_tabs);
tabs.setTabMode(TabLayout.MODE_FIXED);
tabs.setSelectedTabIndicatorColor(new ColorPreferences(Discover.this).getColor("no sub"));
ViewPager pager = (ViewPager) findViewById(R.id.content_view);
pager.setAdapter(new DiscoverPagerAdapter(getSupportFragmentManager()));
tabs.setupWithViewPager(pager);
pager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
findViewById(R.id.header).animate().translationY(0).setInterpolator(new LinearInterpolator()).setDuration(180);
}
});
}
use of com.google.android.material.tabs.TabLayout in project Alarmio by TheAndroidMaster.
the class SoundChooserDialog method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.dialog_sound_chooser, container, false);
Aesthetic.Companion.get().colorPrimary().take(1).subscribe(new Consumer<Integer>() {
@Override
public void accept(Integer integer) throws Exception {
view.setBackgroundColor(integer);
}
});
TabLayout tabLayout = view.findViewById(R.id.tabLayout);
ViewPager viewPager = view.findViewById(R.id.viewPager);
AlarmSoundChooserFragment alarmFragment = new AlarmSoundChooserFragment();
RingtoneSoundChooserFragment ringtoneFragment = new RingtoneSoundChooserFragment();
RadioSoundChooserFragment radioFragment = new RadioSoundChooserFragment();
alarmFragment.setListener(this);
ringtoneFragment.setListener(this);
radioFragment.setListener(this);
viewPager.setAdapter(new SimplePagerAdapter(getChildFragmentManager(), alarmFragment, ringtoneFragment, radioFragment));
tabLayout.setupWithViewPager(viewPager);
return view;
}
Aggregations