Search in sources :

Example 51 with FragmentTransaction

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

Example 52 with FragmentTransaction

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;
    }
}
Also used : FragmentTransaction(android.app.FragmentTransaction) SuppressLint(android.annotation.SuppressLint)

Example 53 with FragmentTransaction

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);
        }
    }
}
Also used : IKlyphFragment(com.abewy.android.apps.klyph.fragment.IKlyphFragment) FragmentTransaction(android.app.FragmentTransaction) PackageManager(android.content.pm.PackageManager) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) Bundle(android.os.Bundle) Intent(android.content.Intent) LoginFragment(com.abewy.android.apps.klyph.fragment.LoginFragment) Fragment(android.app.Fragment) IKlyphFragment(com.abewy.android.apps.klyph.fragment.IKlyphFragment)

Example 54 with FragmentTransaction

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;
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) FragmentTransaction(android.app.FragmentTransaction)

Example 55 with FragmentTransaction

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;
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) FragmentTransaction(android.app.FragmentTransaction)

Aggregations

FragmentTransaction (android.app.FragmentTransaction)266 FragmentManager (android.app.FragmentManager)84 Fragment (android.app.Fragment)82 Bundle (android.os.Bundle)44 DialogFragment (android.app.DialogFragment)20 Intent (android.content.Intent)18 FragmentActivity (android.support.v4.app.FragmentActivity)16 PreferenceFragment (android.support.v14.preference.PreferenceFragment)7 HashMap (java.util.HashMap)7 View (android.view.View)6 File (java.io.File)6 SuppressLint (android.annotation.SuppressLint)5 Uri (android.net.Uri)5 StorageManager (android.os.storage.StorageManager)5 VolumeInfo (android.os.storage.VolumeInfo)5 Fade (android.transition.Fade)5 TextView (android.widget.TextView)5 Selection (com.android.documentsui.dirlist.MultiSelectManager.Selection)5 IOException (java.io.IOException)5 Map (java.util.Map)4