Search in sources :

Example 11 with FragmentTransaction

use of androidx.fragment.app.FragmentTransaction in project Conversations by siacs.

the class BlocklistActivity method showEnterJidDialog.

protected void showEnterJidDialog() {
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    EnterJidDialog dialog = EnterJidDialog.newInstance(null, getString(R.string.block_jabber_id), getString(R.string.block), null, account.getJid().asBareJid().toEscapedString(), true, false);
    dialog.setOnEnterJidDialogPositiveListener((accountJid, contactJid) -> {
        Blockable blockable = new RawBlockable(account, contactJid);
        if (xmppConnectionService.sendBlockRequest(blockable, false)) {
            Toast.makeText(BlocklistActivity.this, R.string.corresponding_conversations_closed, Toast.LENGTH_SHORT).show();
        }
        return true;
    });
    dialog.show(ft, "dialog");
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) RawBlockable(eu.siacs.conversations.entities.RawBlockable) Fragment(androidx.fragment.app.Fragment) RawBlockable(eu.siacs.conversations.entities.RawBlockable) Blockable(eu.siacs.conversations.entities.Blockable)

Example 12 with FragmentTransaction

use of androidx.fragment.app.FragmentTransaction in project Conversations by siacs.

the class ChooseContactActivity method showEnterJidDialog.

protected void showEnterJidDialog(XmppUri uri) {
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    Jid jid = uri == null ? null : uri.getJid();
    EnterJidDialog dialog = EnterJidDialog.newInstance(mActivatedAccounts, getString(R.string.enter_contact), getString(R.string.select), jid == null ? null : jid.asBareJid().toString(), getIntent().getStringExtra(EXTRA_ACCOUNT), true, false);
    dialog.setOnEnterJidDialogPositiveListener((accountJid, contactJid) -> {
        final Intent request = getIntent();
        final Intent data = new Intent();
        data.putExtra("contact", contactJid.toString());
        data.putExtra(EXTRA_ACCOUNT, accountJid.toEscapedString());
        data.putExtra(EXTRA_SELECT_MULTIPLE, false);
        copy(request, data);
        setResult(RESULT_OK, data);
        finish();
        return true;
    });
    dialog.show(ft, "dialog");
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) Jid(eu.siacs.conversations.xmpp.Jid) Intent(android.content.Intent) Fragment(androidx.fragment.app.Fragment)

Example 13 with FragmentTransaction

use of androidx.fragment.app.FragmentTransaction in project Cangol-uiframe by Cangol.

the class RadioTabManager method onCheckedChanged.

@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
    TabInfo newTab = mTabs.get("" + checkedId);
    if (mLastTab != newTab) {
        FragmentTransaction ft = mFragmentManager.beginTransaction();
        if (mLastTab != null) {
            if (mLastTab.fragment != null) {
                ft.detach(mLastTab.fragment);
            }
        }
        if (newTab != null) {
            if (newTab.fragment == null) {
                newTab.fragment = (BaseFragment) Fragment.instantiate(group.getContext(), newTab.clss.getName(), newTab.args);
                ft.add(mContainerId, newTab.fragment, newTab.tag);
            } else {
                ft.attach(newTab.fragment);
            }
        }
        mLastTab = newTab;
        ft.commit();
        mFragmentManager.executePendingTransactions();
    }
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction)

Example 14 with FragmentTransaction

use of androidx.fragment.app.FragmentTransaction in project Cangol-uiframe by Cangol.

the class TabManager method onTabChanged.

public void onTabChanged(String tabId) {
    TabInfo newTab = mTabs.get(tabId);
    if (mLastTab != newTab) {
        FragmentTransaction ft = mFragmentManager.beginTransaction();
        if (mLastTab != null) {
            if (mLastTab.fragment != null) {
                ft.detach(mLastTab.fragment);
            }
        }
        if (newTab != null) {
            if (newTab.fragment == null) {
                newTab.fragment = Fragment.instantiate(mContext, newTab.clss.getName(), newTab.args);
                ft.add(mContainerId, newTab.fragment, newTab.tag);
            } else {
                ft.attach(newTab.fragment);
            }
        }
        mLastTab = newTab;
        ft.commit();
        mFragmentManager.executePendingTransactions();
    }
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction)

Example 15 with FragmentTransaction

use of androidx.fragment.app.FragmentTransaction in project Cangol-uiframe by Cangol.

the class BaseDialogFragment method dismissInternal.

void dismissInternal(boolean allowStateLoss) {
    if (!this.mDismissed) {
        this.mDismissed = true;
        this.mShownByMe = false;
        if (this.mDialog != null) {
            this.mDialog.dismiss();
            this.mDialog = null;
        }
        this.mViewDestroyed = true;
        if (this.mBackStackId >= 0) {
            this.getFragmentManager().popBackStack(this.mBackStackId, 1);
            this.mBackStackId = -1;
        } else {
            FragmentTransaction ft = this.getFragmentManager().beginTransaction();
            ft.remove(this);
            if (allowStateLoss) {
                ft.commitAllowingStateLoss();
            } else {
                ft.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