Search in sources :

Example 1 with DeleteFormsTabsAdapter

use of org.odk.collect.android.adapters.DeleteFormsTabsAdapter in project collect by opendatakit.

the class DeleteSavedFormActivity method setUpViewPager.

private void setUpViewPager() {
    String[] tabNames = { getString(R.string.data), getString(R.string.forms) };
    ViewPager2 viewPager = findViewById(R.id.viewPager);
    TabLayout tabLayout = findViewById(R.id.tabLayout);
    viewPager.setAdapter(new DeleteFormsTabsAdapter(this, viewModel.isMatchExactlyEnabled()));
    new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> tab.setText(tabNames[position])).attach();
}
Also used : ViewPager2(androidx.viewpager2.widget.ViewPager2) BlankFormsListViewModel(org.odk.collect.android.formmanagement.BlankFormsListViewModel) AppBarUtils(org.odk.collect.androidshared.utils.AppBarUtils) Bundle(android.os.Bundle) ViewModelProvider(androidx.lifecycle.ViewModelProvider) TabLayout(com.google.android.material.tabs.TabLayout) ViewPager2(androidx.viewpager2.widget.ViewPager2) DeleteFormsTabsAdapter(org.odk.collect.android.adapters.DeleteFormsTabsAdapter) Inject(javax.inject.Inject) DaggerUtils(org.odk.collect.android.injection.DaggerUtils) Configuration(android.content.res.Configuration) R(org.odk.collect.android.R) Toolbar(androidx.appcompat.widget.Toolbar) TabLayoutMediator(com.google.android.material.tabs.TabLayoutMediator) TabLayout(com.google.android.material.tabs.TabLayout) DeleteFormsTabsAdapter(org.odk.collect.android.adapters.DeleteFormsTabsAdapter) TabLayoutMediator(com.google.android.material.tabs.TabLayoutMediator)

Aggregations

Configuration (android.content.res.Configuration)1 Bundle (android.os.Bundle)1 Toolbar (androidx.appcompat.widget.Toolbar)1 ViewModelProvider (androidx.lifecycle.ViewModelProvider)1 ViewPager2 (androidx.viewpager2.widget.ViewPager2)1 TabLayout (com.google.android.material.tabs.TabLayout)1 TabLayoutMediator (com.google.android.material.tabs.TabLayoutMediator)1 Inject (javax.inject.Inject)1 R (org.odk.collect.android.R)1 DeleteFormsTabsAdapter (org.odk.collect.android.adapters.DeleteFormsTabsAdapter)1 BlankFormsListViewModel (org.odk.collect.android.formmanagement.BlankFormsListViewModel)1 DaggerUtils (org.odk.collect.android.injection.DaggerUtils)1 AppBarUtils (org.odk.collect.androidshared.utils.AppBarUtils)1