Search in sources :

Example 56 with FragmentTransaction

use of android.app.FragmentTransaction in project superCleanMaster by joyoyao.

the class DialogUtil method showAlertDialog.

/**
	 * 描述:对话框dialog (图标,标题,View内容).
	 * @param icon
	 * @param title 对话框标题内容
	 * @param view  对话框提示内容
	 */
public static AlertDialogFragment showAlertDialog(int icon, String title, View view) {
    FragmentActivity activity = (FragmentActivity) view.getContext();
    AlertDialogFragment newFragment = AlertDialogFragment.newInstance(icon, title, 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)

Example 57 with FragmentTransaction

use of android.app.FragmentTransaction in project superCleanMaster by joyoyao.

the class DialogUtil method showAlertDialog.

/**
	 * 描述:对话框dialog (图标,标题,String内容).
	 * @param context
	 * @param icon
	 * @param title 对话框标题内容
	 *
	 */
public static AlertDialogFragment showAlertDialog(Context context, int icon, String title, String message) {
    FragmentActivity activity = (FragmentActivity) context;
    AlertDialogFragment newFragment = AlertDialogFragment.newInstance(icon, title, message, null, 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)

Example 58 with FragmentTransaction

use of android.app.FragmentTransaction in project superCleanMaster by joyoyao.

the class DialogUtil method removeDialog.

/**
	 * 描述:移除Fragment.
	 * 
	 * @param context
	 *            the context
	 */
public static void removeDialog(Context context) {
    try {
        FragmentActivity activity = (FragmentActivity) context;
        FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
        Fragment prev = activity.getFragmentManager().findFragmentByTag(mDialogTag);
        if (prev != null) {
            ft.remove(prev);
        }
        ft.addToBackStack(null);
        ft.commit();
    } catch (Exception e) {
        // 可能有Activity已经被销毁的异常
        e.printStackTrace();
    }
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) FragmentTransaction(android.app.FragmentTransaction) Fragment(android.app.Fragment)

Example 59 with FragmentTransaction

use of android.app.FragmentTransaction in project Etar-Calendar by Etar-Group.

the class SearchActivity method deleteEvent.

private void deleteEvent(long eventId, long startMillis, long endMillis) {
    mDeleteEventHelper.delete(startMillis, endMillis, eventId, -1);
    if (mIsMultipane && mEventInfoFragment != null && eventId == mCurrentEventId) {
        FragmentManager fragmentManager = getFragmentManager();
        FragmentTransaction ft = fragmentManager.beginTransaction();
        ft.remove(mEventInfoFragment);
        ft.commit();
        mEventInfoFragment = null;
        mCurrentEventId = -1;
    }
}
Also used : FragmentManager(android.app.FragmentManager) FragmentTransaction(android.app.FragmentTransaction)

Example 60 with FragmentTransaction

use of android.app.FragmentTransaction in project Etar-Calendar by Etar-Group.

the class AgendaFragment method showEventInfo.

// Shows the selected event in the Agenda view
private void showEventInfo(EventInfo event, boolean allDay, boolean replaceFragment) {
    // Ignore unknown events
    if (event.id == -1) {
        Log.e(TAG, "showEventInfo, event ID = " + event.id);
        return;
    }
    mLastShownEventId = event.id;
    // Create a fragment to show the event to the side of the agenda list
    if (mShowEventDetailsWithAgenda) {
        FragmentManager fragmentManager = getFragmentManager();
        if (fragmentManager == null) {
            // Got a goto event before the fragment finished attaching,
            // stash the event and handle it later.
            mOnAttachedInfo = event;
            mOnAttachAllDay = allDay;
            return;
        }
        FragmentTransaction ft = fragmentManager.beginTransaction();
        if (allDay) {
            event.startTime.timezone = Time.TIMEZONE_UTC;
            event.endTime.timezone = Time.TIMEZONE_UTC;
        }
        if (DEBUG) {
            Log.d(TAG, "***");
            Log.d(TAG, "showEventInfo: start: " + new Date(event.startTime.toMillis(true)));
            Log.d(TAG, "showEventInfo: end: " + new Date(event.endTime.toMillis(true)));
            Log.d(TAG, "showEventInfo: all day: " + allDay);
            Log.d(TAG, "***");
        }
        long startMillis = event.startTime.toMillis(true);
        long endMillis = event.endTime.toMillis(true);
        EventInfoFragment fOld = (EventInfoFragment) fragmentManager.findFragmentById(R.id.agenda_event_info);
        if (fOld == null || replaceFragment || fOld.getStartMillis() != startMillis || fOld.getEndMillis() != endMillis || fOld.getEventId() != event.id) {
            mEventFragment = new EventInfoFragment(mActivity, event.id, startMillis, endMillis, Attendees.ATTENDEE_STATUS_NONE, false, EventInfoFragment.DIALOG_WINDOW_STYLE, null);
            ft.replace(R.id.agenda_event_info, mEventFragment);
            ft.commit();
        } else {
            fOld.reloadEvents();
        }
    }
}
Also used : FragmentManager(android.app.FragmentManager) FragmentTransaction(android.app.FragmentTransaction) EventInfoFragment(com.android.calendar.EventInfoFragment) Date(java.util.Date)

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