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