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();
}
});
}
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();
}
}
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);
}
}
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);
}
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();
}
Aggregations