本文整理汇总了Java中android.app.FragmentTransaction.setCustomAnimations方法的典型用法代码示例。如果您正苦于以下问题:Java FragmentTransaction.setCustomAnimations方法的具体用法?Java FragmentTransaction.setCustomAnimations怎么用?Java FragmentTransaction.setCustomAnimations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.FragmentTransaction
的用法示例。
在下文中一共展示了FragmentTransaction.setCustomAnimations方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showLoginFragment
import android.app.FragmentTransaction; //导入方法依赖的package包/类
/**
* Shows the Login Fragment
*/
public void showLoginFragment() {
final FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.animator.fade_in, R.animator.fade_out, R.animator.slide_in_left, R.animator.slide_out_right);
transaction.replace(R.id.fragment_container, new DCLoginFragment());
transaction.addToBackStack(DCLoginFragment.TAG);
transaction.commit();
}
示例2: showPasswordResetFragment
import android.app.FragmentTransaction; //导入方法依赖的package包/类
public void showPasswordResetFragment() {
final FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.animator.fade_in, R.animator.fade_out, R.animator.slide_in_left, R.animator.slide_out_right);
transaction.add(R.id.fragment_container, new DCResetPasswordFragment());
transaction.addToBackStack(DCResetPasswordFragment.TAG);
transaction.commit();
}
示例3: show
import android.app.FragmentTransaction; //导入方法依赖的package包/类
private static void show(FragmentManager fm, int type, RootInfo root, DocumentInfo doc, String query, int anim) {
final Bundle args = new Bundle();
args.putInt(EXTRA_TYPE, type);
args.putParcelable(EXTRA_ROOT, root);
args.putParcelable(EXTRA_DOC, doc);
args.putString(EXTRA_QUERY, query);
final FragmentTransaction ft = fm.beginTransaction();
switch (anim) {
case ANIM_SIDE:
args.putBoolean(EXTRA_IGNORE_STATE, true);
break;
case ANIM_DOWN:
ft.setCustomAnimations(R.animator.dir_down, R.animator.dir_frozen);
break;
case ANIM_UP:
ft.setCustomAnimations(R.animator.dir_frozen, R.animator.dir_up);
break;
}
final DirectoryFragment fragment = new DirectoryFragment();
fragment.setArguments(args);
ft.replace(R.id.container_directory, fragment);
ft.commitAllowingStateLoss();
}
示例4: showFragment
import android.app.FragmentTransaction; //导入方法依赖的package包/类
private void showFragment(Fragment fragment) {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(
R.animator.enter,
R.animator.exit,
R.animator.pop_enter,
R.animator.pop_exit
);
fragmentTransaction.replace(R.id.products_activity_content, fragment);
fragmentTransaction.addToBackStack("ProductsStack");
fragmentTransaction.commit();
}
示例5: switchFragments
import android.app.FragmentTransaction; //导入方法依赖的package包/类
/**
* This method is used to toggle between the two fragment states by
* calling the appropriate animations between them. The entry and exit
* animations of the text fragment are specified in R.animator resource
* files. The entry and exit animations of the image fragment are
* specified in the slideBack and slideForward methods below. The reason
* for separating the animation logic in this way is because the translucent
* dark hover view must fade in at the same time as the image fragment
* animates into the background, which would be difficult to time
* properly given that the setCustomAnimations method can only modify the
* two fragments in the transaction.
*/
private void switchFragments () {
if (mIsAnimating) {
return;
}
mIsAnimating = true;
if (mDidSlideOut) {
mDidSlideOut = false;
getFragmentManager().popBackStack();
} else {
mDidSlideOut = true;
AnimatorListener listener = new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator arg0) {
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.animator.slide_fragment_in, 0, 0,
R.animator.slide_fragment_out);
transaction.add(R.id.move_to_back_container, mTextFragment);
transaction.addToBackStack(null);
transaction.commit();
}
};
slideBack (listener);
}
}
示例6: setBodyFrontBack
import android.app.FragmentTransaction; //导入方法依赖的package包/类
/**
* 设置人体正反面
* @author leibing
* @createTime 2016/10/07
* @lastModify 2016/10/07
* @param
* @return
*/
private void setBodyFrontBack() {
switch (curSexFace){
case MAN_FRONT:
// 当为男性正面,则设置为男性反面
curSexFace = MAN_BACK;
break;
case MAN_BACK:
// 当为男性反面,则设置为男性正面
curSexFace = MAN_FRONT;
break;
case WOMEN_FRONT:
// 当为女性正面,则设置为女性反面
curSexFace = WOMEN_BACK;
break;
case WOMEN_BACK:
// 当为女性反面,则设置为女性正面
curSexFace = WOMEN_FRONT;
break;
}
if (curSexFace == MAN_FRONT || curSexFace == WOMEN_FRONT){
// 当前面为男性正面或女性正面均设置为正面
reverseTv.setText("正面");
}else if (curSexFace == MAN_BACK || curSexFace == WOMEN_BACK){
// 当前面为男性反面或女性反面均设置为反面
reverseTv.setText("反面");
}
// 执行动画更新fragment内容
FragmentTransaction fm = getFragmentManager().beginTransaction();
fm.setCustomAnimations(R.anim.animator_two_enter, R.anim.animator_one_exit);
fragmentHumanBody = HumanBodyFragment.newInstance(curSexFace);
fm.replace(R.id.ly_fragment_area, fragmentHumanBody, "FragmentHumanBody");
fm.commit();
}
示例7: editProfile
import android.app.FragmentTransaction; //导入方法依赖的package包/类
public void editProfile() {
final FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.animator.slide_in_right, R.animator.slide_out_left, R.animator.slide_in_left, R.animator.slide_out_right);
transaction.replace(R.id.fragment_container, new DCProfileEditFragment());
transaction.addToBackStack(DCProfileEditFragment.TAG);
transaction.commit();
}
示例8: showCollectDCN
import android.app.FragmentTransaction; //导入方法依赖的package包/类
public void showCollectDCN() {
final FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.animator.slide_in_right, R.animator.slide_out_left, R.animator.slide_in_left, R.animator.slide_out_right);
transaction.replace(R.id.fragment_container, new DCCollectDCNFragment());
transaction.addToBackStack(DCCollectDCNFragment.TAG);
transaction.commit();
}
示例9: showSignupFragment
import android.app.FragmentTransaction; //导入方法依赖的package包/类
/**
* Shows the signup fragment
*/
public void showSignupFragment() {
final FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.animator.slide_in_right, R.animator.slide_out_left, R.animator.slide_in_left, R.animator.slide_out_right);
transaction.replace(R.id.fragment_container, new DCSignupFragment());
transaction.addToBackStack(DCSignupFragment.TAG);
transaction.commit();
}
示例10: signupUser
import android.app.FragmentTransaction; //导入方法依赖的package包/类
public void signupUser(final DCUser user) {
DCAgreementFragment agreementFragment = new DCAgreementFragment();
agreementFragment.setListener(new DCAgreementFragment.IDCAgreementListener() {
@Override
public void onAgreementAccepted() {
final DCLoadingFragment loadingFragment = showLoading();
DCApiManager.getInstance().registerUser(user, new DCResponseListener<DCAuthToken>() {
@Override
public void onFailure(DCError error) {
onError(error);
if (loadingFragment != null)
loadingFragment.dismissAllowingStateLoss();
}
@Override
public void onResponse(DCAuthToken object) {
handleAuthentication(object);
if (loadingFragment != null)
loadingFragment.dismissAllowingStateLoss();
}
});
}
});
final FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.animator.slide_in_right, R.animator.slide_out_left, R.animator.slide_in_left, R.animator.slide_out_right);
transaction.add(R.id.fragment_container, agreementFragment);
transaction.addToBackStack(DCAgreementFragment.TAG);
transaction.commit();
}
示例11: changeContent
import android.app.FragmentTransaction; //导入方法依赖的package包/类
public void changeContent (int direction) {
boolean change = false;
if (currentFragment > 0 && direction == DIRECTION_RIGHT) {
currentFragment--;
change = true;
}
if (currentFragment < 3 && direction == DIRECTION_LEFT) {
currentFragment++;
change = true;
}
if (change) {
ContentFragment newFragment = ContentFragment.newInstance();
newFragment.setContentCode(currentFragment);
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
if (direction == DIRECTION_LEFT) {
transaction.setCustomAnimations(R.animator.slide_left_in, R.animator.slide_left_out);
} else {
transaction.setCustomAnimations(R.animator.slide_right_in, R.animator.slide_right_out);
}
transaction.replace(R.id.fragmentContainer, newFragment);
transaction.commit();
}
}
示例12: replaceFragment
import android.app.FragmentTransaction; //导入方法依赖的package包/类
public void replaceFragment(Fragment fragment) {
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.setCustomAnimations(R.anim.slide_in_left,
R.anim.slide_out_right);
fragmentTransaction.replace(R.id.container, fragment);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
}
示例13: setUpRotate3dAnimator
import android.app.FragmentTransaction; //导入方法依赖的package包/类
public static void setUpRotate3dAnimator(FragmentTransaction transaction) {
transaction.setCustomAnimations(R.animator.rotate_3d_enter, R.animator.rotate_3d_exit);
}