android.app.FragmentTransaction.setTransition()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(10.8k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中android.app.FragmentTransaction.setTransition()方法的一些代码示例,展示了FragmentTransaction.setTransition()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FragmentTransaction.setTransition()方法的具体详情如下:
包路径:android.app.FragmentTransaction
类名称:FragmentTransaction
方法名:setTransition

FragmentTransaction.setTransition介绍

暂无

代码示例

代码示例来源:origin: TeamNewPipe/NewPipe

private void updateFragments() {
  MissionsFragment fragment = new MissionsFragment();
  getFragmentManager().beginTransaction()
      .replace(R.id.frame, fragment, MISSIONS_FRAGMENT_TAG)
      .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
      .commit();
}

代码示例来源:origin: iMeiji/Toutiao

private void setupFragment(String fragmentName, Bundle args) {
  Fragment fragment = Fragment.instantiate(this, fragmentName, args);
  FragmentTransaction transaction = getFragmentManager().beginTransaction();
  transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
  transaction.replace(R.id.container, fragment);
  transaction.commitAllowingStateLoss();
}

代码示例来源:origin: joyoyao/superCleanMaster

/**
 * 显示一个一般的对话框(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;
}

代码示例来源:origin: joyoyao/superCleanMaster

/**
 * 描述:对话框dialog (标题,View内容).
 * @param title 对话框标题内容
 * @param view  对话框提示内容
 */
public static AlertDialogFragment showAlertDialog(String title,View view) {
  FragmentActivity activity = (FragmentActivity)view.getContext();
  AlertDialogFragment newFragment = AlertDialogFragment.newInstance(0,title,null,view,null);
  FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
  // 指定一个系统转场动画   
  ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);  
  newFragment.show(ft, mDialogTag);
  return newFragment;
}

代码示例来源:origin: joyoyao/superCleanMaster

/**
 * 显示一个一般的对话框(图标,标题,View内容,确认,取消).
 * @param icon
 * @param title 对话框标题内容
 * @param view 对话框提示内容
 * @param onClickListener 点击确认按钮的事件监听
 */
public static AlertDialogFragment showAlertDialog(int icon,String title,View view,AlertDialogFragment.DialogOnClickListener onClickListener) {
  FragmentActivity activity = (FragmentActivity)view.getContext();
  AlertDialogFragment newFragment = AlertDialogFragment.newInstance(icon,title,null,view,onClickListener);
  FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
  // 指定一个系统转场动画   
  ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);  
  newFragment.show(ft, mDialogTag);
  return newFragment;
}

代码示例来源:origin: joyoyao/superCleanMaster

/**
 * 显示一个一般的对话框(标题,View内容,确认,取消).
 * @param title 对话框标题内容
 * @param view 对话框提示内容
 * @param onClickListener 点击确认按钮的事件监听
 */
public static AlertDialogFragment showAlertDialog(String title,View view,AlertDialogFragment.DialogOnClickListener onClickListener) {
  FragmentActivity activity = (FragmentActivity)view.getContext(); 
  AlertDialogFragment newFragment = AlertDialogFragment.newInstance(0,title,null,view,onClickListener);
  FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
  // 指定一个系统转场动画   
  ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);  
  newFragment.show(ft, mDialogTag);
  return newFragment;
}

代码示例来源:origin: joyoyao/superCleanMaster

/**
 * 描述:对话框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;
}

代码示例来源:origin: joyoyao/superCleanMaster

/**
 * 描述:对话框dialog (标题,String内容).
 * @param context
 * @param title 对话框标题内容
 *
 */
public static AlertDialogFragment showAlertDialog(Context context,String title,String message) {
  FragmentActivity activity = (FragmentActivity)context; 
  AlertDialogFragment newFragment = AlertDialogFragment.newInstance(0,title,message,null,null);
  FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
  // 指定一个系统转场动画   
  ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);  
  newFragment.show(ft, mDialogTag);
  return newFragment;
}

代码示例来源:origin: joyoyao/superCleanMaster

/**
 * 显示一个一般的对话框(String内容).
 * @param context
 *
 */
public static AlertDialogFragment showAlertDialog(Context context,String message) {
  FragmentActivity activity = (FragmentActivity)context; 
  AlertDialogFragment newFragment = AlertDialogFragment.newInstance(0,null,message,null,null);
  FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
  // 指定一个系统转场动画   
  ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);  
  newFragment.show(ft, mDialogTag);
  return newFragment;
}

代码示例来源:origin: joyoyao/superCleanMaster

