Search in sources :

Example 36 with Fragment

use of androidx.fragment.app.Fragment in project paper-onboarding-android by Ramotion.

the class FragmentsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragments_activity_layout);
    fragmentManager = getSupportFragmentManager();
    final PaperOnboardingFragment onBoardingFragment = PaperOnboardingFragment.newInstance(getDataForOnboarding());
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    fragmentTransaction.add(R.id.fragment_container, onBoardingFragment);
    fragmentTransaction.commit();
    onBoardingFragment.setOnRightOutListener(new PaperOnboardingOnRightOutListener() {

        @Override
        public void onRightOut() {
            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
            Fragment bf = new BlankFragment();
            fragmentTransaction.replace(R.id.fragment_container, bf);
            fragmentTransaction.commit();
        }
    });
}
Also used : PaperOnboardingFragment(com.ramotion.paperonboarding.PaperOnboardingFragment) FragmentTransaction(androidx.fragment.app.FragmentTransaction) Fragment(androidx.fragment.app.Fragment) PaperOnboardingFragment(com.ramotion.paperonboarding.PaperOnboardingFragment) PaperOnboardingOnRightOutListener(com.ramotion.paperonboarding.listeners.PaperOnboardingOnRightOutListener)

Example 37 with Fragment

use of androidx.fragment.app.Fragment in project Gadgetbridge by Freeyourgadget.

the class DeviceSettingsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    device = getIntent().getParcelableExtra(GBDevice.EXTRA_DEVICE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_device_settings);
    if (savedInstanceState == null) {
        Fragment fragment = getSupportFragmentManager().findFragmentByTag(DeviceSpecificSettingsFragment.FRAGMENT_TAG);
        if (fragment == null) {
            DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device);
            int[] supportedSettings = coordinator.getSupportedDeviceSpecificSettings(device);
            String[] supportedLanguages = coordinator.getSupportedLanguageSettings(device);
            if (supportedLanguages != null) {
                supportedSettings = ArrayUtils.insert(0, supportedSettings, R.xml.devicesettings_language_generic);
            }
            if (coordinator.supportsActivityTracking()) {
                supportedSettings = ArrayUtils.addAll(supportedSettings, R.xml.devicesettings_chartstabs);
                supportedSettings = ArrayUtils.addAll(supportedSettings, R.xml.devicesettings_device_card_activity_card_preferences);
            }
            final DeviceSpecificSettingsCustomizer deviceSpecificSettingsCustomizer = coordinator.getDeviceSpecificSettingsCustomizer(device);
            fragment = DeviceSpecificSettingsFragment.newInstance(device.getAddress(), supportedSettings, supportedLanguages, deviceSpecificSettingsCustomizer);
        }
        getSupportFragmentManager().beginTransaction().replace(R.id.settings_container, fragment, DeviceSpecificSettingsFragment.FRAGMENT_TAG).commit();
    }
}
Also used : Fragment(androidx.fragment.app.Fragment) DeviceCoordinator(nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator)

Example 38 with Fragment

use of androidx.fragment.app.Fragment in project Rajawali by Rajawali.

the class ExamplesActivity method processExtras.

private void processExtras(Bundle extras) {
    Example example = extras.getParcelable(EXTRA_EXAMPLE);
    if (example == null) {
        throw new NullPointerException();
    }
    Class aClass = example.getType();
    try {
        Bundle bundle = new Bundle();
        bundle.putString(AExampleFragment.BUNDLE_EXAMPLE_URL, example.getPath());
        Fragment fragment = (Fragment) aClass.newInstance();
        fragment.setArguments(bundle);
        getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, fragment, aClass.getName()).commit();
    } catch (Exception e) {
        throw new IllegalStateException(e);
    }
}
Also used : Bundle(android.os.Bundle) Example(org.rajawali3d.examples.data.Example) AExampleFragment(org.rajawali3d.examples.examples.AExampleFragment) Fragment(androidx.fragment.app.Fragment)

Example 39 with Fragment

use of androidx.fragment.app.Fragment in project SwipeRecyclerView by yanzhenjie.

