本文整理匯總了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);
}