Java Code Examples for androidx.fragment.app.FragmentPagerAdapter#BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT

The following examples show how to use androidx.fragment.app.FragmentPagerAdapter#BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AdvancedInstallerFragment.java    From EdXposedManager with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.tab_advanced_installer, container, false);
    ViewPager mPager = view.findViewById(R.id.pager);
    mTabLayout = view.findViewById(R.id.tab_layout);

    tabsAdapter = new TabsAdapter(getChildFragmentManager(), FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
    mPager.setAdapter(tabsAdapter);
    mTabLayout.setupWithViewPager(mPager);

    setHasOptionsMenu(true);
    new JSONParser().execute();

    if (!XposedApp.getPreferences().getBoolean("hide_install_warning", false)) {
        @SuppressLint("InflateParams") final View dontShowAgainView = inflater.inflate(R.layout.dialog_install_warning, null);

        new MaterialDialog.Builder(requireActivity())
                .title(R.string.install_warning_title)
                .customView(dontShowAgainView, false)
                .positiveText(R.string.ok)
                .onPositive((dialog, which) -> {
                    CheckBox checkBox = dontShowAgainView.findViewById(android.R.id.checkbox);
                    if (checkBox.isChecked())
                        XposedApp.getPreferences().edit().putBoolean("hide_install_warning", true).apply();
                })
                .cancelable(false).show();
    }

    return view;
}
 
Example 2
Source File: ImageTransferFormatSelectorDialogFragment.java    From Bluefruit_LE_Connect_Android_V2 with MIT License 5 votes vote down vote up
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {

    // Set animations
    Dialog dialog = getDialog();
    if (dialog != null) {
        //dialog.setTitle(R.string.imagetransfer_resolution_choose);
        //dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        Window window = dialog.getWindow();
        if (window != null) {
            window.setWindowAnimations(R.style.DialogAnimation);
        }
    }

    // Configure tabs and viewpager
    ViewPager viewPager = view.findViewById(R.id.viewpager);
    ResolutionsPageAdapter adapter = new ResolutionsPageAdapter(getChildFragmentManager(), FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT, mResolution);
    viewPager.setAdapter(adapter);

    TabLayout tabLayout = view.findViewById(R.id.tabLayout);
    tabLayout.setupWithViewPager(viewPager);

    // Force titles
    TabLayout.Tab standardResolutions = tabLayout.getTabAt(0);
    if (standardResolutions != null) {
        standardResolutions.setText(R.string.imagetransfer_resolution_mode_standard);
    }
    TabLayout.Tab eInkResolutions = tabLayout.getTabAt(1);
    if (eInkResolutions != null) {
        eInkResolutions.setText(R.string.imagetransfer_resolution_mode_eink);
    }

    // Set initial item
    viewPager.setCurrentItem(mIsEInkModeEnabled ? 1 : 0);
}
 
Example 3
Source File: SectionsPagerAdapter.java    From PixivforMuzei3 with GNU General Public License v3.0 4 votes vote down vote up
public SectionsPagerAdapter(Context context, FragmentManager fm)
{
    super(fm, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
    mContext = context;
}
 
Example 4
Source File: InboxActivity.java    From Infinity-For-Reddit with GNU Affero General Public License v3.0 4 votes vote down vote up
public SectionsPagerAdapter(@NonNull FragmentManager fm) {
    super(fm, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
}
 
Example 5
Source File: PagerAdapter.java    From Aria2App with GNU General Public License v3.0 4 votes vote down vote up
public PagerAdapter(FragmentManager fm, List<F> fragments) {
    super(fm, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
    this.fragments = fragments;
}
 
Example 6
Source File: PagerAdapter.java    From Aria2App with GNU General Public License v3.0 4 votes vote down vote up
@SafeVarargs
public PagerAdapter(FragmentManager fm, F... fragments) {
    super(fm, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
    this.fragments = Arrays.asList(fragments);
}
 
Example 7
Source File: MainActivity.java    From HaoReader with GNU General Public License v3.0 4 votes vote down vote up
PagerAdapter(@NonNull FragmentManager fm, String[] titles) {
    super(fm, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
    this.titles = titles;
}
 
Example 8
Source File: PolylineControlFragmentPagerAdapter.java    From android-samples with Apache License 2.0 4 votes vote down vote up
public PolylineControlFragmentPagerAdapter(FragmentManager fragmentManager, boolean isLiteMode) {
    super(fragmentManager, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
    positionsToFragments = new HashMap<>();
    this.isLiteMode = isLiteMode;
}
 
Example 9
Source File: MapInPagerDemoActivity.java    From android-samples with Apache License 2.0 4 votes vote down vote up
public MyAdapter(FragmentManager fm) {
    super(fm, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
}