use of androidx.fragment.app.FragmentTransaction in project android by owncloud.
the class ConflictsResolveDialog method dismissDialog.
public void dismissDialog(AppCompatActivity activity) {
Fragment prev = activity.getSupportFragmentManager().findFragmentByTag(getTag());
if (prev != null) {
FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
ft.remove(prev);
ft.commit();
}
}
use of androidx.fragment.app.FragmentTransaction in project Tusky by Vavassor.
the class ViewTagActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_tag);
String hashtag = getIntent().getStringExtra(HASHTAG);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar bar = getSupportActionBar();
if (bar != null) {
bar.setTitle(String.format(getString(R.string.title_tag), hashtag));
bar.setDisplayHomeAsUpEnabled(true);
bar.setDisplayShowHomeEnabled(true);
}
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
Fragment fragment = TimelineFragment.newHashtagInstance(Collections.singletonList(hashtag));
fragmentTransaction.replace(R.id.fragment_container, fragment);
fragmentTransaction.commit();
}
use of androidx.fragment.app.FragmentTransaction in project StatusBarCompat by niorgai.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(null);
setContentView(R.layout.activity_main);
fragments.put(PAGE_COMMON, new CommonFragment());
fragments.put(PAGE_TRANSLUCENT, new TranslucentFragment());
fragments.put(PAGE_COORDINATOR, new DrawerFragment());
fragments.put(PAGE_COLLAPSING_TOOLBAR, new CollapsingToolbarFragment());
mCommon = (RadioButton) findViewById(R.id.common);
mCommon.setOnCheckedChangeListener(this);
mTranslucent = (RadioButton) findViewById(R.id.translucent);
mTranslucent.setOnCheckedChangeListener(this);
mCoordinator = (RadioButton) findViewById(R.id.coordinator);
mCoordinator.setOnCheckedChangeListener(this);
mCollapsingToolbar = (RadioButton) findViewById(R.id.collapsing_toolbar);
mCollapsingToolbar.setOnCheckedChangeListener(this);
FragmentTransaction ft = MainActivity.this.getSupportFragmentManager().beginTransaction();
ft.add(fragmentContentId, fragments.get(PAGE_COMMON));
currentTab = PAGE_COMMON;
mCommon.setTextColor(getResources().getColor(R.color.colorAccent));
ft.commit();
}
use of androidx.fragment.app.FragmentTransaction in project StatusBarCompat by niorgai.
the class MainActivity method changeTab.
private void changeTab(int page) {
if (currentTab == page) {
return;
}
Fragment fragment = fragments.get(page);
FragmentTransaction ft = MainActivity.this.getSupportFragmentManager().beginTransaction();
if (!fragment.isAdded()) {
ft.add(fragmentContentId, fragment);
}
ft.hide(fragments.get(currentTab));
ft.show(fragments.get(page));
changeButtonStatus(currentTab, false);
currentTab = page;
changeButtonStatus(currentTab, true);
if (!this.isFinishing()) {
ft.commitAllowingStateLoss();
}
}
use of androidx.fragment.app.FragmentTransaction in project AntennaPod by AntennaPod.
the class MainActivity method loadChildFragment.
public void loadChildFragment(Fragment fragment, TransitionEffect transition) {
Validate.notNull(fragment);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
switch(transition) {
case FADE:
transaction.setCustomAnimations(R.anim.fade_in, R.anim.fade_out);
break;
case SLIDE:
transaction.setCustomAnimations(R.anim.slide_right_in, R.anim.slide_left_out, R.anim.slide_left_in, R.anim.slide_right_out);
break;
}
transaction.hide(getSupportFragmentManager().findFragmentByTag(MAIN_FRAGMENT_TAG)).add(R.id.main_view, fragment, MAIN_FRAGMENT_TAG).addToBackStack(null).commit();
}
Aggregations