use of android.app.FragmentTransaction in project k-9 by k9mail.
the class MessageList method removeMessageViewFragment.
/**
* Remove MessageViewFragment if necessary.
*/
private void removeMessageViewFragment() {
if (mMessageViewFragment != null) {
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.remove(mMessageViewFragment);
mMessageViewFragment = null;
ft.commit();
showDefaultTitleView();
}
}
use of android.app.FragmentTransaction in project k-9 by k9mail.
the class MessageList method addMessageListFragment.
private void addMessageListFragment(MessageListFragment fragment, boolean addToBackStack) {
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.message_list_container, fragment);
if (addToBackStack)
ft.addToBackStack(null);
mMessageListFragment = fragment;
int transactionId = ft.commit();
if (transactionId >= 0 && mFirstBackStackId < 0) {
mFirstBackStackId = transactionId;
}
}
use of android.app.FragmentTransaction in project Klyph by jonathangerbaud.
the class MainActivity method updateContent.
private void updateContent(int selection) {
if (selection != oldSelection) {
Bundle bundle = new Bundle();
bundle.putString(KlyphBundleExtras.ELEMENT_ID, KlyphSession.getSessionUserId());
String className = classes.get(selection);
if (className.equals("com.abewy.android.apps.klyph.fragment.Chat")) {
PackageManager pm = getPackageManager();
try {
pm.getPackageInfo(MESSENGER_PACKAGE_NAME, PackageManager.GET_ACTIVITIES);
Intent intent = getPackageManager().getLaunchIntentForPackage(MESSENGER_PACKAGE_NAME);
startActivity(intent);
} catch (NameNotFoundException e) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(MESSENGER_PLAY_STORE_URI));
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
startActivity(intent);
}
} else {
if (selection < navAdapter.getCount())
setTitle(navAdapter.getItem(selection));
else
setTitle(KlyphSession.getSessionUserName());
Fragment fragment = Fragment.instantiate(MainActivity.this, className, bundle);
if (previousFragment != null)
previousFragment.onSetToBack(this);
FragmentTransaction tx = getFragmentManager().beginTransaction();
tx.replace(R.id.main, fragment, FRAGMENT_TAG);
tx.commitAllowingStateLoss();
((IKlyphFragment) fragment).onSetToFront(this);
previousFragment = (IKlyphFragment) fragment;
navAdapter.setSelectedPosition(selection);
navAdapter.notifyDataSetChanged();
oldSelection = selection;
if (notificationsFragment != null)
notificationsFragment.setHasOptionsMenu(false);
}
}
}
use of android.app.FragmentTransaction in project superCleanMaster by joyoyao.
the class DialogUtil method showAlertDialog.
/**
* 显示一个一般的对话框(标题,String内容,确认,取消).
* @param context
* @param title 对话框标题内容
* @param message 对话框提示内容
* @param onClickListener 点击确认按钮的事件监听
*/
public static AlertDialogFragment showAlertDialog(Context context, String title, String message, AlertDialogFragment.DialogOnClickListener onClickListener) {
FragmentActivity activity = (FragmentActivity) context;
AlertDialogFragment newFragment = AlertDialogFragment.newInstance(0, title, message, null, onClickListener);
FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
// 指定一个系统转场动画
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
newFragment.show(ft, mDialogTag);
return newFragment;
}
use of android.app.FragmentTransaction in project superCleanMaster by joyoyao.
the class DialogUtil method showAlertDialog.
/**
* 显示一个一般的对话框(View内容).
* @param view 对话框标题内容
*/
public static AlertDialogFragment showAlertDialog(View view) {
FragmentActivity activity = (FragmentActivity) view.getContext();
AlertDialogFragment newFragment = AlertDialogFragment.newInstance(0, null, null, view, null);
FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
// 指定一个系统转场动画
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
newFragment.show(ft, mDialogTag);
return newFragment;
}
Aggregations