use of com.google.android.material.tabs.TabLayout in project Signal-Android by signalapp.
the class ManagePendingAndRequestingMembersActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState, boolean ready) {
super.onCreate(savedInstanceState, ready);
setContentView(R.layout.group_pending_and_requesting_member_activity);
if (savedInstanceState == null) {
GroupId.V2 groupId = GroupId.parseOrThrow(getIntent().getStringExtra(GROUP_ID)).requireV2();
ViewPager2 viewPager = findViewById(R.id.pending_and_requesting_pager);
TabLayout tabLayout = findViewById(R.id.pending_and_requesting_tabs);
viewPager.setAdapter(new ViewPagerAdapter(this, groupId));
new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> {
switch(position) {
case 0:
tab.setText(R.string.PendingMembersActivity_requests);
break;
case 1:
tab.setText(R.string.PendingMembersActivity_invites);
break;
default:
throw new AssertionError();
}
}).attach();
}
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
requireSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
use of com.google.android.material.tabs.TabLayout in project MTweaks-KernelAdiutorMOD by morogoku.
the class DownloadsActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_downloads);
initToolBar();
SupportedDownloads.KernelContent content = new SupportedDownloads.KernelContent(getIntent().getStringExtra(JSON_INTENT));
getSupportActionBar().setTitle(Utils.htmlFrom(content.getName()).toString());
final ViewPager viewPager = findViewById(R.id.viewpager);
LinkedHashMap<String, Fragment> items = new LinkedHashMap<>();
List<SupportedDownloads.KernelContent.Feature> features = content.getFeatures();
List<SupportedDownloads.KernelContent.Download> downloads = content.getDownloads();
if (content.getShortDescription() != null && content.getLongDescription() != null) {
items.put(getString(R.string.about), AboutFragment.newInstance(content));
}
if (features.size() > 0) {
items.put(getString(R.string.features), FeaturesFragment.newInstance(features));
}
if (downloads.size() > 0) {
items.put(getString(R.string.downloads), DownloadKernelFragment.newInstance(downloads));
}
viewPager.setOffscreenPageLimit(items.size());
PagerAdapter pagerAdapter = new PagerAdapter(getSupportFragmentManager(), items);
viewPager.setAdapter(pagerAdapter);
TabLayout tabLayout = findViewById(R.id.tablayout);
tabLayout.setupWithViewPager(viewPager);
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
}
use of com.google.android.material.tabs.TabLayout in project android_packages_apps_Settings by omnirom.
the class ProfileSelectFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mContentView = (ViewGroup) super.onCreateView(inflater, container, savedInstanceState);
final Activity activity = getActivity();
final int selectedTab = convertPosition(getTabId(activity, getArguments()));
final View tabContainer = mContentView.findViewById(R.id.tab_container);
final ViewPager viewPager = tabContainer.findViewById(R.id.view_pager);
viewPager.setAdapter(new ProfileSelectFragment.ViewPagerAdapter(this));
final TabLayout tabs = tabContainer.findViewById(R.id.tabs);
tabs.setupWithViewPager(viewPager);
setupTabTextColor(tabs);
tabContainer.setVisibility(View.VISIBLE);
final TabLayout.Tab tab = tabs.getTabAt(selectedTab);
tab.select();
final FrameLayout listContainer = mContentView.findViewById(android.R.id.list_container);
listContainer.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
final RecyclerView recyclerView = getListView();
recyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
Utils.setActionBarShadowAnimation(activity, getSettingsLifecycle(), recyclerView);
return mContentView;
}
use of com.google.android.material.tabs.TabLayout in project RxBinding by JakeWharton.
the class RxTabLayoutTest method selectionsNoInitial.
@Test
@UiThreadTest
public void selectionsNoInitial() {
TabLayout empty = new TabLayout(context);
RecordingObserver<TabLayout.Tab> o = new RecordingObserver<>();
RxTabLayout.selections(empty).subscribe(o);
o.assertNoMoreEvents();
}
use of com.google.android.material.tabs.TabLayout in project Signal-Android by WhisperSystems.
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);
}
Aggregations