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