the class ViewPagerActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_menu_pager_);
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    mActionBar = getSupportActionBar();
    assert mActionBar != null;
    mActionBar.setDisplayHomeAsUpEnabled(true);
    findViewById(R.id.btn_one).setOnClickListener(mBtnClickListener);
    findViewById(R.id.btn_two).setOnClickListener(mBtnClickListener);
    findViewById(R.id.btn_three).setOnClickListener(mBtnClickListener);
    mViewPager = findViewById(R.id.view_pager_menu);
    mViewPager.addOnPageChangeListener(mPageChangeListener);
    mViewPager.setOffscreenPageLimit(2);
    List<Fragment> fragments = new ArrayList<>(3);
    fragments.add(Fragment.instantiate(this, MenuFragment.class.getName()));
    fragments.add(Fragment.instantiate(this, MenuFragment.class.getName()));
    fragments.add(Fragment.instantiate(this, MenuFragment.class.getName()));
    PagerAdapter pagerAdapter = new PagerAdapter(getSupportFragmentManager(), fragments);
    mViewPager.setAdapter(pagerAdapter);
    mPageChangeListener.onPageSelected(0);
}
Also used : ArrayList(java.util.ArrayList) Fragment(androidx.fragment.app.Fragment) MenuFragment(com.yanzhenjie.recyclerview.sample.fragment.MenuFragment) FragmentPagerAdapter(androidx.fragment.app.FragmentPagerAdapter) Toolbar(androidx.appcompat.widget.Toolbar)

Example 40 with Fragment

use of androidx.fragment.app.Fragment in project Signal-Android by WhisperSystems.

the class PaymentRecipientSelectionFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    toolbar = view.findViewById(R.id.payment_recipient_selection_fragment_toolbar);
    toolbar.setNavigationOnClickListener(v -> Navigation.findNavController(v).popBackStack());
    contactFilterView = view.findViewById(R.id.contact_filter_edit_text);
    Bundle arguments = new Bundle();
    arguments.putBoolean(ContactSelectionListFragment.REFRESHABLE, false);
    arguments.putInt(ContactSelectionListFragment.DISPLAY_MODE, DisplayMode.FLAG_PUSH | DisplayMode.FLAG_HIDE_NEW);
    arguments.putBoolean(ContactSelectionListFragment.CAN_SELECT_SELF, false);
    Fragment child = getChildFragmentManager().findFragmentById(R.id.contact_selection_list_fragment_holder);
    if (child == null) {
        FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
        contactsFragment = new ContactSelectionListFragment();
        contactsFragment.setArguments(arguments);
        transaction.add(R.id.contact_selection_list_fragment_holder, contactsFragment);
        transaction.commit();
    } else {
        contactsFragment = (ContactSelectionListFragment) child;
    }
    initializeSearch();
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) Bundle(android.os.Bundle) ContactSelectionListFragment(org.thoughtcrime.securesms.ContactSelectionListFragment) Fragment(androidx.fragment.app.Fragment) LoggingFragment(org.thoughtcrime.securesms.LoggingFragment) ContactSelectionListFragment(org.thoughtcrime.securesms.ContactSelectionListFragment)

Aggregations

Fragment (androidx.fragment.app.Fragment)262 FragmentTransaction (androidx.fragment.app.FragmentTransaction)57 Bundle (android.os.Bundle)49 FragmentManager (androidx.fragment.app.FragmentManager)42 DialogFragment (androidx.fragment.app.DialogFragment)24 FileFragment (com.owncloud.android.ui.fragment.FileFragment)23 Intent (android.content.Intent)22 View (android.view.View)22 FileDetailFragment (com.owncloud.android.ui.fragment.FileDetailFragment)20 OCFileListFragment (com.owncloud.android.ui.fragment.OCFileListFragment)20 SortingOrderDialogFragment (com.owncloud.android.ui.dialog.SortingOrderDialogFragment)19 GalleryFragment (com.owncloud.android.ui.fragment.GalleryFragment)18 TaskRetainerFragment (com.owncloud.android.ui.fragment.TaskRetainerFragment)18 UnifiedSearchFragment (com.owncloud.android.ui.fragment.UnifiedSearchFragment)18 PreviewImageFragment (com.owncloud.android.ui.preview.PreviewImageFragment)18 PreviewMediaFragment (com.owncloud.android.ui.preview.PreviewMediaFragment)18 PreviewTextFileFragment (com.owncloud.android.ui.preview.PreviewTextFileFragment)18 PreviewTextFragment (com.owncloud.android.ui.preview.PreviewTextFragment)18 PreviewTextStringFragment (com.owncloud.android.ui.preview.PreviewTextStringFragment)18 PreviewPdfFragment (com.owncloud.android.ui.preview.pdf.PreviewPdfFragment)18