/**
 * 描述:对话框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;
}

代码示例来源:origin: joyoyao/superCleanMaster

/**
 * 显示一个一般的对话框(标题,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;
}

代码示例来源:origin: joyoyao/superCleanMaster

/**
 * 显示一个一般的对话框(图标,标题,string内容,确认,取消).
 * @param context
 * @param icon
 * @param title 对话框标题内容
 * @param message 对话框提示内容
 * @param onClickListener 点击确认按钮的事件监听
 */
public static AlertDialogFragment showAlertDialog(Context context,int icon,String title,String message,AlertDialogFragment.DialogOnClickListener onClickListener) {
  FragmentActivity activity = (FragmentActivity)context; 
  AlertDialogFragment newFragment = AlertDialogFragment.newInstance(icon,title,message,null,onClickListener);
  FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
  // 指定一个系统转场动画   
  ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);  
  newFragment.show(ft, mDialogTag);
  return newFragment;
}

代码示例来源:origin: novoda/android-demos

FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.carousel, fragment);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.commit();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.carousel, fragment);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.commit();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.carousel, fragment);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.commit();

代码示例来源:origin: joyoyao/superCleanMaster

/**
 * 描述:显示进度框.
 * 
 * @param context
 *            the context
 * @param indeterminateDrawable
 *            用默认请写0
 * @param message
 *            the message
 */
public static ProgressDialogFragment showProgressDialog(Context context,
    int indeterminateDrawable, String message) {
  FragmentActivity activity = (FragmentActivity) context;
  ProgressDialogFragment newFragment = ProgressDialogFragment
      .newInstance(indeterminateDrawable, message);
  FragmentTransaction ft = activity.getFragmentManager()
      .beginTransaction();
  // 指定一个系统转场动画
  ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
  newFragment.show(ft, mDialogTag);
  return newFragment;
}

代码示例来源:origin: joyoyao/superCleanMaster

/**
 * 描述:移除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();
  }
}

代码示例来源:origin: chrisk44/Hijacker

@Override
  public void onClick(View view){
    //Open editor for new
    FragmentTransaction ft = mFragmentManager.beginTransaction();
    ft.replace(R.id.fragment1, new CustomActionEditorFragment());
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    ft.addToBackStack(null);
    ft.commitAllowingStateLoss();
  }
});

代码示例来源:origin: chrisk44/Hijacker

public boolean onMenuItemClick(android.view.MenuItem item){
    if(item.getGroupId()==-1){
      //Open actions manager
      FragmentTransaction ft = mFragmentManager.beginTransaction();
      ft.replace(R.id.fragment1, new CustomActionManagerFragment());
      ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
      ft.addToBackStack(null);
      ft.commitAllowingStateLoss();
    }else{
      onActionSelected(cmds.get(item.getItemId()));
    }
    return true;
  }
});

代码示例来源:origin: chrisk44/Hijacker

void crackReaver(MainActivity activity){
  FragmentManager fragmentManager = activity.getFragmentManager();
  ReaverFragment.ap = this;
  FragmentTransaction ft = fragmentManager.beginTransaction();
  ft.replace(R.id.fragment1, activity.reaverFragment.setAutostart(true));
  ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
  ft.addToBackStack(null);
  ft.commitAllowingStateLoss();
  fragmentManager.executePendingTransactions();      //Wait for everything to be set up
}
void disconnectAll(){

代码示例来源:origin: chrisk44/Hijacker

static void isolate(String mac){
  is_ap = getAPByMac(mac);
  if(is_ap!=null){
    IsolatedFragment.exit_on = mFragmentManager.getBackStackEntryCount();
    FragmentTransaction ft = mFragmentManager.beginTransaction();
    ft.replace(R.id.fragment1, new IsolatedFragment());
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    ft.addToBackStack(null);
    ft.commitAllowingStateLoss();
  }
  Tile.filter();
  if(debug){
    if(is_ap==null) Log.d("HIJACKER/Main", "No AP isolated");
    else Log.d("HIJACKER/Main", "AP with MAC " + mac + " isolated");
  }
}
static void refreshState(){

代码示例来源:origin: chrisk44/Hijacker

@Override
  protected void onPostExecute(final Boolean success){
    if(!success) return;
    loadingDialog.setText(getString(R.string.starting_hijacker));
    if(watchdog){
      watchdogTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }
    //Load default fragment (airodump)
    if(mFragmentManager.getBackStackEntryCount()==0){
      FragmentTransaction ft = mFragmentManager.beginTransaction();
      ft.replace(R.id.fragment1, new MyListFragment());
      ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
      ft.addToBackStack(null);
      ft.commitAllowingStateLoss();
    }
    loadingDialog.dismissAllowingStateLoss();
    //Start
    if(pref.getBoolean("disclaimerAccepted", false)) main();
  }
}

相关文章