Search in sources :

Example 6 with FragmentTransaction

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();
    }
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) Fragment(androidx.fragment.app.Fragment) DialogFragment(androidx.fragment.app.DialogFragment)

Example 7 with FragmentTransaction

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();
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) TimelineFragment(com.keylesspalace.tusky.components.timeline.TimelineFragment) Fragment(androidx.fragment.app.Fragment) ActionBar(androidx.appcompat.app.ActionBar) Toolbar(androidx.appcompat.widget.Toolbar)

Example 8 with FragmentTransaction

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();
}
Also used : DrawerFragment(qiu.statusbarcompat.fragment.DrawerFragment) TranslucentFragment(qiu.statusbarcompat.fragment.TranslucentFragment) FragmentTransaction(androidx.fragment.app.FragmentTransaction) CommonFragment(qiu.statusbarcompat.fragment.CommonFragment) CollapsingToolbarFragment(qiu.statusbarcompat.fragment.CollapsingToolbarFragment)

Example 9 with FragmentTransaction

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();
    }
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) DrawerFragment(qiu.statusbarcompat.fragment.DrawerFragment) CommonFragment(qiu.statusbarcompat.fragment.CommonFragment) TranslucentFragment(qiu.statusbarcompat.fragment.TranslucentFragment) CollapsingToolbarFragment(qiu.statusbarcompat.fragment.CollapsingToolbarFragment) Fragment(androidx.fragment.app.Fragment)

Example 10 with FragmentTransaction

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();
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction)

Aggregations

FragmentTransaction (androidx.fragment.app.FragmentTransaction)176 Fragment (androidx.fragment.app.Fragment)57 FragmentManager (androidx.fragment.app.FragmentManager)53 Bundle (android.os.Bundle)25 Test (org.junit.Test)14 DialogFragment (androidx.fragment.app.DialogFragment)10 OCFileListFragment (com.owncloud.android.ui.fragment.OCFileListFragment)6 View (android.view.View)5 Intent (android.content.Intent)4 ActionBar (androidx.appcompat.app.ActionBar)4 Toolbar (androidx.appcompat.widget.Toolbar)4 SwipeRefreshListFragment (eu.siacs.conversations.ui.widget.SwipeRefreshListFragment)4 MediaGalleryFragment (org.thoughtcrime.securesms.mediasend.v2.gallery.MediaGalleryFragment)4 SuppressLint (android.annotation.SuppressLint)3 Activity (android.app.Activity)3 FragmentActivity (androidx.fragment.app.FragmentActivity)3 SslUntrustedCertDialog (com.owncloud.android.ui.dialog.SslUntrustedCertDialog)3 TargetApi (android.annotation.TargetApi)2 PreferenceFrameLayout (android.preference.PreferenceFrameLayout)2 VisibleForTesting (androidx.annotation.VisibleForTesting)2